mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 14:04:38 -04:00
Proposals
This commit is contained in:
parent
33c37842cc
commit
2000e66c9d
@ -8,7 +8,6 @@ use App\Http\Requests\UpdateProposalRequest;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\Proposal;
|
||||
use App\Models\ProposalTemplate;
|
||||
use App\Models\ProposalSnippet;
|
||||
use App\Ninja\Datatables\ProposalDatatable;
|
||||
use App\Ninja\Repositories\ProposalRepository;
|
||||
use App\Services\ProposalService;
|
||||
@ -64,7 +63,6 @@ class ProposalController extends BaseController
|
||||
'quotes' => Invoice::scope()->with('client.contacts')->quotes()->orderBy('id')->get(),
|
||||
'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(),
|
||||
'quotePublicId' => $request->quote_id,
|
||||
'snippets' => ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get(),
|
||||
];
|
||||
|
||||
return View::make('proposals.edit', $data);
|
||||
@ -92,7 +90,6 @@ class ProposalController extends BaseController
|
||||
'templates' => ProposalTemplate::whereAccountId($account->id)->orWhereNull('account_id')->orderBy('name')->get(),
|
||||
'quotePublicId' => $proposal->quote ? $proposal->quote->public_id : null,
|
||||
'templatePublicId' => $proposal->proposal_template ? $proposal->proposal_template->public_id : null,
|
||||
'snippets' => ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get(),
|
||||
];
|
||||
|
||||
return View::make('proposals.edit', $data);
|
||||
|
@ -60,7 +60,6 @@ class ProposalSnippetController extends BaseController
|
||||
'title' => trans('texts.new_proposal_snippet'),
|
||||
'categories' => ProposalCategory::scope()->orderBy('name')->get(),
|
||||
'categoryPublicId' => 0,
|
||||
'snippets' => ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get(),
|
||||
'icons' => $this->getIcons(),
|
||||
];
|
||||
|
||||
@ -86,7 +85,6 @@ class ProposalSnippetController extends BaseController
|
||||
'title' => trans('texts.edit_proposal_snippet'),
|
||||
'categories' => ProposalCategory::scope()->orderBy('name')->get(),
|
||||
'categoryPublicId' => $proposalSnippet->proposal_category ? $proposalSnippet->proposal_category->public_id : null,
|
||||
'snippets' => ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get(),
|
||||
'icons' => $this->getIcons(),
|
||||
];
|
||||
|
||||
|
@ -7,7 +7,6 @@ use App\Http\Requests\ProposalTemplateRequest;
|
||||
use App\Http\Requests\UpdateProposalTemplateRequest;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\ProposalTemplate;
|
||||
use App\Models\ProposalSnippet;
|
||||
use App\Ninja\Datatables\ProposalTemplateDatatable;
|
||||
use App\Ninja\Repositories\ProposalTemplateRepository;
|
||||
use App\Services\ProposalTemplateService;
|
||||
@ -59,7 +58,6 @@ class ProposalTemplateController extends BaseController
|
||||
'url' => 'proposals/templates',
|
||||
'title' => trans('texts.new_proposal_template'),
|
||||
'templates' => ProposalTemplate::scope()->orderBy('name')->get(),
|
||||
'snippets' => ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get(),
|
||||
];
|
||||
|
||||
return View::make('proposals/templates/edit', $data);
|
||||
@ -83,7 +81,6 @@ class ProposalTemplateController extends BaseController
|
||||
'url' => 'proposals/templates/' . $proposalTemplate->public_id,
|
||||
'title' => trans('texts.edit_proposal_template'),
|
||||
'templates' => ProposalTemplate::scope()->orderBy('name')->get(),
|
||||
'snippets' => ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get(),
|
||||
];
|
||||
|
||||
return View::make('proposals/templates/edit', $data);
|
||||
|
26
app/Http/ViewComposers/ProposalComposer.php
Normal file
26
app/Http/ViewComposers/ProposalComposer.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\ViewComposers;
|
||||
|
||||
use Illuminate\View\View;
|
||||
use App\Models\ProposalSnippet;
|
||||
|
||||
/**
|
||||
* ClientPortalHeaderComposer.php.
|
||||
*
|
||||
* @copyright See LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
class ProposalComposer
|
||||
{
|
||||
/**
|
||||
* Bind data to the view.
|
||||
*
|
||||
* @param View $view
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function compose(View $view)
|
||||
{
|
||||
$view->with('snippets', ProposalSnippet::scope()->with('proposal_category')->orderBy('name')->get());
|
||||
}
|
||||
}
|
@ -31,7 +31,7 @@ class ProposalSnippetDatatable extends EntityDatatable
|
||||
return $model->category;
|
||||
}
|
||||
|
||||
return link_to("proposals/categories/{$model->category_public_id}/edit", $model->category)->toHtml();
|
||||
return link_to("proposals/categories/{$model->category_public_id}/edit", $model->category ?: ' ')->toHtml();
|
||||
},
|
||||
],
|
||||
[
|
||||
|
@ -42,6 +42,15 @@ class ComposerServiceProvider extends ServiceProvider
|
||||
],
|
||||
'App\Http\ViewComposers\ClientPortalHeaderComposer'
|
||||
);
|
||||
|
||||
view()->composer(
|
||||
[
|
||||
'proposals.edit',
|
||||
'proposals.templates.edit',
|
||||
'proposals.snippets.edit',
|
||||
],
|
||||
'App\Http\ViewComposers\ProposalComposer'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user