mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-27 22:49:41 -08:00
934afa036f
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions. You may customize the adopted coding style by adding your own [PHP CS Fixer][1] `.php_cs` config file to your project root. Feel free to use [Shift's Laravel ruleset][2] to help you get started. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200
160 lines
5.1 KiB
PHP
160 lines
5.1 KiB
PHP
<?php
|
|
|
|
namespace App\Presenters;
|
|
|
|
/**
|
|
* Class ManufacturerPresenter
|
|
*/
|
|
class ManufacturerPresenter extends Presenter
|
|
{
|
|
/**
|
|
* Json Column Layout for bootstrap table
|
|
* @return string
|
|
*/
|
|
public static function dataTableLayout()
|
|
{
|
|
$layout = [
|
|
|
|
[
|
|
'field' => 'id',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => trans('general.id'),
|
|
'visible' => false,
|
|
],
|
|
[
|
|
'field' => 'name',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'title' => trans('admin/manufacturers/table.name'),
|
|
'visible' => true,
|
|
'formatter' => 'manufacturersLinkFormatter',
|
|
],
|
|
[
|
|
'field' => 'image',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => trans('general.image'),
|
|
'visible' => true,
|
|
'formatter' => 'imageFormatter',
|
|
],
|
|
[
|
|
'field' => 'url',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => trans('admin/manufacturers/table.url'),
|
|
'visible' => true,
|
|
'formatter' => 'linkFormatter',
|
|
],
|
|
[
|
|
'field' => 'support_url',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => trans('admin/manufacturers/table.support_url'),
|
|
'visible' => true,
|
|
'formatter' => 'linkFormatter',
|
|
],
|
|
|
|
[
|
|
'field' => 'support_phone',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => trans('admin/manufacturers/table.support_phone'),
|
|
'visible' => true,
|
|
'formatter' => 'phoneFormatter',
|
|
],
|
|
|
|
[
|
|
'field' => 'support_email',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => trans('admin/manufacturers/table.support_email'),
|
|
'visible' => true,
|
|
'formatter' => 'emailFormatter',
|
|
],
|
|
|
|
[
|
|
'field' => 'assets_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => ' <span class="hidden-md hidden-lg">Assets</span>'
|
|
.'<span class="hidden-xs"><i class="fa fa-barcode fa-lg"></i></span>',
|
|
'visible' => true,
|
|
],
|
|
[
|
|
'field' => 'licenses_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => ' <span class="hidden-md hidden-lg">Licenses</span>'
|
|
.'<span class="hidden-xs"><i class="fa fa-floppy-o fa-lg"></i></span>',
|
|
'visible' => true,
|
|
],
|
|
[
|
|
'field' => 'consumables_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => ' <span class="hidden-md hidden-lg">Consumables</span>'
|
|
.'<span class="hidden-xs"><i class="fa fa-tint fa-lg"></i></span>',
|
|
'visible' => true,
|
|
],
|
|
[
|
|
'field' => 'accessories_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => ' <span class="hidden-md hidden-lg">Accessories</span>'
|
|
.'<span class="hidden-xs"><i class="fa fa-keyboard-o fa-lg"></i></span>',
|
|
'visible' => true,
|
|
],
|
|
[
|
|
'field' => 'created_at',
|
|
'searchable' => true,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => trans('general.created_at'),
|
|
'visible' => false,
|
|
'formatter' => 'dateDisplayFormatter',
|
|
],
|
|
|
|
[
|
|
'field' => 'actions',
|
|
'searchable' => false,
|
|
'sortable' => false,
|
|
'switchable' => false,
|
|
'title' => trans('table.actions'),
|
|
'visible' => true,
|
|
'formatter' => 'manufacturersActionsFormatter',
|
|
],
|
|
];
|
|
|
|
return json_encode($layout);
|
|
}
|
|
|
|
/**
|
|
* Link to this manufacturers name
|
|
* @return string
|
|
*/
|
|
public function nameUrl()
|
|
{
|
|
return (string) link_to_route('manufacturers.show', $this->name, $this->id);
|
|
}
|
|
|
|
/**
|
|
* Url to view this item.
|
|
* @return string
|
|
*/
|
|
public function viewUrl()
|
|
{
|
|
return route('manufacturers.show', $this->id);
|
|
}
|
|
}
|