1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-18 23:42:25 +02:00

Proposals

This commit is contained in:
Hillel Coren 2018-02-09 16:02:28 +02:00
parent 181094cbc1
commit a59a59ebd2
5 changed files with 17 additions and 1 deletions

View File

@ -63,6 +63,7 @@ class ProposalController extends BaseController
'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,
'templatePublicId' => $request->proposal_template_id,
];
return View::make('proposals.edit', $data);

View File

@ -62,6 +62,15 @@ class ProposalTemplateDatatable extends EntityDatatable
return Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_TEMPLATE, $model->user_id]);
},
],
[
trans('texts.new_proposal'),
function ($model) {
return URL::to("proposals/create/0/{$model->public_id}");
},
function ($model) {
return Auth::user()->can('create', [ENTITY_PROPOSAL, $model->user_id]);
},
],
];
}
}

View File

@ -174,6 +174,7 @@
@include('partials/entity_combobox', ['entityType' => ENTITY_PROPOSAL_TEMPLATE])
if (templateId) {
var template = templateMap[templateId];
$proposal_templateSelect.val(template.public_id);
setComboboxValue($('.template-select'), template.public_id, template.name);
}
$proposal_templateSelect.change(loadTemplate);
@ -190,6 +191,10 @@
var html = mergeTemplate(grapesjsEditor.getHtml());
grapesjsEditor.setComponents(html);
});
@if (! $proposal && $templatePublicId)
loadTemplate();
@endif
});
</script>

View File

@ -62,6 +62,7 @@
@if ($template)
{!! Button::primary(trans('texts.new_proposal'))
->appendIcon(Icon::create('plus-sign'))
->asLinkTo(url('/proposals/create/0/' . $template->public_id)) !!}
@endif

View File

@ -227,7 +227,7 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {
Route::post('proposals/proposals/bulk', 'ProposalController@bulk');
Route::get('proposals/{proposals}/edit', 'ProposalController@edit');
Route::get('proposals/create/{invoice_id?}', 'ProposalController@create');
Route::get('proposals/create/{invoice_id?}/{proposal_template_id?}', 'ProposalController@create');
Route::resource('proposals', 'ProposalController');
Route::get('api/proposals', 'ProposalController@getDatatable');