Fix 'View Quote' button label preview

This commit is contained in:
Hillel Coren 2017-07-09 21:25:55 +03:00
parent 211bc16a24
commit 787c7e2d95
2 changed files with 4 additions and 3 deletions

View File

@ -161,7 +161,8 @@
var idName = '#email_' + stringType + '_' + entityType; var idName = '#email_' + stringType + '_' + entityType;
var value = $(idName).val(); var value = $(idName).val();
var previewName = '#' + entityType + '_' + stringType + '_preview'; var previewName = '#' + entityType + '_' + stringType + '_preview';
$(previewName).html(renderEmailTemplate(value)); var isQuote = entityType == "{{ ENTITY_QUOTE }}";
$(previewName).html(renderEmailTemplate(value, false, isQuote));
} }
} }
} }

View File

@ -1,6 +1,6 @@
<script type="text/javascript"> <script type="text/javascript">
function renderEmailTemplate(str, invoice) { function renderEmailTemplate(str, invoice, isQuote) {
if (!str) { if (!str) {
return ''; return '';
} }
@ -30,7 +30,7 @@
'password': passwordHtml, 'password': passwordHtml,
'documents': documentsHtml, 'documents': documentsHtml,
'viewLink': '{{ link_to('#', url('/view/...')) }}$password', 'viewLink': '{{ link_to('#', url('/view/...')) }}$password',
'viewButton': invoice && invoice.invoice_type_id == {{ INVOICE_TYPE_QUOTE }} ? 'viewButton': isQuote || (invoice && invoice.invoice_type_id == {{ INVOICE_TYPE_QUOTE }}) ?
'{!! Form::flatButton('view_quote', '#0b4d78') !!}$password' : '{!! Form::flatButton('view_quote', '#0b4d78') !!}$password' :
'{!! Form::flatButton('view_invoice', '#0b4d78') !!}$password', '{!! Form::flatButton('view_invoice', '#0b4d78') !!}$password',
'paymentLink': '{{ link_to('#', url('/payment/...')) }}$password', 'paymentLink': '{{ link_to('#', url('/payment/...')) }}$password',