266 lines
13 KiB
HTML
266 lines
13 KiB
HTML
{% extends 'layouts/base.html' %}
|
|
{% load i18n static %}
|
|
|
|
{% block title %}{% trans "Upload Evidence" %}{% 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;
|
|
}
|
|
|
|
.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">{% trans "Upload Evidence Attachment" %}</h1>
|
|
<p class="text-blue-100 text-sm">{{ compliance.standard.code }} - {{ compliance.standard.title }}</p>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
<a href="{% url 'standards:standard_compliance_update' compliance_id=compliance.id %}"
|
|
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 Assessment" %}
|
|
</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-green-100">
|
|
<i data-lucide="upload" class="w-5 h-5 text-green-600"></i>
|
|
</div>
|
|
<h5 class="text-lg font-semibold text-gray-800">{% trans "Upload New Attachment" %}</h5>
|
|
</div>
|
|
<div class="p-6">
|
|
<form method="post" enctype="multipart/form-data">
|
|
{% csrf_token %}
|
|
|
|
<div class="mb-4">
|
|
<label for="{{ form.file.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{% trans "File" %}
|
|
</label>
|
|
{{ form.file }}
|
|
{% if form.file.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.file.errors }}</p>
|
|
{% endif %}
|
|
<p class="mt-1 text-xs text-gray-500">
|
|
{% trans "Accepted formats: PDF, DOC, DOCX, XLS, XLSX, JPG, PNG" %}
|
|
</p>
|
|
</div>
|
|
|
|
<div class="mb-6">
|
|
<label for="{{ form.description.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{% trans "Description" %}
|
|
</label>
|
|
{{ form.description }}
|
|
{% if form.description.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.description.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="flex gap-3">
|
|
<button type="submit" class="btn-transition inline-flex items-center px-6 py-2.5 bg-green-500 text-white font-medium rounded-xl hover:bg-green-600 transition">
|
|
<i data-lucide="upload" class="w-4 h-4 me-2"></i>{% trans "Upload" %}
|
|
</button>
|
|
<a href="{% url 'standards:standard_compliance_update' compliance_id=compliance.id %}"
|
|
class="btn-transition inline-flex items-center px-6 py-2.5 bg-gray-100 text-gray-700 font-medium rounded-xl hover:bg-gray-200 transition">
|
|
{% trans "Cancel" %}
|
|
</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="lg:col-span-1">
|
|
<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 "Compliance Details" %}</h5>
|
|
</div>
|
|
<div class="p-6">
|
|
<dl class="divide-y divide-gray-100">
|
|
<div class="py-3">
|
|
<dt class="text-xs font-medium text-gray-500 mb-1">{% trans "Standard" %}</dt>
|
|
<dd class="text-sm font-semibold text-gray-900">{{ compliance.standard.code }}</dd>
|
|
</div>
|
|
<div class="py-3">
|
|
<dt class="text-xs font-medium text-gray-500 mb-1">{% trans "Title" %}</dt>
|
|
<dd class="text-sm text-gray-900">{{ compliance.standard.title }}</dd>
|
|
</div>
|
|
<div class="py-3">
|
|
<dt class="text-xs font-medium text-gray-500 mb-1">{% trans "Department" %}</dt>
|
|
<dd class="text-sm text-gray-900">{{ compliance.department.name }}</dd>
|
|
</div>
|
|
<div class="py-3">
|
|
<dt class="text-xs font-medium text-gray-500 mb-1">{% trans "Status" %}</dt>
|
|
<dd class="text-sm">
|
|
{% if compliance.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>{{ compliance.get_status_display }}
|
|
</span>
|
|
{% elif compliance.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>{{ compliance.get_status_display }}
|
|
</span>
|
|
{% elif compliance.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>{{ compliance.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>{{ compliance.get_status_display }}
|
|
</span>
|
|
{% endif %}
|
|
</dd>
|
|
</div>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% if compliance.attachments.all %}
|
|
<div class="section-card">
|
|
<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 "Existing Attachments" %}</h5>
|
|
</div>
|
|
<div class="p-0">
|
|
<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 "File Name" %}
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
{% trans "Description" %}
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
{% trans "Uploaded By" %}
|
|
</th>
|
|
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
{% trans "Date" %}
|
|
</th>
|
|
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
|
|
{% trans "Actions" %}
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="bg-white divide-y divide-gray-200">
|
|
{% for attachment in compliance.attachments.all %}
|
|
<tr class="hover:bg-gray-50 transition">
|
|
<td class="px-6 py-4 whitespace-nowrap">
|
|
<div class="flex items-center">
|
|
<i data-lucide="file" class="w-4 h-4 text-gray-400 mr-2"></i>
|
|
<span class="text-sm font-medium text-gray-900">{{ attachment.filename }}</span>
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<span class="text-sm text-gray-600">{{ attachment.description|default:"-" }}</span>
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">
|
|
{{ attachment.uploaded_by.get_full_name }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-600">
|
|
{{ attachment.created_at|date:"Y-m-d H:i" }}
|
|
</td>
|
|
<td class="px-6 py-4 whitespace-nowrap text-right">
|
|
<div class="flex gap-2 justify-end">
|
|
<a href="{{ attachment.file.url }}" target="_blank"
|
|
class="btn-transition inline-flex items-center px-3 py-1.5 bg-blue-500 text-white text-xs font-medium rounded-lg hover:bg-blue-600 transition">
|
|
<i data-lucide="download" class="w-3 h-3"></i>
|
|
</a>
|
|
<a href="{% url 'standards:attachment_delete' pk=attachment.id %}"
|
|
class="btn-transition inline-flex items-center px-3 py-1.5 bg-red-500 text-white text-xs font-medium rounded-lg hover:bg-red-600 transition">
|
|
<i data-lucide="trash-2" class="w-3 h-3"></i>
|
|
</a>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const formInputs = document.querySelectorAll('input[type="text"], textarea');
|
|
formInputs.forEach(input => {
|
|
if (!input.classList.contains('form-control') && input.type !== 'file') {
|
|
input.classList.add('w-full', 'px-4', 'py-2.5', 'border', 'border-gray-300', 'rounded-lg', 'focus:ring-2', 'focus:ring-navy', 'focus:border-transparent', 'transition');
|
|
}
|
|
});
|
|
|
|
const fileInputs = document.querySelectorAll('input[type="file"]');
|
|
fileInputs.forEach(input => {
|
|
if (!input.classList.contains('block')) {
|
|
input.classList.add('block', 'w-full', 'text-sm', 'text-gray-900', 'border', 'border-gray-300', 'rounded-lg', 'cursor-pointer', 'focus:outline-none', 'focus:ring-2', 'focus:ring-navy');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|