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

58 lines
1.3 KiB
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Ninja\Datatables;
2016-05-23 18:52:20 +02:00
use Auth;
use Str;
2017-01-30 20:40:43 +01:00
use URL;
use Utils;
2016-05-23 18:52:20 +02:00
class ProductDatatable extends EntityDatatable
{
public $entityType = ENTITY_PRODUCT;
2016-11-24 10:46:57 +01:00
public $sortCol = 4;
2016-05-23 18:52:20 +02:00
public function columns()
{
return [
[
'product_key',
function ($model) {
return link_to('products/'.$model->public_id.'/edit', $model->product_key)->toHtml();
2017-01-30 20:40:43 +01:00
},
2016-05-23 18:52:20 +02:00
],
[
'notes',
function ($model) {
return nl2br(Str::limit($model->notes, 100));
2017-01-30 20:40:43 +01:00
},
2016-05-23 18:52:20 +02:00
],
[
'cost',
function ($model) {
return Utils::formatMoney($model->cost);
2017-01-30 20:40:43 +01:00
},
2016-05-23 18:52:20 +02:00
],
[
'tax_rate',
function ($model) {
return $model->tax_rate ? ($model->tax_name . ' ' . $model->tax_rate . '%') : '';
},
2017-01-30 20:40:43 +01:00
Auth::user()->account->invoice_item_taxes,
],
2016-05-23 18:52:20 +02:00
];
}
public function actions()
{
return [
[
uctrans('texts.edit_product'),
function ($model) {
return URL::to("products/{$model->public_id}/edit");
2017-01-30 20:40:43 +01:00
},
],
2016-05-23 18:52:20 +02:00
];
}
}