Merge pull request #13291 from akemidx/eol_date_range_for_reports

Added date range for EOL in custom reports
This commit is contained in:
snipe 2024-09-19 21:49:27 +01:00 committed by GitHub
commit 8270947ed2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 2 deletions

View file

@ -703,6 +703,10 @@ class ReportsController extends Controller
$assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]);
}
if (($request->filled('asset_eol_date_start')) && ($request->filled('asset_eol_date_end'))) {
$assets->whereBetween('assets.asset_eol_date', [$request->input('asset_eol_date_start'), $request->input('asset_eol_date_end')]);
}
if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) {
$last_audit_start = Carbon::parse($request->input('last_audit_start'))->startOfDay();
$last_audit_end = Carbon::parse($request->input('last_audit_end'))->endOfDay();
@ -778,7 +782,7 @@ class ReportsController extends Controller
}
if ($request->filled('eol')) {
$row[] = ($asset->asset_eol_date) ? $asset->asset_eol_date : '';
$row[] = ($asset->purchase_date != '') ? $asset->asset_eol_date : '';
}
if ($request->filled('order')) {

View file

@ -88,7 +88,7 @@
<label class="form-control">
{{ Form::checkbox('eol', '1', '1') }}
{{ trans('admin/hardware/table.eol') }}
{{ trans('admin/hardware/form.eol_date') }}
</label>
<label class="form-control">
@ -429,6 +429,16 @@
</div>
<!-- EoL Date -->
<div class="form-group asset_eol_date-range">
<label for="asset_eol_date" class="col-md-3 control-label">{{ trans('admin/hardware/form.eol_date') }}</label>
<div class="input-daterange input-group col-md-6" id="datepicker">
<input type="text" class="form-control" name="asset_eol_date_start" aria-label="asset_eol_date_start">
<span class="input-group-addon">to</span>
<input type="text" class="form-control" name="asset_eol_date_end" aria-label="asset_eol_date_end">
</div>
</div>
<!-- Last Audit Date -->
<div class="form-group last_audit-range{{ ($errors->has('last_audit_start') || $errors->has('last_audit_end')) ? ' has-error' : '' }}">
<label for="last_audit_start" class="col-md-3 control-label">{{ trans('general.last_audit') }}</label>
@ -538,6 +548,12 @@
format: 'yyyy-mm-dd'
});
$('.asset_eol_date-range .input-daterange').datepicker({
clearBtn: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
});
$('.last_audit-range .input-daterange').datepicker({
clearBtn: true,
todayHighlight: true,