2017-03-11 10:05:50 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class ComponentPresenter
|
|
|
|
*/
|
|
|
|
class ComponentPresenter 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,
|
2017-03-11 10:05:50 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'company',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.company'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'companiesLinkObjFormatter',
|
2017-03-11 10:05:50 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.name'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'componentsLinkFormatter',
|
|
|
|
], [
|
|
|
|
'field' => 'image',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.image'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'imageFormatter',
|
|
|
|
], [
|
|
|
|
'field' => 'serial',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/hardware/form.serial'),
|
|
|
|
'formatter' => 'componentsLinkFormatter',
|
|
|
|
], [
|
|
|
|
'field' => 'category',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.category'),
|
|
|
|
'formatter' => 'categoriesLinkObjFormatter',
|
2017-10-25 22:35:58 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'qty',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/components/general.total'),
|
|
|
|
'visible' => true,
|
2017-03-11 10:05:50 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'remaining',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'title' => trans('admin/components/general.remaining'),
|
|
|
|
'visible' => true,
|
2017-03-11 10:05:50 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'min_amt',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'title' => trans('general.min_amt'),
|
|
|
|
'visible' => true,
|
2017-03-11 10:05:50 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'location',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.location'),
|
|
|
|
'formatter' => 'locationsLinkObjFormatter',
|
2017-03-11 10:05:50 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'order_number',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.order_number'),
|
|
|
|
'visible' => true,
|
2017-12-05 00:40:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'purchase_date',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.purchase_date'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'dateDisplayFormatter',
|
2017-03-11 10:05:50 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'purchase_cost',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.purchase_cost'),
|
|
|
|
'visible' => true,
|
|
|
|
'footerFormatter' => 'sumFormatter',
|
2021-11-18 15:09:17 -08:00
|
|
|
'class' => 'text-right',
|
2017-07-29 16:13:17 -07:00
|
|
|
],
|
2017-03-11 10:05:50 -08:00
|
|
|
];
|
|
|
|
|
2017-07-29 16:13:17 -07: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' => 'componentsInOutFormatter',
|
2017-07-29 16:13:17 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
$layout[] = [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'formatter' => 'componentsActionsFormatter',
|
2017-07-29 16:13:17 -07:00
|
|
|
];
|
|
|
|
|
2017-03-11 10:05:50 -08:00
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
2017-04-06 20:08:47 -07:00
|
|
|
/**
|
|
|
|
* Generate html link to this items name.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function nameUrl()
|
|
|
|
{
|
|
|
|
return (string) link_to_route('consumables.show', e($this->name), $this->id);
|
|
|
|
}
|
|
|
|
|
2017-10-07 06:56:18 -07:00
|
|
|
/**
|
|
|
|
* Url to view this item.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function viewUrl()
|
|
|
|
{
|
|
|
|
return route('accessories.show', $this->id);
|
|
|
|
}
|
2017-03-11 10:05:50 -08:00
|
|
|
}
|