Initial commit
This commit is contained in:
186
templates/documents_sbis.html
Normal file
186
templates/documents_sbis.html
Normal file
@@ -0,0 +1,186 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Документы СБИС — Контроль ЭДО{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="page-header">
|
||||
<h2>Документы СБИС</h2>
|
||||
<p>Загрузка выгрузки из СБИС и отслеживание статусов документов</p>
|
||||
</div>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel-header">
|
||||
<div class="panel-icon panel-icon-green">⬆</div>
|
||||
<div class="panel-title">
|
||||
<h3>Загрузка Excel из СБИС</h3>
|
||||
<p>Импортируются только контрагенты из списка. Повторная загрузка обновит статус существующего документа.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="upload-zone">
|
||||
<form method="post" enctype="multipart/form-data" class="upload-form">
|
||||
<input type="hidden" name="action" value="upload">
|
||||
<div class="file-input-wrap">
|
||||
<input type="file" name="file" accept=".xlsx,.xls" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Импортировать</button>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<form method="get" class="filters">
|
||||
<label>
|
||||
Контрагент
|
||||
<select name="contractor">
|
||||
<option value="">Все</option>
|
||||
{% for name in contractors %}
|
||||
<option value="{{ name }}" {% if selected_contractor == name %}selected{% endif %}>
|
||||
{{ name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Статус
|
||||
<select name="status">
|
||||
<option value="">Все</option>
|
||||
{% for st in statuses %}
|
||||
<option value="{{ st }}" {% if selected_status == st %}selected{% endif %}>
|
||||
{{ st }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Поиск
|
||||
<input type="text" name="search" value="{{ search }}" placeholder="Номер документа">
|
||||
</label>
|
||||
<button type="submit" class="btn btn-ghost">Применить</button>
|
||||
</form>
|
||||
|
||||
<div class="section-label">
|
||||
Список документов СБИС
|
||||
<span class="count-badge">{{ rows|length }}</span>
|
||||
</div>
|
||||
|
||||
{% if rows %}
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="col-note"></th>
|
||||
<th>Дата</th>
|
||||
<th>Номер</th>
|
||||
<th>Контрагент</th>
|
||||
<th>Тип</th>
|
||||
<th>Сумма</th>
|
||||
<th>Статус</th>
|
||||
<th>Ответственный</th>
|
||||
<th>Обновлён</th>
|
||||
<th>Заметка</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for row in rows %}
|
||||
{% set has_comment = row.comment and row.comment.strip() %}
|
||||
<tr class="{% if has_comment %}has-note{% endif %}">
|
||||
<td class="col-note">
|
||||
{% if has_comment %}
|
||||
<span class="note-indicator" title="Есть заметка">💬</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="num-cell">
|
||||
{% if row.doc_date %}
|
||||
{% if row.doc_date is string %}
|
||||
{% set date_parts = row.doc_date.split(' ')[0].split('-') %}
|
||||
{{ date_parts[2] }}.{{ date_parts[1] }}.{{ date_parts[0] }}
|
||||
{% else %}
|
||||
{{ row.doc_date.strftime('%d.%m.%Y') }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
—
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><span class="doc-number">{{ row.doc_number }}</span></td>
|
||||
<td>{{ row.contractor }}</td>
|
||||
<td>{{ row.doc_type or '—' }}</td>
|
||||
<td class="num-cell">{{ "%.2f"|format(row.amount) if row.amount is not none else '—' }}</td>
|
||||
<td>
|
||||
{% set st = (row.state or '')|lower %}
|
||||
{% if 'заверш' in st or 'успеш' in st %}
|
||||
<span class="status status-ok">{{ row.state }}</span>
|
||||
{% elif 'подпис' in st or 'обработ' in st %}
|
||||
<span class="status status-warn">{{ row.state }}</span>
|
||||
{% elif 'удал' in st or 'ошиб' in st %}
|
||||
<span class="status status-error">{{ row.state }}</span>
|
||||
{% else %}
|
||||
<span class="status status-neutral">{{ row.state or '—' }}</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ row.responsible or '—' }}</td>
|
||||
<td class="num-cell">
|
||||
{% if row.updated_at %}
|
||||
{% if row.updated_at is string %}
|
||||
{% set date_parts = row.updated_at.split(' ')[0].split('-') %}
|
||||
{{ date_parts[2] }}.{{ date_parts[1] }}.{{ date_parts[0] }}
|
||||
{% else %}
|
||||
{{ row.updated_at.strftime('%d.%m.%Y') }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
—
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="col-comment">
|
||||
<details class="comment-details" {% if has_comment %}open{% endif %}>
|
||||
<summary class="comment-summary">
|
||||
{% if has_comment %}Изменить{% else %}Добавить{% endif %}
|
||||
</summary>
|
||||
<form method="post" class="comment-form">
|
||||
<input type="hidden" name="action" value="comment">
|
||||
<input type="hidden" name="doc_id" value="{{ row.id }}">
|
||||
<input type="hidden" name="contractor" value="{{ selected_contractor }}">
|
||||
<input type="hidden" name="status" value="{{ selected_status }}">
|
||||
<input type="hidden" name="search" value="{{ search }}">
|
||||
<textarea name="comment" rows="2" placeholder="Комментарий или заметка…">{{ row.comment or '' }}</textarea>
|
||||
<div class="comment-actions">
|
||||
<button type="submit" class="btn btn-primary btn-sm">Сохранить</button>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div> <!-- После таблицы -->
|
||||
<!-- Пагинация -->
|
||||
{% if total_pages > 1 %}
|
||||
<div class="pagination" style="margin-top: 20px; display: flex; justify-content: space-between; align-items: center; padding: 15px 0;">
|
||||
<div>
|
||||
Показано записей: {{ rows|length }} из {{ total }}
|
||||
</div>
|
||||
<div style="display: flex; gap: 10px;">
|
||||
{% if page > 1 %}
|
||||
<a href="{{ url_for('main.documents_sbis', page=page-1, contractor=selected_contractor, status=selected_status, search=search) }}" class="btn btn-ghost">← Предыдущая</a>
|
||||
{% endif %}
|
||||
|
||||
<span style="padding: 8px 16px; background: #f0f0f0; border-radius: 6px;">
|
||||
Страница {{ page }} из {{ total_pages }}
|
||||
</span>
|
||||
|
||||
{% if page < total_pages %}
|
||||
<a href="{{ url_for('main.documents_sbis', page=page+1, contractor=selected_contractor, status=selected_status, search=search) }}" class="btn btn-ghost">Следующая →</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
<div class="empty-state">
|
||||
<div class="empty-icon">📭</div>
|
||||
<p>Документов СБИС пока нет</p>
|
||||
<p class="empty-hint">Добавьте контрагентов и загрузите Excel из СБИС</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user