From 96e04ca4b71565b7bdacbcd048b1b6614d3b0547 Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Wed, 10 Dec 2025 23:35:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE=D0=BD=D1=8B=20?= =?UTF-8?q?=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5=D0=B9=D1=81=D0=B0=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D1=81=D0=BF=D0=B8=D1=81=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - list.html - список документов с фильтрацией по статусу и складу - form.html - форма создания документа - detail.html - детальный просмотр документа с возможностью добавления/редактирования позиций - Интерактивное управление позициями через AJAX (добавление, редактирование, удаление) - Отображение статистики документа (количество позиций, общее количество, себестоимость) - Кнопки проведения и отмены документа с подтверждением - Адаптивный дизайн с использованием Bootstrap 5 --- .../inventory/writeoff_document/detail.html | 209 ++++++++++++++++++ .../inventory/writeoff_document/form.html | 62 ++++++ .../inventory/writeoff_document/list.html | 109 +++++++++ 3 files changed, 380 insertions(+) create mode 100644 myproject/inventory/templates/inventory/writeoff_document/detail.html create mode 100644 myproject/inventory/templates/inventory/writeoff_document/form.html create mode 100644 myproject/inventory/templates/inventory/writeoff_document/list.html diff --git a/myproject/inventory/templates/inventory/writeoff_document/detail.html b/myproject/inventory/templates/inventory/writeoff_document/detail.html new file mode 100644 index 0000000..8015779 --- /dev/null +++ b/myproject/inventory/templates/inventory/writeoff_document/detail.html @@ -0,0 +1,209 @@ +{% extends 'base.html' %} + +{% block title %}Документ списания {{ document.document_number }}{% endblock %} + +{% block content %} +
+ + + + + {% if messages %} + {% for message in messages %} + + {% endfor %} + {% endif %} + +
+ +
+
+
+
+ {{ document.document_number }} + {% if document.status == 'draft' %} + Черновик + {% elif document.status == 'confirmed' %} + Проведён + {% elif document.status == 'cancelled' %} + Отменён + {% endif %} +
+ {% if document.can_edit %} +
+
+ {% csrf_token %} + +
+
+ {% csrf_token %} + +
+
+ {% endif %} +
+
+
+
+

Склад

+

{{ document.warehouse.name }}

+
+
+

Дата документа

+

{{ document.date|date:"d.m.Y" }}

+
+
+

Создан

+

{{ document.created_at|date:"d.m.Y H:i" }}

+
+
+ + {% if document.notes %} +
+

Примечания

+

{{ document.notes }}

+
+ {% endif %} + + {% if document.confirmed_at %} +
+
+

Проведён

+

{{ document.confirmed_at|date:"d.m.Y H:i" }}

+
+
+

Провёл

+

{% if document.confirmed_by %}{{ document.confirmed_by.username }}{% else %}-{% endif %}

+
+
+ {% endif %} +
+
+ + +
+
+
Позиции документа
+
+
+
+ + + + + + + + {% if document.can_edit %} + + {% endif %} + + + + {% for item in document.items.all %} + + + + + + {% if document.can_edit %} + + {% endif %} + + {% empty %} + + + + {% endfor %} + + {% if document.items.exists %} + + + + + + + + {% endif %} +
ТоварКоличествоПричинаПримечания
+ {{ item.product.name }} + {{ item.quantity }} + {{ item.get_reason_display }} + + {% if item.notes %}{{ item.notes|truncatechars:50 }}{% else %}-{% endif %} + +
+ {% csrf_token %} + +
+
+ + Позиций пока нет +
Итого:{{ document.total_quantity }}
+
+
+
+
+ + + {% if document.can_edit %} +
+
+
+
Добавить товар
+
+
+
+ {% csrf_token %} + +
+ + {{ item_form.product }} + {% if item_form.product.errors %} +
{{ item_form.product.errors.0 }}
+ {% endif %} +
+ +
+ + {{ item_form.quantity }} + {% if item_form.quantity.errors %} +
{{ item_form.quantity.errors.0 }}
+ {% endif %} +
+ +
+ + {{ item_form.reason }} +
+ +
+ + {{ item_form.notes }} +
+ + +
+
+
+
+ {% endif %} +
+
+{% endblock %} diff --git a/myproject/inventory/templates/inventory/writeoff_document/form.html b/myproject/inventory/templates/inventory/writeoff_document/form.html new file mode 100644 index 0000000..b22f8f1 --- /dev/null +++ b/myproject/inventory/templates/inventory/writeoff_document/form.html @@ -0,0 +1,62 @@ +{% extends 'base.html' %} + +{% block title %}Создать документ списания{% endblock %} + +{% block content %} +
+ + + +
+
+
+
+
+ Новый документ списания +
+
+
+
+ {% csrf_token %} + +
+ + {{ form.warehouse }} + {% if form.warehouse.errors %} +
{{ form.warehouse.errors.0 }}
+ {% endif %} +
+ +
+ + {{ form.date }} + {% if form.date.errors %} +
{{ form.date.errors.0 }}
+ {% endif %} +
+ +
+ + {{ form.notes }} +
+ +
+ + + Отмена + +
+
+
+
+
+
+
+{% endblock %} diff --git a/myproject/inventory/templates/inventory/writeoff_document/list.html b/myproject/inventory/templates/inventory/writeoff_document/list.html new file mode 100644 index 0000000..1c9a3df --- /dev/null +++ b/myproject/inventory/templates/inventory/writeoff_document/list.html @@ -0,0 +1,109 @@ +{% extends 'base.html' %} + +{% block title %}Документы списания{% endblock %} + +{% block content %} +
+ +
+

+ Документы списания +

+ + Создать документ + +
+ + + {% if messages %} + {% for message in messages %} + + {% endfor %} + {% endif %} + + +
+
+
+ + + + + + + + + + + + + + + {% for doc in documents %} + + + + + + + + + + + {% empty %} + + + + {% endfor %} + +
НомерДатаСкладСтатусПозицийКоличествоСоздал
+ + {{ doc.document_number }} + + {{ doc.date|date:"d.m.Y" }}{{ doc.warehouse.name }} + {% if doc.status == 'draft' %} + Черновик + {% elif doc.status == 'confirmed' %} + Проведён + {% elif doc.status == 'cancelled' %} + Отменён + {% endif %} + {{ doc.items.count }}{{ doc.total_quantity }} + {% if doc.created_by %}{{ doc.created_by.username }}{% else %}-{% endif %} + + + + +
+ + Документов списания пока нет +
+
+
+
+ + + {% if page_obj.has_other_pages %} + + {% endif %} +
+{% endblock %}