HH/templates/complaints/partials/departments_panel.html
2026-02-22 08:35:53 +03:00

97 lines
5.4 KiB
HTML

{% load i18n %}
<section class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100">
<div class="flex justify-between items-center mb-6">
<h3 class="text-xl font-bold text-navy">{% trans "Involved Departments" %}</h3>
{% if can_edit %}
<a href="{% url 'complaints:involved_department_add' complaint_pk=complaint.pk %}"
class="px-4 py-2 bg-gradient-to-r from-navy to-blue text-white rounded-xl font-semibold hover:opacity-90 transition flex items-center gap-2">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "Add Department" %}
</a>
{% endif %}
</div>
{% if complaint.involved_departments.exists %}
<div class="space-y-4">
{% for dept in complaint.involved_departments.all %}
<div class="bg-white border border-slate-200 rounded-xl p-5 hover:shadow-md transition {% if dept.is_primary %}border-l-4 border-l-navy{% endif %}">
<div class="flex justify-between items-start">
<div class="flex-1">
<div class="flex items-center gap-3 mb-2">
<h4 class="font-bold text-navy">{{ dept.department.name }}</h4>
{% if dept.is_primary %}
<span class="px-2 py-1 bg-navy text-white rounded-lg text-xs font-bold">{% trans "PRIMARY" %}</span>
{% endif %}
<span class="px-2 py-1 bg-light text-navy rounded-lg text-xs font-semibold">{{ dept.get_role_display }}</span>
</div>
{% if dept.assigned_to %}
<div class="flex items-center gap-2 text-sm text-slate mb-2">
<i data-lucide="user-check" class="w-4 h-4 text-blue"></i>
<span>{% trans "Assigned to:" %} <strong>{{ dept.assigned_to.get_full_name }}</strong></span>
{% if dept.assigned_at %}
<span class="text-slate">({{ dept.assigned_at|date:"M d, Y" }})</span>
{% endif %}
</div>
{% endif %}
{% if dept.notes %}
<div class="bg-slate-50 rounded-lg p-3 mt-2">
<p class="text-sm text-slate">{{ dept.notes }}</p>
</div>
{% endif %}
{% if dept.response_submitted %}
<div class="bg-green-50 border border-green-200 rounded-lg p-3 mt-3">
<div class="flex items-center gap-2 mb-1">
<i data-lucide="check-circle" class="w-4 h-4 text-green-500"></i>
<span class="text-sm font-semibold text-green-700">{% trans "Response Submitted" %}</span>
<span class="text-xs text-slate">{{ dept.response_submitted_at|date:"M d, Y H:i" }}</span>
</div>
{% if dept.response_notes %}
<p class="text-sm text-slate-700 mt-1">{{ dept.response_notes }}</p>
{% endif %}
</div>
{% endif %}
</div>
{% if can_edit %}
<div class="flex items-center gap-2 ml-4">
{% if not dept.response_submitted %}
<form method="post" action="{% url 'complaints:involved_department_response' pk=dept.pk %}" class="inline">
{% csrf_token %}
<button type="submit" class="p-2 text-slate hover:text-blue transition" title="{% trans 'Submit Response' %}">
<i data-lucide="message-square" class="w-5 h-5"></i>
</button>
</form>
{% endif %}
<a href="{% url 'complaints:involved_department_edit' pk=dept.pk %}"
class="p-2 text-slate hover:text-navy transition" title="{% trans 'Edit' %}">
<i data-lucide="edit-2" class="w-5 h-5"></i>
</a>
<form method="post" action="{% url 'complaints:involved_department_remove' pk=dept.pk %}"
class="inline" onsubmit="return confirm('{% trans "Are you sure you want to remove this department?" %}')">
{% csrf_token %}
<button type="submit" class="p-2 text-slate hover:text-red-500 transition" title="{% trans 'Remove' %}">
<i data-lucide="trash-2" class="w-5 h-5"></i>
</button>
</form>
</div>
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-center py-12">
<i data-lucide="building-2" class="w-16 h-16 mx-auto text-slate-300 mb-4"></i>
<p class="text-slate mb-4">{% trans "No departments involved yet" %}</p>
{% if can_edit %}
<a href="{% url 'complaints:involved_department_add' complaint_pk=complaint.pk %}"
class="px-4 py-2 bg-gradient-to-r from-navy to-blue text-white rounded-xl font-semibold hover:opacity-90 transition inline-flex items-center gap-2">
<i data-lucide="plus" class="w-4 h-4"></i> {% trans "Add First Department" %}
</a>
{% endif %}
</div>
{% endif %}
</section>