From f45c39d6f409b39bf4ecbe8e715838af593f52ea Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 31 Jan 2018 13:59:53 +0200 Subject: [PATCH] Working on proposals --- .../ProposalCategoryController.php | 8 ++++---- .../Controllers/ProposalSnippetController.php | 6 +++--- .../ProposalTemplateController.php | 6 +++--- resources/views/list.blade.php | 19 ++++++++++++------- routes/web.php | 18 +++++++++--------- 5 files changed, 31 insertions(+), 26 deletions(-) diff --git a/app/Http/Controllers/ProposalCategoryController.php b/app/Http/Controllers/ProposalCategoryController.php index 034aea230c..3a74d26a37 100644 --- a/app/Http/Controllers/ProposalCategoryController.php +++ b/app/Http/Controllers/ProposalCategoryController.php @@ -55,14 +55,14 @@ class ProposalCategoryController extends BaseController 'account' => auth()->user()->account, 'proposalCategory' => null, 'method' => 'POST', - 'url' => 'proposal_categories', + 'url' => 'proposals/categories', 'title' => trans('texts.new_proposal_category'), 'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(), 'templates' => ProposalCategory::scope()->orderBy('name')->get(), 'quotePublicId' => $request->quote_id, ]; - return View::make('proposals/categories/edit', $data); + return View::make('proposals/categories.edit', $data); } public function edit(ProposalCategoryRequest $request) @@ -73,7 +73,7 @@ class ProposalCategoryController extends BaseController 'account' => auth()->user()->account, 'proposalCategory' => $proposalCategory, 'method' => 'PUT', - 'url' => 'proposal_categories/' . $proposalCategory->public_id, + 'url' => 'proposals/categories/' . $proposalCategory->public_id, 'title' => trans('texts.edit_proposal_category'), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), 'clientPublicId' => $proposalCategory->client ? $proposalCategory->client->public_id : null, @@ -118,6 +118,6 @@ class ProposalCategoryController extends BaseController Session::flash('message', $message); } - return redirect()->to('/proposal_categories'); + return redirect()->to('/proposals/categories'); } } diff --git a/app/Http/Controllers/ProposalSnippetController.php b/app/Http/Controllers/ProposalSnippetController.php index c92e6f5e77..0cf1d6ef66 100644 --- a/app/Http/Controllers/ProposalSnippetController.php +++ b/app/Http/Controllers/ProposalSnippetController.php @@ -55,7 +55,7 @@ class ProposalSnippetController extends BaseController 'account' => auth()->user()->account, 'proposalSnippet' => null, 'method' => 'POST', - 'url' => 'proposal_snippets', + 'url' => 'proposals/snippets', 'title' => trans('texts.new_proposal_snippet'), 'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(), 'templates' => ProposalSnippet::scope()->orderBy('name')->get(), @@ -73,13 +73,13 @@ class ProposalSnippetController extends BaseController 'account' => auth()->user()->account, 'proposalSnippet' => $proposalSnippet, 'method' => 'PUT', - 'url' => 'proposal_snippets/' . $proposalSnippet->public_id, + 'url' => 'proposals/snippets/' . $proposalSnippet->public_id, 'title' => trans('texts.edit_proposal_snippet'), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), '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) diff --git a/app/Http/Controllers/ProposalTemplateController.php b/app/Http/Controllers/ProposalTemplateController.php index dacf38ee7f..5a36b73392 100644 --- a/app/Http/Controllers/ProposalTemplateController.php +++ b/app/Http/Controllers/ProposalTemplateController.php @@ -55,7 +55,7 @@ class ProposalTemplateController extends BaseController 'account' => auth()->user()->account, 'proposalTemplate' => null, 'method' => 'POST', - 'url' => 'proposal_templates', + 'url' => 'proposals/templates', 'title' => trans('texts.new_proposal_template'), 'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(), 'templates' => ProposalTemplate::scope()->orderBy('name')->get(), @@ -73,7 +73,7 @@ class ProposalTemplateController extends BaseController 'account' => auth()->user()->account, 'proposalTemplate' => $proposalTemplate, 'method' => 'PUT', - 'url' => 'proposal_templates/' . $proposalTemplate->public_id, + 'url' => 'proposals/templates/' . $proposalTemplate->public_id, 'title' => trans('texts.edit_proposal_template'), 'clients' => Client::scope()->with('contacts')->orderBy('name')->get(), 'clientPublicId' => $proposalTemplate->client ? $proposalTemplate->client->public_id : null, @@ -118,6 +118,6 @@ class ProposalTemplateController extends BaseController Session::flash('message', $message); } - return redirect()->to('/proposal_templates'); + return redirect()->to('/proposals/templates'); } } diff --git a/resources/views/list.blade.php b/resources/views/list.blade.php index 0bb194461a..e062277b54 100644 --- a/resources/views/list.blade.php +++ b/resources/views/list.blade.php @@ -50,22 +50,22 @@ {!! DropdownButton::normal(trans('texts.proposal_templates')) ->withAttributes(['class'=>'templatesDropdown']) ->withContents([ - ['label' => trans('texts.new_proposal_template'), 'url' => url('/proposal_templates/create')], + ['label' => trans('texts.new_proposal_template'), 'url' => url('/proposals/templates/create')], ] )->split() !!} {!! DropdownButton::normal(trans('texts.proposal_snippets')) ->withAttributes(['class'=>'snippetsDropdown']) ->withContents([ - ['label' => trans('texts.new_proposal_snippet'), 'url' => url('/proposal_snippets/create')], + ['label' => trans('texts.new_proposal_snippet'), 'url' => url('/proposals/snippets/create')], ] )->split() !!} @@ -73,13 +73,13 @@ {!! DropdownButton::normal(trans('texts.proposal_categories')) ->withAttributes(['class'=>'categoriesDropdown']) ->withContents([ - ['label' => trans('texts.new_proposal_category'), 'url' => url('/proposal_categories/create')], + ['label' => trans('texts.new_proposal_category'), 'url' => url('/proposals/categories/create')], ] )->split() !!} @@ -112,7 +112,12 @@ @endif @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 diff --git a/routes/web.php b/routes/web.php index 961d52dc10..60c21f324b 100644 --- a/routes/web.php +++ b/routes/web.php @@ -205,17 +205,17 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () { Route::get('api/quotes/{client_id?}', 'QuoteController@getDatatable'); Route::post('quotes/bulk', 'QuoteController@bulk'); - Route::get('proposal_categories/create', 'ProposalCategoryController@create'); - Route::resource('proposal_categories', 'ProposalCategoryController'); - Route::get('api/proposal_categories', 'ProposalCategoryController@getDatatable'); + Route::get('proposals/categories/create', 'ProposalCategoryController@create'); + Route::resource('proposals/categories', 'ProposalCategoryController'); + Route::get('api/proposal/categories', 'ProposalCategoryController@getDatatable'); - Route::get('proposal_snippets/create', 'ProposalSnippetController@create'); - Route::resource('proposal_snippets', 'ProposalSnippetController'); - Route::get('api/proposal_snippets', 'ProposalSnippetController@getDatatable'); + Route::get('proposals/snippets/create', 'ProposalSnippetController@create'); + Route::resource('proposals/snippets', 'ProposalSnippetController'); + Route::get('api/proposal/snippets', 'ProposalSnippetController@getDatatable'); - Route::get('proposal_templates/create', 'ProposalTemplateController@create'); - Route::resource('proposal_templates', 'ProposalTemplateController'); - Route::get('api/proposal_templates', 'ProposalTemplateController@getDatatable'); + Route::get('proposals/templates/create', 'ProposalTemplateController@create'); + Route::resource('proposals/templates', 'ProposalTemplateController'); + Route::get('api/proposals/templates', 'ProposalTemplateController@getDatatable'); Route::get('proposals/create/{quote_id?}', 'ProposalController@create'); Route::resource('proposals', 'ProposalController');