feat: complete KS-2 foundation and regression coverage
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Создание КС-2{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2>Создание КС-2</h2>
|
||||
|
||||
{% if error %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
{{ error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="/projects/{{ project.id }}/ks2">
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label for="number" class="form-label">Номер КС-2</label>
|
||||
<input type="text" class="form-control" id="number" name="number" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="document_date" class="form-label">Дата</label>
|
||||
<input type="date" class="form-control" id="document_date" name="document_date" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="comment" class="form-label">Комментарий</label>
|
||||
<textarea class="form-control" id="comment" name="comment" rows="3"></textarea>
|
||||
</div>
|
||||
|
||||
<h4>Выберите позиции</h4>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Наименование</th>
|
||||
<th>План</th>
|
||||
<th>Факт</th>
|
||||
<th>Закрыто</th>
|
||||
<th>Доступно</th>
|
||||
<th>Количество</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for balance in balances %}
|
||||
<tr>
|
||||
<td>{{ balance.item.name }}</td>
|
||||
<td>{{ balance.planned_quantity }}</td>
|
||||
<td>{{ balance.actual_quantity }}</td>
|
||||
<td>{{ balance.closed_quantity }}</td>
|
||||
<td>{{ balance.available_quantity }}</td>
|
||||
<td>
|
||||
<input type="checkbox" class="form-check-input" id="include_{{ balance.item.id }}"
|
||||
name="include_{{ balance.item.id }}" value="1"
|
||||
{% if balance.item.id in selected %}checked{% endif %}>
|
||||
<input type="number" class="form-control form-control-sm"
|
||||
name="quantity_{{ balance.item.id }}"
|
||||
value="{{ selected.get(balance.item.id, '') }}"
|
||||
min="0" step="0.0001"
|
||||
{% if balance.item.id not in selected %}disabled{% endif %}
|
||||
placeholder="Количество">
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Создать</button>
|
||||
<a href="/projects/{{ project.id }}/ks2" class="btn btn-secondary">Отмена</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Обработчик изменения чекбокса
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const checkboxes = document.querySelectorAll('input[type="checkbox"]');
|
||||
checkboxes.forEach(checkbox => {
|
||||
checkbox.addEventListener('change', function() {
|
||||
const quantityInput = document.querySelector(`input[name="quantity_${this.id.split('_')[1]}"]`);
|
||||
if (this.checked) {
|
||||
quantityInput.disabled = false;
|
||||
quantityInput.focus();
|
||||
} else {
|
||||
quantityInput.disabled = true;
|
||||
quantityInput.value = '';
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,47 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}КС-2 проекта {{ project.name }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2>КС-2 проекта {{ project.name }}</h2>
|
||||
<a href="/projects/{{ project.id }}/ks2/new" class="btn btn-primary mb-3">Создать новый КС-2</a>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Номер</th>
|
||||
<th>Дата</th>
|
||||
<th>Статус</th>
|
||||
<th>Количество позиций</th>
|
||||
<th>Сумма</th>
|
||||
<th>Действия</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in rows %}
|
||||
<tr>
|
||||
<td>{{ row.document.number }}</td>
|
||||
<td>{{ row.document.date.strftime('%d.%m.%Y') }}</td>
|
||||
<td>
|
||||
<span class="badge bg-{{ 'success' if row.document.status == 'issued' else 'secondary' }}">
|
||||
{{ 'Проведён' if row.document.status == 'issued' else 'Черновик' }}
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ row.item_count }}</td>
|
||||
<td>{{ row.amount | money }}</td>
|
||||
<td>
|
||||
<a href="/projects/{{ project.id }}/ks2/{{ row.document.id }}" class="btn btn-sm btn-outline-primary">Просмотр</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,101 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}КС-2 №{{ document.number }} от {{ document.date.strftime('%d.%m.%Y') }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mt-4">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2>КС-2 №{{ document.number }} от {{ document.date.strftime('%d.%m.%Y') }}</h2>
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<p><strong>Статус:</strong>
|
||||
<span class="badge bg-{{ 'success' if document.status == 'issued' else 'secondary' }}">
|
||||
{{ 'Проведён' if document.status == 'issued' else 'Черновик' }}
|
||||
</span>
|
||||
</p>
|
||||
{% if document.comment %}
|
||||
<p><strong>Комментарий:</strong> {{ document.comment }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4>Позиции</h4>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Наименование</th>
|
||||
<th>Количество</th>
|
||||
<th>Цена</th>
|
||||
<th>Сумма</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>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Итого</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th>{{ total | money }}</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% if document.status == 'draft' %}
|
||||
<h4>Источники</h4>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Наименование</th>
|
||||
<th>Даты</th>
|
||||
<th>Количество</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for line in document.items %}
|
||||
<tr>
|
||||
<td colspan="3"><strong>{{ line.work_item.name }}</strong></td>
|
||||
</tr>
|
||||
{% 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.quantity }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user