Jul 20 - Update Inspection list with scheduled bagde
This commit is contained in:
@@ -84,6 +84,10 @@ class Inspection(db.Model):
|
||||
|
||||
results = db.relationship('InspectionResult', backref='inspection', lazy='dynamic', cascade='all, delete-orphan')
|
||||
issues = db.relationship('Issue', backref='inspection', lazy='dynamic', cascade='all, delete-orphan')
|
||||
# The ScheduledInspection this inspection was started from (phase36), if any.
|
||||
# None for ad-hoc/manual inspections or if the schedule was later deleted.
|
||||
scheduled_inspection = db.relationship('ScheduledInspection',
|
||||
foreign_keys=[scheduled_inspection_id])
|
||||
follow_ups = db.relationship('Inspection', backref=db.backref('parent', remote_side='Inspection.id'),
|
||||
lazy='dynamic', foreign_keys='Inspection.parent_inspection_id')
|
||||
|
||||
|
||||
@@ -123,7 +123,14 @@
|
||||
<td><small>{{ ins.facility.project.name if ins.facility and ins.facility.project else '—' }}</small></td>
|
||||
<td>{{ ins.facility.name }}</td>
|
||||
<td>{% if ins.area %}{{ ins.area.name }}{% else %}<span class="text-muted">—</span>{% endif %}</td>
|
||||
<td>{{ ins.template.name }}</td>
|
||||
<td>
|
||||
{{ ins.template.name }}
|
||||
{% if ins.scheduled_inspection_id %}
|
||||
<span class="badge bg-info text-dark ms-1" title="From a scheduled inspection">
|
||||
<i class="bi bi-calendar-check"></i> Scheduled
|
||||
</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ ins.inspector.display_name }}</td>
|
||||
<td>
|
||||
{% if ins.overall_score %}
|
||||
|
||||
@@ -475,6 +475,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-items-center gap-2">
|
||||
{% if inspection.scheduled_inspection_id %}
|
||||
<span class="badge bg-info text-dark fs-6" title="Created from a scheduled inspection">
|
||||
<i class="bi bi-calendar-check"></i> Scheduled{% if inspection.scheduled_inspection %} · {{ inspection.scheduled_inspection.frequency_label }}{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
<span class="badge bg-{{ 'success' if inspection.status == 'completed' else 'danger' if inspection.status == 'flagged' else 'secondary' }} fs-6">
|
||||
{{ inspection.status|replace('_',' ')|title }}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user