Pages are rendered server-side (SEO, no build step), the interactive parts talk to the existing REST API from the browser: - home: banners, categories, hits and new arrivals - catalog: filters (category, brand, price, stock), search, sorting, pagination, filter chips with one-click removal - product card: gallery, price with discount, stock, characteristics, related products - cart: localStorage, quantity controls, live totals - checkout: contacts, delivery, promo code, bonuses, order submission with Idempotency-Key, success screen - login: OTP by phone (debug code shown in dev) and phone/password - account: profile, orders, addresses, bonuses through the API with JWT - static pages from the admin Supporting pieces: - apps/storefront app with views, urls, templates and static CSS/JS - money/discount/attribute template filters - seed_demo management command with demo catalog, banners and pages - Cyrillic search fallback for SQLite: local DB does not fold case for non-ASCII, production PostgreSQL does Tests: 16 storefront cases (pages, filters, search, ordering, 404s, filters formatting); the suite is 61 passing.
111 lines
4.5 KiB
HTML
111 lines
4.5 KiB
HTML
{% extends "storefront/base.html" %}
|
|
{% load static %}
|
|
|
|
{% block title %}Личный кабинет — {{ site.site_name }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="page-head" style="display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap">
|
|
<div>
|
|
<h1>Личный кабинет</h1>
|
|
<p data-account-hello>Загрузка…</p>
|
|
</div>
|
|
<button class="btn btn-outline" type="button" data-logout>Выйти</button>
|
|
</div>
|
|
|
|
<div class="account-layout">
|
|
<nav class="account-nav">
|
|
<button type="button" class="active" data-panel="orders">Мои заказы</button>
|
|
<button type="button" data-panel="profile">Профиль</button>
|
|
<button type="button" data-panel="addresses">Адреса доставки</button>
|
|
<button type="button" data-panel="bonus">Бонусы</button>
|
|
</nav>
|
|
|
|
<section>
|
|
<div class="account-panel" data-panel-body="orders">
|
|
<div class="panel-head"><h2>Мои заказы</h2></div>
|
|
<div data-orders-list><p class="form-note">Загрузка…</p></div>
|
|
</div>
|
|
|
|
<div class="account-panel" data-panel-body="profile" hidden>
|
|
<div class="panel-head"><h2>Профиль</h2></div>
|
|
<form data-profile-form>
|
|
<div class="field-row">
|
|
<div class="field">
|
|
<label for="first_name">Имя</label>
|
|
<input id="first_name" name="first_name" autocomplete="given-name">
|
|
</div>
|
|
<div class="field">
|
|
<label for="last_name">Фамилия</label>
|
|
<input id="last_name" name="last_name" autocomplete="family-name">
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<label for="middle_name">Отчество</label>
|
|
<input id="middle_name" name="middle_name">
|
|
</div>
|
|
<div class="field">
|
|
<label for="profile_phone">Телефон</label>
|
|
<input id="profile_phone" disabled>
|
|
<div class="form-note">Телефон изменить нельзя — это логин для входа.</div>
|
|
</div>
|
|
<div class="field">
|
|
<label for="profile_email">Email</label>
|
|
<input id="profile_email" name="email" type="email" autocomplete="email">
|
|
</div>
|
|
<button class="btn btn-accent" type="submit">Сохранить</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="account-panel" data-panel-body="addresses" hidden>
|
|
<div class="panel-head"><h2>Адреса доставки</h2></div>
|
|
<div data-addresses-list><p class="form-note">Загрузка…</p></div>
|
|
|
|
<h3 style="margin-top:24px;font-size:17px">Добавить адрес</h3>
|
|
<form data-address-form>
|
|
<div class="field-row">
|
|
<div class="field">
|
|
<label for="city">Город *</label>
|
|
<input id="city" name="city" required>
|
|
</div>
|
|
<div class="field">
|
|
<label for="street">Улица *</label>
|
|
<input id="street" name="street" required>
|
|
</div>
|
|
</div>
|
|
<div class="field-row">
|
|
<div class="field">
|
|
<label for="house">Дом</label>
|
|
<input id="house" name="house">
|
|
</div>
|
|
<div class="field">
|
|
<label for="apartment">Квартира</label>
|
|
<input id="apartment" name="apartment">
|
|
</div>
|
|
</div>
|
|
<div class="field">
|
|
<label for="title">Название (например, «Дом»)</label>
|
|
<input id="title" name="title">
|
|
</div>
|
|
<label class="form-note" style="display:block;margin-bottom:14px">
|
|
<input type="checkbox" name="is_default"> Сделать основным
|
|
</label>
|
|
<button class="btn btn-accent" type="submit">Добавить адрес</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="account-panel" data-panel-body="bonus" hidden>
|
|
<div class="panel-head"><h2>Бонусы</h2></div>
|
|
<div class="balance-card">
|
|
<div class="form-note">Доступно бонусов</div>
|
|
<div class="value" data-bonus-amount>0 ₽</div>
|
|
</div>
|
|
<div data-bonus-history><p class="form-note">Загрузка…</p></div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script src="{% static 'storefront/js/account-page.js' %}" defer></script>
|
|
{% endblock %}
|