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

150 lines
8.0 KiB
HTML

{% extends "layouts/base.html" %}
{% load i18n %}
{% load static %}
{% block title %}{{ title }} - PX 360{% endblock %}
{% block content %}
<div class="p-6">
<!-- Header -->
<div class="mb-6">
<div class="flex items-center justify-between">
<div class="flex items-center gap-4">
<a href="{% url 'complaints:oncall_dashboard' %}" class="text-[#64748b] hover:text-[#005696]">
<i data-lucide="arrow-left" class="w-6 h-6"></i>
</a>
<div>
<h1 class="text-2xl font-bold text-[#005696]">{{ title }}</h1>
<p class="text-[#64748b] mt-1">{% trans "Configure working hours and on-call admin assignments" %}</p>
</div>
</div>
<a href="{% url 'complaints:oncall_schedule_create' %}"
class="px-4 py-2 bg-[#005696] text-white rounded-lg hover:bg-[#007bbd] transition-colors flex items-center gap-2">
<i data-lucide="plus" class="w-4 h-4"></i>
{% trans "Create Schedule" %}
</a>
</div>
</div>
<!-- Schedules Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{% for schedule in schedules %}
<div class="bg-white rounded-xl shadow-sm border border-gray-100 overflow-hidden hover:shadow-md transition-shadow">
<div class="px-6 py-4 border-b border-gray-100 flex items-center justify-between">
<div class="flex items-center gap-2">
{% if schedule.hospital %}
<span class="font-medium text-gray-900">{{ schedule.hospital.name }}</span>
{% else %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-[#eef6fb] text-[#005696]">
{% trans "System-wide" %}
</span>
{% endif %}
</div>
{% if schedule.is_active %}
<span class="w-2.5 h-2.5 bg-green-500 rounded-full" title="{% trans 'Active' %}"></span>
{% else %}
<span class="w-2.5 h-2.5 bg-gray-300 rounded-full" title="{% trans 'Inactive' %}"></span>
{% endif %}
</div>
<div class="p-6">
<div class="space-y-4">
<!-- Working Hours -->
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-[#eef6fb] rounded-lg flex items-center justify-center">
<i data-lucide="clock" class="w-5 h-5 text-[#005696]"></i>
</div>
<div>
<p class="text-sm text-[#64748b]">{% trans "Working Hours" %}</p>
<p class="font-medium text-gray-900">
{{ schedule.work_start_time|time:"H:i" }} - {{ schedule.work_end_time|time:"H:i" }}
</p>
</div>
</div>
<!-- Working Days -->
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-[#eef6fb] rounded-lg flex items-center justify-center">
<i data-lucide="calendar" class="w-5 h-5 text-[#005696]"></i>
</div>
<div>
<p class="text-sm text-[#64748b]">{% trans "Working Days" %}</p>
<p class="font-medium text-gray-900 text-sm">
{% for day in schedule.get_working_days_list %}
{% if day == 0 %}{% trans "Mon" %}{% elif day == 1 %}{% trans "Tue" %}{% elif day == 2 %}{% trans "Wed" %}{% elif day == 3 %}{% trans "Thu" %}{% elif day == 4 %}{% trans "Fri" %}{% elif day == 5 %}{% trans "Sat" %}{% elif day == 6 %}{% trans "Sun" %}{% endif %}{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>
</div>
</div>
<!-- Timezone -->
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-[#eef6fb] rounded-lg flex items-center justify-center">
<i data-lucide="globe" class="w-5 h-5 text-[#005696]"></i>
</div>
<div>
<p class="text-sm text-[#64748b]">{% trans "Timezone" %}</p>
<p class="font-medium text-gray-900 text-sm">{{ schedule.timezone }}</p>
</div>
</div>
<!-- On-Call Admins Count -->
<div class="flex items-center gap-3">
<div class="w-10 h-10 bg-blue-50 rounded-lg flex items-center justify-center">
<i data-lucide="users" class="w-5 h-5 text-[#007bbd]"></i>
</div>
<div>
<p class="text-sm text-[#64748b]">{% trans "On-Call Admins" %}</p>
<p class="font-medium text-[#007bbd]">{{ schedule.on_call_admins.count }}</p>
</div>
</div>
</div>
<!-- Actions -->
<div class="mt-6 pt-4 border-t border-gray-100 flex gap-2">
<a href="{% url 'complaints:oncall_schedule_detail' schedule.id %}"
class="flex-1 px-3 py-2 bg-[#005696] text-white text-sm rounded-lg hover:bg-[#007bbd] transition-colors text-center">
{% trans "View" %}
</a>
<a href="{% url 'complaints:oncall_schedule_edit' schedule.id %}"
class="px-3 py-2 border border-gray-200 text-gray-600 text-sm rounded-lg hover:bg-gray-50 transition-colors">
<i data-lucide="edit" class="w-4 h-4"></i>
</a>
<form method="post" action="{% url 'complaints:oncall_schedule_delete' schedule.id %}"
class="inline" onsubmit="return confirm('{% trans "Are you sure you want to delete this schedule?" %}')">
{% csrf_token %}
<button type="submit" class="px-3 py-2 border border-red-200 text-red-600 text-sm rounded-lg hover:bg-red-50 transition-colors">
<i data-lucide="trash-2" class="w-4 h-4"></i>
</button>
</form>
</div>
</div>
</div>
{% empty %}
<div class="col-span-full">
<div class="bg-white rounded-xl shadow-sm border border-gray-100 p-12 text-center">
<div class="w-16 h-16 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-4">
<i data-lucide="calendar-x" class="w-8 h-8 text-gray-400"></i>
</div>
<h3 class="text-lg font-medium text-gray-900 mb-2">{% trans "No On-Call Schedules" %}</h3>
<p class="text-[#64748b] mb-6 max-w-md mx-auto">
{% trans "Create your first on-call schedule to configure working hours and assign on-call admins for after-hours complaint notifications." %}
</p>
<a href="{% url 'complaints:oncall_schedule_create' %}"
class="px-6 py-3 bg-[#005696] text-white rounded-lg hover:bg-[#007bbd] transition-colors inline-flex items-center gap-2">
<i data-lucide="plus" class="w-5 h-5"></i>
{% trans "Create Schedule" %}
</a>
</div>
</div>
{% endfor %}
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
lucide.createIcons();
});
</script>
{% endblock %}