174 lines
9.2 KiB
HTML
174 lines
9.2 KiB
HTML
{% extends 'layouts/base.html' %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{% if department %}{% trans "Edit Department" %}{% else %}{% trans "Add Department" %}{% 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 %}
|
|
<div class="page-header-gradient">
|
|
<div class="flex items-center gap-2 mb-3">
|
|
<a href="{% url 'organizations:department_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 department %}{% trans "Edit Department" %}{% else %}{% trans "Add Department" %}{% endif %}
|
|
</h1>
|
|
<p class="text-white/80 mt-1">
|
|
{% if department %}{% trans "Update department information" %}{% else %}{% trans "Create a new hospital department" %}{% 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-red-500">*</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="{{ department.name|default:'' }}" required placeholder="{% trans 'Enter department 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="{{ department.name_ar|default:'' }}" dir="rtl" placeholder="{% trans 'Enter department name in Arabic' %}">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="code" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Code" %} <span class="text-red-500">*</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="code" name="code" value="{{ department.code|default:'' }}" required placeholder="{% trans 'Enter department code' %}">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="category" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Category" %}</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="category" name="category">
|
|
<option value="">{% trans "Select Category" %}</option>
|
|
<option value="nursing" {% if department.category == 'nursing' %}selected{% endif %}>{% trans "Nursing" %}</option>
|
|
<option value="support_services" {% if department.category == 'support_services' %}selected{% endif %}>{% trans "Support Services" %}</option>
|
|
<option value="medical" {% if department.category == 'medical' %}selected{% endif %}>{% trans "Medical" %}</option>
|
|
<option value="non_medical" {% if department.category == 'non_medical' %}selected{% endif %}>{% trans "Non-Medical" %}</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div>
|
|
<label for="manager" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Manager" %}</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="manager" name="manager">
|
|
<option value="">{% trans "No Manager" %}</option>
|
|
{% for m in managers %}
|
|
<option value="{{ m.user_id }}" {% if department.manager_id == m.user_id %}selected{% endif %}>{{ m.first_name }} {{ m.last_name }}{% if m.job_title %} — {{ m.job_title }}{% endif %}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
{% if not department %}
|
|
<div>
|
|
<label for="hospital" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Hospital" %} <span class="text-red-500">*</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="hospital" name="hospital" data-tomselect required>
|
|
<option value="">{% trans "Select Hospital" %}</option>
|
|
{% for h in hospitals %}
|
|
<option value="{{ h.id }}">{{ h.get_localized_name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div>
|
|
<label for="phone" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Phone" %}</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="phone" name="phone" value="{{ department.phone|default:'' }}" placeholder="{% trans 'Phone number' %}">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="email" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Email" %}</label>
|
|
<input type="email" 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="email" name="email" value="{{ department.email|default:'' }}" placeholder="{% trans 'Email address' %}">
|
|
</div>
|
|
|
|
<div>
|
|
<label for="location" class="block text-sm font-semibold text-gray-700 mb-2">{% trans "Location" %}</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="location" name="location" value="{{ department.location|default:'' }}" placeholder="{% trans 'Building/Floor/Room' %}">
|
|
</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 department.status == 'active' or not department %}selected{% endif %}>{% trans "Active" %}</option>
|
|
<option value="inactive" {% if department.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:department_list' %}" class="hh-btn hh-btn-secondary">
|
|
<i data-lucide="x" class="w-5 h-5"></i>
|
|
{% trans "Cancel" %}
|
|
</a>
|
|
<button type="submit" class="hh-btn hh-btn-primary">
|
|
<i data-lucide="save" class="w-5 h-5"></i>
|
|
{% trans "Save" %}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|