feat: initial phone store application

This commit is contained in:
2026-12-05 14:35:57 +03:00
commit 7300f13195
25 changed files with 2072 additions and 0 deletions
+130
View File
@@ -0,0 +1,130 @@
{% extends "base.html" %}
{% block title %}Каталог{% endblock %}
{% block content %}
<!-- Hero-блок -->
<section class="hero">
<div class="container">
<div class="hero-content">
<h1>Смартфоны для каждого</h1>
<p>Большой выбор моделей от ведущих производителей. Быстрая доставка и гарантия качества.</p>
</div>
</div>
</section>
<!-- Преимущества -->
<section class="advantages">
<div class="container">
<div class="advantages-grid">
<div class="advantage-card">
<div class="advantage-icon">🚚</div>
<h3>Быстрая доставка</h3>
<p>Доставим заказ в течение 1–3 дней</p>
</div>
<div class="advantage-card">
<div class="advantage-icon">✅</div>
<h3>Официальная гарантия</h3>
<p>Все товары с гарантией производителя</p>
</div>
<div class="advantage-card">
<div class="advantage-icon">💳</div>
<h3>Удобная оплата</h3>
<p>Оплата при получении или онлайн</p>
</div>
<div class="advantage-card">
<div class="advantage-icon">🔄</div>
<h3>Легкий возврат</h3>
<p>14 дней на возврат без вопросов</p>
</div>
</div>
</div>
</section>
<!-- Каталог -->
<section class="catalog">
<div class="container">
<div class="catalog-header">
<h2>Каталог смартфонов</h2>
</div>
<!-- Фильтры и поиск -->
<form class="filters" method="GET" action="{{ url_for('index') }}">
<div class="filter-group search-group">
<input type="text" name="search" placeholder="Поиск по названию или бренду..."
value="{{ search }}" class="search-input">
</div>
<div class="filter-group">
<select name="brand" class="filter-select">
<option value="">Все бренды</option>
{% for b in brands %}
<option value="{{ b.brand }}" {% if selected_brand == b.brand %}selected{% endif %}>
{{ b.brand }}
</option>
{% endfor %}
</select>
</div>
<div class="filter-group">
<select name="sort" class="filter-select">
<option value="">Сортировка</option>
<option value="price_asc" {% if sort == 'price_asc' %}selected{% endif %}>
Цена: по возрастанию
</option>
<option value="price_desc" {% if sort == 'price_desc' %}selected{% endif %}>
Цена: по убыванию
</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Применить</button>
{% if search or selected_brand or sort %}
<a href="{{ url_for('index') }}" class="btn btn-outline">Сбросить</a>
{% endif %}
</form>
<!-- Сетка товаров -->
{% if products %}
<div class="products-grid">
{% for product in products %}
<article class="product-card">
<a href="{{ url_for('product_detail', product_id=product.id) }}" class="product-image-link">
<div class="product-image">
<img src="{{ url_for('static', filename='images/' + product.image) }}"
alt="{{ product.name }}"
onerror="this.src='https://via.placeholder.com/300x300?text={{ product.brand }}'">
</div>
</a>
<div class="product-info">
<span class="product-brand">{{ product.brand }}</span>
<a href="{{ url_for('product_detail', product_id=product.id) }}" class="product-name">
{{ product.name }}
</a>
<div class="product-specs">
<span>{{ product.storage }}</span>
<span>{{ product.ram }} ОЗУ</span>
<span>{{ product.screen }}</span>
</div>
<div class="product-footer">
<span class="product-price">{{ "{:,.0f}".format(product.price).replace(',', ' ') }} ₽</span>
<form action="{{ url_for('add_to_cart', product_id=product.id) }}" method="POST">
<input type="hidden" name="next" value="{{ request.url }}">
<button type="submit" class="btn btn-cart" title="Добавить в корзину">
В корзину
</button>
</form>
</div>
</div>
</article>
{% endfor %}
</div>
{% else %}
<div class="empty-state">
<p>По вашему запросу ничего не найдено</p>
<a href="{{ url_for('index') }}" class="btn btn-primary">Показать все товары</a>
</div>
{% endif %}
</div>
</section>
{% endblock %}