Jul 10 - Update codes to catch up with the single tenant project (Low)
This commit is contained in:
@@ -29,9 +29,20 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{% if projects %}
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small mb-1">Contract</label>
|
||||
<select id="aging_contract_sel" class="form-select form-select-sm">
|
||||
<option value="">All Contracts</option>
|
||||
{% for p in projects %}
|
||||
<option value="{{ p.id }}">{{ p.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small mb-1">Facility</label>
|
||||
<select name="facility_id" class="form-select form-select-sm">
|
||||
<select id="aging_facility_sel" name="facility_id" class="form-select form-select-sm">
|
||||
<option value="">All Facilities</option>
|
||||
{% for f in facilities %}
|
||||
<option value="{{ f.id }}" {{ 'selected' if facility_id_filter == f.id }}>{{ f.name }}</option>
|
||||
@@ -46,6 +57,36 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if projects %}
|
||||
<script>
|
||||
(function () {
|
||||
var contractSel = document.getElementById('aging_contract_sel');
|
||||
var facSel = document.getElementById('aging_facility_sel');
|
||||
if (!contractSel || !facSel) return;
|
||||
var allOpts = Array.from(facSel.options).map(function (o) { return {v: o.value, t: o.text}; });
|
||||
contractSel.addEventListener('change', function () {
|
||||
var pid = this.value;
|
||||
facSel.innerHTML = '<option value="">All Facilities</option>';
|
||||
if (!pid) {
|
||||
allOpts.slice(1).forEach(function (o) {
|
||||
var opt = document.createElement('option'); opt.value = o.v; opt.text = o.t;
|
||||
facSel.appendChild(opt);
|
||||
});
|
||||
return;
|
||||
}
|
||||
fetch('/inspections/facilities_for_project/' + pid)
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (data) {
|
||||
data.forEach(function (f) {
|
||||
var opt = document.createElement('option'); opt.value = f.id; opt.text = f.name;
|
||||
facSel.appendChild(opt);
|
||||
});
|
||||
});
|
||||
});
|
||||
}());
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{# ── KPI row ── #}
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-6 col-md-4">
|
||||
|
||||
@@ -25,17 +25,28 @@
|
||||
<div class="card shadow-sm mb-4">
|
||||
<div class="card-body py-2">
|
||||
<form method="get" class="row g-2 align-items-end">
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small mb-1">From</label>
|
||||
<input type="date" name="start" class="form-control form-control-sm" value="{{ start.strftime('%Y-%m-%d') }}">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small mb-1">To</label>
|
||||
<input type="date" name="end" class="form-control form-control-sm" value="{{ end.strftime('%Y-%m-%d') }}">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
{% if projects %}
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small mb-1">Contract</label>
|
||||
<select id="sla_contract_sel" class="form-select form-select-sm">
|
||||
<option value="">All Contracts</option>
|
||||
{% for p in projects %}
|
||||
<option value="{{ p.id }}">{{ p.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small mb-1">Facility</label>
|
||||
<select name="facility_id" class="form-select form-select-sm">
|
||||
<select id="sla_facility_sel" name="facility_id" class="form-select form-select-sm">
|
||||
<option value="">All Facilities</option>
|
||||
{% for f in facilities %}
|
||||
<option value="{{ f.id }}" {{ 'selected' if facility_id_filter == f.id }}>{{ f.name }}</option>
|
||||
@@ -50,6 +61,36 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if projects %}
|
||||
<script>
|
||||
(function () {
|
||||
var contractSel = document.getElementById('sla_contract_sel');
|
||||
var facSel = document.getElementById('sla_facility_sel');
|
||||
if (!contractSel || !facSel) return;
|
||||
var allOpts = Array.from(facSel.options).map(function (o) { return {v: o.value, t: o.text}; });
|
||||
contractSel.addEventListener('change', function () {
|
||||
var pid = this.value;
|
||||
facSel.innerHTML = '<option value="">All Facilities</option>';
|
||||
if (!pid) {
|
||||
allOpts.slice(1).forEach(function (o) {
|
||||
var opt = document.createElement('option'); opt.value = o.v; opt.text = o.t;
|
||||
facSel.appendChild(opt);
|
||||
});
|
||||
return;
|
||||
}
|
||||
fetch('/inspections/facilities_for_project/' + pid)
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (data) {
|
||||
data.forEach(function (f) {
|
||||
var opt = document.createElement('option'); opt.value = f.id; opt.text = f.name;
|
||||
facSel.appendChild(opt);
|
||||
});
|
||||
});
|
||||
});
|
||||
}());
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if total == 0 %}
|
||||
<div class="alert alert-info">
|
||||
<i class="bi bi-info-circle me-2"></i>No resolved issues found for this period and filter.
|
||||
|
||||
Reference in New Issue
Block a user