Add 'Last Audit Date/Next Audit Date' filter to custom report (#8989)

* Add 'Last Audit Date/Next Audit Date' filter to custom report

* Added a constraint: cannot require a report with a Last Audit Date in the future.
This commit is contained in:
Ivan Nieto 2021-01-26 14:05:31 -06:00 committed by GitHub
parent 79549dbfb9
commit 2da6f9136f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 1 deletions

View file

@ -632,6 +632,14 @@ class ReportsController extends Controller
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')]);
}
if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) {
$assets->whereBetween('assets.last_audit_date', [$request->input('last_audit_start'), $request->input('last_audit_end')]);
}
if (($request->filled('next_audit_start')) && ($request->filled('next_audit_end'))) {
$assets->whereBetween('assets.next_audit_date', [$request->input('next_audit_start'), $request->input('next_audit_end')]);
}
$assets->orderBy('assets.created_at', 'ASC')->chunk(20, function($assets) use($handle, $customfields, $request) {

View file

@ -316,7 +316,25 @@
</div>
</div>
<!-- Last Audit Date -->
<div class="form-group last_audit-range">
<label for="last_audit_start" class="col-md-3 control-label">{{ trans('general.last_audit') }}</label>
<div class="input-daterange input-group col-md-6" id="datepicker">
<input type="text" class="input-sm form-control" name="last_audit_start" aria-label="last_audit_start">
<span class="input-group-addon">to</span>
<input type="text" class="input-sm form-control" name="last_audit_end" aria-label="last_audit_end">
</div>
</div>
<!-- Next Audit Date -->
<div class="form-group next_audit-range">
<label for="next_audit_start" class="col-md-3 control-label">{{ trans('general.next_audit_date') }}</label>
<div class="input-daterange input-group col-md-6" id="datepicker">
<input type="text" class="input-sm form-control" name="next_audit_start" aria-label="nex_audit_start">
<span class="input-group-addon">to</span>
<input type="text" class="input-sm form-control" name="next_audit_end" aria-label="next_audit_end">
</div>
</div>
<div class="col-md-9 col-md-offset-3">
<label>
@ -356,6 +374,19 @@
format: 'yyyy-mm-dd'
});
$('.last_audit-range .input-daterange').datepicker({
clearBtn: true,
todayHighlight: true,
endDate:'0d',
format: 'yyyy-mm-dd'
});
$('.next_audit-range .input-daterange').datepicker({
clearBtn: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
});
// Check-all / Uncheck all
$(function () {
var checkAll = $('input.all');