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

104 lines
5.8 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 Staff" %}</h3>
{% if can_edit %}
<a href="{% url 'complaints:involved_staff_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 Staff" %}
</a>
{% endif %}
</div>
{% if complaint.involved_staff.exists %}
<div class="space-y-4">
{% for staff_inv in complaint.involved_staff.all %}
<div class="bg-white border border-slate-200 rounded-xl p-5 hover:shadow-md transition">
<div class="flex justify-between items-start">
<div class="flex-1">
<div class="flex items-center gap-3 mb-2">
<div class="w-10 h-10 bg-light rounded-full flex items-center justify-center">
<i data-lucide="user" class="w-5 h-5 text-navy"></i>
</div>
<div>
<h4 class="font-bold text-navy">{{ staff_inv.staff }}</h4>
<span class="px-2 py-0.5 bg-light text-navy rounded text-xs font-semibold">{{ staff_inv.get_role_display }}</span>
</div>
</div>
{% if staff_inv.staff.department %}
<div class="flex items-center gap-2 text-sm text-slate mb-2">
<i data-lucide="building-2" class="w-4 h-4 text-slate"></i>
<span>{{ staff_inv.staff.department.name }}</span>
</div>
{% endif %}
{% if staff_inv.notes %}
<div class="bg-slate-50 rounded-lg p-3 mt-2">
<p class="text-sm text-slate">{{ staff_inv.notes }}</p>
</div>
{% endif %}
{% if staff_inv.explanation_received %}
<div class="bg-blue-50 border border-blue-200 rounded-lg p-3 mt-3">
<div class="flex items-center gap-2 mb-1">
<i data-lucide="message-circle" class="w-4 h-4 text-blue"></i>
<span class="text-sm font-semibold text-blue-700">{% trans "Explanation Submitted" %}</span>
<span class="text-xs text-slate">{{ staff_inv.explanation_received_at|date:"M d, Y H:i" }}</span>
</div>
{% if staff_inv.explanation %}
<p class="text-sm text-slate-700 mt-1">{{ staff_inv.explanation }}</p>
{% endif %}
</div>
{% elif staff_inv.explanation_requested %}
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-3 mt-3">
<div class="flex items-center gap-2">
<i data-lucide="clock" class="w-4 h-4 text-yellow-500"></i>
<span class="text-sm font-semibold text-yellow-700">{% trans "Explanation Requested" %}</span>
<span class="text-xs text-slate">{{ staff_inv.explanation_requested_at|date:"M d, Y" }}</span>
</div>
</div>
{% endif %}
</div>
{% if can_edit %}
<div class="flex items-center gap-2 ml-4">
{% if not staff_inv.explanation_received %}
<form method="post" action="{% url 'complaints:involved_staff_explanation' pk=staff_inv.pk %}" class="inline">
{% csrf_token %}
<button type="submit" class="p-2 text-slate hover:text-blue transition" title="{% trans 'Submit Explanation' %}">
<i data-lucide="message-square" class="w-5 h-5"></i>
</button>
</form>
{% endif %}
<a href="{% url 'complaints:involved_staff_edit' pk=staff_inv.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_staff_remove' pk=staff_inv.pk %}"
class="inline" onsubmit="return confirm('{% trans "Are you sure you want to remove this staff member?" %}')">
{% 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="users" class="w-16 h-16 mx-auto text-slate-300 mb-4"></i>
<p class="text-slate mb-4">{% trans "No staff members involved yet" %}</p>
{% if can_edit %}
<a href="{% url 'complaints:involved_staff_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 Staff" %}
</a>
{% endif %}
</div>
{% endif %}
</section>