1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 12:42:36 +01:00

Working on proposals

This commit is contained in:
Hillel Coren 2018-01-31 13:59:53 +02:00
parent de040a4455
commit f45c39d6f4
5 changed files with 31 additions and 26 deletions

View File

@ -55,14 +55,14 @@ class ProposalCategoryController extends BaseController
'account' => auth()->user()->account, 'account' => auth()->user()->account,
'proposalCategory' => null, 'proposalCategory' => null,
'method' => 'POST', 'method' => 'POST',
'url' => 'proposal_categories', 'url' => 'proposals/categories',
'title' => trans('texts.new_proposal_category'), 'title' => trans('texts.new_proposal_category'),
'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(), 'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(),
'templates' => ProposalCategory::scope()->orderBy('name')->get(), 'templates' => ProposalCategory::scope()->orderBy('name')->get(),
'quotePublicId' => $request->quote_id, 'quotePublicId' => $request->quote_id,
]; ];
return View::make('proposals/categories/edit', $data); return View::make('proposals/categories.edit', $data);
} }
public function edit(ProposalCategoryRequest $request) public function edit(ProposalCategoryRequest $request)
@ -73,7 +73,7 @@ class ProposalCategoryController extends BaseController
'account' => auth()->user()->account, 'account' => auth()->user()->account,
'proposalCategory' => $proposalCategory, 'proposalCategory' => $proposalCategory,
'method' => 'PUT', 'method' => 'PUT',
'url' => 'proposal_categories/' . $proposalCategory->public_id, 'url' => 'proposals/categories/' . $proposalCategory->public_id,
'title' => trans('texts.edit_proposal_category'), 'title' => trans('texts.edit_proposal_category'),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
'clientPublicId' => $proposalCategory->client ? $proposalCategory->client->public_id : null, 'clientPublicId' => $proposalCategory->client ? $proposalCategory->client->public_id : null,
@ -118,6 +118,6 @@ class ProposalCategoryController extends BaseController
Session::flash('message', $message); Session::flash('message', $message);
} }
return redirect()->to('/proposal_categories'); return redirect()->to('/proposals/categories');
} }
} }

View File

@ -55,7 +55,7 @@ class ProposalSnippetController extends BaseController
'account' => auth()->user()->account, 'account' => auth()->user()->account,
'proposalSnippet' => null, 'proposalSnippet' => null,
'method' => 'POST', 'method' => 'POST',
'url' => 'proposal_snippets', 'url' => 'proposals/snippets',
'title' => trans('texts.new_proposal_snippet'), 'title' => trans('texts.new_proposal_snippet'),
'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(), 'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(),
'templates' => ProposalSnippet::scope()->orderBy('name')->get(), 'templates' => ProposalSnippet::scope()->orderBy('name')->get(),
@ -73,13 +73,13 @@ class ProposalSnippetController extends BaseController
'account' => auth()->user()->account, 'account' => auth()->user()->account,
'proposalSnippet' => $proposalSnippet, 'proposalSnippet' => $proposalSnippet,
'method' => 'PUT', 'method' => 'PUT',
'url' => 'proposal_snippets/' . $proposalSnippet->public_id, 'url' => 'proposals/snippets/' . $proposalSnippet->public_id,
'title' => trans('texts.edit_proposal_snippet'), 'title' => trans('texts.edit_proposal_snippet'),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
'clientPublicId' => $proposalSnippet->client ? $proposalSnippet->client->public_id : null, 'clientPublicId' => $proposalSnippet->client ? $proposalSnippet->client->public_id : null,
]; ];
return View::make('proposals/snippets/edit', $data); return View::make('proposals/snippets.edit', $data);
} }
public function store(CreateProposalSnippetRequest $request) public function store(CreateProposalSnippetRequest $request)

View File

@ -55,7 +55,7 @@ class ProposalTemplateController extends BaseController
'account' => auth()->user()->account, 'account' => auth()->user()->account,
'proposalTemplate' => null, 'proposalTemplate' => null,
'method' => 'POST', 'method' => 'POST',
'url' => 'proposal_templates', 'url' => 'proposals/templates',
'title' => trans('texts.new_proposal_template'), 'title' => trans('texts.new_proposal_template'),
'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(), 'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(),
'templates' => ProposalTemplate::scope()->orderBy('name')->get(), 'templates' => ProposalTemplate::scope()->orderBy('name')->get(),
@ -73,7 +73,7 @@ class ProposalTemplateController extends BaseController
'account' => auth()->user()->account, 'account' => auth()->user()->account,
'proposalTemplate' => $proposalTemplate, 'proposalTemplate' => $proposalTemplate,
'method' => 'PUT', 'method' => 'PUT',
'url' => 'proposal_templates/' . $proposalTemplate->public_id, 'url' => 'proposals/templates/' . $proposalTemplate->public_id,
'title' => trans('texts.edit_proposal_template'), 'title' => trans('texts.edit_proposal_template'),
'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(),
'clientPublicId' => $proposalTemplate->client ? $proposalTemplate->client->public_id : null, 'clientPublicId' => $proposalTemplate->client ? $proposalTemplate->client->public_id : null,
@ -118,6 +118,6 @@ class ProposalTemplateController extends BaseController
Session::flash('message', $message); Session::flash('message', $message);
} }
return redirect()->to('/proposal_templates'); return redirect()->to('/proposals/templates');
} }
} }

View File

