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
|
|
|
], [
|
2023-04-13 11:09:59 -07:00
|
|
|
'field' => 'supplier',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.supplier'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'suppliersLinkObjFormatter',
|
2024-10-23 09:50:22 -07:00
|
|
|
], [
|
|
|
|
'field' => 'model_number',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/models/table.modelnumber'),
|
|
|
|
], [
|
|
|
|
'field' => 'manufacturer',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.manufacturer'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'manufacturersLinkObjFormatter',
|
|
|
|
], [
|
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,
|
2021-10-10 05:01:44 -07:00
|
|
|
'footerFormatter' => 'sumFormatterQuantity',
|
2021-11-18 15:09:17 -08:00
|
|
|
'class' => 'text-right',
|
2022-03-03 20:30:07 -08:00
|
|
|
], [
|
2022-03-03 21:59:38 -08:00
|
|
|
'field' => 'notes',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.notes'),
|
|
|
|
'formatter' => 'notesFormatter',
|
2024-09-17 14:16:41 -07:00
|
|
|
],[
|
|
|
|
'field' => 'created_by',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.created_by'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'usersLinkObjFormatter',
|
|
|
|
],[
|
|
|
|
'field' => 'created_at',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.created_at'),
|
|
|
|
'formatter' => 'dateDisplayFormatter',
|
|
|
|
], [
|
|
|
|
'field' => 'updated_at',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.updated_at'),
|
|
|
|
'formatter' => 'dateDisplayFormatter',
|
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,
|
2024-03-20 14:25:50 -07:00
|
|
|
'switchable' => false,
|
2021-06-10 13:15:52 -07:00
|
|
|
'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
|
|
|
}
|