HH/templates/organizations/section_form.html
2026-03-15 23:48:45 +03:00

137 lines
6.0 KiB
HTML

{% extends 'layouts/base.html' %}
{% load i18n %}
{% block title %}{% if section %}{% trans "Edit Section" %}{% else %}{% trans "Add 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);
}
.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;
}
.btn-primary:hover {
background: #007bbd;
}
.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;
}
.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">
<a href="{% url 'organizations:section_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>
</div>
<h1 class="text-2xl font-bold">
{% if section %}{% trans "Edit Section" %}{% else %}{% trans "Add Section" %}{% endif %}
</h1>
<p class="text-white/80 mt-1">
{% if section %}{% trans "Update section information" %}{% else %}{% trans "Create a new hospital 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="name" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Name" %} <span class="text-navy">*</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-navy focus:border-transparent transition" id="name" name="name" value="{{ section.name|default:'' }}" required placeholder="{% trans 'Enter section name' %}">
</div>
<div>
<label for="name_ar" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Name (Arabic)" %}</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-navy focus:border-transparent transition" id="name_ar" name="name_ar" value="{{ section.name_ar|default:'' }}" dir="rtl" placeholder="{% trans 'Enter 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-navy focus:border-transparent transition" id="code" name="code" value="{{ section.code|default:'' }}" placeholder="{% trans 'Enter section code' %}">
</div>
<div>
<label for="department" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Department" %} <span class="text-navy">*</span></label>
<select class="w-full px-4 py-3 border border-gray-200 rounded-xl text-gray-800 focus:ring-2 focus:ring-navy focus:border-transparent transition" id="department" name="department" required>
<option value="">{% trans "Select Department" %}</option>
{% for dept in departments %}
<option value="{{ dept.id }}" {% if section.department_id == dept.id %}selected{% endif %}>{{ dept.name }} ({{ dept.hospital.name }})</option>
{% endfor %}
</select>
</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-navy focus:border-transparent transition" id="status" name="status">
<option value="active" {% if section.status == 'active' or not section %}selected{% endif %}>{% trans "Active" %}</option>
<option value="inactive" {% if 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">
<a href="{% url 'organizations:section_list' %}" class="btn-secondary">
<i data-lucide="x" class="w-5 h-5"></i>
{% trans "Cancel" %}
</a>
<button type="submit" class="btn-primary">
<i data-lucide="save" class="w-5 h-5"></i>
{% trans "Save" %}
</button>
</div>
</form>
</div>
</div>
{% endblock %}