From 7fe07462e4ada4a9189aef27557cdfdffa81d12f Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Fri, 9 Feb 2018 14:31:53 +0200 Subject: [PATCH] Proposals --- app/Http/Controllers/ProposalController.php | 4 +- resources/views/proposals/edit.blade.php | 19 +++- .../views/proposals/grapesjs_help.blade.php | 93 +++++++++++++++++++ .../views/proposals/snippets/edit.blade.php | 2 + .../views/proposals/templates/edit.blade.php | 2 + 5 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 resources/views/proposals/grapesjs_help.blade.php diff --git a/app/Http/Controllers/ProposalController.php b/app/Http/Controllers/ProposalController.php index 5fbf11bddf3c..0dfa74971fcd 100644 --- a/app/Http/Controllers/ProposalController.php +++ b/app/Http/Controllers/ProposalController.php @@ -60,7 +60,7 @@ class ProposalController extends BaseController 'method' => 'POST', 'url' => 'proposals', '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(), 'invoicePublicId' => $request->invoice_id, ]; @@ -86,7 +86,7 @@ class ProposalController extends BaseController 'method' => 'PUT', 'url' => 'proposals/' . $proposal->public_id, '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(), 'invoicePublicId' => $proposal->invoice ? $proposal->invoice->public_id : null, 'templatePublicId' => $proposal->proposal_template ? $proposal->proposal_template->public_id : null, diff --git a/resources/views/proposals/edit.blade.php b/resources/views/proposals/edit.blade.php index 847f30db2fdb..42774c1d6426 100644 --- a/resources/views/proposals/edit.blade.php +++ b/resources/views/proposals/edit.blade.php @@ -101,6 +101,8 @@ return html; } + invoice.account = {!! auth()->user()->account->load('country') !!}; + var regExp = new RegExp(/\$[a-z][\w\.]*/, 'g'); var matches = html.match(regExp); @@ -108,24 +110,31 @@ for (var i=0; i= 0) { 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() }}'); } diff --git a/resources/views/proposals/grapesjs_help.blade.php b/resources/views/proposals/grapesjs_help.blade.php new file mode 100644 index 000000000000..1ca5283a95a4 --- /dev/null +++ b/resources/views/proposals/grapesjs_help.blade.php @@ -0,0 +1,93 @@ +{!! Button::normal(trans('texts.help')) + ->appendIcon(Icon::create('question-sign')) + ->withAttributes(['onclick' => 'showProposalHelp()']) !!} + + + + diff --git a/resources/views/proposals/snippets/edit.blade.php b/resources/views/proposals/snippets/edit.blade.php index 11ffbe3a0a62..5769b5c54a76 100644 --- a/resources/views/proposals/snippets/edit.blade.php +++ b/resources/views/proposals/snippets/edit.blade.php @@ -53,6 +53,8 @@
+ @include('proposals.grapesjs_help') + {!! Button::normal(trans('texts.cancel')) ->appendIcon(Icon::create('remove-circle')) ->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!} diff --git a/resources/views/proposals/templates/edit.blade.php b/resources/views/proposals/templates/edit.blade.php index aff8ece02bbd..e8db9577bc08 100644 --- a/resources/views/proposals/templates/edit.blade.php +++ b/resources/views/proposals/templates/edit.blade.php @@ -51,6 +51,8 @@
+ @include('proposals.grapesjs_help') + {!! Button::normal(trans('texts.cancel')) ->appendIcon(Icon::create('remove-circle')) ->asLinkTo(HTMLUtils::previousUrl('/proposals')) !!}