Aug 3 - Add scheduled task confirm button in notification email, and separate pending/completed scheduled tasks UI
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Confirm Receipt — Janitorial QC</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
|
||||
<style>
|
||||
body { background:#eef1f5; }
|
||||
.wrap { max-width: 520px; margin: 8vh auto 0; padding: 16px; }
|
||||
.card-soft { background:#fff; border:1px solid #e6e9ef; border-radius:.85rem; }
|
||||
.badge-icon { width:64px; height:64px; border-radius:50%; display:flex; align-items:center;
|
||||
justify-content:center; font-size:2rem; margin:0 auto 12px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<div class="card-soft shadow-sm p-4 text-center">
|
||||
|
||||
{% set ok = status in ['confirmed', 'already'] %}
|
||||
<div class="badge-icon"
|
||||
style="background:{{ '#e6f7ec' if ok else '#fdecec' }};color:{{ '#198754' if ok else '#dc3545' }};">
|
||||
<i class="bi bi-{{ 'check-circle-fill' if ok else 'exclamation-triangle-fill' }}"></i>
|
||||
</div>
|
||||
|
||||
{% if status == 'confirmed' %}
|
||||
<h4 class="mb-2">Receipt confirmed</h4>
|
||||
<p class="text-muted mb-0">Thank you — you've confirmed you received this scheduled inspection request.</p>
|
||||
{% elif status == 'already' %}
|
||||
<h4 class="mb-2">Already confirmed</h4>
|
||||
<p class="text-muted mb-0">You had already confirmed receipt of this scheduled inspection. No further action is needed.</p>
|
||||
{% elif status == 'reassigned' %}
|
||||
<h4 class="mb-2">This request was reassigned</h4>
|
||||
<p class="text-muted mb-0">This scheduled inspection is no longer assigned to you, so it can't be confirmed from this link.</p>
|
||||
{% elif status == 'inactive' %}
|
||||
<h4 class="mb-2">No longer active</h4>
|
||||
<p class="text-muted mb-0">This scheduled inspection is no longer active, so there's nothing to confirm.</p>
|
||||
{% elif status == 'expired' %}
|
||||
<h4 class="mb-2">Link expired</h4>
|
||||
<p class="text-muted mb-0">This confirmation link has expired. Please sign in to confirm receipt from the Scheduled Inspections page.</p>
|
||||
{% else %}
|
||||
<h4 class="mb-2">Invalid link</h4>
|
||||
<p class="text-muted mb-0">This confirmation link is not valid. Please sign in to confirm receipt from the Scheduled Inspections page.</p>
|
||||
{% endif %}
|
||||
|
||||
{% if sched %}
|
||||
<hr class="my-3">
|
||||
<div class="text-start small">
|
||||
<div class="mb-1"><span class="text-muted">Facility:</span>
|
||||
<strong>{{ sched.facility.name if sched.facility else '—' }}</strong></div>
|
||||
<div class="mb-1"><span class="text-muted">Template:</span>
|
||||
{{ sched.template.name if sched.template else '—' }}</div>
|
||||
<div><span class="text-muted">Due:</span>
|
||||
{{ sched.next_due_date.strftime('%b %d, %Y') if sched.next_due_date else '—' }}
|
||||
<span class="text-muted">·</span> {{ sched.recurrence_label }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="mt-4">
|
||||
<a href="{{ url_for('scheduled_inspections.index') }}" class="btn btn-primary">
|
||||
<i class="bi bi-box-arrow-in-right"></i> Open Scheduled Inspections
|
||||
</a>
|
||||
</div>
|
||||
<p class="text-muted mt-3 mb-0" style="font-size:.75rem;">
|
||||
You may be asked to sign in.
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -19,7 +19,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
{# Pending / Completed tabs (phase47). #}
|
||||
<ul class="nav nav-tabs mb-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {{ 'active' if tab == 'pending' }}"
|
||||
href="{{ url_for('scheduled_inspections.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('scheduled_inspections.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>
|
||||
|
||||
<div class="card shadow-sm border-top-0" style="border-top-left-radius:0;border-top-right-radius:0;">
|
||||
<div class="card-body p-0">
|
||||
{% if schedules %}
|
||||
<div class="table-responsive">
|
||||
@@ -74,6 +92,11 @@
|
||||
{% else %}
|
||||
<span class="badge bg-secondary">Inactive</span>
|
||||
{% endif %}
|
||||
{% if s.last_completed_at %}
|
||||
<div class="small text-muted" title="Last completed">
|
||||
<i class="bi bi-check2"></i> {{ s.last_completed_at.strftime('%b %d, %Y') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{# Receipt confirmation by the assigned inspector (phase47). #}
|
||||
@@ -88,8 +111,8 @@
|
||||
<span class="badge bg-warning text-dark" title="The inspector has not confirmed receipt yet">
|
||||
<i class="bi bi-hourglass-split"></i> Awaiting
|
||||
</span>
|
||||
{# The assignee can confirm right here. #}
|
||||
{% if s.inspector_id == current_user.id %}
|
||||
{# The assignee can confirm right here (only while still active). #}
|
||||
{% if s.active and s.inspector_id == current_user.id %}
|
||||
<form method="POST" class="d-inline"
|
||||
action="{{ url_for('scheduled_inspections.acknowledge', schedule_id=s.id) }}">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
@@ -138,10 +161,14 @@
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="p-4 text-muted text-center">
|
||||
No scheduled inspections yet.
|
||||
{% if tab == 'completed' %}
|
||||
No completed scheduled inspections yet.
|
||||
{% else %}
|
||||
No pending scheduled inspections.
|
||||
{% if current_user.role in ['admin','director','project_manager','auditor'] %}
|
||||
<a href="{{ url_for('scheduled_inspections.create') }}">Create one</a>.
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user