Aug 5 - Update code to follow up ST - Fix pending items

This commit is contained in:
2026-08-05 12:40:31 -04:00
parent 9bd6b364b7
commit 97c1dec54d
4 changed files with 474 additions and 11 deletions
+37 -2
View File
@@ -23,8 +23,27 @@
{% endif %}
</p>
{# Pending / Completed tabs (phase51). The partition is on `active`, so it is
exhaustive — no schedule can fall between the two tabs. #}
<ul class="nav nav-tabs mb-0">
<li class="nav-item">
<a class="nav-link {{ 'active' if tab == 'pending' }}"
href="{{ url_for('inspection_schedules.index', tab='pending') }}">
<i class="bi bi-hourglass-split"></i> Pending
<span class="badge rounded-pill bg-{{ 'primary' if tab == 'pending' else 'secondary' }} ms-1">{{ pending_count }}</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link {{ 'active' if tab == 'completed' }}"
href="{{ url_for('inspection_schedules.index', tab='completed') }}">
<i class="bi bi-check2-circle"></i> Completed
<span class="badge rounded-pill bg-{{ 'primary' if tab == 'completed' else 'secondary' }} ms-1">{{ completed_count }}</span>
</a>
</li>
</ul>
{% if schedules %}
<div class="card shadow-sm">
<div class="card shadow-sm border-top-0 rounded-top-0">
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover mb-0 align-middle">
@@ -155,13 +174,29 @@
</div>
</div>
{% else %}
<div class="card shadow-sm">
<div class="card shadow-sm border-top-0 rounded-top-0">
<div class="card-body text-center py-5 text-muted">
{% if tab == 'completed' %}
<i class="bi bi-check2-circle fs-1 d-block mb-3 opacity-25"></i>
<p class="mb-0">No completed schedules yet.</p>
{% elif completed_count %}
{# Nothing pending but there IS history — offer the other tab rather than
inviting them to create a duplicate of something already closed. #}
<i class="bi bi-calendar-check fs-1 d-block mb-3 opacity-25"></i>
<p class="mb-3">Nothing pending — all schedules are complete.</p>
<a href="{{ url_for('inspection_schedules.index', tab='completed') }}"
class="btn btn-outline-secondary">
<i class="bi bi-check2-circle"></i> View Completed ({{ completed_count }})
</a>
{% else %}
<i class="bi bi-calendar-x fs-1 d-block mb-3 opacity-25"></i>
<p class="mb-3">No inspection schedules configured yet.</p>
{% if current_user.role != 'inspector' %}
<a href="{{ url_for('inspection_schedules.create') }}" class="btn btn-primary">
<i class="bi bi-plus-circle"></i> Create First Schedule
</a>
{% endif %}
{% endif %}
</div>
</div>
{% endif %}