mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-23 11:43:47 -08:00
cafafe851c
* Move slack integration to laravel5.3 style notifications, part 1. * Fix consumable tab when active. * Move the slack notifiable to the settings model. Move all slack notifications into logCheckout/logCheckin. Should think about refactoring this as an event at some point still. Move Asset checkin/checkout to use the general loggable trait rather than it's own solution. * Fix a logic error where assets with a non deployable status would show checkin instead of no button at all. * Fix an html formatting error that resulted in us not closing a form. This would cause the checkin page to try to submit a delete request (related to the modal form) rather than the desired checkin request. Also fix formatting in this file.
58 lines
1.5 KiB
PHP
58 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
use App\Helpers\Helper;
|
|
|
|
/**
|
|
* Class CategoryPresenter
|
|
* @package App\Presenters
|
|
*/
|
|
class CategoryPresenter extends Presenter
|
|
{
|
|
/**
|
|
* JSON representation of category for datatable.
|
|
* @return array
|
|
*/
|
|
public function forDataTable()
|
|
{
|
|
$actions = Helper::generateDatatableButton('edit', route('categories.edit', $this->id));
|
|
$actions .= Helper::generateDatatableButton(
|
|
'delete',
|
|
route('categories.destroy', $this->id),
|
|
$this->itemCount() == 0, /* enabled */
|
|
trans('admin/categories/message.delete.confirm'),
|
|
$this->name
|
|
);
|
|
$results = [];
|
|
$results['id'] = $this->id;
|
|
$results['name'] = $this->nameUrl();
|
|
$results['category_type'] = ucwords($this->category_type);
|
|
$results['count'] = $this->itemCount();
|
|
$results['acceptance'] = ($this->require_acceptance == '1') ? '<i class="fa fa-check"></i>' : '';
|
|
$results['eula'] = $this->getEula() ? '<i class="fa fa-check"></i>' : '';
|
|
$results['actions'] = $actions;
|
|
|
|
return $results;
|
|
}
|
|
|
|
/**
|
|
* Link to this categories name
|
|
* @return string
|
|
*/
|
|
public function nameUrl()
|
|
{
|
|
return (string) link_to_route('categories.show', $this->name, $this->id);
|
|
}
|
|
|
|
/**
|
|
* Url to view this item.
|
|
* @return string
|
|
*/
|
|
public function viewUrl()
|
|
{
|
|
return route('categories.show', $this->id);
|
|
}
|
|
}
|