2015-03-16 22:45:25 +01:00
|
|
|
@extends('accounts.nav')
|
|
|
|
|
|
|
|
@section('head')
|
|
|
|
@parent
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
|
|
textarea {
|
|
|
|
min-height: 150px !important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
@stop
|
|
|
|
|
|
|
|
@section('content')
|
|
|
|
@parent
|
|
|
|
@include('accounts.nav_advanced')
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
{!! Former::open()->addClass('col-md-10 col-md-offset-1 warn-on-exit') !!}
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::populateField('email_template_invoice', $invoiceEmail) !!}
|
|
|
|
{!! Former::populateField('email_template_quote', $quoteEmail) !!}
|
|
|
|
{!! Former::populateField('email_template_payment', $paymentEmail) !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.invoice_email') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
{!! Former::textarea('email_template_invoice')->raw() !!}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6" id="invoice_preview"></div>
|
|
|
|
</div>
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.quote_email') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
{!! Former::textarea('email_template_quote')->raw() !!}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6" id="quote_preview"></div>
|
|
|
|
</div>
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
2015-04-20 16:34:23 +02:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<h3 class="panel-title">{!! trans('texts.payment_email') !!}</h3>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
|
|
|
{!! Former::textarea('email_template_payment')->raw() !!}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-6" id="payment_preview"></div>
|
|
|
|
</div>
|
2015-03-16 22:45:25 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@if (Auth::user()->isPro())
|
2015-04-20 16:34:23 +02:00
|
|
|
<center>
|
|
|
|
{!! Button::success(trans('texts.save'))->submit()->large()->appendIcon(Icon::create('floppy-disk')) !!}
|
|
|
|
</center>
|
2015-03-16 22:45:25 +01:00
|
|
|
@else
|
|
|
|
<script>
|
|
|
|
$(function() {
|
|
|
|
$('form.warn-on-exit input').prop('disabled', true);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@endif
|
|
|
|
|
2015-04-01 21:57:02 +02:00
|
|
|
{!! Former::close() !!}
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
$(function() {
|
|
|
|
$('#email_template_invoice').keyup(refreshInvoice);
|
|
|
|
$('#email_template_quote').keyup(refreshQuote);
|
|
|
|
$('#email_template_payment').keyup(refreshPayment);
|
|
|
|
|
|
|
|
refreshInvoice();
|
|
|
|
refreshQuote();
|
|
|
|
refreshPayment();
|
|
|
|
});
|
|
|
|
|
|
|
|
function refreshInvoice() {
|
|
|
|
$('#invoice_preview').html(processVariables($('#email_template_invoice').val()));
|
|
|
|
}
|
|
|
|
|
|
|
|
function refreshQuote() {
|
|
|
|
$('#quote_preview').html(processVariables($('#email_template_quote').val()));
|
|
|
|
}
|
|
|
|
|
|
|
|
function refreshPayment() {
|
|
|
|
$('#payment_preview').html(processVariables($('#email_template_payment').val()));
|
|
|
|
}
|
|
|
|
|
|
|
|
function processVariables(str) {
|
|
|
|
if (!str) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2015-05-26 19:41:40 +02:00
|
|
|
keys = ['footer', 'account', 'client', 'amount', 'link', 'contact'];
|
2015-05-29 21:33:55 +02:00
|
|
|
vals = [{!! json_encode($emailFooter) !!}, '{!! Auth::user()->account->getDisplayName() !!}', 'Client Name', formatMoney(100), '{!! NINJA_WEB_URL !!}', 'Contact Name'];
|
|
|
|
|
|
|
|
// Add any available payment method links
|
|
|
|
<?php
|
|
|
|
foreach([PAYMENT_TYPE_CREDIT_CARD, PAYMENT_TYPE_PAYPAL, PAYMENT_TYPE_BITCOIN] as $type) {
|
|
|
|
if (Auth::user()->account->getGatewayByType($type)) {
|
|
|
|
|
|
|
|
// Changes "PAYMENT_TYPE_CREDIT_CARD" to "credit_card"
|
|
|
|
$gateway_slug = strtolower(str_replace('PAYMENT_TYPE_', '', $type)).'_link';
|
|
|
|
|
|
|
|
echo "keys.push('$gateway_slug'); ";
|
|
|
|
echo "vals.push('".URL::to("/payment/xxxxxx/{$type}")."'); ";
|
|
|
|
echo "\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
for (var i=0; i<keys.length; i++) {
|
|
|
|
var regExp = new RegExp('\\$'+keys[i], 'g');
|
|
|
|
str = str.replace(regExp, vals[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
@stop
|