HH/templates/organizations/orgsubsection_form.html
ismail 7369d08012
All checks were successful
Build and Push Docker Image / build (push) Successful in 4m14s
feat: unified reference numbers + feedback modules QA audit
Reference numbers (unified scheme PREFIX-YYYYMM-HOSP-NNNN, e.g. CMP-202606-HHN-0001):
- new ReferenceSequence model + generate_reference() helper (apps/core)
- Complaint/Inquiry/Observation/Appreciation/Suggestion emit unified refs via save()
- prefix-based auto-routing in public track API (CMP/INQ/OBS trackable; APR/SGT internal-only)
- removed legacy CMP-/INQ- generators in ui_views, integrations, px_sources
- migrations: core.0003_referencesequence, appreciation.0006, feedback.0008, observations.0012
- unit tests (format, sanitization, monthly reset, 40-thread concurrency)

QA audit:
- isolated E2E hospital sandbox mirroring HH-N + 10 role users (create_e2e_isolated_env)
- feedback-modules-audit.spec.ts + audit helper (headed, run-to-completion)
- reports/feedback-modules-qa-report.md

Also bundles accumulated in-progress work across complaints, observations,
organizations, templates, and other modules.
2026-06-14 14:29:23 +03:00

168 lines
8.1 KiB
HTML

