137 lines
6.0 KiB
HTML
137 lines
6.0 KiB
HTML
{% extends 'layouts/base.html' %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% if subsection %}{% trans "Edit Subsection" %}{% else %}{% trans "Add Subsection" %}{% 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:subsection_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 subsection %}{% trans "Edit Subsection" %}{% else %}{% trans "Add Subsection" %}{% endif %}
|
|
</h1>
|
|
<p class="text-white/80 mt-1">
|
|
{% if subsection %}{% trans "Update subsection information" %}{% else %}{% trans "Create a new subsection" %}{% 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="{{ subsection.name|default:'' }}" required placeholder="{% trans 'Enter subsection 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="{{ subsection.name_ar|default:'' }}" dir="rtl" placeholder="{% trans 'Enter subsection 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="{{ subsection.code|default:'' }}" placeholder="{% trans 'Enter subsection code' %}">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="section" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Section" %} <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="section" name="section" required>
|
|
<option value="">{% trans "Select Section" %}</option>
|
|
{% for sec in sections %}
|
|
<option value="{{ sec.id }}" {% if subsection.section_id == sec.id %}selected{% endif %}>{{ sec.name }} ({{ sec.department.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 subsection.status == 'active' or not subsection %}selected{% endif %}>{% trans "Active" %}</option>
|
|
<option value="inactive" {% if subsection.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:subsection_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 %}
|