mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-27 14:39:49 -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
124 lines
4.4 KiB
PHP
124 lines
4.4 KiB
PHP
<?php
|
|
|
|
namespace App\Presenters;
|
|
|
|
/**
|
|
* Class CompanyPresenter
|
|
*/
|
|
class CompanyPresenter 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,
|
|
'switchable' => true,
|
|
'title' => trans('admin/companies/table.name'),
|
|
'visible' => true,
|
|
'formatter' => 'companiesLinkFormatter',
|
|
], [
|
|
'field' => 'image',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'switchable' => true,
|
|
'title' => trans('general.image'),
|
|
'visible' => true,
|
|
'formatter' => 'imageFormatter',
|
|
], [
|
|
'field' => 'users_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'title' => '<span class="hidden-xs"><i class="fa fa-users"></i></span><span class="hidden-md hidden-lg">'.trans('general.users').'</span></th>',
|
|
'visible' => true,
|
|
|
|
], [
|
|
'field' => 'assets_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'title' => '<span class="hidden-xs"><i class="fa fa-barcode" aria-hidden="true"></i></span><span class="hidden-md hidden-lg">'.trans('general.assets').'</span>',
|
|
'visible' => true,
|
|
|
|
], [
|
|
'field' => 'licenses_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'visible' => true,
|
|
'title' => ' <span class="hidden-xs"><i class="fa fa-floppy-o"></i></span><span class="hidden-md hidden-lg">'.trans('general.licenses').'</span>',
|
|
], [
|
|
'field' => 'accessories_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'visible' => true,
|
|
'title' => ' <span class="hidden-xs"><i class="fa fa-keyboard-o"></i></span><span class="hidden-md hidden-lg">'.trans('general.accessories').'</span>',
|
|
], [
|
|
'field' => 'consumables_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'visible' => true,
|
|
'title' => ' <span class="hidden-xs"><i class="fa fa-tint"></i></span><span class="hidden-md hidden-lg">'.trans('general.consumables').'</span>',
|
|
], [
|
|
'field' => 'components_count',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'visible' => true,
|
|
'title' => ' <span class="hidden-xs"><i class="fa fa-hdd-o"></i></span><span class="hidden-md hidden-lg">'.trans('general.components').'</span>',
|
|
], [
|
|
'field' => 'updated_at',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'visible' => false,
|
|
'title' => trans('general.updated_at'),
|
|
'formatter' => 'createdAtFormatter',
|
|
], [
|
|
'field' => 'created_at',
|
|
'searchable' => false,
|
|
'sortable' => true,
|
|
'visible' => false,
|
|
'title' => trans('general.created_at'),
|
|
'formatter' => 'createdAtFormatter',
|
|
], [
|
|
'field' => 'actions',
|
|
'searchable' => false,
|
|
'sortable' => false,
|
|
'switchable' => false,
|
|
'title' => trans('table.actions'),
|
|
'visible' => true,
|
|
'formatter' => 'companiesActionsFormatter',
|
|
],
|
|
];
|
|
|
|
return json_encode($layout);
|
|
}
|
|
|
|
/**
|
|
* Link to this companies name
|
|
* @return string
|
|
*/
|
|
public function nameUrl()
|
|
{
|
|
return (string) link_to_route('companies.show', $this->name, $this->id);
|
|
}
|
|
|
|
/**
|
|
* Url to view this item.
|
|
* @return string
|
|
*/
|
|
public function viewUrl()
|
|
{
|
|
return route('companies.show', $this->id);
|
|
}
|
|
}
|