Merge pull request #14262 from akemidx/bug/sc-24812

Last Checkin Date added to Hardware View and Index
This commit is contained in:
snipe 2024-03-27 19:02:25 +00:00 committed by GitHub
commit 545a185614
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 5 deletions

View file

@ -700,12 +700,13 @@ class ReportsController extends Controller
} }
if (($request->filled('checkin_date_start'))) { if (($request->filled('checkin_date_start'))) {
$assets->whereBetween('last_checkin', [ $checkin_start = \Carbon::parse($request->input('checkin_date_start'))->startOfDay();
Carbon::parse($request->input('checkin_date_start'))->startOfDay(), // use today's date is `checkin_date_end` is not provided
// use today's date if `checkin_date_end` is not provided $checkin_end = \Carbon::parse($request->input('checkin_date_end', now()))->endOfDay();
Carbon::parse($request->input('checkin_date_end', now()))->endOfDay(),
]); $assets->whereBetween('assets.last_checkin', [$checkin_start, $checkin_end ]);
} }
//last checkin is exporting, but currently is a date and not a datetime in the custom report ONLY.
if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) { if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) {
$assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]); $assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]);

View file

@ -88,6 +88,7 @@ class AssetsTransformer
'purchase_date' => Helper::getFormattedDateObject($asset->purchase_date, 'date'), 'purchase_date' => Helper::getFormattedDateObject($asset->purchase_date, 'date'),
'age' => $asset->purchase_date ? $asset->purchase_date->diffForHumans() : '', 'age' => $asset->purchase_date ? $asset->purchase_date->diffForHumans() : '',
'last_checkout' => Helper::getFormattedDateObject($asset->last_checkout, 'datetime'), 'last_checkout' => Helper::getFormattedDateObject($asset->last_checkout, 'datetime'),
'last_checkin' => Helper::getFormattedDateObject($asset->last_checkin, 'datetime'),
'expected_checkin' => Helper::getFormattedDateObject($asset->expected_checkin, 'date'), 'expected_checkin' => Helper::getFormattedDateObject($asset->expected_checkin, 'date'),
'purchase_cost' => Helper::formatCurrencyOutput($asset->purchase_cost), 'purchase_cost' => Helper::formatCurrencyOutput($asset->purchase_cost),
'checkin_counter' => (int) $asset->checkin_counter, 'checkin_counter' => (int) $asset->checkin_counter,

View file

@ -253,6 +253,13 @@ class AssetPresenter extends Presenter
'visible' => false, 'visible' => false,
'title' => trans('admin/hardware/table.checkout_date'), 'title' => trans('admin/hardware/table.checkout_date'),
'formatter' => 'dateDisplayFormatter', 'formatter' => 'dateDisplayFormatter',
], [
'field' => 'last_checkin',
'searchable' => false,
'sortable' => true,
'visible' => false,
'title' => trans('admin/hardware/table.last_checkin_date'),
'formatter' => 'dateDisplayFormatter',
], [ ], [
'field' => 'expected_checkin', 'field' => 'expected_checkin',
'searchable' => false, 'searchable' => false,

View file

@ -781,6 +781,18 @@
</div> </div>
</div> </div>
@endif @endif
@if ($asset->last_checkin!='')
<div class="row">
<div class="col-md-2">
<strong>
{{ trans('admin/hardware/table.last_checkin_date') }}
</strong>
</div>
<div class="col-md-6">
{{ Helper::getFormattedDateObject($asset->last_checkin, 'datetime', false) }}
</div>
</div>
@endif