2016-12-23 17:52:00 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class LocationPresenter
|
|
|
|
*/
|
|
|
|
class LocationPresenter extends Presenter
|
|
|
|
{
|
2018-02-16 13:22:55 -08:00
|
|
|
/**
|
|
|
|
* Json Column Layout for bootstrap table
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function dataTableLayout()
|
|
|
|
{
|
|
|
|
$layout = [
|
2024-02-16 10:57:50 -08:00
|
|
|
[
|
|
|
|
'field' => 'bulk_selectable',
|
|
|
|
'checkbox' => true,
|
|
|
|
'formatter' => 'checkboxEnabledFormatter',
|
|
|
|
],
|
2018-02-16 13:22:55 -08:00
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/locations/table.name'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'locationsLinkFormatter',
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'image',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.image'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'imageFormatter',
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'parent',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/locations/table.parent'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'locationsLinkObjFormatter',
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
|
|
|
|
[
|
2022-10-26 09:39:03 -07:00
|
|
|
'field' => 'assets_count',
|
2021-06-10 13:15:52 -07:00
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
2022-10-26 00:16:06 -07:00
|
|
|
'title' => trans('admin/locations/message.current_location'),
|
2021-06-10 13:15:52 -07:00
|
|
|
'visible' => true,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
2022-10-26 00:16:06 -07:00
|
|
|
|
|
|
|
[
|
|
|
|
'field' => 'rtd_assets_count',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/hardware/form.default_location'),
|
|
|
|
'visible' => false,
|
|
|
|
],
|
|
|
|
|
2018-02-16 13:22:55 -08:00
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'assigned_assets_count',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
2022-10-26 00:16:06 -07:00
|
|
|
'title' => trans('admin/locations/message.assigned_assets'),
|
2021-06-10 13:15:52 -07:00
|
|
|
'visible' => true,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
2022-10-26 00:16:06 -07:00
|
|
|
|
2018-02-16 13:22:55 -08:00
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'users_count',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.people'),
|
|
|
|
'visible' => true,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'currency',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.currency'),
|
|
|
|
'visible' => true,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'address',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/locations/table.address'),
|
|
|
|
'visible' => true,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
2022-06-06 19:31:08 -07:00
|
|
|
[
|
|
|
|
'field' => 'address2',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
2023-10-19 10:01:08 -07:00
|
|
|
'title' => trans('admin/locations/table.address2'),
|
2022-06-06 19:31:08 -07:00
|
|
|
'visible' => false,
|
|
|
|
],
|
2018-02-16 13:22:55 -08:00
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'city',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/locations/table.city'),
|
|
|
|
'visible' => true,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'state',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/locations/table.state'),
|
|
|
|
'visible' => true,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'zip',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/locations/table.zip'),
|
|
|
|
'visible' => false,
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'country',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/locations/table.country'),
|
|
|
|
'visible' => false,
|
2020-11-17 22:17:07 -08:00
|
|
|
],
|
2023-07-10 11:44:21 -07:00
|
|
|
[
|
|
|
|
'field' => 'phone',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/users/table.phone'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'phoneFormatter',
|
|
|
|
],
|
|
|
|
[
|
|
|
|
'field' => 'fax',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/suppliers/table.fax'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'phoneFormatter',
|
|
|
|
],
|
2020-11-17 22:17:07 -08:00
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'ldap_ou',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/locations/table.ldap_ou'),
|
|
|
|
'visible' => false,
|
2020-11-17 22:17:07 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'manager',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/users/table.manager'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'usersLinkObjFormatter',
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'created_at',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.created_at'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'dateDisplayFormatter',
|
2018-02-16 13:22:55 -08:00
|
|
|
],
|
|
|
|
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'locationsActionsFormatter',
|
|
|
|
],
|
2018-02-16 13:22:55 -08:00
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
2016-12-23 17:52:00 -08:00
|
|
|
/**
|
|
|
|
* Link to this locations name
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function nameUrl()
|
|
|
|
{
|
2021-06-10 13:15:52 -07:00
|
|
|
return (string) link_to_route('locations.show', $this->name, $this->id);
|
2016-12-23 17:52:00 -08:00
|
|
|
}
|
2016-12-26 15:19:04 -08:00
|
|
|
|
2016-12-27 16:24:41 -08:00
|
|
|
/**
|
|
|
|
* Getter for Polymorphism.
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function name()
|
|
|
|
{
|
|
|
|
return $this->model->name;
|
|
|
|
}
|
|
|
|
|
2016-12-26 15:19:04 -08:00
|
|
|
/**
|
|
|
|
* Url to view this item.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function viewUrl()
|
|
|
|
{
|
|
|
|
return route('locations.show', $this->id);
|
|
|
|
}
|
2016-12-29 18:12:27 -08:00
|
|
|
|
|
|
|
public function glyph()
|
|
|
|
{
|
2021-09-24 14:30:36 -07:00
|
|
|
return '<i class="fas fa-map-marker-alt" aria-hidden="true"></i>';
|
2016-12-29 18:12:27 -08:00
|
|
|
}
|
2021-06-10 13:15:52 -07:00
|
|
|
|
|
|
|
public function fullName()
|
|
|
|
{
|
2017-08-25 03:26:10 -07:00
|
|
|
return $this->name;
|
|
|
|
}
|
2016-12-23 17:52:00 -08:00
|
|
|
}
|