feat: update order payment methods and refine profile edit functionality
All checks were successful
Build and Push Docker Image / build (push) Successful in 43s

- Replaced `Order.PaymentMethod` options with "cash" and "card" while adjusting related code and templates
- Set "cash" as the default payment method for orders and checkout forms
- Added profile editing functionality with `ProfileForm`, allowing users to update names
- Improved feedback messages across profile and order management templates
- Updated catalog to handle empty filter results with a "reset filters" option
This commit is contained in:
2026-05-30 12:25:19 +02:00
parent d4fa91ac7f
commit ad962d946b
18 changed files with 171 additions and 36 deletions

View File

@@ -1,5 +1,14 @@
<main class="item-list">
{% include "_fragments/item-grid.html" with items=page_obj empty_message="В этой категории пока нет товаров." %}
{% if page_obj.object_list %}
{% include "_fragments/item-grid.html" with items=page_obj empty_message="В этой категории пока нет товаров." %}
{% elif filters_active %}
<div class="catalog-empty">
<p class="item-list-empty">По выбранным фильтрам ничего не найдено.</p>
<a class="catalog-empty__reset" href="{{ reset_filters_url }}">Сбросить фильтры</a>
</div>
{% else %}
{% include "_fragments/item-grid.html" with items=page_obj empty_message="В этой категории пока нет товаров." %}
{% endif %}
{% if paginator.num_pages > 1 %}
<nav class="catalog-pagination">

View File

@@ -112,11 +112,11 @@
<legend>СПОСОБ ДОСТАВКИ</legend>
<div class="checkout-options checkout-options--two">
<label class="checkout-radio">
<input type="radio" name="delivery_method" value="courier" {% if checkout_form.delivery_method.value == "courier" or not checkout_form.is_bound %}checked{% endif %}>
<input type="radio" name="delivery_method" value="courier" required {% if checkout_form.delivery_method.value == "courier" or not checkout_form.is_bound %}checked{% endif %}>
<span>Курьерская доставка</span>
</label>
<label class="checkout-radio">
<input type="radio" name="delivery_method" value="pickup" {% if checkout_form.delivery_method.value == "pickup" %}checked{% endif %}>
<input type="radio" name="delivery_method" value="pickup" required {% if checkout_form.delivery_method.value == "pickup" %}checked{% endif %}>
<span>Самовывоз</span>
</label>
</div>
@@ -141,18 +141,14 @@
<fieldset class="checkout-fieldset">
<legend>СПОСОБ ОПЛАТЫ</legend>
<div class="checkout-options checkout-options--three">
<div class="checkout-options checkout-options--two">
<label class="checkout-radio">
<input type="radio" name="payment_method" value="card" {% if checkout_form.payment_method.value == "card" or not checkout_form.is_bound %}checked{% endif %}>
<span>Банковская карта</span>
<input type="radio" name="payment_method" value="cash" required {% if checkout_form.payment_method.value == "cash" or not checkout_form.is_bound %}checked{% endif %}>
<span>Наличкой при получении</span>
</label>
<label class="checkout-radio">
<input type="radio" name="payment_method" value="credit" {% if checkout_form.payment_method.value == "credit" %}checked{% endif %}>
<span>Кредит</span>
</label>
<label class="checkout-radio">
<input type="radio" name="payment_method" value="installment" {% if checkout_form.payment_method.value == "installment" %}checked{% endif %}>
<span>Рассрочка</span>
<input type="radio" name="payment_method" value="card" required {% if checkout_form.payment_method.value == "card" %}checked{% endif %}>
<span>Картой при получении</span>
</label>
</div>
{% for error in checkout_form.payment_method.errors %}<p class="field-error">{{ error }}</p>{% endfor %}
@@ -163,15 +159,15 @@
<div class="checkout-grid checkout-grid--contacts">
<label class="checkout-input checkout-input--wide">
<span>ФИО*</span>
<input type="text" name="customer_name" value="{{ checkout_form.customer_name.value|default:'' }}" placeholder="ФИО*" autocomplete="name">
<input type="text" name="customer_name" value="{{ checkout_form.customer_name.value|default:'' }}" placeholder="ФИО*" autocomplete="name" required>
</label>
<label class="checkout-input">
<span>Телефон*</span>
<input type="tel" name="phone" value="{{ checkout_form.phone.value|default:'' }}" placeholder="Телефон*" autocomplete="tel">
<input type="tel" name="phone" value="{{ checkout_form.phone.value|default:'' }}" placeholder="Телефон*" autocomplete="tel" inputmode="tel" pattern="\+?[\d\s\-()]{7,20}" required>
</label>
<label class="checkout-input">
<span>E-mail*</span>
<input type="email" name="email" value="{{ checkout_form.email.value|default:'' }}" placeholder="E-mail*" autocomplete="email">
<input type="email" name="email" value="{{ checkout_form.email.value|default:'' }}" placeholder="E-mail*" autocomplete="email" required>
</label>
</div>
{% for error in checkout_form.customer_name.errors %}<p class="field-error">{{ error }}</p>{% endfor %}
@@ -201,7 +197,7 @@
<button class="checkout-submit" type="submit">ОФОРМИТЬ ЗАКАЗ</button>
<label class="checkout-checkbox checkout-checkbox--terms">
<input type="checkbox" name="terms_accepted" value="on" {% if checkout_form.terms_accepted.value %}checked{% endif %}>
<input type="checkbox" name="terms_accepted" value="on" required {% if checkout_form.terms_accepted.value %}checked{% endif %}>
<span>Согласен с условиями продажи, оплаты и возврата</span>
</label>
{% for error in checkout_form.terms_accepted.errors %}<p class="field-error">{{ error }}</p>{% endfor %}

