54 lines
2.4 KiB
HTML
54 lines
2.4 KiB
HTML
{% extends "base.html" %}
|
||
{% block content %}
|
||
|
||
{% if current_role != 'guest' %}
|
||
<form method="GET" class="filters">
|
||
<input type="text" name="search" placeholder="Поиск..." value="{{ search }}">
|
||
<select name="category">
|
||
<option value="">Все категории</option>
|
||
{% for cat in categories %}
|
||
<option value="{{ cat.id }}" {% if cat_filter == cat.id|string %}selected{% endif %}>{{ cat.name }}</option>
|
||
{% endfor %}
|
||
</select>
|
||
<button type="submit">Найти</button>
|
||
</form>
|
||
{% endif %}
|
||
|
||
<div class="catalog">
|
||
{% for product in products %}
|
||
<div class="product-card {% if product.highlight %}highlight{% endif %}">
|
||
<img src="{{ url_for('static', filename=product.image_path) }}" alt="Фото">
|
||
|
||
<div class="info">
|
||
<h3>{{ product.manufacturer_name }} | {{ product.name }}</h3>
|
||
<p><b>Категория:</b> {{ product.category_name }} / {{ product.subcategory_name }}</p>
|
||
<p><b>Количество:</b> {{ product.qty_text }}</p>
|
||
<p><b>Состав:</b> {{ product.composition }}</p>
|
||
<p><b>Описание:</b> {{ product.description }}</p>
|
||
</div>
|
||
|
||
<div class="price-block">
|
||
{% if product.final_price < product.price %}
|
||
<span class="old-price">{{ product.price }} руб.</span>
|
||
<span class="new-price">{{ product.final_price }} руб.</span>
|
||
{% else %}
|
||
<span class="price">{{ product.price }} руб.</span>
|
||
{% endif %}
|
||
|
||
{% if current_role != 'guest' and product.total_qty > 0 %}
|
||
<form method="POST" action="{{ url_for('add_to_cart', product_id=product.id) }}" class="add-form">
|
||
<select name="size_id">
|
||
<!-- В реальности здесь нужно выводить только те размеры, что есть в наличии -->
|
||
<option value="1">40</option>
|
||
<option value="2">41</option>
|
||
<option value="3">42</option>
|
||
</select>
|
||
<input type="number" name="quantity" value="1" min="1" style="width: 50px;">
|
||
<button type="submit">В корзину</button>
|
||
</form>
|
||
{% endif %}
|
||
</div>
|
||
</div>
|
||
{% endfor %}
|
||
</div>
|
||
{% endblock %} |