jewelry_inventory/templates/index.html
2026-03-27 12:02:41 +05:00

89 lines
3.5 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 content %}
<h1>📋 Заявки партнеров</h1>
<div style="margin-bottom: 20px;">
<a href="/orders/add" class="btn btn-primary">➕ Новая заявка</a>
</div>
<div class="filters" style="background: #F5DEB3; padding: 15px; border-radius: 8px; margin-bottom: 20px;">
<form method="get" style="display: flex; gap: 10px; align-items: center; flex-wrap: wrap;">
<label style="font-weight: bold;">Фильтр по партнеру:</label>
<select name="partner_id" onchange="this.form.submit()" style="padding: 8px; border-radius: 5px; border: 1px solid #D2691E;">
<option value="">Все партнеры</option>
{% for p in partners %}
<option value="{{ p.id }}" {% if selected_partner == p.id|string %}selected{% endif %}>{{ p.company_name }}</option>
{% endfor %}
</select>
{% if selected_partner %}
<a href="/" class="btn btn-secondary btn-small">Сбросить фильтр</a>
{% endif %}
</form>
</div>
<div class="stats">
<div class="stat-card">
<h3>Всего заявок</h3>
<div class="number">{{ orders|length }}</div>
</div>
<div class="stat-card">
<h3>Общая сумма (без скидки)</h3>
<div class="number">
{% set total = namespace(value=0) %}
{% for order in orders %}
{% set total.value = total.value + order.subtotal_amount %}
{% endfor %}
{{ "%.2f"|format(total.value) }} ₽
</div>
</div>
<div class="stat-card">
<h3>Общая сумма (со скидкой)</h3>
<div class="number">
{% set total_disc = namespace(value=0) %}
{% for order in orders %}
{% set total_disc.value = total_disc.value + order.total_amount %}
{% endfor %}
{{ "%.2f"|format(total_disc.value) }} ₽
</div>
</div>
</div>
<table>
<thead>
<tr>
<th>Номер</th>
<th>Партнер</th>
<th>Дата</th>
<th>Сумма (без скидки)</th>
<th>Скидка</th>
<th>Сумма (со скидкой)</th>
<th>Примечание</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for order in orders %}
<tr>
<td><strong>{{ order.order_number }}</strong></td>
<td>{{ order.partner_name }}</td>
<td>{{ order.order_date }}</td>
<td>{{ "%.2f"|format(order.subtotal_amount) }} ₽</td>
<td><span style="background: #D2691E; color: white; padding: 3px 8px; border-radius: 15px;">{{ order.discount_percent }}%</span></td>
<td><strong style="color: #D2691E;">{{ "%.2f"|format(order.total_amount) }} ₽</strong></td>
<td>{{ order.notes or '-' }}</td>
<td>
<a href="/orders/{{ order.id }}/edit" class="btn btn-secondary btn-small">✏️</a>
<form method="post" action="/orders/{{ order.id }}/delete" style="display: inline;" onsubmit="return confirm('Удалить заявку?')">
<button type="submit" class="btn btn-primary btn-small">🗑️</button>
</form>
</td>
</tr>
{% else %}
<tr>
<td colspan="8" style="text-align: center;">Нет заявок. Создайте первую!</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}