283 lines
14 KiB
HTML
283 lines
14 KiB
HTML
{% extends 'layouts/base.html' %}
|
|
{% load i18n static %}
|
|
|
|
{% block title %}{% trans "Create Standard" %}{% 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 "Create New Standard" %}</h1>
|
|
<p class="text-blue-100 text-sm">{% trans "Add a new compliance standard" %}</p>
|
|
</div>
|
|
<div class="flex gap-2">
|
|
{% if department_id %}
|
|
<a href="{% url 'standards:department_standards' pk=department_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 Department Standards" %}
|
|
</a>
|
|
{% else %}
|
|
<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>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-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">
|
|
<form method="post">
|
|
{% csrf_token %}
|
|
|
|
<div class="mb-4">
|
|
<label for="{{ form.source.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.source.label }} <span class="text-red-500">*</span>
|
|
</label>
|
|
{{ form.source }}
|
|
{% if form.source.help_text %}
|
|
<p class="mt-1 text-xs text-gray-500">{{ form.source.help_text }}</p>
|
|
{% endif %}
|
|
{% if form.source.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.source.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="{{ form.category.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.category.label }} <span class="text-red-500">*</span>
|
|
</label>
|
|
{{ form.category }}
|
|
{% if form.category.help_text %}
|
|
<p class="mt-1 text-xs text-gray-500">{{ form.category.help_text }}</p>
|
|
{% endif %}
|
|
{% if form.category.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.category.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="{{ form.code.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.code.label }} <span class="text-red-500">*</span>
|
|
</label>
|
|
{{ form.code }}
|
|
{% if form.code.help_text %}
|
|
<p class="mt-1 text-xs text-gray-500">{{ form.code.help_text }}</p>
|
|
{% endif %}
|
|
{% if form.code.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.code.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="{{ form.title.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.title.label }} <span class="text-red-500">*</span>
|
|
</label>
|
|
{{ form.title }}
|
|
{% if form.title.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.title.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="{{ form.title_ar.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.title_ar.label }}
|
|
</label>
|
|
{{ form.title_ar }}
|
|
{% if form.title_ar.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.title_ar.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="{{ form.description.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.description.label }} <span class="text-red-500">*</span>
|
|
</label>
|
|
{{ form.description }}
|
|
{% if form.description.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.description.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label for="{{ form.department.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.department.label }}
|
|
</label>
|
|
{{ form.department }}
|
|
<p class="mt-1 text-xs text-gray-500">{% trans "Leave empty to apply to all departments" %}</p>
|
|
{% if form.department.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.department.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-4 mb-4">
|
|
<div>
|
|
<label for="{{ form.effective_date.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.effective_date.label }}
|
|
</label>
|
|
{{ form.effective_date }}
|
|
{% if form.effective_date.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.effective_date.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
<div>
|
|
<label for="{{ form.review_date.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">
|
|
{{ form.review_date.label }}
|
|
</label>
|
|
{{ form.review_date }}
|
|
{% if form.review_date.errors %}
|
|
<p class="mt-1 text-xs text-red-600">{{ form.review_date.errors }}</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-6">
|
|
<label class="flex items-center">
|
|
{{ form.is_active }}
|
|
<span class="ml-2 text-sm text-gray-700">{{ form.is_active.label }}</span>
|
|
</label>
|
|
</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="save" class="w-4 h-4 me-2"></i>{% trans "Create Standard" %}
|
|
</button>
|
|
{% if department_id %}
|
|
<a href="{% url 'standards:department_standards' pk=department_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>
|
|
{% else %}
|
|
<a href="{% url 'standards:dashboard' %}" 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>
|
|
{% endif %}
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="lg:col-span-1">
|
|
<div class="section-card">
|
|
<div class="section-header">
|
|
<div class="section-icon bg-blue/10">
|
|
<i data-lucide="help-circle" class="w-5 h-5 text-blue"></i>
|
|
</div>
|
|
<h5 class="text-lg font-semibold text-gray-800">{% trans "Help" %}</h5>
|
|
</div>
|
|
<div class="p-6">
|
|
<div class="mb-4">
|
|
<h6 class="text-sm font-semibold text-gray-800 mb-2">{% trans "Standard Code Format" %}</h6>
|
|
<p class="text-xs text-gray-600 mb-2">
|
|
{% trans "Use a unique code to identify this standard" %}
|
|
</p>
|
|
<div class="text-xs text-gray-500 space-y-1">
|
|
<p><strong>{% trans "Examples:" %}</strong></p>
|
|
<p class="ml-2">• STD-001</p>
|
|
<p class="ml-2">• QM-05</p>
|
|
<p class="ml-2">• PS-12</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<h6 class="text-sm font-semibold text-gray-800 mb-2">{% trans "Department Assignment" %}</h6>
|
|
<p class="text-xs text-gray-600">
|
|
{% trans "Leave the department field empty if this standard applies to all departments. Select a specific department only if the standard is department-specific." %}
|
|
</p>
|
|
</div>
|
|
|
|
<div>
|
|
<h6 class="text-sm font-semibold text-gray-800 mb-2">{% trans "Dates" %}</h6>
|
|
<p class="text-xs text-gray-600">
|
|
{% trans "Effective date: When the standard becomes mandatory" %}<br>
|
|
{% trans "Review date: When the standard should be reviewed for updates" %}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const formInputs = document.querySelectorAll('input[type="text"], input[type="date"], select, textarea');
|
|
formInputs.forEach(input => {
|
|
if (!input.classList.contains('form-control') && input.type !== 'checkbox') {
|
|
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 checkboxes = document.querySelectorAll('input[type="checkbox"]');
|
|
checkboxes.forEach(checkbox => {
|
|
if (!checkbox.classList.contains('rounded')) {
|
|
checkbox.classList.add('rounded', 'border-gray-300', 'text-navy', 'focus:ring-navy', 'w-4', 'h-4');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|