93 lines
4.0 KiB
HTML
93 lines
4.0 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Inspection Schedules{% endblock %}
|
|
{% 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>
|
|
<a href="{{ url_for('inspection_schedules.create') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus-circle"></i> New Schedule
|
|
</a>
|
|
</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.
|
|
</p>
|
|
|
|
{% if schedules %}
|
|
<div class="card shadow-sm">
|
|
<div class="card-body p-0">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover mb-0 align-middle">
|
|
<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>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for s in schedules %}
|
|
<tr class="{{ 'text-muted' if not s.active else '' }}">
|
|
<td><strong>{{ s.name }}</strong></td>
|
|
<td>{{ s.template.name if s.template else '—' }}</td>
|
|
<td>
|
|
{{ s.facility.name if s.facility else '—' }}
|
|
{% if s.area %}<span class="text-muted small">/ {{ s.area.name }}</span>{% endif %}
|
|
</td>
|
|
<td>{{ s.inspector.display_name if s.inspector else '—' }}</td>
|
|
<td><span class="badge bg-secondary">{{ s.frequency|title }}</span></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 '—' }}
|
|
</td>
|
|
<td class="small text-muted">
|
|
{{ s.last_run_at.strftime('%Y-%m-%d %H:%M') if s.last_run_at else 'Never' }}
|
|
</td>
|
|
<td>
|
|
{% if s.active %}<span class="badge bg-success">Active</span>
|
|
{% else %}<span class="badge bg-secondary">Paused</span>{% endif %}
|
|
</td>
|
|
<td class="text-end">
|
|
<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>
|
|
</a>
|
|
<form method="POST"
|
|
action="{{ url_for('inspection_schedules.run_now', schedule_id=s.id) }}"
|
|
class="d-inline">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button type="submit" class="btn btn-sm btn-outline-primary" title="Create inspection now"
|
|
onclick="return confirm('Create an inspection from this schedule now?')">
|
|
<i class="bi bi-play-circle"></i>
|
|
</button>
|
|
</form>
|
|
<form method="POST"
|
|
action="{{ url_for('inspection_schedules.delete', schedule_id=s.id) }}"
|
|
class="d-inline"
|
|
onsubmit="return confirm('Delete this schedule? Existing inspections are not affected.')">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button type="submit" class="btn btn-sm btn-outline-danger" title="Delete">
|
|
<i class="bi bi-trash3"></i>
|
|
</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="card shadow-sm">
|
|
<div class="card-body text-center py-5 text-muted">
|
|
<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>
|
|
<a href="{{ url_for('inspection_schedules.create') }}" class="btn btn-primary">
|
|
<i class="bi bi-plus-circle"></i> Create First Schedule
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|