feat: enforce Daily Report lifecycle rules around KS-2 closed volume

This commit is contained in:
Арсентьев Александр
2026-09-28 19:30:10 +03:00
parent fac2816622
commit 2821208c65
6 changed files with 961 additions and 24 deletions
+33 -3
View File
@@ -8,12 +8,42 @@
<body class="bg-light">
<main class="container py-4">
<nav class="mb-3"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="/projects/">Проекты</a></li><li class="breadcrumb-item"><a href="/projects/{{ project.id }}">{{ project.name }}</a></li><li class="breadcrumb-item"><a href="/projects/{{ project.id }}/daily-reports">Daily Reports</a></li><li class="breadcrumb-item active">{{ report.report_date.strftime('%d.%m.%Y') }}</li></ol></nav>
<div class="d-flex justify-content-between align-items-start mb-4"><div><h1>Daily Report</h1><div class="text-muted">{{ report.report_date.strftime('%d.%m.%Y') }} · {{ report.system.name if report.system else '&#1055;&#1088;&#1086;&#1077;&#1082;&#1090;&#1085;&#1099;&#1077; &#1087;&#1086;&#1079;&#1080;&#1094;&#1080;&#1080; &#1073;&#1077;&#1079; &#1089;&#1080;&#1089;&#1090;&#1077;&#1084;&#1099;' }}</div>{% if report.notes %}<p class="mt-2">{{ report.notes }}</p>{% endif %}</div><a class="btn btn-primary" href="/projects/{{ project.id }}/daily-reports/{{ report.id }}/edit">Редактировать</a></div>
<div class="d-flex justify-content-between align-items-start mb-4 gap-3 flex-wrap">
<div>
<h1>Daily Report</h1>
<div class="text-muted">{{ report.report_date.strftime('%d.%m.%Y') }} · {{ report.system.name if report.system else 'Проектные позиции без системы' }}</div>
{% if report.notes %}<p class="mt-2">{{ report.notes }}</p>{% endif %}
</div>
<div class="d-flex gap-2">
<a class="btn btn-primary" href="/projects/{{ project.id }}/daily-reports/{{ report.id }}/edit">Редактировать</a>
{% if can_delete_report %}
<form method="post" action="/projects/{{ project.id }}/daily-reports/{{ report.id }}/delete" class="d-inline">
<button type="submit" class="btn btn-outline-danger"
onclick="return confirm('Удалить Daily Report? Действие необратимо.')">Удалить отчёт</button>
</form>
{% else %}
<button type="button" class="btn btn-outline-danger" disabled
title="{{ delete_blocked_reason }}">Удалить отчёт</button>
{% endif %}
</div>
</div>
{% if not can_delete_report %}
<div class="alert alert-warning" role="alert">{{ delete_blocked_reason }}</div>
{% endif %}
{% if warnings %}<div class="alert alert-warning"><strong>Превышен план по {{ warnings|length }} позициям.</strong> Фактическое выполнение сохранено.</div>{% endif %}
<div class="card"><div class="table-responsive"><table class="table table-hover align-middle mb-0">
<thead><tr><th>Раздел</th><th>№</th><th>Рабочая позиция</th><th>Ед.</th><th class="text-end">План</th><th class="text-end">Накоплено до отчёта</th><th class="text-end">В этом отчёте</th><th class="text-end">Накоплено</th></tr></thead>
<thead><tr><th>Раздел</th><th>№</th><th>Рабочая позиция</th><th>Ед.</th><th class="text-end">План</th><th class="text-end">В этом отчёте</th><th class="text-end">Закрыто КС-2</th><th class="text-end">Доступно</th></tr></thead>
<tbody>{% for row in rows %}
<tr class="{% if row.over_plan %}table-warning{% endif %}"><td>{{ row.item.section.name if row.item.section else '—' }}</td><td>{{ row.item.source_number or '' }}</td><td>{{ row.item.name }}</td><td>{{ row.item.unit or '' }}</td><td class="text-end">{{ row.planned_quantity if row.planned_quantity is not none else '—' }}</td><td class="text-end">{{ row.accumulated }}</td><td class="text-end">{{ row.current_quantity }}</td><td class="text-end">{{ row.accumulated + row.current_quantity }}</td></tr>
<tr class="{% if row.over_plan %}table-warning{% endif %}">
<td>{{ row.item.section.name if row.item.section else '—' }}</td>
<td>{{ row.item.source_number or '' }}</td>
<td>{{ row.item.name }}</td>
<td>{{ row.item.unit or '' }}</td>
<td class="text-end">{{ row.planned_quantity if row.planned_quantity is not none else '—' }}</td>
<td class="text-end">{{ row.current_quantity }}</td>
<td class="text-end">{{ row.closed_quantity }}</td>
<td class="text-end">{{ row.available_quantity }}</td>
</tr>
{% else %}<tr><td colspan="8" class="text-center text-muted py-4">В отчёте нет рабочих позиций.</td></tr>{% endfor %}</tbody>
</table></div></div>
<div class="mt-3"><a href="/projects/{{ project.id }}/daily-reports" class="btn btn-outline-secondary">К списку отчётов</a></div>