2016-12-23 17:52:00 -08:00
|
|
|
<?php
|
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class AccessoryPresenter
|
|
|
|
* @package App\Presenters
|
|
|
|
*/
|
|
|
|
class AccessoryPresenter extends Presenter
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Json Column Layout for bootstrap table
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function dataTableLayout()
|
|
|
|
{
|
|
|
|
$layout = [
|
|
|
|
[
|
2017-02-10 18:43:30 -08:00
|
|
|
"field" => "id",
|
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => true,
|
|
|
|
"switchable" => true,
|
|
|
|
"title" => trans('general.id'),
|
|
|
|
"visible" => false
|
2017-10-19 16:25:24 -07:00
|
|
|
],[
|
|
|
|
"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
|
|
|
], [
|
2017-01-25 02:19:26 -08:00
|
|
|
"field" => "company",
|
2016-12-23 17:52:00 -08:00
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"switchable" => true,
|
|
|
|
"title" => trans('admin/companies/table.title'),
|
|
|
|
"visible" => false,
|
2017-01-25 02:19:26 -08:00
|
|
|
"formatter" => "companiesLinkObjFormatter"
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "name",
|
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
2017-03-11 10:05:50 -08:00
|
|
|
"title" => trans('general.name'),
|
2017-01-25 02:19:26 -08:00
|
|
|
"formatter" => "accessoriesLinkFormatter"
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "category",
|
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"title" => trans('admin/accessories/general.accessory_category'),
|
2017-01-25 02:19:26 -08:00
|
|
|
"formatter" => "categoriesLinkObjFormatter"
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "model_number",
|
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"title" => trans('admin/models/table.modelnumber'),
|
2017-01-25 02:19:26 -08:00
|
|
|
"formatter" => "accessoriesLinkFormatter"
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "manufacturer",
|
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"title" => trans('general.manufacturer'),
|
2017-01-25 02:19:26 -08:00
|
|
|
"formatter" => "manufacturersLinkObjFormatter",
|
2017-10-19 16:25:24 -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
|
|
|
], [
|
|
|
|
"field" => "location",
|
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"title" => trans('general.location'),
|
2017-01-25 02:19:26 -08:00
|
|
|
"formatter" => "locationsLinkObjFormatter",
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "qty",
|
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => false,
|
|
|
|
"title" => trans('admin/accessories/general.total'),
|
2017-01-25 02:19:26 -08:00
|
|
|
], [
|
|
|
|
"field" => "min_qty",
|
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => true,
|
|
|
|
"title" => trans('general.min_amt'),
|
|
|
|
], [
|
|
|
|
"field" => "remaining_qty",
|
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => false,
|
|
|
|
"title" => trans('admin/accessories/general.remaining'),
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "purchase_date",
|
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"visible" => false,
|
|
|
|
"title" => trans('general.purchase_date'),
|
2017-03-11 10:05:50 -08:00
|
|
|
"formatter" => "dateDisplayFormatter"
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "purchase_cost",
|
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"title" => trans('general.purchase_cost'),
|
2021-08-04 14:09:50 -07:00
|
|
|
"footerFormatter" => 'sumFormatterQuantity',
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "order_number",
|
|
|
|
"searchable" => true,
|
|
|
|
"sortable" => true,
|
|
|
|
"visible" => false,
|
|
|
|
"title" => trans('general.order_number'),
|
2017-03-11 12:14:10 -08:00
|
|
|
],[
|
|
|
|
"field" => "change",
|
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => false,
|
|
|
|
"visible" => true,
|
|
|
|
"title" => trans('general.change'),
|
|
|
|
"formatter" => "accessoriesInOutFormatter",
|
2016-12-23 17:52:00 -08:00
|
|
|
], [
|
|
|
|
"field" => "actions",
|
|
|
|
"searchable" => false,
|
|
|
|
"sortable" => false,
|
|
|
|
"switchable" => false,
|
|
|
|
"title" => trans('table.actions'),
|
2017-01-25 02:19:26 -08:00
|
|
|
"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
|
|
|
}
|