From 2b81d7ec479d51bed7e7d62c9066904f3525506c Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 26 Mar 2018 11:09:13 +0300 Subject: [PATCH] Change quote to proposal in custom email designs --- app/Ninja/Mailers/ContactMailer.php | 2 +- app/Services/TemplateService.php | 4 +++- resources/lang/en/texts.php | 3 ++- .../accounts/templates_and_reminders.blade.php | 3 +-- resources/views/partials/email_templates.blade.php | 14 ++++++++++---- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/Ninja/Mailers/ContactMailer.php b/app/Ninja/Mailers/ContactMailer.php index 5e20d8f531b2..94132ce1d8ef 100644 --- a/app/Ninja/Mailers/ContactMailer.php +++ b/app/Ninja/Mailers/ContactMailer.php @@ -191,7 +191,7 @@ class ContactMailer extends Mailer $data = [ 'body' => $this->templateService->processVariables($body, $variables), 'link' => $invitation->getLink(), - 'entityType' => $invoice->getEntityType(), + 'entityType' => $proposal ? ENTITY_PROPOSAL : $invoice->getEntityType(), 'invoiceId' => $invoice->id, 'invitation' => $invitation, 'account' => $account, diff --git a/app/Services/TemplateService.php b/app/Services/TemplateService.php index 8ed901d406d3..ab85a2a0677c 100644 --- a/app/Services/TemplateService.php +++ b/app/Services/TemplateService.php @@ -30,8 +30,10 @@ class TemplateService // check if it's a proposal if ($invitation->proposal) { $invoice = $invitation->proposal->invoice; + $entityType = ENTITY_PROPOSAL; } else { $invoice = $invitation->invoice; + $entityType = $invoice->getEntityType(); } $contact = $invitation->contact; @@ -67,7 +69,7 @@ class TemplateService '$link' => $invitation->getLink(), '$password' => $passwordHTML, '$viewLink' => $invitation->getLink().'$password', - '$viewButton' => Form::emailViewButton($invitation->getLink(), $invoice->getEntityType()).'$password', + '$viewButton' => Form::emailViewButton($invitation->getLink(), $entityType).'$password', '$paymentLink' => $invitation->getLink('payment').'$password', '$paymentButton' => Form::emailPaymentButton($invitation->getLink('payment')).'$password', '$customClient1' => $client->custom_value1, diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 5e8a97ba7ddc..f017264f7d6e 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2793,7 +2793,8 @@ $LANG = array( 'purge_client_warning' => 'All related records (invoices, tasks, expenses, documents, etc) will also be deleted.', 'clone_product' => 'Clone Product', 'item_details' => 'Item Details', - 'send_item_details_help' => 'Send the line item details to the payment gateway.' + 'send_item_details_help' => 'Send the line item details to the payment gateway.', + 'view_proposal' => 'View Proposal', ); diff --git a/resources/views/accounts/templates_and_reminders.blade.php b/resources/views/accounts/templates_and_reminders.blade.php index 1bb9d52a4dd0..865612e6be95 100644 --- a/resources/views/accounts/templates_and_reminders.blade.php +++ b/resources/views/accounts/templates_and_reminders.blade.php @@ -165,8 +165,7 @@ var idName = '#email_' + stringType + '_' + entityType; var value = $(idName).val(); var previewName = '#' + entityType + '_' + stringType + '_preview'; - var isQuote = entityType == "{{ ENTITY_QUOTE }}"; - $(previewName).html(renderEmailTemplate(value, false, isQuote)); + $(previewName).html(renderEmailTemplate(value, false, entityType)); } } } diff --git a/resources/views/partials/email_templates.blade.php b/resources/views/partials/email_templates.blade.php index 56a13249b05a..d8f80d9ae89a 100644 --- a/resources/views/partials/email_templates.blade.php +++ b/resources/views/partials/email_templates.blade.php @@ -1,10 +1,18 @@