View File

@@ -1,7 +1,7 @@
<div style="max-width:640px;margin:0 auto;background:#ffffff;border:1px solid #d6dde6;padding:32px;font-family:Arial,sans-serif;color:#36213e;">
<h1 style="margin:0 0 16px;font-size:28px;">Заказ №{{ order.id }} оплачен</h1>
<h1 style="margin:0 0 16px;font-size:28px;">Заказ №{{ order.id }} оформлен</h1>
<p>Здравствуйте, {{ order.customer_name }}!</p>
<p>Ваш заказ успешно оформлен и оплачен.</p>
<p>Ваш заказ успешно оформлен.</p>
<table style="width:100%;border-collapse:collapse;margin:24px 0;">
<thead>
@@ -26,7 +26,7 @@
<p><strong>Скидка:</strong> {{ order.discount_total }} руб.</p>
<p><strong>Доставка:</strong> {{ order.delivery_total }} руб.</p>
<p><strong>Подъём на этаж:</strong> {{ order.floor_lift_total }} руб.</p>
<p style="font-size:18px;"><strong>Итого к оплате:</strong> {{ order.total }} руб.</p>
<p style="font-size:18px;"><strong>Итого:</strong> {{ order.total }} руб.</p>
<p><strong>Доставка:</strong> {{ order.get_delivery_method_display }}</p>
{% if order.region or order.address %}

View File

@@ -1,6 +1,6 @@
Здравствуйте, {{ order.customer_name }}!
Ваш заказ №{{ order.id }} успешно оплачен.
Ваш заказ №{{ order.id }} успешно оформлен.
Состав заказа:
{% for item in order.items.all %}
@@ -11,7 +11,7 @@
Скидка: {{ order.discount_total }} руб.
Доставка: {{ order.delivery_total }} руб.
Подъём на этаж: {{ order.floor_lift_total }} руб.
Итого к оплате: {{ order.total }} руб.
Итого: {{ order.total }} руб.
Доставка: {{ order.get_delivery_method_display }}
{% if order.region or order.address %}Адрес: {{ order.region }}{% if order.address %}, {{ order.address }}{% endif %}

View File

@@ -1 +1 @@
{{ site_name }}: заказ №{{ order.id }} оплачен
{{ site_name }}: заказ №{{ order.id }} оформлен

View File

@@ -1,7 +1,7 @@
{% extends "_layouts/base.html" %}
{% load static %}
{% block title %}Оплата прошла успешно{% endblock %}
{% block title %}Заказ оформлен{% endblock %}
{% block add_css %}
<link rel="stylesheet" href="{% static "css/cart.css" %}">
@@ -10,11 +10,11 @@
{% block content %}
{% include "_fragments/header.html" %}
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2='/orders/cart/' text_2='Корзина' url_3=request.path text_3='Заказ оплачен' %}
{% include '_fragments/breadcrumbs.html' with url_1='/' text_1='Главная' url_2='/orders/cart/' text_2='Корзина' url_3=request.path text_3='Заказ оформлен' %}
<main class="container cart-page">
<section class="order-success">
<p class="order-success__eyebrow">Оплата прошла успешно</p>
<p class="order-success__eyebrow">Заказ оформлен</p>
<h1>Заказ №{{ order.id }} оформлен</h1>
<p class="order-success__lead">
Мы отправили письмо с деталями заказа на {{ order.email }}. Менеджер свяжется с вами при необходимости.

View File

@@ -24,7 +24,48 @@
<div class="auth-copy-block">
<h2 class="auth-panel-title">Данные аккаунта</h2>
<p class="auth-panel-text"><strong>Email:</strong> {{ request.user.email }}</p>
<p class="auth-panel-text"><strong>Имя:</strong> {{ request.user.get_full_name|default:"Не указано" }}</p>
{% if messages %}
{% for message in messages %}
<p class="auth-panel-text">{{ message }}</p>
{% endfor %}
{% endif %}
<form class="auth-form" method="post" action="{% url 'users:profile' %}">
{% csrf_token %}
<div class="auth-field">
<label for="{{ form.first_name.id_for_label }}">Имя</label>
<input
id="{{ form.first_name.id_for_label }}"
name="{{ form.first_name.html_name }}"
type="text"
value="{{ form.first_name.value|default:'' }}"
autocomplete="given-name"
required
>
{% for error in form.first_name.errors %}
<p class="auth-field-error">{{ error }}</p>
{% endfor %}
</div>
<div class="auth-field">
<label for="{{ form.last_name.id_for_label }}">Фамилия</label>
<input
id="{{ form.last_name.id_for_label }}"
name="{{ form.last_name.html_name }}"
type="text"
value="{{ form.last_name.value|default:'' }}"
autocomplete="family-name"
required
>
{% for error in form.last_name.errors %}
<p class="auth-field-error">{{ error }}</p>
{% endfor %}
</div>
<div class="auth-actions">
<button class="auth-submit" type="submit">Сохранить</button>
</div>
</form>
<form method="post" action="{% url 'users:logout' %}">
{% csrf_token %}
<div class="auth-actions">