agdar/hr/templates/hr/schedule_grid.html
Marwan Alwali d912313a27 update
2025-11-02 16:03:03 +03:00

95 lines
3.9 KiB
HTML

{% extends "base.html" %}
{% load i18n static hr_tags %}
{% block title %}{% trans "Schedule Grid" %} - {{ block.super }}{% endblock %}
{% block content %}
<div class="container-fluid">
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3 mb-0">
<i class="fa fa-th me-2"></i>{% trans "Schedule Grid" %}
</h1>
<div class="btn-group">
<a href="{% url 'hr:schedule-list' %}" class="btn btn-secondary">
<i class="fa fa-list me-1"></i>{% trans "List View" %}
</a>
<a href="{% url 'hr:schedule-create' %}" class="btn btn-primary">
<i class="fa fa-plus me-1"></i>{% trans "New Schedule" %}
</a>
</div>
</div>
{% include "includes/messages.html" %}
<div class="card">
<div class="card-body">
{% if schedule_grid %}
<div class="table-responsive">
<table class="table table-bordered">
<thead class="table-light">
<tr>
<th>{% trans "Employee" %}</th>
{% for day_code, day_name in days %}
<th class="text-center">{{ day_name }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for employee_name, employee_schedules in schedule_grid.items %}
<tr>
<td><strong>{{ employee_name }}</strong></td>
{% for day_code, day_name in days %}
<td class="text-center">
{% if day_code in employee_schedules %}
{% with schedule=employee_schedules|get_item:day_code %}
<div class="schedule-cell">
<small class="d-block">
{{ schedule.start_time|time:"H:i" }} - {{ schedule.end_time|time:"H:i" }}
</small>
<small class="text-muted">
({{ schedule.duration_hours }}h)
</small>
<div class="mt-1">
<a href="{% url 'hr:schedule-detail' schedule.pk %}" class="btn btn-sm btn-outline-primary">
<i class="fa fa-eye"></i>
</a>
<a href="{% url 'hr:schedule-update' schedule.pk %}" class="btn btn-sm btn-outline-warning">
<i class="fa fa-edit"></i>
</a>
</div>
</div>
{% endwith %}
{% else %}
<span class="text-muted"></span>
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-center py-5">
<i class="fa fa-calendar-alt fa-3x text-muted mb-3"></i>
<p class="text-muted">{% trans "No active schedules found." %}</p>
<a href="{% url 'hr:schedule-create' %}" class="btn btn-primary">
<i class="fa fa-plus me-1"></i>{% trans "Create First Schedule" %}
</a>
</div>
{% endif %}
</div>
</div>
</div>
<style>
.schedule-cell {
padding: 0.5rem;
min-height: 80px;
}
.table td {
vertical-align: middle;
}
</style>
{% endblock %}