67 lines
4.3 KiB
HTML
67 lines
4.3 KiB
HTML
{% extends 'layouts/base.html' %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% if section %}{% trans "Edit Section" %}{% else %}{% trans "Add Section" %}{% 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 section %}{% trans "Edit Section" %}{% else %}{% trans "Add Section" %}{% endif %}
|
|
</h1>
|
|
<p class="text-gray-400">
|
|
{% if section %}{% trans "Update section information" %}{% else %}{% trans "Create a new hospital section" %}{% 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="{{ 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="px-6 py-4 bg-gray-50 border-t border-gray-100 flex justify-end gap-3">
|
|
<a href="{% url 'organizations:section_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 %} |