feat: add KS-2 UI, reporting period, and table layout fixes

- 004: KS-2 UI (list, create, edit, view, issue) with integration tests
- 005: navigation buttons, financial column alignment, button layout
- 006: reporting_period_from/to fields with migration, validation, display
- 007: fixed table layout with colgroup, quantity2 filter, stable column widths
This commit is contained in:
Арсентьев Александр
2026-09-26 21:36:43 +03:00
parent 1f5eed2064
commit 6c608a8779
20 changed files with 1407 additions and 96 deletions
+35 -25
View File
@@ -4,6 +4,10 @@
{% block content %}
<div class="container mt-4">
<nav class="mb-3">
<a href="/projects/{{ project.id }}" class="btn btn-outline-secondary btn-sm">&larr; К проекту</a>
</nav>
<div class="row">
<div class="col-12">
<h2>КС-2 №{{ document.number }} от {{ document.date.strftime('%d.%m.%Y') }}</h2>
@@ -15,6 +19,9 @@
{{ 'Проведён' if document.status == 'issued' else 'Черновик' }}
</span>
</p>
{% if document.reporting_period_from and document.reporting_period_to %}
<p><strong>Период:</strong> {{ document.reporting_period_from.strftime('%d.%m.%Y') }} — {{ document.reporting_period_to.strftime('%d.%m.%Y') }}</p>
{% endif %}
{% if document.comment %}
<p><strong>Комментарий:</strong> {{ document.comment }}</p>
{% endif %}
@@ -28,41 +35,54 @@
<thead>
<tr>
<th>Наименование</th>
<th>Количество</th>
<th>Цена</th>
<th>Сумма</th>
<th>Ед.</th>
<th class="text-end text-nowrap">Количество</th>
<th class="text-end text-nowrap">Цена</th>
<th class="text-end text-nowrap">Сумма</th>
</tr>
</thead>
<tbody>
{% for line in document.items %}
<tr>
<td>{{ line.work_item.name }}</td>
<td>{{ line.quantity }}</td>
<td>{{ line.unit_price | money }}</td>
<td>{{ line.amount | money }}</td>
<td>{{ line.work_item.unit or '' }}</td>
<td class="text-end text-nowrap">{{ line.quantity }}</td>
<td class="text-end text-nowrap">{{ line.unit_price | money }}</td>
<td class="text-end text-nowrap">{{ line.amount | money }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th>Итого</th>
<th></th>
<th></th>
<th>{{ total | money }}</th>
<th colspan="4" class="text-end">Итого</th>
<th class="text-end text-nowrap">{{ total | money }}</th>
</tr>
</tfoot>
</table>
</div>
{% if document.status == 'draft' %}
<h4>Источники</h4>
<div class="d-flex gap-2 align-items-center">
<a href="/projects/{{ project.id }}/ks2/{{ document.id }}/edit" class="btn btn-primary">Редактировать</a>
<form method="post" action="/projects/{{ project.id }}/ks2/{{ document.id }}/issue" class="d-inline">
<button type="submit" class="btn btn-success"
onclick="return confirm('После проведения КС-2 изменить его будет нельзя. Продолжить?')">Провести КС-2</button>
</form>
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Назад к списку</a>
</div>
{% else %}
<div class="alert alert-success" role="alert">
КС-2 проведено. Документ не может быть изменён.
</div>
<h4>Источники факта</h4>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Наименование</th>
<th>Даты</th>
<th>Дата отчёта</th>
<th>Количество</th>
</tr>
</thead>
@@ -74,7 +94,7 @@
{% for source in line.sources %}
<tr>
<td></td>
<td>{{ source.daily_report_item.report.report_date.strftime('%d.%m.%Y') }} ({{ source.daily_report_item.report.id }})</td>
<td>{{ source.daily_report_item.report.report_date.strftime('%d.%m.%Y') }}</td>
<td>{{ source.quantity }}</td>
</tr>
{% endfor %}
@@ -83,19 +103,9 @@
</table>
</div>
<a href="/projects/{{ project.id }}/ks2/{{ document.id }}/edit" class="btn btn-primary">Редактировать</a>
<form method="post" action="/projects/{{ project.id }}/ks2/{{ document.id }}/issue" class="d-inline">
<button type="submit" class="btn btn-success"
onclick="return confirm('Вы уверены, что хотите провести КС-2?')">Провести</button>
</form>
{% else %}
<div class="alert alert-success" role="alert">
КС-2 проведено
</div>
{% endif %}
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Назад к списку</a>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% endblock %}