Show deleted_at date in table if looking at deleted assets
This commit is contained in:
@@ -17,7 +17,7 @@ class AssetPresenter extends Presenter
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function dataTableLayout()
|
||||
public static function dataTableLayout($hide_fields = [])
|
||||
{
|
||||
$layout = [
|
||||
[
|
||||
@@ -278,7 +278,23 @@ class AssetPresenter extends Presenter
|
||||
'title' => trans('general.updated_at'),
|
||||
'visible' => false,
|
||||
'formatter' => 'dateDisplayFormatter',
|
||||
], [
|
||||
],
|
||||
];
|
||||
|
||||
if (! in_array('deleted_at', $hide_fields)) {
|
||||
$layout[] = [
|
||||
'field' => 'deleted_at',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
'switchable' => true,
|
||||
'title' => trans('general.deleted_at'),
|
||||
'visible' => true,
|
||||
'formatter' => 'dateDisplayFormatter',
|
||||
];
|
||||
}
|
||||
|
||||
$layout = array_merge($layout, [
|
||||
[
|
||||
'field' => 'last_checkout',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
@@ -323,7 +339,7 @@ class AssetPresenter extends Presenter
|
||||
'formatter' => 'trueFalseFormatter',
|
||||
|
||||
],
|
||||
];
|
||||
]);
|
||||
|
||||
// This looks complicated, but we have to confirm that the custom fields exist in custom fieldsets
|
||||
// *and* those fieldsets are associated with models, otherwise we'll trigger
|
||||
|
||||
@@ -125,6 +125,7 @@ return [
|
||||
'delete_confirm' => 'Are you sure you wish to delete :item?',
|
||||
'delete_confirm_no_undo' => 'Are you sure you wish to delete :item? This cannot be undone.',
|
||||
'deleted' => 'Deleted',
|
||||
'deleted_at' => 'Deleted At',
|
||||
'delete_seats' => 'Deleted Seats',
|
||||
'deletion_failed' => 'Deletion failed',
|
||||
'departments' => 'Departments',
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@props([
|
||||
'route' => route('api.assets.index'),
|
||||
'name' => 'default',
|
||||
'presenter' => \App\Presenters\AssetPresenter::dataTableLayout(),
|
||||
'fixed_right_number' => 2,
|
||||
'fixed_number' => 1,
|
||||
'table_header' => trans('general.assets'),
|
||||
'status_type' => null,
|
||||
])
|
||||
|
||||
@aware(['name'])
|
||||
@@ -18,11 +18,11 @@
|
||||
</x-slot:table_header>
|
||||
|
||||
<x-slot:bulkactions>
|
||||
<x-table.bulk-assets/>
|
||||
<x-table.bulk-assets :status_type="$status_type"/>
|
||||
</x-slot:bulkactions>
|
||||
|
||||
|
||||
<x-table
|
||||
:$presenter
|
||||
:presenter="\App\Presenters\AssetPresenter::dataTableLayout($status_type !== 'Deleted' ? ['deleted_at'] : [])"
|
||||
:$fixed_right_number
|
||||
:$fixed_number
|
||||
show_column_search="true"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@props(['status_type' => null])
|
||||
@aware(['name'])
|
||||
|
||||
<form
|
||||
@@ -19,7 +20,7 @@
|
||||
</span>
|
||||
|
||||
<select name="bulk_actions" class="form-control select2" aria-label="bulk_actions" style="width: 350px !important;">
|
||||
@if ((isset($status)) && ($status == 'Deleted'))
|
||||
@if ($status_type == 'Deleted')
|
||||
@can('delete', \App\Models\Asset::class)
|
||||
<option value="restore">{{trans('button.restore')}}</option>
|
||||
@endcan
|
||||
@@ -30,13 +31,13 @@
|
||||
<option value="maintenance">{{ trans('button.add_maintenance') }}</option>
|
||||
@endcan
|
||||
|
||||
@if((!isset($status)) || (($status != 'Deployed') && ($status != 'Archived')))
|
||||
@if($status_type != 'Deployed' && $status_type != 'Archived')
|
||||
@can('checkout', \App\Models\Asset::class)
|
||||
<option value="checkout">{{ trans('general.bulk_checkout') }}</option>
|
||||
@endcan
|
||||
@endif
|
||||
|
||||
@if((!isset($status)) || ($status == 'Deployed'))
|
||||
@if(!$status_type || $status_type == 'Deployed')
|
||||
@can('checkin', \App\Models\Asset::class)
|
||||
<option value="checkin">{{ trans('admin/hardware/general.bulk_checkin') }}</option>
|
||||
@endcan
|
||||
|
||||
@@ -55,13 +55,15 @@
|
||||
@section('content')
|
||||
<x-container>
|
||||
<x-box name="assets">
|
||||
<x-table.assets :route="route('api.assets.index',
|
||||
array(
|
||||
<x-table.assets
|
||||
:route="route('api.assets.index', array(
|
||||
'status_type' => is_scalar($requestStatusType) ? $requestStatusType : null,
|
||||
'order_number' => is_scalar($requestOrderNumber) ? strval($requestOrderNumber) : null,
|
||||
'company_id' => is_scalar($requestCompanyId) ? $requestCompanyId : null,
|
||||
'status_id' => is_scalar($requestStatusTypeId) ? $requestStatusTypeId : null,
|
||||
))"/>
|
||||
))"
|
||||
:status_type="is_scalar($requestStatusType) ? $requestStatusType : null"
|
||||
/>
|
||||
</x-box>
|
||||
</x-container>
|
||||
@stop
|
||||
|
||||
Reference in New Issue
Block a user