From e44cdef2896c2d5588f75c1ea4f0b53f4fe085f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=9D=D0=B0=D0=B4=D0=B5?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Mon, 20 Oct 2025 17:07:36 +0300 Subject: [PATCH] Make comment field dynamic and flexible in request_list.html --- backend/templates/requests/request_list.html | 357 ++++++++++++------- 1 file changed, 226 insertions(+), 131 deletions(-) diff --git a/backend/templates/requests/request_list.html b/backend/templates/requests/request_list.html index 4c9c8e6b..4048463f 100644 --- a/backend/templates/requests/request_list.html +++ b/backend/templates/requests/request_list.html @@ -18,7 +18,6 @@ .req-actions{ display:flex; align-items:center; gap:.4rem; flex-wrap:wrap; } .badge-status{ font-weight:600; } .text-mono{ font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; } - .ios-page{ max-width: 1120px; } + + {% endblock %} {% block content %} @@ -122,6 +130,7 @@

Заявления

+
{% if can_process or user.is_staff or user.is_superuser %} @@ -148,12 +157,11 @@ {# ===== Фильтры ===== #}
-
+
-
- -
- - - -
+
+ + + + +
@@ -187,56 +196,51 @@
{% if requests %} {% for obj in requests %} -
-
+
+
- -
+
- - {{ obj.title|default:"Без заголовка" }} - - {# === Тип (локализация кода в русскую метку) === #} - {% if obj.type %} - {% with tp=obj.type|lower %} - + {{ obj.title|default:"Без заголовка" }} + {% if obj.employee %} + + + {% if obj.employee.id == user.id %} + Вы + {% else %} + + {{ obj.employee.full_name|default:obj.employee.display_name|default:"Сотрудник" }} + + {% endif %} + + {% endif %} + {% if obj.type %}{% with tp=obj.type|lower %} + {% if tp == 'vacation' %}Отпуск {% elif tp == 'sick_leave' %}Больничный {% elif tp == 'transfer' %}Перевод {% elif tp == 'dismissal' %}Увольнение {% elif tp == 'other' %}Другое {% else %}{{ obj.type }}{% endif %} - - {% endwith %} - {% endif %} - - {# === Статус (и цвет, и переведённая метка) === #} - {% if obj.status %} - {% with st=obj.status|lower %} - + + {% endwith %}{% endif %} + {% if obj.status %}{% with st=obj.status|lower %} + {% if st == 'draft' %}Черновик {% elif st == 'pending' %}На рассмотрении {% elif st == 'approved' %}Одобрено {% elif st == 'rejected' %}Отклонено {% elif st == 'cancelled' %}Отменено {% else %}{{ obj.status }}{% endif %} - - {% endwith %} - {% endif %} - {% if obj.attachment %} - - Вложение - - {% endif %} + + {% endwith %}{% endif %}
- -
+
{% if obj.date_from or obj.date_to %} {{ obj.date_from|default:"—" }} → {{ obj.date_to|default:"—" }} @@ -253,99 +257,83 @@ {% endif %}
- - -
- + +
- - - -
- -
-
-
-
-
Действия с заявлением #{{ obj.id }}
- {% if obj.status %} - {% with st=obj.status|lower %} - - {% if st == 'draft' %}Черновик{% elif st == 'pending' %}На рассмотрении{% elif st == 'approved' %}Одобрено{% elif st == 'rejected' %}Отклонено{% elif st == 'cancelled' %}Отменено{% else %}{{ obj.status }}{% endif %} - - {% endwith %} - {% endif %} -
- - -
- - - Комментарии - - {% if obj.status and obj.status|lower != 'approved' and obj.status|lower != 'rejected' and obj.status|lower != 'cancelled' %} - - - - {% if can_process %} - - - - {% endif %} - - {% endif %} - - - -
-
+ {% endif %} + {% if obj.employee.id == user.id %} +
+ +
-
+ {% endif %} +
{% if obj.comment %}
{{ obj.comment }}
{% endif %} -
+ +
+ + {% if obj.attachment %} + + Вложение + + {% endif %} +
+ +
+
+
+ Комментарии + +
+
+
+ {% csrf_token %} +
+ + +
+
+
+
+ {% endfor %} {% else %}
Нет заявлений.
@@ -690,4 +678,111 @@ }); {% endif %} + + + + {% endblock %}