project/templates/my_orders.html

71 lines
3.6 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: 1rem; padding: 0.5rem; background: #FDF5E6; border-radius: 5px;">
<span>Сортировать по: </span>
<a href="/my-orders?sort=date&order={% if sort_by=='date' and order=='desc' %}asc{% else %}desc{% endif %}" style="color: #CD853F; text-decoration: none;">
📅 Дата {% if sort_by=='date' %}{% if order=='desc' %}↓{% else %}↑{% endif %}{% endif %}
</a> |
<a href="/my-orders?sort=total&order={% if sort_by=='total' and order=='desc' %}asc{% else %}desc{% endif %}" style="color: #CD853F; text-decoration: none;">
💰 Сумма {% if sort_by=='total' %}{% if order=='desc' %}↓{% else %}↑{% endif %}{% endif %}
</a> |
<a href="/my-orders?sort=quantity&order={% if sort_by=='quantity' and order=='desc' %}asc{% else %}desc{% endif %}" style="color: #CD853F; text-decoration: none;">
📦 Количество {% if sort_by=='quantity' %}{% if order=='desc' %}↓{% else %}↑{% endif %}{% endif %}
</a> |
<a href="/my-orders?sort=name&order={% if sort_by=='name' and order=='desc' %}asc{% else %}desc{% endif %}" style="color: #CD853F; text-decoration: none;">
👤 Имя {% if sort_by=='name' %}{% if order=='desc' %}↓{% else %}↑{% endif %}{% endif %}
</a>
</div>
{% if orders %}
{% for order in orders %}
<div style="background: #FDF5E6; padding: 1rem; margin-bottom: 1rem; border-radius: 10px; border-left: 4px solid #CD853F;">
<div style="display: flex; justify-content: space-between; flex-wrap: wrap;">
<strong>Заказ #{{ order.id }}</strong>
<div>
<span style="color: #666;">{{ order.order_date }}</span>
<a href="/orders/delete/{{ order.id }}" onclick="return confirm('Удалить заказ #{{ order.id }}?')" style="background: #f44336; color: white; padding: 0.2rem 0.5rem; text-decoration: none; border-radius: 3px; margin-left: 0.5rem;">🗑️ Удалить</a>
</div>
</div>
<p><strong>👤 Клиент:</strong> {{ order.client_name }} ({{ order.phone }})</p>
<p><strong>📦 Товар:</strong> {{ order.product_name }}</p>
<p><strong>📋 Категория:</strong> {{ order.category }}</p>
<p><strong>🤝 Партнер:</strong> {{ order.partner }}</p>
<p><strong>📦 Количество:</strong> {{ order.quantity }} шт. × {{ order.price_per_unit }} ₽</p>
<div style="background: white; padding: 0.5rem; border-radius: 5px; margin-top: 0.5rem;">
<p><strong>💰 Стоимость:</strong></p>
<p style="margin-left: 1rem;">
Сумма: {{ order.total }} ₽<br>
Скидка: {{ order.discount_percent }}% ({{ order.discount_amount }} ₽)<br>
<span style="font-size: 1.2rem; color: #CD853F;"><strong>Итого: {{ order.final_total }} ₽</strong></span>
</p>
</div>
{% if order.notes %}
<p style="margin-top: 0.5rem;"><strong>📝 Примечание:</strong> {{ order.notes }}</p>
{% endif %}
</div>
{% endfor %}
{% else %}
<p style="text-align: center;">Заказов пока нет.</p>
<p style="text-align: center;"><a href="/order" class="btn-primary">Сделать первый заказ</a></p>
{% endif %}
<style>
.btn-primary {
display: inline-block;
background: #CD853F;
color: white;
padding: 0.5rem 1rem;
text-decoration: none;
border-radius: 5px;
}
</style>
{% endblock %}