Files
work-volume-tracker/app/templates/ks3/form.html
T
Арсентьев Александр 80b7d4732e feat: auto-suggest KS-2/KS-3 document numbers
2026-09-27 17:39:22 +03:00

98 lines
5.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% block title %}{{ 'Редактирование' if document else 'Создание' }} КС-3{% endblock %}
{% 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>{{ 'Редактирование КС-3' if document else 'Создание КС-3' }}</h2>
{% if error %}
<div class="alert alert-danger" role="alert">{{ error }}</div>
{% endif %}
<form method="post" action="/projects/{{ project.id }}/ks3{% if document %}/{{ document.id }}/edit{% endif %}">
<div class="row mb-3">
<div class="col-md-3">
<label for="number" class="form-label">Номер КС-3</label>
<input type="text" class="form-control" id="number" name="number" required
value="{{ form_values.get('number', document.number if document else suggested_number) }}">
</div>
<div class="col-md-3">
<label for="document_date" class="form-label">Дата</label>
<input type="date" class="form-control" id="document_date" name="document_date" required
value="{{ form_values.get('document_date', document.date.isoformat() if document else '') }}">
</div>
<div class="col-md-3">
<label for="reporting_period_from" class="form-label">Период с</label>
<input type="date" class="form-control" id="reporting_period_from" name="reporting_period_from" required
value="{{ form_values.get('reporting_period_from', document.reporting_period_from.isoformat() if document and document.reporting_period_from else '') }}">
</div>
<div class="col-md-3">
<label for="reporting_period_to" class="form-label">Период по</label>
<input type="date" class="form-control" id="reporting_period_to" name="reporting_period_to" required
value="{{ form_values.get('reporting_period_to', document.reporting_period_to.isoformat() if document and document.reporting_period_to else '') }}">
</div>
</div>
<div class="row mb-3">
<div class="col-md-12">
<label for="comment" class="form-label">Комментарий</label>
<input type="text" class="form-control" id="comment" name="comment"
value="{{ form_values.get('comment', document.comment if document and document.comment else '') }}">
</div>
</div>
<h4>Выберите проведённые КС-2</h4>
{% if available_ks2 %}
<div class="table-responsive">
<table class="table table-striped table-sm" style="table-layout: fixed;">
<colgroup>
<col style="width: 40px">
<col style="width: 100px">
<col style="width: 90px">
<col>
<col style="width: 120px">
</colgroup>
<thead>
<tr>
<th></th>
<th>№ КС-2</th>
<th>Дата</th>
<th>Период</th>
<th class="text-end text-nowrap">Сумма</th>
</tr>
</thead>
<tbody>
{% for item in available_ks2 %}
<tr>
<td>
<input type="checkbox" class="form-check-input" name="ks2_ids"
value="{{ item.id }}"
{% if item.id in selected_ids %}checked{% endif %}>
</td>
<td>{{ item.number }}</td>
<td>{{ item.date.strftime('%d.%m.%Y') }}</td>
<td>{% if item.period_from and item.period_to %}{{ item.period_from.strftime('%d.%m.%Y') }} — {{ item.period_to.strftime('%d.%m.%Y') }}{% endif %}</td>
<td class="text-end text-nowrap">{{ item.total | money }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-info">Нет проведённых КС-2 для выбора.</div>
{% endif %}
<button type="submit" class="btn btn-primary">{{ 'Сохранить' if document else 'Создать' }}</button>
<a href="/projects/{{ project.id }}/ks3{% if document %}/{{ document.id }}{% endif %}" class="btn btn-secondary">Отмена</a>
</form>
</div>
</div>
</div>
{% endblock %}