feat: UI/UX cleanup V1 with header, import requisites, and status fixes

This commit is contained in:
Арсентьев Александр
2026-09-27 20:22:13 +03:00
parent 79d802d536
commit 94571f9684
31 changed files with 2842 additions and 73 deletions
+15 -3
View File
@@ -47,15 +47,23 @@
<li class="breadcrumb-item active" aria-current="page">Ведомость</li>
</ol>
</nav>
<div class="d-flex justify-content-between align-items-start mb-4">
<div class="d-flex justify-content-between align-items-start mb-2">
<div>
<h1>{{ document_title }}</h1>
<p class="text-muted mb-0">{{ project.name }}{% if document.source_file %} · {{ document.source_file }}{% endif %}</p>
<p class="text-muted mb-0">
{{ project.name }}{% if document.source_file %} · {{ document.source_file }}{% endif %}
</p>
{% if document.document_number or document.document_date or document.contract %}
<p class="text-muted small mb-0">
{% if document.document_number %}<span>№ {{ document.document_number }}</span>{% endif %}
{% if document.document_date %}<span class="ms-2">от {{ document.document_date.strftime('%d.%m.%Y') }}</span>{% endif %}
{% if document.contract %}<span class="ms-2">Договор: {{ document.contract }}</span>{% endif %}
</p>
{% endif %}
</div>
<div class="d-flex gap-2">
<button type="button" class="btn btn-outline-secondary btn-sm" id="expandAll">Развернуть всё</button>
<button type="button" class="btn btn-outline-secondary btn-sm" id="collapseAll">Свернуть всё</button>
<button type="button" class="btn btn-outline-secondary" id="toggleMoney" title="Показать/скрыть финансовые суммы" aria-label="Показать или скрыть финансовые суммы">👁</button>
{% if not has_history %}
<form method="post" action="/boq/{{ project.id }}/documents/{{ document.id }}/delete" class="d-inline">
<button type="submit" class="btn btn-outline-danger" onclick="return confirm('Удалить ведомость и все её позиции? Это действие необратимо.')">Удалить ведомость</button>
@@ -68,6 +76,10 @@
<a class="btn btn-outline-secondary" href="/projects/{{ project.id }}">К проекту</a>
</div>
</div>
<div class="d-flex justify-content-end align-items-center gap-2 mb-3">
<span class="text-muted small">Финансовые суммы</span>
<button type="button" class="btn btn-outline-secondary btn-sm" id="toggleMoney" title="Показать/скрыть финансовые суммы" aria-label="Показать или скрыть финансовые суммы">👁</button>
</div>
<div class="boq-table-wrap">
<table class="table table-bordered table-sm align-middle boq-table">
+1 -1
View File
@@ -23,7 +23,7 @@
<div class="list-group shadow-sm">
{% for document in documents %}
<a class="list-group-item list-group-item-action d-flex justify-content-between align-items-center gap-3" href="/boq/{{ project.id }}/documents/{{ document.id }}">
<span><strong>{{ document.name.replace('BOQ Import - ', 'Импорт ведомости — ').replace('BOQ Import — ', 'Импорт ведомости — ') }}</strong><br><small class="text-muted">{{ document.source_file or 'Источник не указан' }} · {{ document.created_at.strftime('%d.%m.%Y %H:%M') if document.created_at else 'Дата не указана' }}</small></span>
<span><strong>{{ document.display_name }}</strong><br><small class="text-muted">{{ document.source_file or 'Источник не указан' }} · {{ document.created_at.strftime('%d.%m.%Y %H:%M') if document.created_at else 'Дата не указана' }}</small></span>
<span class="btn btn-sm btn-outline-primary">Открыть</span>
</a>
{% endfor %}
+122 -22
View File
@@ -13,28 +13,78 @@
.system-progress-table .progress-summary > * { white-space: nowrap; }
.money-value { transition: filter 0.15s; }
.money-hidden .money-value { filter: blur(6px); user-select: none; pointer-events: none; }
/*
* Document navigation: one horizontal row, no horizontal scroll.
* Buttons never wrap to a second row; long labels wrap inside the button.
* Equal height via stretch + flex centering of button content.
*/
.doc-nav {
display: flex;
flex-wrap: nowrap;
align-items: stretch;
gap: .5rem;
}
.doc-nav .btn {
flex: 1 1 0;
min-width: 0;
white-space: normal;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
line-height: 1.25;
padding-left: .5rem;
padding-right: .5rem;
}
</style>
</head>
<body class="bg-light money-hidden">
<main class="container-fluid container-xxl py-4">
<nav class="mb-3"><ol class="breadcrumb"><li class="breadcrumb-item"><a href="/projects/">Проекты</a></li><li class="breadcrumb-item active">{{ project.name }}</li></ol></nav>
<header class="d-flex flex-wrap justify-content-between align-items-start gap-3 mb-4">
<div>
<h1 class="h2 mb-2">{{ project.name }}</h1>
<div class="d-flex flex-wrap gap-3 text-secondary">
<span>Договор: <strong class="text-dark">{{ project.contract_number or 'не указан' }}</strong></span>
<span>Заказчик: <strong class="text-dark">{{ project.customer or 'не указан' }}</strong></span>
<span>Валюта: <strong class="text-dark">{{ project.currency or 'RUB' }}</strong></span>
<span>Период: <strong class="text-dark">{{ project.start_date.strftime('%d.%m.%Y') if project.start_date else '—' }} — {{ project.end_date.strftime('%d.%m.%Y') if project.end_date else '—' }}</strong></span>
<span>Статус: <span class="badge text-bg-secondary">{{ project.status or 'не указан' }}</span></span>
</div>
{% if base_boq_documents|length == 1 %}<div class="small text-muted mt-2">Ведомость проекта: {{ base_boq_documents[0].name.replace('BOQ Import - ', 'Импорт ведомости — ').replace('BOQ Import — ', 'Импорт ведомости — ') }}</div>{% elif base_boq_documents|length > 1 %}<div class="small text-muted mt-2">Ведомостей проекта: {{ base_boq_documents|length }}</div>{% endif %}
</div>
<div class="d-flex flex-wrap gap-2">
<a class="btn btn-primary" href="/projects/{{ project.id }}/daily-reports/new">Создать Daily Report</a>
<button type="button" class="btn btn-outline-secondary" id="toggleMoney" title="Показать/скрыть финансовые суммы" aria-label="Показать или скрыть финансовые суммы">👁</button>
<header class="mb-4">
<!-- Block 1: project title -->
<h1 class="h2 mb-2">{{ project.name }}</h1>
<!-- Block 2: project actions (under title) -->
<div class="d-flex flex-wrap gap-2 mb-3">
<a class="btn btn-primary" href="/projects/{{ project.id }}/daily-reports/new">Дневной отчёт</a>
<a class="btn btn-outline-secondary" href="/projects/{{ project.id }}/edit">Редактировать</a>
</div>
<!-- Requisites -->
<div class="row g-3 g-md-4 align-items-start mb-2">
<div class="col-6 col-sm-4 col-md-auto">
<div class="text-muted small mb-1">Договор</div>
<div class="fw-semibold text-dark">{{ project.contract_number or 'не указан' }}</div>
</div>
<div class="col-6 col-sm-4 col-md-auto">
<div class="text-muted small mb-1">Заказчик</div>
<div class="fw-semibold text-dark">{{ project.customer or 'не указан' }}</div>
</div>
<div class="col-6 col-sm-4 col-md-auto">
<div class="text-muted small mb-1">Валюта</div>
<div class="fw-semibold text-dark">{{ project.currency or 'RUB' }}</div>
</div>
<div class="col-6 col-sm-4 col-md-auto">
<div class="text-muted small mb-1">Период</div>
<div class="fw-semibold text-dark">{{ project.start_date.strftime('%d.%m.%Y') if project.start_date else '—' }} — {{ project.end_date.strftime('%d.%m.%Y') if project.end_date else '—' }}</div>
</div>
<div class="col-6 col-sm-4 col-md-auto">
<div class="text-muted small mb-1">Статус</div>
{% set status = project.status or 'active' %}
{% set status_map = {
'active': ('Активный', 'success'),
'completed': ('Завершён', 'primary'),
'on_hold': ('Приостановлен', 'warning'),
'archived': ('Архивирован', 'secondary')
} %}
{% set status_pair = status_map.get(status, (status, 'secondary')) %}
<div><span class="badge text-bg-{{ status_pair[1] }}">{{ status_pair[0] }}</span></div>
</div>
</div>
<!-- BOQ document -->
{% if base_boq_documents|length == 1 %}<div class="small text-muted mb-3">Ведомость проекта: {{ base_boq_documents[0].display_name }}</div>{% elif base_boq_documents|length > 1 %}<div class="small text-muted mb-3">Ведомостей проекта: {{ base_boq_documents|length }}</div>{% endif %}
<!-- Document navigation: single left-aligned row, no h-scroll -->
<nav class="doc-nav mb-3" aria-label="Документы проекта">
<a class="btn btn-outline-primary" href="/boq/{{ project.id }}">Ведомости{% if base_boq_documents %} ({{ base_boq_documents|length }}){% endif %}</a>
<a class="btn btn-outline-primary" href="/projects/{{ project.id }}/agreements">Дополнительные соглашения{% if agreements_count %} ({{ agreements_count }}){% endif %}</a>
<a class="btn btn-outline-primary" href="/projects/{{ project.id }}/daily-reports">Daily Reports{% if daily_reports_count %} ({{ daily_reports_count }}){% endif %}</a>
@@ -42,7 +92,7 @@
<a class="btn btn-outline-primary" href="/projects/{{ project.id }}/ks3">КС-3{% if ks3_count %} ({{ ks3_count }}){% endif %}</a>
<a class="btn btn-outline-primary" href="/projects/{{ project.id }}/ks6a">КС-6а</a>
<a class="btn btn-outline-primary" href="/projects/{{ project.id }}/payments">Платежи{% if payments_count %} ({{ payments_count }}){% endif %}</a>
</div>
</nav>
</header>
{% if project.status != 'archived' %}
@@ -50,8 +100,8 @@
<form method="post" action="/projects/{{ project.id }}/archive" class="d-inline">
<button type="submit" class="btn btn-outline-warning btn-sm" onclick="return confirm('Архивировать проект? Данные будут сохранены.')">Архивировать</button>
</form>
<form method="post" action="/projects/{{ project.id }}/delete" class="d-inline">
<button type="submit" class="btn btn-outline-danger btn-sm" onclick="return confirm('ВНИМАНИЕ: Проект будет физически удалён вместе со связанными данными. Это действие необратимо. Продолжить?')">Удалить проект</button>
<form method="post" action="/projects/{{ project.id }}/delete" class="d-inline" id="delete-project-form">
<button type="submit" class="btn btn-outline-danger btn-sm">Удалить проект</button>
</form>
</div>
{% else %}
@@ -64,6 +114,11 @@
{% else %}<div class="text-success small py-2">✓ Проверка плана: превышений нет</div>{% endif %}
</section>
<div class="d-flex justify-content-end align-items-center gap-2 mb-3">
<span class="text-muted small">Финансовые суммы</span>
<button type="button" class="btn btn-outline-secondary btn-sm" id="toggleMoney" title="Показать/скрыть финансовые суммы" aria-label="Показать или скрыть финансовые суммы">👁</button>
</div>
<section class="mb-4" aria-labelledby="kpi-heading">
<h2 id="kpi-heading" class="h5 mb-3">План и выполнение</h2>
<div class="row g-3">
@@ -184,8 +239,8 @@
<option value="word">Word</option>
</select>
</div>
<div class="col-md-2">
<button type="submit" class="btn btn-primary w-100">Сформировать комплект</button>
<div class="col-md-2 d-flex align-items-end">
<button type="submit" class="btn btn-primary text-nowrap w-auto">Сформировать комплект</button>
</div>
</form>
<div id="package-error" class="alert alert-danger mt-3 mb-0" role="alert" hidden></div>
@@ -202,13 +257,19 @@
</section>
<section class="card border-0 shadow-sm mt-4">
<div class="card-header bg-white d-flex justify-content-between align-items-center"><h2 class="h5 mb-0">Дерево документов</h2><a href="/boq/{{ project.id }}" class="btn btn-sm btn-outline-primary">Ведомости</a></div>
<div class="card-header bg-white d-flex justify-content-between align-items-center">
<h2 class="h5 mb-0">Дерево документов</h2>
<div class="d-flex gap-2">
<a href="/boq/{{ project.id }}" class="btn btn-sm btn-outline-primary">Ведомости</a>
<a href="/projects/{{ project.id }}/agreements" class="btn btn-sm btn-outline-primary">Дополнительные соглашения</a>
</div>
</div>
<div class="card-body">
<div class="mb-2 fw-semibold">План и ведомости</div>
{% for node in doc_tree %}
<div class="ms-3 mb-2">
<a href="/boq/{{ project.id }}/documents/{{ node.doc.id }}" class="text-decoration-none">
📄 {{ node.doc.name.replace('BOQ Import - ', 'Импорт ведомости — ').replace('BOQ Import — ', 'Импорт ведомости — ') }}
📄 {{ node.doc.display_name }}
</a>
{% if node.agreements %}
<div class="ms-4 mt-1">
@@ -263,6 +324,26 @@
</table></div></div>
</div></div>
</div>
<div class="modal fade" id="deleteBlockedModal" tabindex="-1" aria-labelledby="deleteBlockedTitle" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title fs-5" id="deleteBlockedTitle">Проект нельзя удалить</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Закрыть"></button>
</div>
<div class="modal-body">
<p>В проекте есть связанные данные: ведомости, отчёты или документы. Удаление невозможно, чтобы не нарушить историю проекта.</p>
<p class="mb-0"><strong>Рекомендуется архивировать проект.</strong></p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Отмена</button>
<form method="post" action="/projects/{{ project.id }}/archive" class="d-inline">
<button type="submit" class="btn btn-warning">Архивировать проект</button>
</form>
</div>
</div>
</div>
</div>
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
@@ -346,6 +427,25 @@
document.getElementById('toggleMoney').addEventListener('click', () => {
document.body.classList.toggle('money-hidden');
});
const deleteForm = document.getElementById('delete-project-form');
if (deleteForm) {
deleteForm.addEventListener('submit', async event => {
event.preventDefault();
if (!window.confirm('ВНИМАНИЕ: Проект будет физически удалён вместе со связанными данными. Это действие необратимо. Продолжить?')) return;
try {
const response = await fetch(deleteForm.getAttribute('action'), {method: 'POST'});
if (response.ok) {
window.location.href = '/projects/';
return;
}
const modal = new bootstrap.Modal(document.getElementById('deleteBlockedModal'));
modal.show();
} catch {
const modal = new bootstrap.Modal(document.getElementById('deleteBlockedModal'));
modal.show();
}
});
}
const packageForm = document.querySelector('form[action*="/export/package"]');
const packageError = document.getElementById('package-error');
if (packageForm) {
+19
View File
@@ -19,6 +19,25 @@
<label for="file" class="form-label">Выберите Excel файл</label>
<input class="form-control" type="file" id="file" name="file" accept=".xlsx,.xls" required>
</div>
<h6 class="card-subtitle mb-3">Реквизиты ведомости</h6>
<div class="row g-3 mb-3">
<div class="col-md-6">
<label for="document_name" class="form-label">Название ведомости</label>
<input class="form-control" type="text" id="document_name" name="document_name" maxlength="255" placeholder="Например: Основная ведомость">
</div>
<div class="col-md-3">
<label for="document_number" class="form-label">Номер</label>
<input class="form-control" type="text" id="document_number" name="document_number" maxlength="100">
</div>
<div class="col-md-3">
<label for="document_date" class="form-label">Дата</label>
<input class="form-control" type="date" id="document_date" name="document_date">
</div>
<div class="col-md-6">
<label for="contract" class="form-label">Договор</label>
<input class="form-control" type="text" id="contract" name="contract" maxlength="255" value="{{ project.contract_number or '' }}">
</div>
</div>
<button type="submit" class="btn btn-primary">Загрузить</button>
<a href="/projects/{{ project.id }}" class="btn btn-secondary">Отмена</a>
</form>
@@ -12,6 +12,7 @@
<p><strong>Проект:</strong> {{ project.name }}</p>
<p><strong>Файл:</strong> {{ filename }}</p>
<p><strong>Лист:</strong> {{ sheet_name }}</p>
{% if import_result.document_name %}<p><strong>Ведомость:</strong> {{ import_result.document_name }}</p>{% endif %}
<div class="card">
<div class="card-body">
+24 -1
View File
@@ -95,7 +95,30 @@
</div>
<div class="mt-4">
<form method="post" action="/boq/{{ project.id }}/import/confirm">
<form method="post" action="/boq/{{ project.id }}/import/confirm" id="import-confirm-form">
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">Реквизиты ведомости</h5>
<div class="row g-3">
<div class="col-md-6">
<label class="form-label" for="document_name">Название ведомости</label>
<input class="form-control" type="text" id="document_name" name="document_name" value="{{ document_name or sheet_name }}" required maxlength="255">
</div>
<div class="col-md-3">
<label class="form-label" for="document_number">Номер</label>
<input class="form-control" type="text" id="document_number" name="document_number" value="{{ document_number or '' }}" maxlength="100">
</div>
<div class="col-md-3">
<label class="form-label" for="document_date">Дата</label>
<input class="form-control" type="date" id="document_date" name="document_date" value="{{ document_date or '' }}">
</div>
<div class="col-md-6">
<label class="form-label" for="contract">Договор</label>
<input class="form-control" type="text" id="contract" name="contract" value="{{ contract or '' }}" maxlength="255">
</div>
</div>
</div>
</div>
<input type="hidden" name="filename" value="{{ filename }}">
<input type="hidden" name="sheet_name" value="{{ sheet_name }}">
<input type="hidden" name="header_row" value="{{ header_row }}">
@@ -35,6 +35,10 @@
<input type="hidden" name="sheet_name" value="{{ sheet }}">
<input type="hidden" name="header_row" value="5">
<input type="hidden" name="start_row" value="6">
<input type="hidden" name="document_name" value="{{ document_name or '' }}">
<input type="hidden" name="document_number" value="{{ document_number or '' }}">
<input type="hidden" name="document_date" value="{{ document_date or '' }}">
<input type="hidden" name="contract" value="{{ contract or '' }}">
<button type="submit" class="btn btn-sm btn-primary">Выбрать</button>
</form>
</td>