54 lines
2.3 KiB
HTML
54 lines
2.3 KiB
HTML
{% extends "base.html" %}
|
||
{% block content %}
|
||
<h1>Инвентарь</h1>
|
||
<a href="{{ url_for('main.inventory_new') }}" class="btn">➕ Добавить инвентарь</a>
|
||
|
||
<!-- Фильтры -->
|
||
<form method="get" class="filter-form" style="margin: 1rem 0; display: flex; gap: 1rem; flex-wrap: wrap;">
|
||
<div>
|
||
<label for="category">Категория:</label>
|
||
<select name="category" id="category" onchange="this.form.submit()">
|
||
<option value="">Все</option>
|
||
{% for cat in categories %}
|
||
<option value="{{ cat.id }}" {% if selected_category == cat.id %}selected{% endif %}>{{ cat.name }}</option>
|
||
{% endfor %}
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label for="season">Сезон:</label>
|
||
<select name="season" id="season" onchange="this.form.submit()">
|
||
<option value="">Все</option>
|
||
<option value="winter" {% if selected_season == 'winter' %}selected{% endif %}>Зима</option>
|
||
<option value="summer" {% if selected_season == 'summer' %}selected{% endif %}>Лето</option>
|
||
</select>
|
||
</div>
|
||
</form>
|
||
|
||
<table>
|
||
<thead>
|
||
<tr><th>ID</th><th>Наименование</th><th>Категория</th><th>Базовая цена</th><th>Сезон</th><th>Действия</th></tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for item in items %}
|
||
<tr>
|
||
<td>{{ item.id }}</td>
|
||
<td>{{ item.name }}</td>
|
||
<td>{{ item.category.name }}</td>
|
||
<td>{{ item.base_price }} ₽</td>
|
||
<td>{{ 'Зима' if item.season_type == 'winter' else 'Лето' }}</td>
|
||
<td>
|
||
<a href="{{ url_for('main.inventory_edit', id=item.id) }}" class="btn btn-secondary">✏️</a>
|
||
<form action="{{ url_for('main.inventory_delete', id=item.id) }}" method="post" style="display:inline;">
|
||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||
<button type="submit" class="btn" onclick="return confirm('Удалить этот инвентарь?')">🗑️</button>
|
||
</form>
|
||
</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr>
|
||
<td colspan="6">Нет инвентаря</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
{% endblock %} |