2016-12-23 17:52:00 -08:00
|
|
|
<?php
|
2021-06-10 13:15:52 -07:00
|
|
|
|
2016-12-23 17:52:00 -08:00
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class AccessoryPresenter
|
|
|
|
*/
|
|
|
|
class AccessoryPresenter extends Presenter
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Json Column Layout for bootstrap table
|
|
|
|
* @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,
|
|
|
|
], [
|
|
|
|
'field' => 'image',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/hardware/table.image'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'imageFormatter',
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'company',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/companies/table.title'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'companiesLinkObjFormatter',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.name'),
|
|
|
|
'formatter' => 'accessoriesLinkFormatter',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'category',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/accessories/general.accessory_category'),
|
|
|
|
'formatter' => 'categoriesLinkObjFormatter',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'model_number',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/models/table.modelnumber'),
|
|
|
|
'formatter' => 'accessoriesLinkFormatter',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'manufacturer',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
2022-03-03 21:59:38 -08:00
|
|
|
'switchable' => true,
|
2021-06-10 13:15:52 -07:00
|
|
|
'title' => trans('general.manufacturer'),
|
2022-03-03 21:59:38 -08:00
|
|
|
'visible' => false,
|
2021-06-10 13:15:52 -07:00
|
|
|
'formatter' => 'manufacturersLinkObjFormatter',
|
2017-10-19 16:25:24 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'supplier',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.supplier'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'suppliersLinkObjFormatter',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'location',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.location'),
|
|
|
|
'formatter' => 'locationsLinkObjFormatter',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'qty',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
2023-01-21 14:39:53 -08:00
|
|
|
'title' => trans('admin/accessories/general.total'),
|
2017-01-25 02:19:26 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'remaining_qty',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
2022-03-03 21:59:38 -08:00
|
|
|
'visible' => false,
|
2021-06-10 13:15:52 -07:00
|
|
|
'title' => trans('admin/accessories/general.remaining'),
|
2023-01-21 14:39:53 -08:00
|
|
|
],[
|
|
|
|
'field' => 'users_count',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => true,
|
|
|
|
'title' => trans('general.checked_out'),
|
|
|
|
], [
|
|
|
|
'field' => 'min_qty',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.min_amt'),
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'purchase_date',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.purchase_date'),
|
|
|
|
'formatter' => 'dateDisplayFormatter',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'purchase_cost',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.purchase_cost'),
|
2021-10-10 05:01:44 -07:00
|
|
|
'footerFormatter' => 'sumFormatterQuantity',
|
2021-11-18 15:09:17 -08:00
|
|
|
'class' => 'text-right',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'order_number',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.order_number'),
|
2022-03-03 21:59:38 -08:00
|
|
|
],[
|
|
|
|
'field' => 'notes',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.notes'),
|
|
|
|
'formatter' => 'notesFormatter'
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'change',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'visible' => true,
|
|
|
|
'title' => trans('general.change'),
|
|
|
|
'formatter' => 'accessoriesInOutFormatter',
|
|
|
|
], [
|
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'formatter' => 'accessoriesActionsFormatter',
|
|
|
|
],
|
2016-12-23 17:52:00 -08:00
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pregenerated link to this accessories view page.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function nameUrl()
|
|
|
|
{
|
|
|
|
return (string) link_to_route('accessories.show', $this->name, $this->id);
|
|
|
|
}
|
2016-12-26 15:19:04 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Url to view this item.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function viewUrl()
|
|
|
|
{
|
|
|
|
return route('accessories.show', $this->id);
|
|
|
|
}
|
2017-01-03 16:55:43 -08:00
|
|
|
|
|
|
|
public function name()
|
|
|
|
{
|
|
|
|
return $this->model->name;
|
|
|
|
}
|
2016-12-23 17:52:00 -08:00
|
|
|
}
|