{% extends 'layouts/base.html' %}
{% load i18n %}
{% block title %}{% if sub_section %}{% trans "Edit Sub-Section" %}{% else %}{% trans "Add Sub-Section" %}{% endif %} - PX360{% endblock %}
{% block extra_css %}
<style>
.page-header-gradient {
background: linear-gradient(135deg, #005696 0%, #0069a8 50%, #007bbd 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);
}
.form-section {
background: #fff;
border: 2px solid #e2e8f0;
border-radius: 1rem;
padding: 1.5rem;
margin-bottom: 1.5rem;
transition: all 0.3s ease;
}
.form-section:hover {
border-color: #005696;
box-shadow: 0 4px 12px rgba(0, 86, 150, 0.1);
}
.hh-btn-primary {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1.5rem;
background: #005696;
color: white;
border-radius: 0.75rem;
font-weight: 600;
transition: all 0.2s ease;
border: none;
cursor: pointer;
}
.hh-btn-primary:hover {
background: #007bbd;
}
.hh-btn-secondary {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1.5rem;
background: white;
color: #64748b;
border: 2px solid #e2e8f0;
border-radius: 0.75rem;
font-weight: 600;
transition: all 0.2s ease;
}
.hh-btn-secondary:hover {
background: #f1f5f9;
border-color: #005696;
}
</style>
{% endblock %}
{% block content %}
<!-- Gradient Header -->
<div class="page-header-gradient">
<div class="flex items-center gap-2 mb-3">
{% if sub_section %}
<a href="{% url 'organizations:orgsection_detail' sub_section.section.pk %}"
class="inline-flex items-center gap-2 px-4 py-2 bg-white/20 backdrop-blur-sm rounded-xl text-white hover:bg-white/30 transition text-sm font-semibold">
<i data-lucide="arrow-left" class="w-4 h-4"></i> {% trans "Back" %}
</a>
{% elif preselected_section %}
<a href="{% url 'organizations:orgsection_detail' preselected_section.pk %}"
class="inline-flex items-center gap-2 px-4 py-2 bg-white/20 backdrop-blur-sm rounded-xl text-white hover:bg-white/30 transition text-sm font-semibold">
<i data-lucide="arrow-left" class="w-4 h-4"></i> {% trans "Back" %}
</a>
{% else %}
<a href="{% url 'organizations:orgsubsection_list' %}"
class="inline-flex items-center gap-2 px-4 py-2 bg-white/20 backdrop-blur-sm rounded-xl text-white hover:bg-white/30 transition text-sm font-semibold">
<i data-lucide="arrow-left" class="w-4 h-4"></i> {% trans "Back" %}
</a>
{% endif %}
</div>
<h1 class="text-2xl font-bold">
{% if sub_section %}{% trans "Edit Sub-Section" %}{% else %}{% trans "Add Sub-Section" %}{% endif %}
</h1>
<p class="text-white/80 mt-1">
{% if sub_section %}{% trans "Update sub-section information" %}{% else %}{% trans "Create a new sub-section" %}{% endif %}
</p>
</div>
<div class="max-w-2xl mx-auto">
<div class="form-section">
<form method="post">
{% csrf_token %}
<div class="space-y-6">
<div>
<label for="subsection" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Parent Section" %} <span class="text-[#005696]">*</span></label>
{% if sub_section %}
<select class="w-full px-4 py-3 border border-gray-200 rounded-xl text-gray-800 bg-gray-100 cursor-not-allowed" id="section" name="section" disabled>
<option value="{{ sub_section.section.pk }}" selected>{{ sub_section.section.name_en }}</option>
</select>
<input type="hidden" name="section" value="{{ sub_section.section.pk }}">
{% else %}
<select class="w-full px-4 py-3 border border-gray-200 rounded-xl text-gray-800 focus:ring-2 focus:ring-[#005696] focus:border-transparent transition" id="section" name="section" data-tomselect required>
<option value="">{% trans "Select Section" %}</option>
{% for sec in org_sections %}
<option value="{{ sec.id }}" {% if preselected_section and preselected_section.pk == sec.id %}selected{% endif %}>{{ sec.name_en }} ({{ sec.department.get_localized_name }})</option>
{% endfor %}
</select>
{% endif %}
</div>
<div>
<label for="name_en" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Name (EN)" %} <span class="text-[#005696]">*</span></label>
<input type="text" class="w-full px-4 py-3 border border-gray-200 rounded-xl text-gray-800 focus:ring-2 focus:ring-[#005696] focus:border-transparent transition" id="name_en" name="name_en" value="{{ sub_section.name_en|default:'' }}" required placeholder="{% trans 'Enter sub-section name in English' %}">
</div>
<div>
<label for="name_ar" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Name (AR)" %}</label>
<input type="text" class="w-full px-4 py-3 border border-gray-200 rounded-xl text-gray-800 focus:ring-2 focus:ring-[#005696] focus:border-transparent transition" id="name_ar" name="name_ar" value="{{ sub_section.name_ar|default:'' }}" dir="rtl" placeholder="{% trans 'Enter sub-section name in Arabic' %}">
</div>
<div>
<label for="code" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Code" %}</label>
<input type="text" class="w-full px-4 py-3 border border-gray-200 rounded-xl text-gray-800 focus:ring-2 focus:ring-[#005696] focus:border-transparent transition" id="code" name="code" value="{{ sub_section.code|default:'' }}" placeholder="{% trans 'Enter sub-section code' %}">
</div>
<div>
<label for="status" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Status" %}</label>
<select class="w-full px-4 py-3 border border-gray-200 rounded-xl text-gray-800 focus:ring-2 focus:ring-[#005696] focus:border-transparent transition" id="status" name="status">
<option value="active" {% if sub_section.status == 'active' or not sub_section %}selected{% endif %}>{% trans "Active" %}</option>
<option value="inactive" {% if sub_section.status == 'inactive' %}selected{% endif %}>{% trans "Inactive" %}</option>
</select>
</div>
</div>
<div class="flex justify-end gap-3 mt-8 pt-6 border-t border-gray-100">
{% if sub_section %}
<a href="{% url 'organizations:orgsection_detail' sub_section.section.pk %}" class="hh-btn-secondary">
<i data-lucide="x" class="w-5 h-5"></i>
{% trans "Cancel" %}
</a>
{% elif preselected_section %}
<a href="{% url 'organizations:orgsection_detail' preselected_section.pk %}" class="hh-btn-secondary">
<i data-lucide="x" class="w-5 h-5"></i>
{% trans "Cancel" %}
</a>
{% else %}
<a href="{% url 'organizations:orgsubsection_list' %}" class="hh-btn-secondary">
<i data-lucide="x" class="w-5 h-5"></i>
{% trans "Cancel" %}
</a>
{% endif %}
<button type="submit" class="hh-btn-primary">
<i data-lucide="save" class="w-5 h-5"></i>
{% trans "Save" %}
</button>
</div>
</form>
</div>
</div>
{% endblock %}