diff --git a/backend/procurement/views_frontend.py b/backend/procurement/views_frontend.py index 4895e2e1..d12ff69b 100644 --- a/backend/procurement/views_frontend.py +++ b/backend/procurement/views_frontend.py @@ -214,7 +214,7 @@ def equipment_detail(request, pk): 'procurement_item', 'procurement_item__request' ).prefetch_related( - 'maintenance_records', + 'maintenance_history', 'transfer_logs__from_department', 'transfer_logs__to_department', 'transfer_logs__from_person', diff --git a/backend/templates/procurement/equipment_detail.html b/backend/templates/procurement/equipment_detail.html index e308bc6c..3c6cd351 100644 --- a/backend/templates/procurement/equipment_detail.html +++ b/backend/templates/procurement/equipment_detail.html @@ -11,14 +11,6 @@ {% block content %}
- {# ===== Хлебные крошки ===== #} -
{# ===== Основная информация ===== #} @@ -122,39 +114,47 @@ {% endif %}
-
- {% if equipment.maintenance_records.exists %} -
- - - - - - - - - - - {% for record in equipment.maintenance_records.all %} - - - - - - - {% endfor %} - -
ДатаТипОписаниеСтоимость
{{ record.date|date:"d.m.Y" }}{{ record.get_type_display }}{{ record.description|truncatechars:50 }} - {% if record.cost %}{{ record.cost|floatformat:0 }} ₽{% else %}—{% endif %} -
+ + {% if equipment.maintenance_history.exists %} +
+
+
Дата
+
Тип
+
Описание
+
Стоимость
- {% else %} +
+ +
+ {% for record in equipment.maintenance_history.all %} +
+
+ Дата: + {{ record.date|date:"d.m.Y" }} +
+
+ Тип: + {{ record.get_type_display }} +
+
+ Описание: + {{ record.description|truncatechars:80 }} +
+
+ Стоимость: + {% if record.cost %}{{ record.cost|floatformat:0 }} ₽{% else %}—{% endif %} +
+
+ {% endfor %} +
+ {% else %} +

Записей об обслуживании нет

- {% endif %}
+ {% endif %}
{# История передач #} @@ -162,43 +162,53 @@
История передач
-
- {% if equipment.transfer_logs.exists %} -
- - - - - - - - - - - {% for log in equipment.transfer_logs.all %} - - - - - - - {% endfor %} - -
ДатаОткудаКудаПричина
{{ log.created_at|date:"d.m.Y" }} - {% if log.from_department %}{{ log.from_department.name }}{% endif %} - {% if log.from_person %}({{ log.from_person.get_full_name }}){% endif %} - - {% if log.to_department %}{{ log.to_department.name }}{% endif %} - {% if log.to_person %}({{ log.to_person.get_full_name }}){% endif %} - {{ log.reason|truncatechars:40 }}
+ + {% if equipment.transfer_logs.exists %} +
+
+
Дата
+
Откуда
+
Куда
+
Причина
- {% else %} +
+ +
+ {% for log in equipment.transfer_logs.all %} +
+
+ Дата: + {{ log.created_at|date:"d.m.Y" }} +
+
+ Откуда: +
+ {% if log.from_department %}{{ log.from_department.name }}{% endif %} + {% if log.from_person %}({{ log.from_person.get_full_name }}){% endif %} +
+
+
+ Куда: +
+ {% if log.to_department %}{{ log.to_department.name }}{% endif %} + {% if log.to_person %}({{ log.to_person.get_full_name }}){% endif %} +
+
+
+ Причина: + {{ log.reason|truncatechars:60 }} +
+
+ {% endfor %} +
+ {% else %} +

Передач не было

- {% endif %}
+ {% endif %}