mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 16:17:32 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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 [
 | |
|             [
 | |
|                 'name',
 | |
|                 function ($model) {
 | |
|                     if (! Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_TEMPLATE, $model->user_id])) {
 | |
|                         return $model->name;
 | |
|                     }
 | |
| 
 | |
|                     return link_to("proposals/templates/{$model->public_id}", $model->name)->toHtml();
 | |
|                     //$str = link_to("quotes/{$model->quote_public_id}", $model->quote_number)->toHtml();
 | |
|                     //return $this->addNote($str, $model->private_notes);
 | |
|                 },
 | |
|             ],
 | |
|             [
 | |
|                 'content',
 | |
|                 function ($model) {
 | |
|                     return $this->showWithTooltip(strip_tags($model->content));
 | |
|                 },
 | |
|             ],
 | |
|             [
 | |
|                 'private_notes',
 | |
|                 function ($model) {
 | |
|                     return $this->showWithTooltip($model->private_notes);
 | |
|                 },
 | |
|             ],
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     public function actions()
 | |
|     {
 | |
|         return [
 | |
|             [
 | |
|                 trans('texts.edit_proposal_template'),
 | |
|                 function ($model) {
 | |
|                     return URL::to("proposals/templates/{$model->public_id}/edit");
 | |
|                 },
 | |
|                 function ($model) {
 | |
|                     return Auth::user()->can('editByOwner', [ENTITY_PROPOSAL_TEMPLATE, $model->user_id]);
 | |
|                 },
 | |
|             ],
 | |
|         ];
 | |
|     }
 | |
| }
 |