From c88eb24265efda6e801dfb8e7381efd17c2eebfb Mon Sep 17 00:00:00 2001 From: raishvaria Date: Sat, 14 Dec 2019 13:54:35 +0530 Subject: [PATCH] fix pdf & installation issue --- .env.example | 2 +- app/Http/Controllers/CustomersController.php | 1 + app/Http/Controllers/OnboardingController.php | 9 ++- config/dompdf.php | 2 +- .../assets/js/views/customers/Create.vue | 58 +++++++++++++++++-- .../assets/js/views/estimates/Create.vue | 10 ++-- resources/assets/js/views/invoices/Create.vue | 8 +-- .../app/pdf/estimate/estimate1.blade.php | 6 +- .../app/pdf/estimate/estimate2.blade.php | 6 +- .../app/pdf/estimate/estimate3.blade.php | 6 +- .../partials/billing-address.blade.php | 8 +-- .../partials/shipping-address.blade.php | 4 +- .../views/app/pdf/invoice/invoice1.blade.php | 6 +- .../views/app/pdf/invoice/invoice2.blade.php | 6 +- .../views/app/pdf/invoice/invoice3.blade.php | 6 +- .../partials/billing-address.blade.php | 4 +- .../partials/shipping-address.blade.php | 4 +- .../views/app/pdf/reports/expenses.blade.php | 2 +- .../app/pdf/reports/profit-loss.blade.php | 2 +- .../app/pdf/reports/sales-customers.blade.php | 2 +- .../app/pdf/reports/sales-items.blade.php | 2 +- .../app/pdf/reports/tax-summary.blade.php | 2 +- 22 files changed, 91 insertions(+), 65 deletions(-) diff --git a/.env.example b/.env.example index e8c6a0c8..1f721255 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ APP_ENV=production APP_KEY=base64:kgk/4DW1vEVy7aEvet5FPp5un6PIGe/so8H0mvoUtW0= -APP_DEBUG=false +APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://crater.test diff --git a/app/Http/Controllers/CustomersController.php b/app/Http/Controllers/CustomersController.php index 8b587e37..6c0424be 100644 --- a/app/Http/Controllers/CustomersController.php +++ b/app/Http/Controllers/CustomersController.php @@ -177,6 +177,7 @@ class CustomersController extends Controller $customer->enable_portal = $request->enable_portal; $customer->save(); + $customer->addresses()->delete(); if ($request->addresses) { foreach ($request->addresses as $address) { $newAddress = $customer->addresses()->firstOrNew(['type' => $address["type"]]); diff --git a/app/Http/Controllers/OnboardingController.php b/app/Http/Controllers/OnboardingController.php index dbf0f5c8..4724d14f 100644 --- a/app/Http/Controllers/OnboardingController.php +++ b/app/Http/Controllers/OnboardingController.php @@ -277,7 +277,14 @@ class OnboardingController extends Controller if (file_exists($path)) { file_put_contents($path, str_replace( - 'PROXY_OAUTH_CLIENT_SECRET='.config('auth.proxy.client_secret'), 'PROXY_OAUTH_CLIENT_SECRET='.$client->secret, file_get_contents($path) + 'PROXY_OAUTH_CLIENT_SECRET='.config('auth.proxy.client_secret'), + 'PROXY_OAUTH_CLIENT_SECRET='.$client->secret, + file_get_contents($path) + )); + file_put_contents($path, str_replace( + 'APP_DEBUG=true', + 'APP_DEBUG=false', + file_get_contents($path) )); } diff --git a/config/dompdf.php b/config/dompdf.php index 1cef81a6..68b35ec8 100644 --- a/config/dompdf.php +++ b/config/dompdf.php @@ -149,7 +149,7 @@ return array( * Used if no suitable fonts can be found. This must exist in the font folder. * @var string */ - "default_font" => "serif", + "default_font" => "DejaVu Sans", /** * Image DPI setting diff --git a/resources/assets/js/views/customers/Create.vue b/resources/assets/js/views/customers/Create.vue index 804794e3..f8e68135 100644 --- a/resources/assets/js/views/customers/Create.vue +++ b/resources/assets/js/views/customers/Create.vue @@ -162,7 +162,7 @@ :options="billingCountries" :searchable="true" :show-labels="false" - :allow-empty="false" + :allow-empty="true" :tabindex="8" :placeholder="$t('general.select_country')" label="name" @@ -265,7 +265,7 @@ :searchable="true" :show-labels="false" :tabindex="16" - :allow-empty="false" + :allow-empty="true" :placeholder="$t('general.select_country')" label="name" track-by="id" @@ -411,6 +411,36 @@ export default { return true } return false + }, + hasBillingAdd () { + let billing = this.billing + if ( + billing.name || + billing.country_id || + billing.state || + billing.city || + billing.phone || + billing.zip || + billing.address_street_1 || + billing.address_street_2) { + return true + } + return false + }, + hasShippingAdd () { + let shipping = this.shipping + if ( + shipping.name || + shipping.country_id || + shipping.state || + shipping.city || + shipping.phone || + shipping.zip || + shipping.address_street_1 || + shipping.address_street_2) { + return true + } + return false } }, watch: { @@ -418,12 +448,16 @@ export default { if (newCountry) { this.billing.country_id = newCountry.id this.isDisabledBillingState = false + } else { + this.billing.country_id = null } }, shipping_country (newCountry) { if (newCountry) { this.shipping.country_id = newCountry.id return true + } else { + this.shipping.country_id = null } } }, @@ -446,7 +480,14 @@ export default { ]), async loadCustomer () { let { data: { customer, currencies, currency } } = await this.fetchCustomer(this.$route.params.id) - this.formData = customer + + this.formData.id = customer.id + this.formData.name = customer.name + this.formData.contact_name = customer.contact_name + this.formData.email = customer.email + this.formData.phone = customer.phone + this.formData.currency_id = customer.currency_id + this.formData.website = customer.website if (customer.billing_address) { this.billing = customer.billing_address @@ -495,7 +536,16 @@ export default { if (this.$v.$invalid) { return true } - this.formData.addresses = [{...this.billing}, {...this.shipping}] + if (this.hasBillingAdd && this.hasShippingAdd) { + this.formData.addresses = [{...this.billing}, {...this.shipping}] + } else { + if (this.hasBillingAdd) { + this.formData.addresses = [{...this.billing}] + } + if (this.hasShippingAdd) { + this.formData.addresses = [{...this.shipping}] + } + } if (this.isEdit) { if (this.currency) { diff --git a/resources/assets/js/views/estimates/Create.vue b/resources/assets/js/views/estimates/Create.vue index 62988de3..8ba487fd 100644 --- a/resources/assets/js/views/estimates/Create.vue +++ b/resources/assets/js/views/estimates/Create.vue @@ -32,8 +32,8 @@ class="show-customer" >
-
-
+
+
-
-
+
+
- +
diff --git a/resources/assets/js/views/invoices/Create.vue b/resources/assets/js/views/invoices/Create.vue index 7c13fb2c..c1ad0288 100644 --- a/resources/assets/js/views/invoices/Create.vue +++ b/resources/assets/js/views/invoices/Create.vue @@ -30,8 +30,8 @@
-
-
+
+
-
-
+
+