@ -50,22 +50,22 @@
{!! DropdownButton::normal(trans('texts.proposal_templates')) {!! DropdownButton::normal(trans('texts.proposal_templates'))
->withAttributes(['class'=>'templatesDropdown']) ->withAttributes(['class'=>'templatesDropdown'])
->withContents([ ->withContents([
['label' => trans('texts.new_proposal_template'), 'url' => url('/proposal_templates/create')], ['label' => trans('texts.new_proposal_template'), 'url' => url('/proposals/templates/create')],
] ]
)->split() !!} )->split() !!}
{!! DropdownButton::normal(trans('texts.proposal_snippets')) {!! DropdownButton::normal(trans('texts.proposal_snippets'))
->withAttributes(['class'=>'snippetsDropdown']) ->withAttributes(['class'=>'snippetsDropdown'])
->withContents([ ->withContents([
['label' => trans('texts.new_proposal_snippet'), 'url' => url('/proposal_snippets/create')], ['label' => trans('texts.new_proposal_snippet'), 'url' => url('/proposals/snippets/create')],
] ]
)->split() !!} )->split() !!}
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('.templatesDropdown:not(.dropdown-toggle)').click(function(event) { $('.templatesDropdown:not(.dropdown-toggle)').click(function(event) {
openUrlOnClick('{{ url('/proposal_templates') }}', event); openUrlOnClick('{{ url('/proposals/templates') }}', event);
}); });
$('.snippetsDropdown:not(.dropdown-toggle)').click(function(event) { $('.snippetsDropdown:not(.dropdown-toggle)').click(function(event) {
openUrlOnClick('{{ url('/proposal_snippets') }}', event); openUrlOnClick('{{ url('/proposals/snippets') }}', event);
}); });
}); });
</script> </script>
@ -73,13 +73,13 @@
{!! DropdownButton::normal(trans('texts.proposal_categories')) {!! DropdownButton::normal(trans('texts.proposal_categories'))
->withAttributes(['class'=>'categoriesDropdown']) ->withAttributes(['class'=>'categoriesDropdown'])
->withContents([ ->withContents([
['label' => trans('texts.new_proposal_category'), 'url' => url('/proposal_categories/create')], ['label' => trans('texts.new_proposal_category'), 'url' => url('/proposals/categories/create')],
] ]
)->split() !!} )->split() !!}
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
$('.categoriesDropdown:not(.dropdown-toggle)').click(function(event) { $('.categoriesDropdown:not(.dropdown-toggle)').click(function(event) {
openUrlOnClick('{{ url('/proposal_categories') }}', event); openUrlOnClick('{{ url('/proposals/categories') }}', event);
}); });
}); });
</script> </script>
@ -112,7 +112,12 @@
@endif @endif
@if (Auth::user()->can('create', $entityType) && empty($vendorId)) @if (Auth::user()->can('create', $entityType) && empty($vendorId))
{!! Button::primary(mtrans($entityType, "new_{$entityType}"))->asLinkTo(url(Utils::pluralizeEntityType($entityType) . '/create/' . (isset($clientId) ? ($clientId . (isset($projectId) ? '/' . $projectId : '')) : '')))->appendIcon(Icon::create('plus-sign')) !!} {!! Button::primary(mtrans($entityType, "new_{$entityType}"))
->asLinkTo(url(
(in_array($entityType, [ENTITY_PROPOSAL_SNIPPET, ENTITY_PROPOSAL_CATEGORY, ENTITY_PROPOSAL_TEMPLATE]) ? str_replace('_', 's/', Utils::pluralizeEntityType($entityType)) : Utils::pluralizeEntityType($entityType)) .
'/create/' . (isset($clientId) ? ($clientId . (isset($projectId) ? '/' . $projectId : '')) : '')
))
->appendIcon(Icon::create('plus-sign')) !!}
@endif @endif
</div> </div>

View File

@ -205,17 +205,17 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {
Route::get('api/quotes/{client_id?}', 'QuoteController@getDatatable'); Route::get('api/quotes/{client_id?}', 'QuoteController@getDatatable');
Route::post('quotes/bulk', 'QuoteController@bulk'); Route::post('quotes/bulk', 'QuoteController@bulk');
Route::get('proposal_categories/create', 'ProposalCategoryController@create'); Route::get('proposals/categories/create', 'ProposalCategoryController@create');
Route::resource('proposal_categories', 'ProposalCategoryController'); Route::resource('proposals/categories', 'ProposalCategoryController');
Route::get('api/proposal_categories', 'ProposalCategoryController@getDatatable'); Route::get('api/proposal/categories', 'ProposalCategoryController@getDatatable');
Route::get('proposal_snippets/create', 'ProposalSnippetController@create'); Route::get('proposals/snippets/create', 'ProposalSnippetController@create');
Route::resource('proposal_snippets', 'ProposalSnippetController'); Route::resource('proposals/snippets', 'ProposalSnippetController');
Route::get('api/proposal_snippets', 'ProposalSnippetController@getDatatable'); Route::get('api/proposal/snippets', 'ProposalSnippetController@getDatatable');
Route::get('proposal_templates/create', 'ProposalTemplateController@create'); Route::get('proposals/templates/create', 'ProposalTemplateController@create');
Route::resource('proposal_templates', 'ProposalTemplateController'); Route::resource('proposals/templates', 'ProposalTemplateController');
Route::get('api/proposal_templates', 'ProposalTemplateController@getDatatable'); Route::get('api/proposals/templates', 'ProposalTemplateController@getDatatable');
Route::get('proposals/create/{quote_id?}', 'ProposalController@create'); Route::get('proposals/create/{quote_id?}', 'ProposalController@create');
Route::resource('proposals', 'ProposalController'); Route::resource('proposals', 'ProposalController');