161 lines
7.1 KiB
HTML
161 lines
7.1 KiB
HTML
{% extends "base.html" %}
|
||
|
||
{% block title %}Документы 1С — Контроль ЭДО{% endblock %}
|
||
|
||
{% block content %}
|
||
<div class="page-header">
|
||
<h2>Документы 1С</h2>
|
||
<p>Загрузка выгрузки из 1С и контроль актуальных статусов ЭДО</p>
|
||
</div>
|
||
|
||
<section class="panel">
|
||
<div class="panel-header">
|
||
<div class="panel-icon panel-icon-blue">⬆</div>
|
||
<div class="panel-title">
|
||
<h3>Загрузка Excel из 1С</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>
|
||
</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>{{ row.contractor or '—' }}</td>
|
||
<td>{{ row.doc_type }}</td>
|
||
<td class="num-cell">
|
||
{% if row.doc_date %}
|
||
{% if row.doc_date is string %}
|
||
{{ row.doc_date.replace('-', '.').split(' ')[0].split('-')[::-1]|join('.') }}
|
||
{% else %}
|
||
{{ row.doc_date.strftime('%d.%m.%Y') }}
|
||
{% endif %}
|
||
{% else %}
|
||
—
|
||
{% endif %}
|
||
</td>
|
||
<td><span class="doc-number">{{ row.doc_number }}</span></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 %}
|
||
<span class="status status-ok">{{ row.state }}</span>
|
||
{% elif 'подпис' in st %}
|
||
<span class="status status-warn">{{ row.state }}</span>
|
||
{% elif 'ошиб' in st %}
|
||
<span class="status status-error">{{ row.state }}</span>
|
||
{% else %}
|
||
<span class="status status-neutral">{{ row.state or '—' }}</span>
|
||
{% endif %}
|
||
</td>
|
||
<td class="num-cell">
|
||
{% if row.updated_at %}
|
||
{% if row.updated_at is string %}
|
||
{{ row.updated_at.replace('-', '.').split(' ')[0].split('-')[::-1]|join('.') }}
|
||
{% 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>
|
||
{% else %}
|
||
<div class="empty-state">
|
||
<div class="empty-icon">📭</div>
|
||
<p>Документов пока нет</p>
|
||
<p class="empty-hint">Добавьте контрагентов и загрузите Excel из 1С</p>
|
||
</div>
|
||
{% endif %}
|
||
</section>
|
||
{% endblock %}
|