From 81739827c0c11ae8451d4cdb445f9fec54526cf7 Mon Sep 17 00:00:00 2001 From: radhu587 Date: Wed, 11 Dec 2019 17:02:28 +0530 Subject: [PATCH 01/29] Add customization --- app/Http/Controllers/CompanyController.php | 77 ++++ app/Http/Controllers/OnboardingController.php | 39 ++ resources/assets/js/plugins/en.json | 65 ++- resources/assets/js/router.js | 6 + .../js/views/settings/Customization.vue | 375 ++++++++++++++++++ .../assets/js/views/settings/layout/Index.vue | 6 + resources/assets/sass/crater.scss | 1 + .../assets/sass/pages/customization.scss | 39 ++ routes/api.php | 10 + 9 files changed, 617 insertions(+), 1 deletion(-) create mode 100644 resources/assets/js/views/settings/Customization.vue create mode 100644 resources/assets/sass/pages/customization.scss diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index a26ad328..ffefaf6e 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -153,6 +153,83 @@ class CompanyController extends Controller ]); } + public function getCustomizeSetting (Request $request) + { + $invoice_prefix = CompanySetting::getSetting('invoice_prefix', $request->header('company')); + $invoice_auto_generate = CompanySetting::getSetting('invoice_auto_generate', $request->header('company')); + $invoice_notes = CompanySetting::getSetting('invoice_notes', $request->header('company'), true); + $invoice_terms_and_conditions = CompanySetting::getSetting('invoice_terms_and_conditions', $request->header('company'), true); + + $estimate_prefix = CompanySetting::getSetting('estimate_prefix', $request->header('company')); + $estimate_notes = CompanySetting::getSetting('estimate_notes', $request->header('company'), true); + $estimate_terms_and_conditions = CompanySetting::getSetting('estimate_terms_and_conditions', $request->header('company'), true); + $estimate_auto_generate = CompanySetting::getSetting('estimate_auto_generate', $request->header('company')); + + $payment_prefix = CompanySetting::getSetting('payment_prefix', $request->header('company')); + $payment_auto_generate = CompanySetting::getSetting('payment_auto_generate', $request->header('company')); + + $billing_address_format = CompanySetting::getSetting('billing_address_format', $request->header('company'), $large= true); + $shipping_address_format = CompanySetting::getSetting('shipping_address_format', $request->header('company'), $large= true); + $company_address_format = CompanySetting::getSetting('company_address_format', $request->header('company'), $large= true); + + return response()->json([ + 'invoice_prefix' => $invoice_prefix, + 'invoice_auto_generate' => $invoice_auto_generate, + 'invoice_notes' => $invoice_notes, + 'invoice_terms_and_conditions' => $invoice_terms_and_conditions, + 'estimate_prefix' => $estimate_prefix, + 'estimate_auto_generate' => $estimate_auto_generate, + 'estimate_notes' => $estimate_notes, + 'estimate_terms_and_conditions' => $estimate_terms_and_conditions, + 'payment_prefix' => $payment_prefix, + 'payment_auto_generate' => $payment_auto_generate, + 'billing_address_format' => $billing_address_format, + 'shipping_address_format' => $shipping_address_format, + 'company_address_format' => $company_address_format + ]); + } + + public function updateCustomizeSetting (Request $request) + { + $sets = []; + + if ($request->type == "PAYMENTS") { + $sets = [ + 'payment_prefix' + ]; + } elseif ($request->type == "INVOICES") { + $sets = [ + 'invoice_prefix', + 'invoice_notes', + 'invoice_terms_and_conditions' + ]; + } elseif ($request->type == "ESTIMATES") { + $sets = [ + 'estimate_prefix', + 'estimate_notes', + 'estimate_terms_and_conditions' + ]; + } else { + $sets = [ + 'billing_address_format', + 'shipping_address_format', + 'company_address_format' + ]; + } + + foreach ($sets as $key) { + if ($key == 'invoice_terms_and_conditions' || $key == 'invoice_notes' || $request->type == "ADDRESSES" || $key === 'estimate_terms_and_conditions' || $key === 'estimate_notes') { + CompanySetting::setSetting($key, $request->$key, $request->header('company'), true); + } else { + CompanySetting::setSetting($key, $request->$key, $request->header('company')); + } + } + + return response()->json([ + 'success' => true + ]); + } + public function updateSetting(SettingRequest $request) { CompanySetting::setSetting($request->key, $request->value, $request->header('company')); diff --git a/app/Http/Controllers/OnboardingController.php b/app/Http/Controllers/OnboardingController.php index 2eb8bb94..dbf0f5c8 100644 --- a/app/Http/Controllers/OnboardingController.php +++ b/app/Http/Controllers/OnboardingController.php @@ -202,6 +202,45 @@ class OnboardingController extends Controller ); } + $invoices = [ + 'invoice_auto_generate' => 'YES', + 'invoice_prefix' => 'INV' + ]; + + foreach ($invoices as $key => $value) { + CompanySetting::setSetting( + $key, + $value, + $user->company_id + ); + } + + $estimates = [ + 'estimate_prefix' => 'EST', + 'estimate_auto_generate' => 'YES' + ]; + + foreach ($estimates as $key => $value) { + CompanySetting::setSetting( + $key, + $value, + $user->company_id + ); + } + + $payments = [ + 'payment_prefix' => 'PAY', + 'payment_auto_generate' => 'YES' + ]; + + foreach ($payments as $key => $value) { + CompanySetting::setSetting( + $key, + $value, + $user->company_id + ); + } + $colors = [ 'primary_text_color' => '#5851D8', 'heading_text_color' => '#595959', diff --git a/resources/assets/js/plugins/en.json b/resources/assets/js/plugins/en.json index 3bcc26a4..00d58eeb 100644 --- a/resources/assets/js/plugins/en.json +++ b/resources/assets/js/plugins/en.json @@ -530,6 +530,7 @@ "menu_title": { "account_settings": "Account Settings", "company_information": "Company Information", + "customization": "Customization", "preferences": "Preferences", "notifications": "Notifications", "tax_types": "Tax Types", @@ -598,6 +599,67 @@ "save": "Save", "updated_message": "Company information updated successfully" }, + "customization": { + "customization": "customization", + "save": "Save", + "addresses": { + "title": "Addresses", + "section_description": "You can set Customer Billing Address and Customer Shipping Address Format (Displayed in PDF only). ", + "customer_billing_address": "Customer Billing Address", + "customer_shipping_address": "Customer Shipping Address", + "company_address": "Company Address", + "insert_fields": "Insert Fields", + "contact": "Contact", + "address": "Address", + "display_name": "Display Name", + "primary_contact_name": "Primary Contact Name", + "email": "Email", + "website": "Website", + "name": "Name", + "country": "Country", + "state": "State", + "city": "City", + "company_name": "Company Name", + "address_street_1": "Address Street 1", + "address_street_2": "Address Street 2", + "phone": "Phone", + "zip_code": "Zip Code", + "address_setting_updated": "Address Setting updated successfully" + }, + "updated_message": "Company information updated successfully", + + "invoices": { + "title": "Invoices", + "notes": "Notes", + "invoice_prefix": "Invoice Prefix", + "invoice_settings": "Invoice Settings", + "autogenerate_invoice_number": "Autogenerate Invoice Number", + "invoice_setting_description": "Disable this, If you don't wish to auto-generate invoice numbers each time you create a new invoice.", + "enter_invoice_prefix": "Enter invoice prefix", + "terms_and_conditions": "Terms and Conditions", + "invoice_setting_updated": "Invoice Setting updated successfully" + }, + + "estimates": { + "title": "Estimates", + "estimate_prefix": "Estimate Prefix", + "estimate_settings": "Estimate Settings", + "autogenerate_estimate_number": "Autogenerate Estimate Number", + "estimate_setting_description": "Disable this, If you don't wish to auto-generate estimate numbers each time you create a new estimate.", + "enter_estimate_prefix": "Enter estmiate prefix", + "estimate_setting_updated": "Estimate Setting updated successfully" + }, + + "payments": { + "title": "Payments", + "payment_prefix": "Payment Prefix", + "payment_settings": "Payment Settings", + "autogenerate_payment_number": "Autogenerate Payment Number", + "payment_setting_description": "Disable this, If you don't wish to auto-generate payment numbers each time you create a new payment.", + "enter_payment_prefix": "Enter Payment Prefix", + "payment_setting_updated": "Payment Setting updated successfully" + } + }, "account_settings": { "profile_picture": "Profile Picture", "name": "Name", @@ -812,6 +874,7 @@ "maximum_options_error": "Maximum of {max} options selected. First remove a selected option to select another.", "notes_maxlength": "Notes should not be greater than 255 characters.", "address_maxlength": "Address should not be greater than 255 characters.", - "ref_number_maxlength": "Ref Number should not be greater than 255 characters." + "ref_number_maxlength": "Ref Number should not be greater than 255 characters.", + "prefix_maxlength": "Prefix should not be greater than 5 characters." } } diff --git a/resources/assets/js/router.js b/resources/assets/js/router.js index 279a620d..f53d156e 100644 --- a/resources/assets/js/router.js +++ b/resources/assets/js/router.js @@ -66,6 +66,7 @@ import ReportLayout from './views/reports/layout/Index.vue' // Settings import SettingsLayout from './views/settings/layout/Index.vue' import CompanyInfo from './views/settings/CompanyInfo.vue' +import Customization from './views/settings/Customization.vue' import Notifications from './views/settings/Notifications.vue' import Preferences from './views/settings/Preferences.vue' import UserProfile from './views/settings/UserProfile.vue' @@ -309,6 +310,11 @@ const routes = [ name: 'company.info', component: CompanyInfo }, + { + path: 'customization', + name: 'customization', + component: Customization + }, { path: 'user-profile', name: 'user.profile', diff --git a/resources/assets/js/views/settings/Customization.vue b/resources/assets/js/views/settings/Customization.vue new file mode 100644 index 00000000..cb8f55b8 --- /dev/null +++ b/resources/assets/js/views/settings/Customization.vue @@ -0,0 +1,375 @@ + + diff --git a/resources/assets/js/views/settings/layout/Index.vue b/resources/assets/js/views/settings/layout/Index.vue index 797ac1f6..0a76fa8a 100644 --- a/resources/assets/js/views/settings/layout/Index.vue +++ b/resources/assets/js/views/settings/layout/Index.vue @@ -45,6 +45,12 @@ export default { icon: 'building', iconType: 'far' }, + { + link: '/admin/settings/customization', + title: 'settings.menu_title.customization', + icon: 'edit', + iconType: 'fa' + }, { link: '/admin/settings/preferences', title: 'settings.menu_title.preferences', diff --git a/resources/assets/sass/crater.scss b/resources/assets/sass/crater.scss index e0f71ccd..cd4645a9 100644 --- a/resources/assets/sass/crater.scss +++ b/resources/assets/sass/crater.scss @@ -91,6 +91,7 @@ @import 'pages/login'; @import 'pages/login-3'; @import 'pages/404'; +@import 'pages/customization'; @import 'pages/settings'; @import 'pages/invoices/create'; @import 'pages/invoices/view'; diff --git a/resources/assets/sass/pages/customization.scss b/resources/assets/sass/pages/customization.scss new file mode 100644 index 00000000..d9ce8d39 --- /dev/null +++ b/resources/assets/sass/pages/customization.scss @@ -0,0 +1,39 @@ +.customization { + + .prefix-input { + max-width: 30%; + } + + .form-section { + padding: 8px 15px; + } + + .invoice-customization-card { + border: 1px solid #EBF1FA;border-radius: 5px; + } + + @media (max-width: $x-small-breakpoint) { + .address-customization-card { + + .address-fields-container { + display: flex; + flex-wrap: wrap; + + .fields-list { + border-right: 0px; + } + } + + } + + .tabs { + + .tab { + padding: 10px 10px; + } + + } + + } + +} diff --git a/routes/api.php b/routes/api.php index f5927df6..6f0ae7d9 100644 --- a/routes/api.php +++ b/routes/api.php @@ -358,6 +358,16 @@ Route::group(['middleware' => 'api'], function () { 'uses' => 'CompanyController@updateSetting' ]); + Route::get('/get-customize-setting', [ + 'as' => 'admin.get.customize.setting', + 'uses' => 'CompanyController@getCustomizeSetting' + ]); + + Route::put('/update-customize-setting', [ + 'as' => 'admin.update.customize.setting', + 'uses' => 'CompanyController@updateCustomizeSetting' + ]); + Route::get('/environment/mail', [ 'as' => 'admin.environment.mail', 'uses' => 'EnvironmentController@getMailDrivers' From 01f3646869914102b574595a7c0b20101e1c4f5a Mon Sep 17 00:00:00 2001 From: raishvaria Date: Thu, 12 Dec 2019 11:50:25 +0530 Subject: [PATCH 02/29] add meta tag --- resources/assets/js/views/layouts/LayoutBasic.vue | 4 ++-- resources/views/app/pdf/invoice/invoice1.blade.php | 1 + resources/views/app/pdf/invoice/invoice2.blade.php | 1 + resources/views/app/pdf/invoice/invoice3.blade.php | 1 + resources/views/app/pdf/invoice/partials/notes.blade.php | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/resources/assets/js/views/layouts/LayoutBasic.vue b/resources/assets/js/views/layouts/LayoutBasic.vue index cc0cf34c..a26bb996 100644 --- a/resources/assets/js/views/layouts/LayoutBasic.vue +++ b/resources/assets/js/views/layouts/LayoutBasic.vue @@ -50,7 +50,7 @@ export default { Layout.set('layout-default') }, - created() { + created () { this.bootstrap().then((res) => { this.setInitialCompany() }) @@ -59,7 +59,7 @@ export default { methods: { ...mapActions(['bootstrap']), ...mapActions('company', ['setSelectedCompany']), - setInitialCompany() { + setInitialCompany () { let selectedCompany = Ls.get('selectedCompany') !== null if (selectedCompany) { diff --git a/resources/views/app/pdf/invoice/invoice1.blade.php b/resources/views/app/pdf/invoice/invoice1.blade.php index 4b984bfb..d3dfbc13 100644 --- a/resources/views/app/pdf/invoice/invoice1.blade.php +++ b/resources/views/app/pdf/invoice/invoice1.blade.php @@ -3,6 +3,7 @@ Invoice {{-- --}} + diff --git a/resources/assets/sass/components/base/base-prefix-input.scss b/resources/assets/sass/components/base/base-prefix-input.scss new file mode 100644 index 00000000..5bf55aae --- /dev/null +++ b/resources/assets/sass/components/base/base-prefix-input.scss @@ -0,0 +1,54 @@ +.base-prefix-input { + display: flex; + position: relative; + width: 100%; + height: 40px; + padding: 2px 2px; + flex-direction: row; + background: #FFFFFF; + border: 1px solid $ls-color-gray--light; + border-radius: 5px; + + .icon { + width: 13px; + height: 18px; + color: $ls-color-gray; + font-style: normal; + font-weight: 900; + font-size: 14px; + line-height: 16px; + margin-top: 17px; + margin-left: 20px; + z-index: 1; + transform: translate(-50%,-50%); + } + + p { + padding: 0 0 0 0; + margin: 0 0 0 0; + } + + .prefix-label { + display: flex; + height: 18px; + color: #55547A; + font-weight: 500; + font-size: 14px; + line-height: 16px; + padding: 9px 2px 9px 10px; + } + + .prefix-input-field { + width: 100%; + padding: 8px 13px; + padding-left: 1px; + text-align: left; + background: #FFFFFF; + border: none; + font-style: normal; + font-weight: 400; + font-size: 14px; + line-height: 21px; + } +} + diff --git a/resources/assets/sass/crater.scss b/resources/assets/sass/crater.scss index cd4645a9..034912fe 100644 --- a/resources/assets/sass/crater.scss +++ b/resources/assets/sass/crater.scss @@ -48,6 +48,7 @@ @import 'components/base/base-text-area'; @import "components/base/base-switch"; @import 'components/base/base-loader/index'; +@import 'components/base/base-prefix-input'; // Components From 79e77f9e165a00ba0d1746d482309c3e9efa1685 Mon Sep 17 00:00:00 2001 From: raishvaria Date: Thu, 12 Dec 2019 14:20:31 +0530 Subject: [PATCH 04/29] fix pdf lang issue --- .../views/app/pdf/estimate/estimate1.blade.php | 12 +++++++----- .../views/app/pdf/estimate/estimate2.blade.php | 12 +++++++----- .../views/app/pdf/estimate/estimate3.blade.php | 12 +++++++----- resources/views/app/pdf/invoice/invoice1.blade.php | 14 +++++++------- resources/views/app/pdf/invoice/invoice2.blade.php | 12 ++++++------ resources/views/app/pdf/invoice/invoice3.blade.php | 13 +++++++------ 6 files changed, 41 insertions(+), 34 deletions(-) diff --git a/resources/views/app/pdf/estimate/estimate1.blade.php b/resources/views/app/pdf/estimate/estimate1.blade.php index 7fc1668a..eea1228f 100644 --- a/resources/views/app/pdf/estimate/estimate1.blade.php +++ b/resources/views/app/pdf/estimate/estimate1.blade.php @@ -3,9 +3,11 @@ Estimate {{-- --}} + +