From b76e78e9ed23137f0bd75cd430c503fa65575023 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 16 Feb 2023 09:20:24 +1100 Subject: [PATCH] Fixes for email designs and cross client compatibility --- app/Http/Controllers/EmailController.php | 4 +-- app/Mail/Engine/PaymentEmailEngine.php | 32 +++++++++++++++++-- app/Utils/VendorHtmlEngine.php | 23 ++++++++++++- .../email/admin/download_credits.blade.php | 3 +- .../email/admin/download_documents.blade.php | 2 +- .../email/admin/download_files.blade.php | 2 +- .../email/admin/download_invoices.blade.php | 2 +- .../admin/download_purchase_orders.blade.php | 2 +- .../email/admin/download_quotes.blade.php | 2 +- resources/views/email/admin/generic.blade.php | 2 +- .../views/email/admin/generic_email.blade.php | 2 +- .../views/email/template/admin.blade.php | 5 ++- .../views/email/template/client.blade.php | 10 ++++++ 13 files changed, 75 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/EmailController.php b/app/Http/Controllers/EmailController.php index 8329a71337bd..d618d8cf0dd9 100644 --- a/app/Http/Controllers/EmailController.php +++ b/app/Http/Controllers/EmailController.php @@ -147,9 +147,9 @@ class EmailController extends BaseController if (! $invitation->contact->trashed() && $invitation->contact->email) { $entity_obj->service()->markSent()->save(); - // EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data); + EmailEntity::dispatch($invitation->fresh(), $invitation->company, $template, $data); - MailEntity::dispatch($invitation, $invitation->company->db, $mo); + // MailEntity::dispatch($invitation, $invitation->company->db, $mo); } }); diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php index 6a76d5209efe..8213215fbc9f 100644 --- a/app/Mail/Engine/PaymentEmailEngine.php +++ b/app/Mail/Engine/PaymentEmailEngine.php @@ -244,12 +244,12 @@ class PaymentEmailEngine extends BaseEmailEngine $data['$company3'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company3', $this->settings->custom_value3, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company3')]; $data['$company4'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company4', $this->settings->custom_value4, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company4')]; - $data['$view_link'] = ['value' => ''.ctrans('texts.view_payment').'', 'label' => ctrans('texts.view_payment')]; + $data['$view_link'] = ['value' => $this->buildViewButton($this->payment->getLink(), ctrans('texts.view_payment')), 'label' => ctrans('texts.view_payment')]; $data['$view_button'] = &$data['$view_link']; $data['$viewButton'] = &$data['$view_link']; $data['$viewLink'] = &$data['$view_link']; $data['$paymentLink'] = &$data['$view_link']; - $data['$portalButton'] = ['value' => "".ctrans('texts.login').'', 'label' =>'']; + $data['$portalButton'] = ['value' => $this->buildViewButton($this->payment->getPortalLink(), ctrans('texts.login')), 'label' =>'']; $data['$portal_url'] = &$data['$portalButton']; $data['$view_url'] = ['value' => $this->payment->getLink(), 'label' => ctrans('texts.view_payment')]; @@ -367,7 +367,12 @@ class PaymentEmailEngine extends BaseEmailEngine return $data; } - + + /** + * generateLabelsAndValues + * + * @return void + */ public function generateLabelsAndValues() { $data = []; @@ -381,4 +386,25 @@ class PaymentEmailEngine extends BaseEmailEngine return $data; } + + /** + * buildViewButton + * + * @param string $link + * @param string $text + * @return string + */ + private function buildViewButton(string $link, string $text): string + { + return ' + + + + +
+ '. $text .' +
+ '; + } + } diff --git a/app/Utils/VendorHtmlEngine.php b/app/Utils/VendorHtmlEngine.php index da513836f642..f4b3239158a3 100644 --- a/app/Utils/VendorHtmlEngine.php +++ b/app/Utils/VendorHtmlEngine.php @@ -156,7 +156,7 @@ class VendorHtmlEngine $data['$number_short'] = ['value' => $this->entity->number ?: ' ', 'label' => ctrans('texts.purchase_order_number_short')]; $data['$entity.terms'] = ['value' => Helpers::processReservedKeywords(\nl2br($this->entity->terms), $this->company) ?: '', 'label' => ctrans('texts.invoice_terms')]; $data['$terms'] = &$data['$entity.terms']; - $data['$view_link'] = ['value' => ''.ctrans('texts.view_purchase_order').'', 'label' => ctrans('texts.view_purchase_order')]; + $data['$view_link'] = ['value' => $this->buildViewButton($this->invitation->getLink(), ctrans('texts.view_purchase_order')), 'label' => ctrans('texts.view_purchase_order')]; $data['$viewLink'] = &$data['$view_link']; $data['$viewButton'] = &$data['$view_link']; $data['$view_button'] = &$data['$view_link']; @@ -813,4 +813,25 @@ html { return $dom->saveHTML(); } + + /** + * buildViewButton + * + * @param string $link + * @param string $text + * @return string + */ + private function buildViewButton(string $link, string $text): string + { + return ' + + + + +
+ '. $text .' +
+ '; + } + } diff --git a/resources/views/email/admin/download_credits.blade.php b/resources/views/email/admin/download_credits.blade.php index f82acaa78ca5..c9c9e4abb608 100644 --- a/resources/views/email/admin/download_credits.blade.php +++ b/resources/views/email/admin/download_credits.blade.php @@ -7,12 +7,11 @@ {{ ctrans('texts.download') }} --> - diff --git a/resources/views/email/admin/download_documents.blade.php b/resources/views/email/admin/download_documents.blade.php index 13300defede4..3c8da4cb4434 100644 --- a/resources/views/email/admin/download_documents.blade.php +++ b/resources/views/email/admin/download_documents.blade.php @@ -12,7 +12,7 @@ diff --git a/resources/views/email/admin/download_files.blade.php b/resources/views/email/admin/download_files.blade.php index f556c3a7dd49..035c303e0608 100644 --- a/resources/views/email/admin/download_files.blade.php +++ b/resources/views/email/admin/download_files.blade.php @@ -7,7 +7,7 @@ diff --git a/resources/views/email/admin/download_invoices.blade.php b/resources/views/email/admin/download_invoices.blade.php index 14bb01ade58b..600f04a4346a 100644 --- a/resources/views/email/admin/download_invoices.blade.php +++ b/resources/views/email/admin/download_invoices.blade.php @@ -12,7 +12,7 @@ diff --git a/resources/views/email/admin/download_purchase_orders.blade.php b/resources/views/email/admin/download_purchase_orders.blade.php index 96e1a676ec8d..e8d1d089efef 100644 --- a/resources/views/email/admin/download_purchase_orders.blade.php +++ b/resources/views/email/admin/download_purchase_orders.blade.php @@ -12,7 +12,7 @@ diff --git a/resources/views/email/admin/download_quotes.blade.php b/resources/views/email/admin/download_quotes.blade.php index ee033e75a5d6..c54446e42487 100644 --- a/resources/views/email/admin/download_quotes.blade.php +++ b/resources/views/email/admin/download_quotes.blade.php @@ -11,7 +11,7 @@ diff --git a/resources/views/email/admin/generic.blade.php b/resources/views/email/admin/generic.blade.php index ddc4a2d12ccb..2f18f3d4b6c3 100644 --- a/resources/views/email/admin/generic.blade.php +++ b/resources/views/email/admin/generic.blade.php @@ -33,7 +33,7 @@ diff --git a/resources/views/email/admin/generic_email.blade.php b/resources/views/email/admin/generic_email.blade.php index 3813b3a42544..be32dcf1aa21 100644 --- a/resources/views/email/admin/generic_email.blade.php +++ b/resources/views/email/admin/generic_email.blade.php @@ -9,7 +9,7 @@
- {{ ctrans('texts.download') }} + {{ ctrans('texts.download') }}
- {{ ctrans('texts.download') }} + {{ ctrans('texts.download') }}
- {{ ctrans('texts.download') }} + {{ ctrans('texts.download') }}
- {{ ctrans('texts.download') }} + {{ ctrans('texts.download') }}
- {{ ctrans('texts.download') }} + {{ ctrans('texts.download') }}
- {{ ctrans('texts.download') }} + {{ ctrans('texts.download') }}
- {{ ctrans($button) }} + {{ ctrans($button) }}
- {{ $view_text }} + {{ $view_text }}
diff --git a/resources/views/email/template/admin.blade.php b/resources/views/email/template/admin.blade.php index 08fb36abe60c..d591dfc28d55 100644 --- a/resources/views/email/template/admin.blade.php +++ b/resources/views/email/template/admin.blade.php @@ -149,10 +149,13 @@ position: fixed; } - .new_button { + .new_button, a { background-color: {{ $primary_color }}; } + a:visited { + color:#ffffff !important; + } diff --git a/resources/views/email/template/client.blade.php b/resources/views/email/template/client.blade.php index 45262ba2a858..650b0b7f2ce6 100644 --- a/resources/views/email/template/client.blade.php +++ b/resources/views/email/template/client.blade.php @@ -119,6 +119,16 @@ .new_button { background-color: {{ $primary_color }}; + + } + } + + .new_button, { + background-color: {{ $primary_color }}; + } + + a:visited { + color:#ffffff !important; }