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

Proposals

This commit is contained in:
Hillel Coren 2018-02-04 17:31:45 +02:00
parent 7618053c60
commit 1474627dda
2 changed files with 18 additions and 8 deletions

View File

@ -15,15 +15,23 @@ class ProposalSnippetDatatable extends EntityDatatable
{
return [
[
'name',
'proposal',
function ($model) {
if (! Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_SNIPPET, $model->user_id])) {
return $model->name;
return $model->proposal;
}
return link_to("proposal_snippets/{$model->public_id}", $model->name)->toHtml();
//$str = link_to("proposal_snippets/{$model->public_id}", $model->name)->toHtml();
//return $this->addNote($str, $model->private_notes);
return link_to("proposals/snippets/{$model->public_id}/edit", $model->proposal)->toHtml();
},
],
[
'category',
function ($model) {
if (! Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_CATEGORY, $model->category_user_id])) {
return $model->category;
}
return link_to("proposals/categories/{$model->category_public_id}/edit", $model->category)->toHtml();
},
],
];
@ -33,9 +41,9 @@ class ProposalSnippetDatatable extends EntityDatatable
{
return [
[
trans('texts.edit_snippet'),
trans('texts.edit_proposal_snippet'),
function ($model) {
return URL::to("proposals_snippets/{$model->public_id}/edit");
return URL::to("proposals/snippets/{$model->public_id}/edit");
},
function ($model) {
return Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_SNIPPET, $model->user_id]);

View File

@ -32,7 +32,9 @@ class ProposalSnippetRepository extends BaseRepository
'proposal_snippets.deleted_at',
'proposal_snippets.is_deleted',
'proposal_snippets.private_notes',
'proposal_categories.name'
'proposal_categories.name as category',
'proposal_categories.public_id as category_public_id',
'proposal_categories.user_id as category_user_id'
);
$this->applyFilters($query, ENTITY_PROPOSAL_SNIPPET);