mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 03:47:36 -05:00 
			
		
		
		
	Change quote to proposal in custom email designs
This commit is contained in:
		
							parent
							
								
									c6d5bc2450
								
							
						
					
					
						commit
						2b81d7ec47
					
				@ -191,7 +191,7 @@ class ContactMailer extends Mailer
 | 
				
			|||||||
        $data = [
 | 
					        $data = [
 | 
				
			||||||
            'body' => $this->templateService->processVariables($body, $variables),
 | 
					            'body' => $this->templateService->processVariables($body, $variables),
 | 
				
			||||||
            'link' => $invitation->getLink(),
 | 
					            'link' => $invitation->getLink(),
 | 
				
			||||||
            'entityType' => $invoice->getEntityType(),
 | 
					            'entityType' => $proposal ? ENTITY_PROPOSAL : $invoice->getEntityType(),
 | 
				
			||||||
            'invoiceId' => $invoice->id,
 | 
					            'invoiceId' => $invoice->id,
 | 
				
			||||||
            'invitation' => $invitation,
 | 
					            'invitation' => $invitation,
 | 
				
			||||||
            'account' => $account,
 | 
					            'account' => $account,
 | 
				
			||||||
 | 
				
			|||||||
@ -30,8 +30,10 @@ class TemplateService
 | 
				
			|||||||
        // check if it's a proposal
 | 
					        // check if it's a proposal
 | 
				
			||||||
        if ($invitation->proposal) {
 | 
					        if ($invitation->proposal) {
 | 
				
			||||||
            $invoice = $invitation->proposal->invoice;
 | 
					            $invoice = $invitation->proposal->invoice;
 | 
				
			||||||
 | 
					            $entityType = ENTITY_PROPOSAL;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $invoice = $invitation->invoice;
 | 
					            $invoice = $invitation->invoice;
 | 
				
			||||||
 | 
					            $entityType = $invoice->getEntityType();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $contact = $invitation->contact;
 | 
					        $contact = $invitation->contact;
 | 
				
			||||||
@ -67,7 +69,7 @@ class TemplateService
 | 
				
			|||||||
            '$link' => $invitation->getLink(),
 | 
					            '$link' => $invitation->getLink(),
 | 
				
			||||||
            '$password' => $passwordHTML,
 | 
					            '$password' => $passwordHTML,
 | 
				
			||||||
            '$viewLink' => $invitation->getLink().'$password',
 | 
					            '$viewLink' => $invitation->getLink().'$password',
 | 
				
			||||||
            '$viewButton' => Form::emailViewButton($invitation->getLink(), $invoice->getEntityType()).'$password',
 | 
					            '$viewButton' => Form::emailViewButton($invitation->getLink(), $entityType).'$password',
 | 
				
			||||||
            '$paymentLink' => $invitation->getLink('payment').'$password',
 | 
					            '$paymentLink' => $invitation->getLink('payment').'$password',
 | 
				
			||||||
            '$paymentButton' => Form::emailPaymentButton($invitation->getLink('payment')).'$password',
 | 
					            '$paymentButton' => Form::emailPaymentButton($invitation->getLink('payment')).'$password',
 | 
				
			||||||
            '$customClient1' => $client->custom_value1,
 | 
					            '$customClient1' => $client->custom_value1,
 | 
				
			||||||
 | 
				
			|||||||
@ -2793,7 +2793,8 @@ $LANG = array(
 | 
				
			|||||||
    'purge_client_warning' => 'All related records (invoices, tasks, expenses, documents, etc) will also be deleted.',
 | 
					    'purge_client_warning' => 'All related records (invoices, tasks, expenses, documents, etc) will also be deleted.',
 | 
				
			||||||
    'clone_product' => 'Clone Product',
 | 
					    'clone_product' => 'Clone Product',
 | 
				
			||||||
    'item_details' => 'Item Details',
 | 
					    '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',
 | 
				
			||||||
 | 
					
 | 
				
			||||||
);
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -165,8 +165,7 @@
 | 
				
			|||||||
                    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';
 | 
				
			||||||
                    var isQuote = entityType == "{{ ENTITY_QUOTE }}";
 | 
					                    $(previewName).html(renderEmailTemplate(value, false, entityType));
 | 
				
			||||||
                    $(previewName).html(renderEmailTemplate(value, false, isQuote));
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -1,10 +1,18 @@
 | 
				
			|||||||
<script type="text/javascript">
 | 
					<script type="text/javascript">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function renderEmailTemplate(str, invoice, isQuote) {
 | 
					    function renderEmailTemplate(str, invoice, entityType) {
 | 
				
			||||||
        if (!str) {
 | 
					        if (!str) {
 | 
				
			||||||
            return '';
 | 
					            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/>':'' !!}";
 | 
					        var passwordHtml = "{!! $account->isPro() && $account->enable_portal_password && $account->send_portal_password?'<br/>'.trans('texts.password').': XXXXXXXXX<br/>':'' !!}";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @if ($account->isPro())
 | 
					        @if ($account->isPro())
 | 
				
			||||||
@ -34,9 +42,7 @@
 | 
				
			|||||||
            'password': passwordHtml,
 | 
					            'password': passwordHtml,
 | 
				
			||||||
            'documents': documentsHtml,
 | 
					            'documents': documentsHtml,
 | 
				
			||||||
            'viewLink': '{{ link_to('#', auth()->user()->account->getBaseUrl() . '/...') }}$password',
 | 
					            'viewLink': '{{ link_to('#', auth()->user()->account->getBaseUrl() . '/...') }}$password',
 | 
				
			||||||
            'viewButton': isQuote || (invoice && invoice.invoice_type_id == {{ INVOICE_TYPE_QUOTE }}) ?
 | 
					            'viewButton': viewButton,
 | 
				
			||||||
                '{!! Form::flatButton('view_quote', '#0b4d78') !!}$password' :
 | 
					 | 
				
			||||||
                '{!! Form::flatButton('view_invoice', '#0b4d78') !!}$password',
 | 
					 | 
				
			||||||
            'paymentLink': '{{ link_to('#', auth()->user()->account->getBaseUrl() . '/...') }}$password',
 | 
					            'paymentLink': '{{ link_to('#', auth()->user()->account->getBaseUrl() . '/...') }}$password',
 | 
				
			||||||
            'paymentButton': '{!! Form::flatButton('pay_now', '#36c157') !!}$password',
 | 
					            'paymentButton': '{!! Form::flatButton('pay_now', '#36c157') !!}$password',
 | 
				
			||||||
            'autoBill': '{{ trans('texts.auto_bill_notification_placeholder') }}',
 | 
					            'autoBill': '{{ trans('texts.auto_bill_notification_placeholder') }}',
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user