2018-10-31 06:06:38 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class LicensePresenter
|
|
|
|
*/
|
|
|
|
class PredefinedKitPresenter extends Presenter
|
|
|
|
{
|
|
|
|
/**
|
2019-02-23 11:44:03 -08:00
|
|
|
* Json Column Layout for bootstrap table of kits
|
2018-10-31 06:06:38 -07:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function dataTableLayout()
|
|
|
|
{
|
|
|
|
$layout = [
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => 'Name', // TODO: trans
|
|
|
|
'formatter' => 'kitsLinkFormatter',
|
|
|
|
],
|
2018-10-31 06:06:38 -07:00
|
|
|
];
|
|
|
|
|
2018-11-13 09:33:32 -08:00
|
|
|
$layout[] = [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'checkincheckout',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.checkin').'/'.trans('general.checkout'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'kitsInOutFormatter',
|
2018-11-13 09:33:32 -08:00
|
|
|
];
|
|
|
|
|
2018-10-31 06:06:38 -07:00
|
|
|
$layout[] = [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'formatter' => 'kitsActionsFormatter',
|
2018-10-31 06:06:38 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-02-23 11:44:03 -08:00
|
|
|
* Json Column Layout for bootstrap table of kit models
|
2018-10-31 06:06:38 -07:00
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function dataTableModels()
|
|
|
|
{
|
|
|
|
$layout = [
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'pivot_id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'owner_id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => 'Name', // TODO: trans
|
|
|
|
'formatter' => 'modelsLinkFormatter',
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'quantity',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'title' => 'Quantity', // TODO: trans
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'formatter' => 'kits_modelsActionsFormatter',
|
|
|
|
],
|
2018-10-31 06:06:38 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-06-10 13:15:52 -07:00
|
|
|
* Json Column Layout for bootstrap table of kit licenses
|
|
|
|
* @return string
|
|
|
|
*/
|
2018-10-31 06:06:38 -07:00
|
|
|
public static function dataTableLicenses()
|
|
|
|
{
|
|
|
|
$layout = [
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'pivot_id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'owner_id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => 'Name', // TODO: trans
|
|
|
|
'formatter' => 'licensesLinkFormatter',
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'quantity',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'title' => 'Quantity', // TODO: trans
|
2018-10-31 06:06:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'formatter' => 'kits_licensesActionsFormatter',
|
|
|
|
],
|
2018-10-31 06:06:38 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
2019-01-27 12:19:24 -08:00
|
|
|
/**
|
2021-06-10 13:15:52 -07:00
|
|
|
* Json Column Layout for bootstrap table of kit accessories
|
|
|
|
* @return string
|
|
|
|
*/
|
2019-01-27 12:19:24 -08:00
|
|
|
public static function dataTableAccessories()
|
|
|
|
{
|
|
|
|
$layout = [
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'pivot_id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'owner_id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => 'Name', // TODO: trans
|
|
|
|
'formatter' => 'accessoriesLinkFormatter',
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'quantity',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'title' => 'Quantity', // TODO: trans
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'formatter' => 'kits_accessoriesActionsFormatter',
|
|
|
|
],
|
2019-01-27 12:19:24 -08:00
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-06-10 13:15:52 -07:00
|
|
|
* Json Column Layout for bootstrap table of kit consumables
|
|
|
|
* @return string
|
|
|
|
*/
|
2019-01-27 12:19:24 -08:00
|
|
|
public static function dataTableConsumables()
|
|
|
|
{
|
|
|
|
$layout = [
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'pivot_id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'owner_id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => 'Name', // TODO: trans
|
|
|
|
'formatter' => 'consumablesLinkFormatter',
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'quantity',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'title' => 'Quantity', // TODO: trans
|
2019-01-27 12:19:24 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'formatter' => 'kits_consumablesActionsFormatter',
|
|
|
|
],
|
2019-01-27 12:19:24 -08:00
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
2018-10-31 06:06:38 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Link to this kit Name
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function nameUrl()
|
|
|
|
{
|
2021-06-10 13:15:52 -07:00
|
|
|
return (string) link_to_route('kits.show', $this->name, $this->id);
|
2018-10-31 06:06:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function fullName()
|
|
|
|
{
|
|
|
|
return $this->name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Url to view this item.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function viewUrl()
|
|
|
|
{
|
|
|
|
return route('kits.show', $this->id);
|
|
|
|
}
|
|
|
|
}
|