1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 12:42:36 +01:00

Change quote to proposal in custom email designs

This commit is contained in:
Hillel Coren 2018-03-26 11:09:13 +03:00
parent c6d5bc2450
commit 2b81d7ec47
5 changed files with 17 additions and 9 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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',
);

View File

@ -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));
}
}
}

View File

@ -1,10 +1,18 @@
<script type="text/javascript">
function renderEmailTemplate(str, invoice, isQuote) {
function renderEmailTemplate(str, invoice, entityType) {
if (!str) {
return '';
}
if (invoice && invoice.invoice_type_id == {{ INVOICE_TYPE_QUOTE }} || entityType == '{{ ENTITY_QUOTE }}') {
var viewButton = '{!! Form::flatButton('view_quote', '#0b4d78') !!}$password';
} else if (entityType == '{{ ENTITY_PROPOSAL }}') {
var viewButton = '{!! Form::flatButton('view_proposal', '#0b4d78') !!}$password';
} else {
var viewButton = '{!! Form::flatButton('view_invoice', '#0b4d78') !!}$password';
}
var passwordHtml = "{!! $account->isPro() && $account->enable_portal_password && $account->send_portal_password?'<br/>'.trans('texts.password').': XXXXXXXXX<br/>':'' !!}";
@if ($account->isPro())
@ -34,9 +42,7 @@
'password': passwordHtml,
'documents': documentsHtml,
'viewLink': '{{ link_to('#', auth()->user()->account->getBaseUrl() . '/...') }}$password',
'viewButton': isQuote || (invoice && invoice.invoice_type_id == {{ INVOICE_TYPE_QUOTE }}) ?
'{!! Form::flatButton('view_quote', '#0b4d78') !!}$password' :
'{!! Form::flatButton('view_invoice', '#0b4d78') !!}$password',
'viewButton': viewButton,
'paymentLink': '{{ link_to('#', auth()->user()->account->getBaseUrl() . '/...') }}$password',
'paymentButton': '{!! Form::flatButton('pay_now', '#36c157') !!}$password',
'autoBill': '{{ trans('texts.auto_bill_notification_placeholder') }}',