HH/templates/organizations/subsection_form.html
2026-02-22 08:35:53 +03:00

67 lines
4.3 KiB
HTML

{% extends 'layouts/base.html' %}
{% load i18n %}
{% block title %}{% if subsection %}{% trans "Edit Subsection" %}{% else %}{% trans "Add Subsection" %}{% endif %} - PX360{% endblock %}
{% block content %}
<div class="max-w-2xl mx-auto">
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-800 mb-2">
{% if subsection %}{% trans "Edit Subsection" %}{% else %}{% trans "Add Subsection" %}{% endif %}
</h1>
<p class="text-gray-400">
{% if subsection %}{% trans "Update subsection information" %}{% else %}{% trans "Create a new subsection" %}{% endif %}
</p>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-50 overflow-hidden">
<form method="post">
{% csrf_token %}
<div class="p-6 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="px-6 py-4 bg-gray-50 border-t border-gray-100 flex justify-end gap-3">
<a href="{% url 'organizations:subsection_list' %}" class="px-6 py-3 bg-gray-200 text-gray-700 rounded-xl font-semibold hover:bg-gray-300 transition">
{% trans "Cancel" %}
</a>
<button type="submit" class="px-6 py-3 bg-light0 text-white rounded-xl font-bold hover:bg-navy transition shadow-lg shadow-blue-200">
{% trans "Save" %}
</button>
</div>
</form>
</div>
</div>
{% endblock %}