2017-01-30 20:40:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Ninja\Datatables;
|
2016-05-23 18:52:20 +02:00
|
|
|
|
|
|
|
use URL;
|
|
|
|
|
|
|
|
class TaxRateDatatable extends EntityDatatable
|
|
|
|
{
|
|
|
|
public $entityType = ENTITY_TAX_RATE;
|
|
|
|
|
|
|
|
public function columns()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[
|
|
|
|
'name',
|
|
|
|
function ($model) {
|
|
|
|
return link_to("tax_rates/{$model->public_id}/edit", $model->name)->toHtml();
|
2017-01-30 20:40:43 +01:00
|
|
|
},
|
2016-05-23 18:52:20 +02:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'rate',
|
|
|
|
function ($model) {
|
2018-02-15 12:33:11 +01:00
|
|
|
return ($model->rate + 0) . '%';
|
2017-01-30 20:40:43 +01:00
|
|
|
},
|
2017-01-02 12:38:58 +01:00
|
|
|
],
|
|
|
|
[
|
|
|
|
'type',
|
|
|
|
function ($model) {
|
2017-12-03 12:56:10 +01:00
|
|
|
if (auth()->user()->account->inclusive_taxes) {
|
2017-12-04 22:30:04 +01:00
|
|
|
return trans('texts.inclusive');
|
2017-12-03 12:56:10 +01:00
|
|
|
} else {
|
|
|
|
return $model->is_inclusive ? trans('texts.inclusive') : trans('texts.exclusive');
|
|
|
|
}
|
2017-01-30 20:40:43 +01:00
|
|
|
},
|
|
|
|
],
|
2016-05-23 18:52:20 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function actions()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
[
|
|
|
|
uctrans('texts.edit_tax_rate'),
|
|
|
|
function ($model) {
|
|
|
|
return URL::to("tax_rates/{$model->public_id}/edit");
|
2017-01-30 20:40:43 +01:00
|
|
|
},
|
|
|
|
],
|
2016-05-23 18:52:20 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|