Jul 17 - Fill the gaps between Single-tenant mode and Multi-tenant mode - MT4
This commit is contained in:
@@ -39,6 +39,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">Mode</label>
|
||||
<select name="mode" class="form-select">
|
||||
<option value="auto" {{ 'selected' if not schedule or schedule.mode != 'plan' }}>
|
||||
Auto — create the inspection automatically each period</option>
|
||||
<option value="plan" {{ 'selected' if schedule and schedule.mode == 'plan' }}>
|
||||
Plan — inspector presses Start (with due/overdue reminders)</option>
|
||||
</select>
|
||||
<div class="form-text">
|
||||
Auto drops an in-progress inspection into the inspector's queue on
|
||||
schedule. Plan assigns a due date and reminds them the day before, on
|
||||
the day, and alerts managers once it's overdue.
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">Notes for the inspector <span class="text-muted small">(optional)</span></label>
|
||||
<textarea name="notes" class="form-control" rows="2"
|
||||
placeholder="Anything the inspector should know before starting">{{ schedule.notes if schedule and schedule.notes else '' }}</textarea>
|
||||
<div class="form-text">Copied onto the inspection when it starts.</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">Facility</label>
|
||||
@@ -80,8 +103,12 @@
|
||||
<label class="form-check-label" for="activeSwitch">Active</label>
|
||||
</div>
|
||||
<p class="text-muted small">
|
||||
Saving recomputes the next run from now. Next run:
|
||||
Saving recomputes the next {{ 'due date' if schedule.mode == 'plan' else 'run' }}
|
||||
from now, and resets this occurrence's reminders. Currently:
|
||||
{{ schedule.next_run_at.strftime('%Y-%m-%d %H:%M') if schedule.next_run_at else '—' }}
|
||||
{% if schedule.last_completed_at %}
|
||||
· last completed {{ schedule.last_completed_at.strftime('%Y-%m-%d %H:%M') }}
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -3,15 +3,24 @@
|
||||
{% block content %}
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2><i class="bi bi-calendar2-week"></i> Inspection Schedules</h2>
|
||||
{% if current_user.role != 'inspector' %}
|
||||
<a href="{{ url_for('inspection_schedules.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle"></i> New Schedule
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<p class="text-muted small mb-4">
|
||||
Recurring schedules automatically create an in-progress inspection for the
|
||||
assigned inspector each period. The inspector is notified and opens it from
|
||||
their Inspections list to complete it.
|
||||
{% if current_user.role == 'inspector' %}
|
||||
Inspections scheduled for you. <strong>Auto</strong> schedules appear in your
|
||||
Inspections list on their own each period; <strong>Plan</strong> schedules wait
|
||||
for you to press Start.
|
||||
{% else %}
|
||||
<strong>Auto</strong> schedules automatically create an in-progress inspection
|
||||
for the assigned inspector each period. <strong>Plan</strong> schedules assign a
|
||||
due date and let the inspector press Start when they begin — with reminders the
|
||||
day before, on the day, and an alert to managers once overdue.
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
{% if schedules %}
|
||||
@@ -22,8 +31,8 @@
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Name</th><th>Template</th><th>Facility / Area</th>
|
||||
<th>Inspector</th><th>Frequency</th><th>Next Run</th>
|
||||
<th>Last Run</th><th>Status</th><th width="150"></th>
|
||||
<th>Inspector</th><th>Frequency</th><th>Mode</th><th>Next Due</th>
|
||||
<th>Last Run</th><th>Status</th><th width="190"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -37,8 +46,18 @@
|
||||
</td>
|
||||
<td>{{ s.inspector.display_name if s.inspector else '—' }}</td>
|
||||
<td><span class="badge bg-secondary">{{ s.frequency|title }}</span></td>
|
||||
<td>
|
||||
{% if s.mode == 'plan' %}
|
||||
<span class="badge bg-info text-dark" title="Inspector presses Start">Plan</span>
|
||||
{% else %}
|
||||
<span class="badge bg-light text-dark border" title="Cron creates the inspection">Auto</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="small {{ 'text-danger fw-semibold' if s.active and s.next_run_at and s.next_run_at <= now else 'text-muted' }}">
|
||||
{{ s.next_run_at.strftime('%Y-%m-%d %H:%M') if s.next_run_at else '—' }}
|
||||
{% if s.is_overdue(today) %}
|
||||
<span class="badge bg-danger ms-1">Overdue</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="small text-muted">
|
||||
{{ s.last_run_at.strftime('%Y-%m-%d %H:%M') if s.last_run_at else 'Never' }}
|
||||
@@ -48,6 +67,14 @@
|
||||
{% else %}<span class="badge bg-secondary">Paused</span>{% endif %}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
{% if s.active and s.mode == 'plan'
|
||||
and (current_user.role != 'inspector' or s.inspector_id == current_user.id) %}
|
||||
<a href="{{ url_for('inspection_schedules.start', schedule_id=s.id) }}"
|
||||
class="btn btn-sm btn-primary" title="Start this inspection now">
|
||||
<i class="bi bi-play-fill"></i> Start
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if current_user.role != 'inspector' %}
|
||||
<a href="{{ url_for('inspection_schedules.edit', schedule_id=s.id) }}"
|
||||
class="btn btn-sm btn-outline-secondary" title="Edit">
|
||||
<i class="bi bi-pencil"></i>
|
||||
@@ -70,6 +97,7 @@
|
||||
<i class="bi bi-trash3"></i>
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user