mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:07:33 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			58 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			58 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Ninja\Datatables;
 | 
						|
 | 
						|
use Auth;
 | 
						|
use Str;
 | 
						|
use URL;
 | 
						|
use Utils;
 | 
						|
 | 
						|
class ProductDatatable extends EntityDatatable
 | 
						|
{
 | 
						|
    public $entityType = ENTITY_PRODUCT;
 | 
						|
    public $sortCol = 4;
 | 
						|
 | 
						|
    public function columns()
 | 
						|
    {
 | 
						|
        return [
 | 
						|
            [
 | 
						|
                'product_key',
 | 
						|
                function ($model) {
 | 
						|
                    return link_to('products/'.$model->public_id.'/edit', $model->product_key)->toHtml();
 | 
						|
                },
 | 
						|
            ],
 | 
						|
            [
 | 
						|
                'notes',
 | 
						|
                function ($model) {
 | 
						|
                    return e(Str::limit($model->notes, 100));
 | 
						|
                },
 | 
						|
            ],
 | 
						|
            [
 | 
						|
                'cost',
 | 
						|
                function ($model) {
 | 
						|
                    return Utils::formatMoney($model->cost);
 | 
						|
                },
 | 
						|
            ],
 | 
						|
            [
 | 
						|
                'tax_rate',
 | 
						|
                function ($model) {
 | 
						|
                    return $model->tax_rate ? ($model->tax_name . ' ' . $model->tax_rate . '%') : '';
 | 
						|
                },
 | 
						|
                Auth::user()->account->invoice_item_taxes,
 | 
						|
            ],
 | 
						|
        ];
 | 
						|
    }
 | 
						|
 | 
						|
    public function actions()
 | 
						|
    {
 | 
						|
        return [
 | 
						|
            [
 | 
						|
                uctrans('texts.edit_product'),
 | 
						|
                function ($model) {
 | 
						|
                    return URL::to("products/{$model->public_id}/edit");
 | 
						|
                },
 | 
						|
            ],
 | 
						|
        ];
 | 
						|
    }
 | 
						|
}
 |