1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Ninja/Datatables/ProposalTemplateDatatable.php

77 lines
2.4 KiB
PHP
Raw Normal View History

2018-01-30 19:58:55 +01:00
<?php
namespace App\Ninja\Datatables;
use Auth;
use URL;
use Utils;
class ProposalTemplateDatatable extends EntityDatatable
{
public $entityType = ENTITY_PROPOSAL_TEMPLATE;
public $sortCol = 1;
public function columns()
{
return [
[
2018-02-04 17:42:13 +01:00
'name',
2018-01-30 19:58:55 +01:00
function ($model) {
if (! Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_TEMPLATE, $model->user_id])) {
return $model->name;
}
2018-02-04 17:42:13 +01:00
return link_to("proposals/templates/{$model->public_id}", $model->name)->toHtml();
2018-01-30 19:58:55 +01:00
//$str = link_to("quotes/{$model->quote_public_id}", $model->quote_number)->toHtml();
//return $this->addNote($str, $model->private_notes);
},
],
2018-02-04 22:50:57 +01:00
[
'content',
function ($model) {
return $this->showWithTooltip(strip_tags($model->content));
},
],
2018-02-04 17:42:13 +01:00
[
'private_notes',
function ($model) {
return $this->showWithTooltip($model->private_notes);
},
],
2018-01-30 19:58:55 +01:00
];
}
public function actions()
{
return [
[
2018-02-04 17:42:13 +01:00
trans('texts.edit_proposal_template'),
2018-01-30 19:58:55 +01:00
function ($model) {
2018-02-04 17:42:13 +01:00
return URL::to("proposals/templates/{$model->public_id}/edit");
2018-01-30 19:58:55 +01:00
},
function ($model) {
return Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_TEMPLATE, $model->user_id]);
},
],
2018-02-08 12:41:22 +01:00
[
trans('texts.clone_proposal_template'),
function ($model) {
return URL::to("proposals/templates/{$model->public_id}/clone");
},
function ($model) {
return Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_TEMPLATE, $model->user_id]);
},
],
2018-02-09 15:02:28 +01:00
[
trans('texts.new_proposal'),
function ($model) {
return URL::to("proposals/create/0/{$model->public_id}");
},
function ($model) {
return Auth::user()->can('create', [ENTITY_PROPOSAL, $model->user_id]);
},
],
2018-01-30 19:58:55 +01:00
];
}
}