diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index ee56fa2b91cd..620f50fe1270 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -5,6 +5,17 @@ use Input; use Redirect; use Utils; use View; + +use App\Models\Account; +use App\Models\Client; +use App\Models\Country; +use App\Models\Currency; +use App\Models\Industry; +use App\Models\InvoiceDesign; +use App\Models\PaymentTerm; +use App\Models\Product; +use App\Models\Size; +use App\Models\TaxRate; use App\Ninja\Mailers\ContactMailer as Mailer; use App\Ninja\Repositories\InvoiceRepository; use App\Ninja\Repositories\ClientRepository; @@ -128,6 +139,7 @@ class QuoteController extends BaseController private static function getViewModel() { + /* return [ 'entityType' => ENTITY_QUOTE, 'account' => Auth::user()->account, @@ -143,6 +155,22 @@ class QuoteController extends BaseController ->where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), 'invoiceLabels' => Auth::user()->account->getInvoiceLabels() ]; +*/ + // TODO: Add Remember Cache + return [ + 'entityType' => ENTITY_QUOTE, + 'account' => Auth::user()->account, + 'products' => Product::scope()->orderBy('id')->get(array('product_key', 'notes', 'cost', 'qty')), + 'countries' => Country::orderBy('name')->get(), + 'clients' => Client::scope()->with('contacts', 'country')->orderBy('name')->get(), + 'taxRates' => TaxRate::scope()->orderBy('name')->get(), + 'currencies' => Currency::orderBy('name')->get(), + 'sizes' => Size::orderBy('id')->get(), + 'paymentTerms' => PaymentTerm::orderBy('num_days')->get(['name', 'num_days']), + 'industries' => Industry::orderBy('name')->get(), + 'invoiceDesigns' => InvoiceDesign::where('id', '<=', Auth::user()->maxInvoiceDesignId())->orderBy('id')->get(), + 'invoiceLabels' => Auth::user()->account->getInvoiceLabels() + ]; } public function bulk() diff --git a/app/Models/InvoiceDesign.php b/app/Models/InvoiceDesign.php index 5779f329521a..9604a3451c92 100644 --- a/app/Models/InvoiceDesign.php +++ b/app/Models/InvoiceDesign.php @@ -1,5 +1,7 @@ @endif - {{ Former::open($url)->method($method)->addClass('warn-on-exit')->rules(array( + {!! Former::open($url)->method($method)->addClass('warn-on-exit')->rules(array( 'client' => 'required', 'email' => 'required', 'product_key' => 'max:20' - )) }} + )) !!} @@ -38,7 +38,7 @@
- {{ Former::hidden('data')->data_bind("value: ko.mapping.toJSON(model)") }} + {!! Former::hidden('data')->data_bind("value: ko.mapping.toJSON(model)") !!}
- {{ Former::text('product_key')->useDatalist($products->toArray(), 'product_key')->onkeyup('onItemChange()') - ->raw()->data_bind("value: product_key, valueUpdate: 'afterkeydown'")->addClass('datalist') }} + {!! Former::text('product_key')->useDatalist($products->toArray(), 'product_key')->onkeyup('onItemChange()') + ->raw()->data_bind("value: product_key, valueUpdate: 'afterkeydown'")->addClass('datalist') !!} |
@@ -175,20 +175,20 @@
- {{ Former::textarea('public_notes')->data_bind("value: wrapped_notes, valueUpdate: 'afterkeydown'")
- ->label(null)->style('resize: none; min-width: 450px;')->rows(3) }}
+ {!! Former::textarea('public_notes')->data_bind("value: wrapped_notes, valueUpdate: 'afterkeydown'")
+ ->label(null)->style('resize: none; min-width: 450px;')->rows(3) !!}
- {{ Former::textarea('terms')->data_bind("value:wrapped_terms, placeholder: default_terms, valueUpdate: 'afterkeydown'")
+ {!! Former::textarea('terms')->data_bind("value:wrapped_terms, placeholder: default_terms, valueUpdate: 'afterkeydown'")
->label(false)->style('resize: none; min-width: 450px')->rows(3)
->help('') }}
+ '.trans('texts.save_as_default_terms').'') !!}
- {{ Former::textarea('invoice_footer')->data_bind("value:wrapped_footer, placeholder: default_footer, valueUpdate: 'afterkeydown'")
+ {!! Former::textarea('invoice_footer')->data_bind("value:wrapped_footer, placeholder: default_footer, valueUpdate: 'afterkeydown'")
->label(false)->style('resize: none; min-width: 450px')->rows(3)
->help('') }}
+ '.trans('texts.save_as_default_footer').'') !!}
- {{ Former::populateField('entityType', $entityType) }}
- {{ Former::text('entityType') }}
- {{ Former::text('action') }}
+ {!! Former::populateField('entityType', $entityType) !!}
+ {!! Former::text('entityType') !!}
+ {!! Former::text('action') !!}
@if ($invoice && $invoice->id)
- {{ Former::populateField('id', $invoice->public_id) }}
- {{ Former::text('id') }}
+ {!! Former::populateField('id', $invoice->public_id) !!}
+ {!! Former::text('id') !!}
@endif
@if (!Utils::isPro() || InvoiceDesign::count() == COUNT_FREE_DESIGNS)
- {{ Former::select('invoice_design_id')->style('display:inline;width:150px')->raw()->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id")->addOption(trans('texts.more_designs') . '...', '-1') }}
+ {!! Former::select('invoice_design_id')->style('display:inline;width:150px')->raw()->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id")->addOption(trans('texts.more_designs') . '...', '-1') !!}
@else
- {{ Former::select('invoice_design_id')->style('display:inline;width:150px')->raw()->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id") }}
+ {!! Former::select('invoice_design_id')->style('display:inline;width:150px')->raw()->fromQuery($invoiceDesigns, 'name', 'id')->data_bind("value: invoice_design_id") !!}
@endif
- {{ Button::primary(trans('texts.download_pdf'), array('onclick' => 'onDownloadClick()'))->append_with_icon('download-alt'); }}
+ {!! Button::primary(trans('texts.download_pdf'))->withAttributes(array('onclick' => 'onDownloadClick()'))->appendIcon(Icon::create('download-alt')) !!}
@if (!$invoice || (!$invoice->trashed() && !$invoice->client->trashed()))
@if ($invoice && $invoice->id)
@@ -334,18 +334,18 @@
- {{ Former::legend('organization') }}
- {{ Former::text('name')->data_bind("value: name, valueUpdate: 'afterkeydown', attr { placeholder: name.placeholder }") }}
- {{ Former::text('id_number')->data_bind("value: id_number, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('vat_number')->data_bind("value: vat_number, valueUpdate: 'afterkeydown'") }}
+ {!! Former::legend('organization') !!}
+ {!! Former::text('name')->data_bind("value: name, valueUpdate: 'afterkeydown', attr { placeholder: name.placeholder }") !!}
+ {!! Former::text('id_number')->data_bind("value: id_number, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('vat_number')->data_bind("value: vat_number, valueUpdate: 'afterkeydown'") !!}
- {{ Former::text('website')->data_bind("value: website, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('work_phone')->data_bind("value: work_phone, valueUpdate: 'afterkeydown'") }}
+ {!! Former::text('website')->data_bind("value: website, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('work_phone')->data_bind("value: work_phone, valueUpdate: 'afterkeydown'") !!}
@if (Auth::user()->isPro())
@if ($account->custom_client_label1)
- {{ Former::text('custom_value1')->label($account->custom_client_label1)
- ->data_bind("value: custom_value1, valueUpdate: 'afterkeydown'") }}
+ {!! Former::text('custom_value1')->label($account->custom_client_label1)
+ ->data_bind("value: custom_value1, valueUpdate: 'afterkeydown'") !!}
@endif
@if ($account->custom_client_label2)
- {{ Former::text('custom_value2')->label($account->custom_client_label2)
- ->data_bind("value: custom_value2, valueUpdate: 'afterkeydown'") }}
+ {!! Former::text('custom_value2')->label($account->custom_client_label2)
+ ->data_bind("value: custom_value2, valueUpdate: 'afterkeydown'") !!}
@endif
@endif
- {{ Former::legend('address') }}
- {{ Former::text('address1')->data_bind("value: address1, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('address2')->data_bind("value: address2, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('city')->data_bind("value: city, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('state')->data_bind("value: state, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('postal_code')->data_bind("value: postal_code, valueUpdate: 'afterkeydown'") }}
- {{ Former::select('country_id')->addOption('','')->addGroupClass('country_select')
- ->fromQuery($countries, 'name', 'id')->data_bind("dropdown: country_id") }}
+ {!! Former::legend('address') !!}
+ {!! Former::text('address1')->data_bind("value: address1, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('address2')->data_bind("value: address2, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('city')->data_bind("value: city, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('state')->data_bind("value: state, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('postal_code')->data_bind("value: postal_code, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::select('country_id')->addOption('','')->addGroupClass('country_select')
+ ->fromQuery($countries, 'name', 'id')->data_bind("dropdown: country_id") !!}
- {{ Former::legend('contacts') }}
+ {!! Former::legend('contacts') !!}
@@ -486,10 +486,10 @@
- {{ Former::hidden('public_id')->data_bind("value: public_id, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('first_name')->data_bind("value: first_name, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('last_name')->data_bind("value: last_name, valueUpdate: 'afterkeydown'") }}
- {{ Former::text('email')->data_bind('value: email, valueUpdate: \'afterkeydown\', attr: {id:\'email\'+$index()}') }}
- {{ Former::text('phone')->data_bind("value: phone, valueUpdate: 'afterkeydown'") }}
+ {!! Former::hidden('public_id')->data_bind("value: public_id, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('first_name')->data_bind("value: first_name, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('last_name')->data_bind("value: last_name, valueUpdate: 'afterkeydown'") !!}
+ {!! Former::text('email')->data_bind('value: email, valueUpdate: \'afterkeydown\', attr: {id:\'email\'+$index()}') !!}
+ {!! Former::text('phone')->data_bind("value: phone, valueUpdate: 'afterkeydown'") !!}
- {{ Former::legend('additional_info') }}
- {{ Former::select('payment_terms')->addOption('','0')->data_bind('value: payment_terms')
- ->fromQuery($paymentTerms, 'name', 'num_days') }}
- {{ Former::select('currency_id')->addOption('','')->data_bind('value: currency_id')
- ->fromQuery($currencies, 'name', 'id') }}
- {{ Former::select('size_id')->addOption('','')->data_bind('value: size_id')
- ->fromQuery($sizes, 'name', 'id') }}
- {{ Former::select('industry_id')->addOption('','')->data_bind('value: industry_id')
- ->fromQuery($industries, 'name', 'id') }}
- {{ Former::textarea('private_notes')->data_bind('value: private_notes') }}
+ {!! Former::legend('additional_info') !!}
+ {!! Former::select('payment_terms')->addOption('','0')->data_bind('value: payment_terms')
+ ->fromQuery($paymentTerms, 'name', 'num_days') !!}
+ {!! Former::select('currency_id')->addOption('','')->data_bind('value: currency_id')
+ ->fromQuery($currencies, 'name', 'id') !!}
+ {!! Former::select('size_id')->addOption('','')->data_bind('value: size_id')
+ ->fromQuery($sizes, 'name', 'id') !!}
+ {!! Former::select('industry_id')->addOption('','')->data_bind('value: industry_id')
+ ->fromQuery($industries, 'name', 'id') !!}
+ {!! Former::textarea('private_notes')->data_bind('value: private_notes') !!}
- {{ link_to('#', trans('texts.remove_contact').' -', array('data-bind'=>'click: $parent.removeContact')) }}
+ {!! link_to('#', trans('texts.remove_contact').' -', array('data-bind'=>'click: $parent.removeContact')) !!}
- {{ link_to('#', trans('texts.add_contact').' +', array('data-bind'=>'click: $parent.addContact')) }}
+ {!! link_to('#', trans('texts.add_contact').' +', array('data-bind'=>'click: $parent.addContact')) !!}
|