Mar 04 2026: Implement customer's view functionalities - Phase 3

This commit is contained in:
2026-03-04 13:17:30 -05:00
parent a58a0c8ded
commit 0a7259ae72
8 changed files with 242 additions and 44 deletions
+2
View File
@@ -68,9 +68,11 @@
<a class="nav-link" href="{{ url_for('projects.index') }}">Projects</a>
</li>
{% endif %}
{% if current_user.role != 'customer' %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('templates.index') }}">Templates</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link" href="{{ url_for('inspections.index') }}">Inspections</a>
</li>
+53
View File
@@ -95,6 +95,59 @@
</div>
{% endif %}
{# ── Customer portal: scoped facilities panel ───────────────────────────── #}
{% if current_user.role == 'customer' %}
<div class="row g-3 mb-4">
<div class="col-12">
<div class="card shadow-sm">
<div class="card-header bg-light fw-semibold">
<i class="bi bi-building me-1"></i> Your Facilities
</div>
{% if customer_facilities %}
<div class="card-body p-0">
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead class="table-light">
<tr>
<th>Facility</th>
<th>Address</th>
<th>Project</th>
<th></th>
</tr>
</thead>
<tbody>
{% for f in customer_facilities %}
<tr>
<td><strong>{{ f.name }}</strong></td>
<td class="text-muted small">{{ f.address or '—' }}</td>
<td class="text-muted small">{{ f.project.name if f.project else '—' }}</td>
<td>
<a href="{{ url_for('facilities.view_facility', facility_id=f.id) }}"
class="btn btn-sm btn-outline-primary">
<i class="bi bi-eye"></i> View
</a>
<a href="{{ url_for('reports.facility_report', facility_id=f.id) }}"
class="btn btn-sm btn-outline-secondary ms-1">
<i class="bi bi-graph-up"></i> Report
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% else %}
<div class="card-body text-muted small">
<i class="bi bi-info-circle me-1"></i>
No facilities have been assigned to your account yet. Please contact your administrator.
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
{# ── System quick stats (admin/supervisor) ──────────────────────────────── #}
{% if current_user.role in ['admin', 'supervisor'] %}
<div class="row g-3 mb-4">
+2
View File
@@ -3,9 +3,11 @@
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-clipboard-data"></i> Inspections</h2>
{% if current_user.role != 'customer' %}
<a href="{{ url_for('inspections.start') }}" class="btn btn-primary">
<i class="bi bi-plus-circle"></i> Start Inspection
</a>
{% endif %}
</div>
{# Filters #}