HH/templates/standards/standard_detail.html
2026-03-09 16:10:24 +03:00

295 lines
15 KiB
HTML

{% extends 'layouts/base.html' %}
{% load i18n static %}
{% load standards_filters %}
{% block title %}{{ standard.code }} - {% trans "Standard Details" %}{% endblock %}
{% block extra_css %}
<style>
:root {
--hh-navy: #005696;
--hh-blue: #007bbd;
--hh-light: #eef6fb;
--hh-slate: #64748b;
}
.page-header-gradient {
background: linear-gradient(135deg, var(--hh-navy) 0%, #0069a8 50%, var(--hh-blue) 100%);
color: white;
padding: 1.5rem 2rem;
border-radius: 1rem;
margin-bottom: 1.5rem;
box-shadow: 0 10px 15px -3px rgba(0, 86, 150, 0.2);
}
.section-card {
background: white;
border-radius: 1rem;
border: 2px solid #e2e8f0;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
overflow: hidden;
transition: all 0.3s ease;
}
.section-card:hover {
border-color: #005696;
box-shadow: 0 10px 25px -5px rgba(0, 86, 150, 0.15);
}
.section-header {
padding: 1rem 1.5rem;
border-bottom: 2px solid #e2e8f0;
background: linear-gradient(to right, #f8fafc, #f1f5f9);
display: flex;
align-items: center;
gap: 0.75rem;
}
.section-icon {
width: 40px;
height: 40px;
border-radius: 0.75rem;
display: flex;
align-items: center;
justify-content: center;
}
.stat-card {
background: white;
border-radius: 1rem;
border: 2px solid #e2e8f0;
padding: 1.5rem;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
}
.stat-card:hover {
transform: translateY(-2px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
border-color: #005696;
}
.btn-transition {
transition: all 0.2s ease-in-out;
}
</style>
{% endblock %}
{% block content %}
<div class="px-6 py-4">
<div class="page-header-gradient">
<div class="flex justify-between items-center">
<div>
<h1 class="text-2xl font-bold mb-1">{{ standard.code }}</h1>
<p class="text-blue-100 text-sm">{{ standard.title }}</p>
</div>
<div class="flex gap-2">
{% if is_px_admin %}
<a href="{% url 'standards:standard_update' pk=standard.pk %}" class="btn-transition inline-flex items-center px-4 py-2.5 bg-green-500 text-white font-medium rounded-xl hover:bg-green-600 transition">
<i data-lucide="edit-2" class="w-4 h-4 me-2"></i>{% trans "Edit" %}
</a>
<a href="{% url 'standards:standard_delete' pk=standard.pk %}" class="btn-transition inline-flex items-center px-4 py-2.5 bg-red-500 text-white font-medium rounded-xl hover:bg-red-600 transition">
<i data-lucide="trash-2" class="w-4 h-4 me-2"></i>{% trans "Delete" %}
</a>
{% endif %}
<a href="{% url 'standards:dashboard' %}" class="btn-transition inline-flex items-center px-4 py-2.5 bg-white/10 border-2 border-white/30 text-white font-medium rounded-xl hover:bg-white hover:text-navy transition">
<i data-lucide="arrow-left" class="w-4 h-4 me-2"></i>{% trans "Back to Dashboard" %}
</a>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
<div class="lg:col-span-2">
<div class="section-card">
<div class="section-header">
<div class="section-icon bg-navy/10">
<i data-lucide="clipboard-list" class="w-5 h-5 text-navy"></i>
</div>
<h5 class="text-lg font-semibold text-gray-800">{% trans "Standard Information" %}</h5>
</div>
<div class="p-6">
<dl class="divide-y divide-gray-100">
<div class="py-3 flex justify-between">
<dt class="text-sm font-medium text-gray-500">{% trans "Source" %}</dt>
<dd class="text-sm font-semibold text-gray-900">{{ standard.source.name }}</dd>
</div>
<div class="py-3 flex justify-between">
<dt class="text-sm font-medium text-gray-500">{% trans "Category" %}</dt>
<dd class="text-sm font-semibold text-gray-900">{{ standard.category.name }}</dd>
</div>
<div class="py-3 flex justify-between">
<dt class="text-sm font-medium text-gray-500">{% trans "Department" %}</dt>
<dd class="text-sm font-semibold text-gray-900">
{% if standard.department %}
{{ standard.department.name }}
{% else %}
<span class="text-gray-400 italic">{% trans "All Departments" %}</span>
{% endif %}
</dd>
</div>
<div class="py-3 flex justify-between">
<dt class="text-sm font-medium text-gray-500">{% trans "Effective Date" %}</dt>
<dd class="text-sm font-semibold text-gray-900">
{% if standard.effective_date %}
{{ standard.effective_date|date:"Y-m-d" }}
{% else %}
<span class="text-gray-400 italic">{% trans "Not specified" %}</span>
{% endif %}
</dd>
</div>
<div class="py-3 flex justify-between">
<dt class="text-sm font-medium text-gray-500">{% trans "Review Date" %}</dt>
<dd class="text-sm font-semibold text-gray-900">
{% if standard.review_date %}
{{ standard.review_date|date:"Y-m-d" }}
{% else %}
<span class="text-gray-400 italic">{% trans "Not specified" %}</span>
{% endif %}
</dd>
</div>
</dl>
</div>
</div>
</div>
<div class="lg:col-span-1">
<div class="stat-card">
<div class="text-center mb-4">
<div class="text-4xl font-bold text-navy mb-1">{{ compliance_records.count }}</div>
<div class="text-sm text-gray-600">{% trans "Assessments" %}</div>
</div>
<div class="space-y-2">
<div class="flex items-center justify-between p-2 bg-green-50 rounded-lg">
<span class="text-sm text-gray-700">{% trans "Met" %}</span>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-semibold bg-green-100 text-green-800">
{{ compliance_records|count_by:"status:met" }}
</span>
</div>
<div class="flex items-center justify-between p-2 bg-yellow-50 rounded-lg">
<span class="text-sm text-gray-700">{% trans "Partially Met" %}</span>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-semibold bg-yellow-100 text-yellow-800">
{{ compliance_records|count_by:"status:partially_met" }}
</span>
</div>
<div class="flex items-center justify-between p-2 bg-red-50 rounded-lg">
<span class="text-sm text-gray-700">{% trans "Not Met" %}</span>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-semibold bg-red-100 text-red-800">
{{ compliance_records|count_by:"status:not_met" }}
</span>
</div>
<div class="flex items-center justify-between p-2 bg-gray-50 rounded-lg">
<span class="text-sm text-gray-700">{% trans "Not Assessed" %}</span>
<span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-semibold bg-gray-100 text-gray-800">
{{ compliance_records|count_by:"status:not_assessed" }}
</span>
</div>
</div>
</div>
</div>
</div>
<div class="section-card mb-6">
<div class="section-header">
<div class="section-icon bg-blue/10">
<i data-lucide="file-text" class="w-5 h-5 text-blue"></i>
</div>
<h5 class="text-lg font-semibold text-gray-800">{% trans "Description" %}</h5>
</div>
<div class="p-6">
<div class="text-sm text-gray-700 leading-relaxed">
{{ standard.description|linebreaks }}
</div>
</div>
</div>
<div class="section-card">
<div class="section-header">
<div class="section-icon bg-navy/10">
<i data-lucide="building-2" class="w-5 h-5 text-navy"></i>
</div>
<h5 class="text-lg font-semibold text-gray-800">{% trans "Compliance by Department" %}</h5>
</div>
<div class="p-0">
{% if compliance_records %}
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{% trans "Department" %}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{% trans "Status" %}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{% trans "Last Assessed" %}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{% trans "Assessor" %}
</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
{% trans "Evidence" %}
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
{% for record in compliance_records %}
<tr class="hover:bg-gray-50 transition">
<td class="px-6 py-4 whitespace-nowrap">
<a href="{% url 'standards:department_standards' pk=record.department.id %}" class="text-sm font-medium text-gray-900 hover:text-navy transition">
{{ record.department.name }}
</a>
</td>
<td class="px-6 py-4 whitespace-nowrap">
{% if record.status == 'met' %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800">
<i data-lucide="check-circle" class="w-3 h-3 me-1"></i>{{ record.get_status_display }}
</span>
{% elif record.status == 'partially_met' %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
<i data-lucide="alert-circle" class="w-3 h-3 me-1"></i>{{ record.get_status_display }}
</span>
{% elif record.status == 'not_met' %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800">
<i data-lucide="x-circle" class="w-3 h-3 me-1"></i>{{ record.get_status_display }}
</span>
{% else %}
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
<i data-lucide="help-circle" class="w-3 h-3 me-1"></i>{{ record.get_status_display }}
</span>
{% endif %}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">
{% if record.last_assessed_date %}
{{ record.last_assessed_date|date:"Y-m-d" }}
{% else %}
<span class="text-gray-400 italic">{% trans "Not assessed" %}</span>
{% endif %}
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">
{% if record.assessor %}
{{ record.assessor.get_full_name }}
{% else %}
<span class="text-gray-400">-</span>
{% endif %}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="inline-flex items-center px-3 py-1 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
<i data-lucide="file-text" class="w-3 h-3 me-1"></i>{{ record.attachments.count }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-center py-12 text-gray-500">
<i data-lucide="inbox" class="w-12 h-12 mx-auto mb-3 text-gray-300"></i>
<p>{% trans "No compliance assessments yet" %}</p>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}