mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Proposals
This commit is contained in:
parent
e96e633c40
commit
7fe07462e4
@ -60,7 +60,7 @@ class ProposalController extends BaseController
|
|||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'url' => 'proposals',
|
'url' => 'proposals',
|
||||||
'title' => trans('texts.new_proposal'),
|
'title' => trans('texts.new_proposal'),
|
||||||
'invoices' => Invoice::scope()->with('client.contacts')->unapprovedQuotes()->orderBy('id')->get(),
|
'invoices' => Invoice::scope()->with('client.contacts', 'client.country')->unapprovedQuotes()->orderBy('id')->get(),
|
||||||
'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(),
|
'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(),
|
||||||
'invoicePublicId' => $request->invoice_id,
|
'invoicePublicId' => $request->invoice_id,
|
||||||
];
|
];
|
||||||
@ -86,7 +86,7 @@ class ProposalController extends BaseController
|
|||||||
'method' => 'PUT',
|
'method' => 'PUT',
|
||||||
'url' => 'proposals/' . $proposal->public_id,
|
'url' => 'proposals/' . $proposal->public_id,
|
||||||
'title' => trans('texts.edit_proposal'),
|
'title' => trans('texts.edit_proposal'),
|
||||||
'invoices' => Invoice::scope()->with('client.contacts')->unapprovedQuotes($proposal->invoice_id)->orderBy('id')->get(),
|
'invoices' => Invoice::scope()->with('client.contacts', 'client.country')->unapprovedQuotes($proposal->invoice_id)->orderBy('id')->get(),
|
||||||
'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(),
|
'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(),
|
||||||
'invoicePublicId' => $proposal->invoice ? $proposal->invoice->public_id : null,
|
'invoicePublicId' => $proposal->invoice ? $proposal->invoice->public_id : null,
|
||||||
'templatePublicId' => $proposal->proposal_template ? $proposal->proposal_template->public_id : null,
|
'templatePublicId' => $proposal->proposal_template ? $proposal->proposal_template->public_id : null,
|
||||||
|
@ -101,6 +101,8 @@
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
invoice.account = {!! auth()->user()->account->load('country') !!};
|
||||||
|
|
||||||
var regExp = new RegExp(/\$[a-z][\w\.]*/, 'g');
|
var regExp = new RegExp(/\$[a-z][\w\.]*/, 'g');
|
||||||
var matches = html.match(regExp);
|
var matches = html.match(regExp);
|
||||||
|
|
||||||
@ -108,24 +110,31 @@
|
|||||||
for (var i=0; i<matches.length; i++) {
|
for (var i=0; i<matches.length; i++) {
|
||||||
var match = matches[i];
|
var match = matches[i];
|
||||||
|
|
||||||
field = match.substring(1, match.length);
|
field = match.replace('$quote.', '$');
|
||||||
|
field = field.substring(1, field.length);
|
||||||
field = toSnakeCase(field);
|
field = toSnakeCase(field);
|
||||||
|
|
||||||
if (field == 'invoice_number') {
|
if (field == 'quote_number') {
|
||||||
field = 'invoice_number';
|
field = 'invoice_number';
|
||||||
} else if (field == 'valid_until') {
|
} else if (field == 'valid_until') {
|
||||||
field = 'due_date';
|
field = 'due_date';
|
||||||
} else if (field == 'invoice_date') {
|
} else if (field == 'quote_date') {
|
||||||
field = 'invoice_date';
|
field = 'invoice_date';
|
||||||
|
} else if (field == 'footer') {
|
||||||
|
field = 'invoice_footer';
|
||||||
|
} else if (match == '$account.phone') {
|
||||||
|
field = 'account.work_phone';
|
||||||
|
} else if (match == '$client.phone') {
|
||||||
|
field = 'client.phone';
|
||||||
}
|
}
|
||||||
|
|
||||||
var value = getDescendantProp(invoice, field) || ' ';
|
var value = getDescendantProp(invoice, field) || ' ';
|
||||||
value = doubleDollarSign(value) + '';
|
value = doubleDollarSign(value) + '';
|
||||||
value = value.replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
value = value.replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
||||||
|
|
||||||
if (field == 'amount' || field == 'partial') {
|
if (['amount', 'partial', 'balance', 'paid_to_date'].indexOf(field) >= 0) {
|
||||||
value = formatMoneyInvoice(value, invoice);
|
value = formatMoneyInvoice(value, invoice);
|
||||||
} else if (['invoice_date', 'due_date'].indexOf(field) >= 0) {
|
} else if (['invoice_date', 'due_date', 'partial_due_date'].indexOf(field) >= 0) {
|
||||||
value = moment.utc(value).format('{{ $account->getMomentDateFormat() }}');
|
value = moment.utc(value).format('{{ $account->getMomentDateFormat() }}');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
93
resources/views/proposals/grapesjs_help.blade.php
Normal file
93
resources/views/proposals/grapesjs_help.blade.php
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
{!! Button::normal(trans('texts.help'))
|
||||||
|
->appendIcon(Icon::create('question-sign'))
|
||||||
|
->withAttributes(['onclick' => 'showProposalHelp()']) !!}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function showProposalHelp() {
|
||||||
|
$('#proposalHelpModal').modal('show');
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="modal fade" id="proposalHelpModal" tabindex="-1" role="dialog" aria-labelledby="proposalHelpModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog" style="text-align:left">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title" id="proposalHelpModalLabel">{{ trans('texts.help') }}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<ul>
|
||||||
|
<li>$quote.quoteNumber</li>
|
||||||
|
<li>$quote.discount</li>
|
||||||
|
<li>$quote.poNumber</li>
|
||||||
|
<li>$quote.quoteDate</li>
|
||||||
|
<li>$quote.validUntil</li>
|
||||||
|
<li>$quote.publicNotes</li>
|
||||||
|
<li>$quote.amount</li>
|
||||||
|
<li>$quote.terms</li>
|
||||||
|
<li>$quote.footer</li>
|
||||||
|
<li>$quote.partial</li>
|
||||||
|
<li>$quote.partialDueDate</li>
|
||||||
|
<li>$quote.customValue1</li>
|
||||||
|
<li>$quote.customValue2</li>
|
||||||
|
<li>$quote.customTextValue1</li>
|
||||||
|
<li>$quote.customTextValue2</li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li>$contact.firstName</li>
|
||||||
|
<li>$contact.lastName</li>
|
||||||
|
<li>$contact.email</li>
|
||||||
|
<li>$contact.phone</li>
|
||||||
|
<li>$contact.customValue1</li>
|
||||||
|
<li>$contact.customValue2</li>
|
||||||
|
</ul>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<ul>
|
||||||
|
<li>$client.name</li>
|
||||||
|
<li>$client.idNumber</li>
|
||||||
|
<li>$client.vatNumber</li>
|
||||||
|
<li>$client.address1</li>
|
||||||
|
<li>$client.address2</li>
|
||||||
|
<li>$client.city</li>
|
||||||
|
<li>$client.state</li>
|
||||||
|
<li>$client.postalCode</li>
|
||||||
|
<li>$client.country.name</li>
|
||||||
|
<li>$client.phone</li>
|
||||||
|
<li>$client.balance</li>
|
||||||
|
<li>$client.customValue1</li>
|
||||||
|
<li>$client.customValue2</li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li>$account.name</li>
|
||||||
|
<li>$account.idNumber</li>
|
||||||
|
<li>$account.vatNumber</li>
|
||||||
|
<li>$account.address1</li>
|
||||||
|
<li>$account.address2</li>
|
||||||
|
<li>$account.city</li>
|
||||||
|
<li>$account.state</li>
|
||||||
|
<li>$account.postalCode</li>
|
||||||
|
<li>$account.country.name</li>
|
||||||
|
<li>$account.phone</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }}</button>
|
||||||
|
<!-- <a class="btn btn-primary" href="{{ config('ninja.video_urls.custom_design') }}" target="_blank">{{ trans('texts.video') }}</a> -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -53,6 +53,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<center class="buttons">
|
<center class="buttons">
|
||||||
|
@include('proposals.grapesjs_help')
|
||||||
|
|
||||||
{!! Button::normal(trans('texts.cancel'))
|
{!! Button::normal(trans('texts.cancel'))
|
||||||
->appendIcon(Icon::create('remove-circle'))
|
->appendIcon(Icon::create('remove-circle'))
|
||||||
->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}
|
->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}
|
||||||
|
@ -51,6 +51,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<center class="buttons">
|
<center class="buttons">
|
||||||
|
@include('proposals.grapesjs_help')
|
||||||
|
|
||||||
{!! Button::normal(trans('texts.cancel'))
|
{!! Button::normal(trans('texts.cancel'))
|
||||||
->appendIcon(Icon::create('remove-circle'))
|
->appendIcon(Icon::create('remove-circle'))
|
||||||
->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}
|
->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user