project322/templates/products.html

58 lines
2.3 KiB
HTML
Raw Permalink 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 title %}Товары{% endblock %}
{% block content %}
<div class="page-header">
<h2>📦 Каталог товаров</h2>
<a href="{{ url_for('new_product') }}" class="btn btn-primary">➕ Новый товар</a>
</div>
<div class="filters" style="margin: 20px 0;">
<form method="GET" style="display: flex; gap: 10px;">
<input type="text" name="search" placeholder="Поиск по названию..." value="{{ request.args.get('search', '') }}" style="flex: 1;">
<select name="category">
<option value="">Все категории</option>
{% for category in categories %}
<option value="{{ category.id }}" {% if request.args.get('category')|int == category.id %}selected{% endif %}>
{{ category.name }}
</option>
{% endfor %}
</select>
<button type="submit" class="btn">🔍 Поиск</button>
<a href="{{ url_for('products') }}" class="btn">Сбросить</a>
</form>
</div>
<table>
<thead>
<tr>
<th>Артикул</th>
<th>Наименование</th>
<th>Категория</th>
<th>Цена</th>
<th>Акциз</th>
<th>Сбор</th>
<th>Алкоголь</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for product in products %}
<tr>
<td>{{ product.article }}</td>
<td>{{ product.name }}</td>
<td>{{ product.category.name }}</td>
<td>{{ product.base_price }} ₽</td>
<td>{{ product.excise_tax }} ₽</td>
<td>{{ product.license_fee }} ₽</td>
<td>{% if product.is_alcohol %}✅{% else %}❌{% endif %}</td>
<td class="actions">
<a href="{{ url_for('edit_product', id=product.id) }}" class="btn btn-small" title="Редактировать">✏️</a>
<a href="{{ url_for('delete_product', id=product.id) }}" class="btn btn-small btn-delete" onclick="return confirm('Удалить товар {{ product.name }}?')" title="Удалить">🗑️</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}