2016-12-23 17:52:00 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class LicensePresenter
|
|
|
|
*/
|
|
|
|
class LicensePresenter extends Presenter
|
|
|
|
{
|
|
|
|
/**
|
2017-02-10 18:43:30 -08:00
|
|
|
* Json Column Layout for bootstrap table
|
|
|
|
* @return string
|
2016-12-23 17:52:00 -08:00
|
|
|
*/
|
2017-02-10 18:43:30 -08:00
|
|
|
public static function dataTableLayout()
|
2016-12-23 17:52:00 -08:00
|
|
|
{
|
2017-02-10 18:43:30 -08:00
|
|
|
$layout = [
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'id',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.id'),
|
|
|
|
'visible' => false,
|
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',
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
2023-04-18 02:43:59 -07:00
|
|
|
'title' => trans('general.name'),
|
2021-06-10 13:15:52 -07:00
|
|
|
'formatter' => 'licensesLinkFormatter',
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'product_key',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/licenses/form.license_key'),
|
|
|
|
'formatter' => 'licensesLinkFormatter',
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'expiration_date',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/licenses/form.expiration'),
|
|
|
|
'formatter' => 'dateDisplayFormatter',
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'license_email',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/licenses/form.to_email'),
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'license_name',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/licenses/form.to_name'),
|
2018-05-04 21:01:38 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'category',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.category'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'categoriesLinkObjFormatter',
|
2017-08-10 14:38:04 -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',
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'manufacturer',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('general.manufacturer'),
|
|
|
|
'formatter' => 'manufacturersLinkObjFormatter',
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'seats',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/accessories/general.total'),
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'free_seats_count',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'title' => trans('admin/accessories/general.remaining'),
|
2017-02-10 18:43:30 -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',
|
2021-01-27 01:34:32 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'termination_date',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('admin/licenses/form.termination_date'),
|
|
|
|
'formatter' => 'dateDisplayFormatter',
|
2021-01-27 01:34:32 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'depreciation',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/hardware/form.depreciation'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'depreciationsLinkObjFormatter',
|
2021-01-27 01:34:32 -08:00
|
|
|
],
|
|
|
|
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'maintained',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('admin/licenses/form.maintained'),
|
|
|
|
'formatter' => 'trueFalseFormatter',
|
2020-09-04 10:02:04 -07:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'reassignable',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('admin/licenses/form.reassignable'),
|
|
|
|
'formatter' => 'trueFalseFormatter',
|
2020-09-04 10:02:04 -07:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'purchase_cost',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'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',
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'purchase_order',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('admin/licenses/form.purchase_order'),
|
2017-02-10 18:43:30 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'order_number',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.order_number'),
|
2017-10-07 04:42:53 -07:00
|
|
|
], [
|
2023-04-27 16:19:53 -07:00
|
|
|
'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',
|
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'notes',
|
|
|
|
'searchable' => true,
|
|
|
|
'sortable' => true,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.notes'),
|
|
|
|
'formatter' => 'notesFormatter',
|
|
|
|
],
|
2016-12-23 17:52:00 -08:00
|
|
|
];
|
|
|
|
|
2017-04-24 21:37:20 -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' => 'licensesInOutFormatter',
|
2017-04-24 21:37:20 -07:00
|
|
|
];
|
|
|
|
|
|
|
|
$layout[] = [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'actions',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => false,
|
|
|
|
'title' => trans('table.actions'),
|
|
|
|
'formatter' => 'licensesActionsFormatter',
|
2017-04-24 21:37:20 -07:00
|
|
|
];
|
|
|
|
|
2017-02-10 18:43:30 -08:00
|
|
|
return json_encode($layout);
|
2016-12-23 17:52:00 -08:00
|
|
|
}
|
|
|
|
|
2018-02-16 13:22:55 -08:00
|
|
|
/**
|
|
|
|
* Json Column Layout for bootstrap table
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public static function dataTableLayoutSeats()
|
|
|
|
{
|
|
|
|
$layout = [
|
2022-05-09 10:59:06 -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' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'sorter' => 'numericOnly',
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/licenses/general.seat'),
|
|
|
|
'visible' => true,
|
2018-02-16 13:22:55 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'assigned_user',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/licenses/general.user'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'usersLinkObjFormatter',
|
2018-02-16 13:22:55 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'department',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => true,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.department'),
|
|
|
|
'visible' => false,
|
|
|
|
'formatter' => 'departmentNameLinkFormatter',
|
2019-11-21 22:03:56 -08:00
|
|
|
],
|
|
|
|
[
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'assigned_asset',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('admin/licenses/form.asset'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'hardwareLinkObjFormatter',
|
2018-02-16 13:22:55 -08:00
|
|
|
], [
|
2021-06-10 13:15:52 -07:00
|
|
|
'field' => 'location',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'switchable' => true,
|
|
|
|
'title' => trans('general.location'),
|
|
|
|
'visible' => true,
|
|
|
|
'formatter' => 'locationsLinkObjFormatter',
|
2019-11-21 22:03:56 -08:00
|
|
|
],
|
2023-09-28 07:40:18 -07:00
|
|
|
[
|
|
|
|
'field' => 'notes',
|
|
|
|
'searchable' => false,
|
|
|
|
'sortable' => false,
|
|
|
|
'visible' => false,
|
|
|
|
'title' => trans('general.notes'),
|
|
|
|
'formatter' => 'notesFormatter'
|
|
|
|
],
|
2019-11-21 22:03:56 -08:00
|
|
|
[
|
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' => 'licenseSeatInOutFormatter',
|
|
|
|
],
|
2018-02-16 13:22:55 -08:00
|
|
|
];
|
|
|
|
|
|
|
|
return json_encode($layout);
|
|
|
|
}
|
|
|
|
|
2016-12-23 17:52:00 -08:00
|
|
|
/**
|
|
|
|
* Link to this licenses Name
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function nameUrl()
|
|
|
|
{
|
2021-06-10 13:15:52 -07:00
|
|
|
return (string) link_to_route('licenses.show', $this->name, $this->id);
|
2016-12-23 17:52:00 -08:00
|
|
|
}
|
|
|
|
|
2017-09-25 21:40:43 -07:00
|
|
|
/**
|
|
|
|
* Link to this licenses Name
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function fullName()
|
|
|
|
{
|
2017-09-29 12:03:12 -07:00
|
|
|
return $this->name;
|
2017-09-25 21:40:43 -07:00
|
|
|
}
|
|
|
|
|
2016-12-23 17:52:00 -08:00
|
|
|
/**
|
|
|
|
* Link to this licenses serial
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function serialUrl()
|
|
|
|
{
|
2021-06-10 13:15:52 -07:00
|
|
|
return (string) link_to('/licenses/'.$this->id, mb_strimwidth($this->serial, 0, 50, '...'));
|
2016-12-23 17:52:00 -08:00
|
|
|
}
|
2016-12-26 15:19:04 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Url to view this item.
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function viewUrl()
|
|
|
|
{
|
|
|
|
return route('licenses.show', $this->id);
|
|
|
|
}
|
2016-12-23 17:52:00 -08:00
|
|
|
}
|