Aug 19 - Update code to catch up with ST
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Inspection Schedules{% endblock %}
|
||||
{% block content %}
|
||||
{# Who may create/edit/delete a schedule — mirrors schedule_manager_required
|
||||
in routes/inspection_schedules.py. 'customer' is the Customer DIRECTOR, who
|
||||
plans work for their own facilities; a Customer Inspector ('external_inspector')
|
||||
performs schedules and is covered by is_inspector below. #}
|
||||
{% set can_manage_schedules = current_user.role in
|
||||
['admin','director','project_manager','auditor','customer'] %}
|
||||
<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' %}
|
||||
{% if can_manage_schedules %}
|
||||
<a href="{{ url_for('inspection_schedules.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle"></i> New Schedule
|
||||
</a>
|
||||
@@ -11,7 +17,7 @@
|
||||
</div>
|
||||
|
||||
<p class="text-muted small mb-4">
|
||||
{% if current_user.role == 'inspector' %}
|
||||
{% if current_user.is_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.
|
||||
@@ -134,14 +140,18 @@
|
||||
</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{# Start is for whoever must DO the work. A Customer Director can
|
||||
plan a schedule but never execute one — the route 403s them, so
|
||||
the button must not be offered either. #}
|
||||
{% if s.active and s.mode == 'plan'
|
||||
and (current_user.role != 'inspector' or s.inspector_id == current_user.id) %}
|
||||
and current_user.role != 'customer'
|
||||
and (not current_user.is_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' %}
|
||||
{% if can_manage_schedules %}
|
||||
<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>
|
||||
@@ -191,7 +201,7 @@
|
||||
{% 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' %}
|
||||
{% if can_manage_schedules %}
|
||||
<a href="{{ url_for('inspection_schedules.create') }}" class="btn btn-primary">
|
||||
<i class="bi bi-plus-circle"></i> Create First Schedule
|
||||
</a>
|
||||
|
||||
Reference in New Issue
Block a user