Phase 2: enhancements
This commit is contained in:
@@ -0,0 +1,128 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block title %}{{ template.name }}{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-md-8">
|
||||||
|
<h2><i class="bi bi-file-earmark-text"></i> {{ template.name }}</h2>
|
||||||
|
<p class="text-muted">{{ template.description or 'No description provided' }}</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 text-end">
|
||||||
|
{% if current_user.role in ['admin', 'supervisor'] %}
|
||||||
|
<a href="{{ url_for('templates.edit_template', template_id=template.id) }}" class="btn btn-primary">
|
||||||
|
<i class="bi bi-pencil"></i> Edit Template
|
||||||
|
</a>
|
||||||
|
<form method="POST" action="{{ url_for('templates.delete_template', template_id=template.id) }}" class="d-inline" onsubmit="return confirm('Delete this template? This action cannot be undone.');">
|
||||||
|
<button type="submit" class="btn btn-outline-danger">
|
||||||
|
<i class="bi bi-trash"></i> Delete
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-4">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card shadow-sm">
|
||||||
|
<div class="card-header bg-light">
|
||||||
|
<h5 class="mb-0">Template Details</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<table class="table table-sm table-borderless mb-0">
|
||||||
|
<tr>
|
||||||
|
<th width="40%">Frequency:</th>
|
||||||
|
<td>
|
||||||
|
<span class="badge bg-info">{{ template.frequency|title }}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Total Items:</th>
|
||||||
|
<td>{{ template.checklist_items.count() }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Created:</th>
|
||||||
|
<td>{{ template.created_at.strftime('%Y-%m-%d %H:%M') if template.created_at else 'N/A' }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Total Inspections:</th>
|
||||||
|
<td>{{ template.inspections.count() }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<div class="card shadow-sm">
|
||||||
|
<div class="card-header bg-light">
|
||||||
|
<h5 class="mb-0">Statistics</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col-6">
|
||||||
|
<h3 class="text-primary">{{ items_by_category|length }}</h3>
|
||||||
|
<small class="text-muted">Categories</small>
|
||||||
|
</div>
|
||||||
|
<div class="col-6">
|
||||||
|
<h3 class="text-success">{{ template.checklist_items.count() }}</h3>
|
||||||
|
<small class="text-muted">Checklist Items</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card shadow-sm">
|
||||||
|
<div class="card-header bg-light">
|
||||||
|
<h5 class="mb-0"><i class="bi bi-check2-square"></i> Checklist Preview</h5>
|
||||||
|
</div>
|
||||||
|
<div class="card-body">
|
||||||
|
{% if items_by_category %}
|
||||||
|
{% for category, items in items_by_category.items() %}
|
||||||
|
<div class="mb-4">
|
||||||
|
<h5 class="border-bottom pb-2 mb-3">
|
||||||
|
<i class="bi bi-folder"></i> {{ category }}
|
||||||
|
<span class="badge bg-secondary">{{ items|length }} items</span>
|
||||||
|
</h5>
|
||||||
|
|
||||||
|
<div class="list-group">
|
||||||
|
{% for item in items %}
|
||||||
|
<div class="list-group-item">
|
||||||
|
<div class="d-flex justify-content-between align-items-start">
|
||||||
|
<div class="flex-grow-1">
|
||||||
|
<div class="mb-2">
|
||||||
|
<span class="badge bg-info me-2">{{ item.scoring_type.replace('_', ' ')|title }}</span>
|
||||||
|
{% if item.requires_photo %}
|
||||||
|
<span class="badge bg-warning text-dark">
|
||||||
|
<i class="bi bi-camera"></i> Photo Required
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
|
<span class="badge bg-secondary">Weight: {{ item.weight }}</span>
|
||||||
|
</div>
|
||||||
|
<p class="mb-0">{{ item.item_description }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-info mb-0">
|
||||||
|
<i class="bi bi-info-circle"></i> No checklist items defined for this template yet.
|
||||||
|
{% if current_user.role in ['admin', 'supervisor'] %}
|
||||||
|
<a href="{{ url_for('templates.edit_template', template_id=template.id) }}" class="alert-link">Click here to add items.</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-3">
|
||||||
|
<a href="{{ url_for('templates.index') }}" class="btn btn-secondary">
|
||||||
|
<i class="bi bi-arrow-left"></i> Back to Templates
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user