260 lines
6.3 KiB
HTML
260 lines
6.3 KiB
HTML
{% extends "base.html" %}
|
||
|
||
{% block content %}
|
||
<div class="page-header">
|
||
<h2>Список заказов</h2>
|
||
<div class="header-actions">
|
||
<div class="sort-controls">
|
||
<label for="sort">Сортировка:</label>
|
||
<select id="sort" onchange="changeSort(this.value)">
|
||
<option value="date_desc" {% if current_sort == 'date_desc' %}selected{% endif %}>По дате (новые сначала)</option>
|
||
<option value="amount_desc" {% if current_sort == 'amount_desc' %}selected{% endif %}>По стоимости (дорогие сначала)</option>
|
||
<option value="partner" {% if current_sort == 'partner' %}selected{% endif %}>По партнерам</option>
|
||
</select>
|
||
</div>
|
||
<a href="{{ url_for('add_order') }}" class="btn-add-light">+ Новый заказ</a>
|
||
</div>
|
||
</div>
|
||
|
||
{% if orders %}
|
||
<div class="orders-grid">
|
||
{% for order in orders %}
|
||
<div class="order-card">
|
||
<div class="order-header">
|
||
<h3>Заказ #{{ order.order_id }}</h3>
|
||
</div>
|
||
<div class="order-body">
|
||
<p class="partner"><strong>Партнер:</strong> {{ order.partner_name }}</p>
|
||
<p class="date"><strong>Дата:</strong> {{ order.order_date }}</p>
|
||
<p class="items"><strong>Позиций:</strong> {{ order.items_count if order.items_count else 0 }}</p>
|
||
|
||
<div class="order-items-preview">
|
||
<strong>Информация:</strong>
|
||
<p>В заказе {{ order.items_count if order.items_count else 0 }} позиций</p>
|
||
</div>
|
||
|
||
<div class="order-total">
|
||
<div class="subtotal">Сумма без наценки: {{ "%.2f"|format(order.subtotal_without_markup|float) }} ₽</div>
|
||
<div class="markup">Наценка 10%: +{{ "%.2f"|format((order.subtotal_with_markup - order.subtotal_without_markup)|float) }} ₽</div>
|
||
<div class="subtotal-with-markup">Сумма с наценкой: {{ "%.2f"|format(order.subtotal_with_markup|float) }} ₽</div>
|
||
{% if order.discount_percent and order.discount_percent > 0 %}
|
||
<div class="discount">Скидка {{ order.discount_percent }}%: -{{ "%.2f"|format(order.discount_amount|float) }} ₽</div>
|
||
{% endif %}
|
||
<div class="total"><strong>ИТОГО К ОПЛАТЕ: {{ "%.2f"|format(order.total|float) }} ₽</strong></div>
|
||
</div>
|
||
</div>
|
||
<div class="order-footer">
|
||
<a href="{{ url_for('edit_order', order_id=order.order_id) }}" class="btn-edit">Редактировать</a>
|
||
</div>
|
||
</div>
|
||
{% endfor %}
|
||
</div>
|
||
{% else %}
|
||
<div class="empty-state">
|
||
<p>Заказов пока нет</p>
|
||
<a href="{{ url_for('add_order') }}" class="btn-add-light">Создать первый заказ</a>
|
||
</div>
|
||
{% endif %}
|
||
|
||
<script>
|
||
function changeSort(sortValue) {
|
||
window.location.href = '?sort=' + sortValue;
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
.order-items-preview {
|
||
background-color: #F5F5F5;
|
||
padding: 10px;
|
||
border-radius: 4px;
|
||
margin: 10px 0;
|
||
}
|
||
|
||
.order-items-preview p {
|
||
margin: 5px 0;
|
||
}
|
||
|
||
.page-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 30px;
|
||
flex-wrap: wrap;
|
||
gap: 15px;
|
||
}
|
||
|
||
.page-header h2 {
|
||
font-size: 2rem;
|
||
color: #696969;
|
||
font-weight: 500;
|
||
margin: 0;
|
||
}
|
||
|
||
.header-actions {
|
||
display: flex;
|
||
gap: 10px;
|
||
align-items: center;
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.sort-controls {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
background: white;
|
||
padding: 5px 10px;
|
||
border-radius: 4px;
|
||
border: 1px solid #E0E0E0;
|
||
}
|
||
|
||
.sort-controls label {
|
||
color: #696969;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.sort-controls select {
|
||
padding: 5px;
|
||
border: 1px solid #E0E0E0;
|
||
border-radius: 4px;
|
||
font-family: 'Calibri', sans-serif;
|
||
background-color: white;
|
||
}
|
||
|
||
.btn-add-light {
|
||
background-color: #E0E0E0;
|
||
color: #696969;
|
||
padding: 8px 16px;
|
||
border-radius: 4px;
|
||
text-decoration: none;
|
||
font-weight: 600;
|
||
transition: background-color 0.3s;
|
||
border: 1px solid #696969;
|
||
}
|
||
|
||
.btn-add-light:hover {
|
||
background-color: #D0D0D0;
|
||
}
|
||
|
||
.empty-state {
|
||
text-align: center;
|
||
padding: 60px 20px;
|
||
background: white;
|
||
border-radius: 8px;
|
||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||
}
|
||
|
||
.empty-state p {
|
||
font-size: 1.2rem;
|
||
color: #666;
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
.orders-grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
||
gap: 20px;
|
||
}
|
||
|
||
.order-card {
|
||
background: white;
|
||
border-radius: 8px;
|
||
overflow: hidden;
|
||
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
||
transition: transform 0.3s;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.order-card:hover {
|
||
transform: translateY(-3px);
|
||
box-shadow: 0 5px 15px rgba(0,0,0,0.15);
|
||
}
|
||
|
||
.order-header {
|
||
background-color: #E0E0E0;
|
||
padding: 15px;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
.order-header h3 {
|
||
color: #696969;
|
||
font-size: 1.2rem;
|
||
margin: 0;
|
||
}
|
||
|
||
.order-body {
|
||
padding: 15px;
|
||
flex: 1;
|
||
}
|
||
|
||
.order-body p {
|
||
margin-bottom: 8px;
|
||
}
|
||
|
||
.order-footer {
|
||
padding: 15px;
|
||
background-color: #F5F5F5;
|
||
display: flex;
|
||
gap: 10px;
|
||
justify-content: center;
|
||
}
|
||
|
||
.btn-edit {
|
||
background-color: #E0E0E0;
|
||
color: #696969;
|
||
padding: 8px 16px;
|
||
border-radius: 4px;
|
||
text-decoration: none;
|
||
font-weight: 500;
|
||
transition: background-color 0.3s;
|
||
}
|
||
|
||
.btn-edit:hover {
|
||
background-color: #D0D0D0;
|
||
}
|
||
|
||
.subtotal, .markup, .subtotal-with-markup, .discount, .total {
|
||
margin: 5px 0;
|
||
padding: 3px 0;
|
||
}
|
||
|
||
.discount {
|
||
color: #4CAF50;
|
||
font-weight: 500;
|
||
}
|
||
|
||
.total {
|
||
font-size: 1.2rem;
|
||
border-top: 2px solid #696969;
|
||
padding-top: 8px;
|
||
margin-top: 8px;
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
.page-header {
|
||
flex-direction: column;
|
||
align-items: flex-start;
|
||
}
|
||
|
||
.header-actions {
|
||
width: 100%;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.sort-controls {
|
||
width: 100%;
|
||
}
|
||
|
||
.sort-controls select {
|
||
flex: 1;
|
||
}
|
||
|
||
.btn-add-light {
|
||
width: 100%;
|
||
text-align: center;
|
||
}
|
||
}
|
||
</style>
|
||
{% endblock %} |