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

Proposals

This commit is contained in:
Hillel Coren 2018-01-31 18:16:48 +02:00
parent 839d535728
commit 11a3e9ab1e
4 changed files with 22 additions and 2 deletions

View File

@ -355,6 +355,15 @@ class EntityModel extends Eloquent
return false; return false;
} }
public static function getFormUrl($entityType)
{
if (in_array($entityType, [ENTITY_PROPOSAL_CATEGORY, ENTITY_PROPOSAL_SNIPPET, ENTITY_PROPOSAL_TEMPLATE])) {
return str_replace('_', 's/', Utils::pluralizeEntityType($entityType));
} else {
return Utils::pluralizeEntityType($entityType);
}
}
public static function getStates($entityType = false) public static function getStates($entityType = false)
{ {
$data = []; $data = [];

View File

@ -96,6 +96,7 @@ class AppServiceProvider extends ServiceProvider
}); });
Form::macro('breadcrumbs', function ($status = false) { Form::macro('breadcrumbs', function ($status = false) {
$str = '<ol class="breadcrumb">'; $str = '<ol class="breadcrumb">';
// Get the breadcrumbs by exploding the current path. // Get the breadcrumbs by exploding the current path.
@ -133,6 +134,9 @@ class AppServiceProvider extends ServiceProvider
if ($i == count($crumbs) - 1) { if ($i == count($crumbs) - 1) {
$str .= "<li class='active'>$name</li>"; $str .= "<li class='active'>$name</li>";
} else { } else {
if (count($crumbs) > 2 && $crumbs[1] == 'proposals' && $crumb != 'proposals') {
$crumb = 'proposals/' . $crumb;
}
$str .= '<li>'.link_to($crumb, $name).'</li>'; $str .= '<li>'.link_to($crumb, $name).'</li>';
} }
} }

View File

@ -1,4 +1,4 @@
{!! Former::open(Utils::pluralizeEntityType($entityType) . '/bulk') {!! Former::open(\App\Models\EntityModel::getFormUrl($entityType) . '/bulk')
->addClass('listForm_' . $entityType) !!} ->addClass('listForm_' . $entityType) !!}
<div style="display:none"> <div style="display:none">
@ -114,7 +114,7 @@
@if (Auth::user()->can('create', $entityType) && empty($vendorId)) @if (Auth::user()->can('create', $entityType) && empty($vendorId))
{!! Button::primary(mtrans($entityType, "new_{$entityType}")) {!! Button::primary(mtrans($entityType, "new_{$entityType}"))
->asLinkTo(url( ->asLinkTo(url(
(in_array($entityType, [ENTITY_PROPOSAL_SNIPPET, ENTITY_PROPOSAL_CATEGORY, ENTITY_PROPOSAL_TEMPLATE]) ? str_replace('_', 's/', Utils::pluralizeEntityType($entityType)) : Utils::pluralizeEntityType($entityType)) . (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 : '')) : '') '/create/' . (isset($clientId) ? ($clientId . (isset($projectId) ? '/' . $projectId : '')) : '')
)) ))
->appendIcon(Icon::create('plus-sign')) !!} ->appendIcon(Icon::create('plus-sign')) !!}

View File

@ -205,18 +205,25 @@ 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::post('proposals/categories/bulk', 'ProposalCategoryController@bulk');
Route::get('proposals/categories/{proposal_categories}/edit', 'ProposalCategoryController@edit'); Route::get('proposals/categories/{proposal_categories}/edit', 'ProposalCategoryController@edit');
Route::get('proposals/categories/create', 'ProposalCategoryController@create'); Route::get('proposals/categories/create', 'ProposalCategoryController@create');
Route::resource('proposals/categories', 'ProposalCategoryController'); Route::resource('proposals/categories', 'ProposalCategoryController');
Route::get('api/proposal_categories', 'ProposalCategoryController@getDatatable'); Route::get('api/proposal_categories', 'ProposalCategoryController@getDatatable');
Route::post('proposals/snippets/bulk', 'ProposalSnippetController@bulk');
Route::get('proposals/snippets/{proposal_snippets}/edit', 'ProposalSnippetController@edit'); Route::get('proposals/snippets/{proposal_snippets}/edit', 'ProposalSnippetController@edit');
Route::get('proposals/snippets/create', 'ProposalSnippetController@create'); Route::get('proposals/snippets/create', 'ProposalSnippetController@create');
Route::resource('proposals/snippets', 'ProposalSnippetController'); Route::resource('proposals/snippets', 'ProposalSnippetController');
Route::get('api/proposal_snippets', 'ProposalSnippetController@getDatatable'); Route::get('api/proposal_snippets', 'ProposalSnippetController@getDatatable');
Route::post('proposals/templates/bulk', 'ProposalTemplateController@bulk');
Route::get('proposals/templates/{proposal_templates}/edit', 'ProposalTemplateController@edit'); Route::get('proposals/templates/{proposal_templates}/edit', 'ProposalTemplateController@edit');
Route::get('proposals/templates/create', 'ProposalTemplateController@create'); Route::get('proposals/templates/create', 'ProposalTemplateController@create');
Route::resource('proposals/templates', 'ProposalTemplateController'); Route::resource('proposals/templates', 'ProposalTemplateController');
Route::get('api/proposal_templates', 'ProposalTemplateController@getDatatable'); Route::get('api/proposal_templates', 'ProposalTemplateController@getDatatable');
Route::post('proposals/proposals/bulk', 'ProposalController@bulk');
Route::get('proposals/{proposals}/edit', 'ProposalController@edit'); Route::get('proposals/{proposals}/edit', 'ProposalController@edit');
Route::get('proposals/create/{quote_id?}', 'ProposalController@create'); Route::get('proposals/create/{quote_id?}', 'ProposalController@create');
Route::resource('proposals', 'ProposalController'); Route::resource('proposals', 'ProposalController');