Перемещены поля адреса доставки под кнопки выбора типа доставки
- Все поля ввода адреса доставки теперь расположены под кнопками "С ДОСТАВКОЙ" / "САМОВЫВОЗ" - Поля адреса скрыты когда выбран вариант "САМОВЫВОЗ" - Поля адреса видны только когда выбрана "С ДОСТАВКОЙ" - Переименован div с id="delivery-fields" на id="delivery-mode-fields" для лучшей организации - Обновлена функция syncDeliveryType() для управления видимостью полей доставки - Улучшена структура формы для лучшей UX 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -207,8 +207,6 @@
|
|||||||
<!-- Скрытое поле для передачи значения is_delivery -->
|
<!-- Скрытое поле для передачи значения is_delivery -->
|
||||||
<input type="hidden" id="{{ form.is_delivery.id_for_label }}" name="{{ form.is_delivery.name }}" value="on">
|
<input type="hidden" id="{{ form.is_delivery.id_for_label }}" name="{{ form.is_delivery.name }}" value="on">
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md-6">
|
|
||||||
<!-- Кнопки выбора типа доставки -->
|
<!-- Кнопки выбора типа доставки -->
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label d-block mb-2">Тип доставки</label>
|
<label class="form-label d-block mb-2">Тип доставки</label>
|
||||||
@@ -225,6 +223,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Поля доставки (показываются только если выбрана доставка) -->
|
||||||
|
<div id="delivery-mode-fields" style="display: block;">
|
||||||
<!-- Чекбокс "Покупатель = получатель" -->
|
<!-- Чекбокс "Покупатель = получатель" -->
|
||||||
<div class="mb-3 form-check">
|
<div class="mb-3 form-check">
|
||||||
{{ form.customer_is_recipient }}
|
{{ form.customer_is_recipient }}
|
||||||
@@ -232,8 +232,6 @@
|
|||||||
Покупатель является получателем
|
Покупатель является получателем
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Поля получателя (показываются когда покупатель != получатель) -->
|
<!-- Поля получателя (показываются когда покупатель != получатель) -->
|
||||||
<div class="row" id="recipient-fields" style="display: none;">
|
<div class="row" id="recipient-fields" style="display: none;">
|
||||||
@@ -261,8 +259,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" id="delivery-fields">
|
|
||||||
<!-- Способ указания адреса -->
|
<!-- Способ указания адреса -->
|
||||||
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">{{ form.address_mode.label }}</label>
|
<label class="form-label">{{ form.address_mode.label }}</label>
|
||||||
@@ -423,6 +421,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Товары в заказе -->
|
<!-- Товары в заказе -->
|
||||||
<div class="card mb-3">
|
<div class="card mb-3">
|
||||||
@@ -984,7 +983,7 @@ if (typeof $ !== 'undefined') {
|
|||||||
// === УПРАВЛЕНИЕ ТИПОМ ДОСТАВКИ (КНОПКИ) ===
|
// === УПРАВЛЕНИЕ ТИПОМ ДОСТАВКИ (КНОПКИ) ===
|
||||||
const deliveryTypeRadios = document.querySelectorAll('input[name="delivery-type"]');
|
const deliveryTypeRadios = document.querySelectorAll('input[name="delivery-type"]');
|
||||||
const isDeliveryCheckbox = document.getElementById('{{ form.is_delivery.id_for_label }}');
|
const isDeliveryCheckbox = document.getElementById('{{ form.is_delivery.id_for_label }}');
|
||||||
const deliveryFields = document.getElementById('delivery-fields');
|
const deliveryModeFields = document.getElementById('delivery-mode-fields');
|
||||||
const pickupFields = document.getElementById('pickup-fields');
|
const pickupFields = document.getElementById('pickup-fields');
|
||||||
|
|
||||||
function syncDeliveryType() {
|
function syncDeliveryType() {
|
||||||
@@ -993,14 +992,14 @@ if (typeof $ !== 'undefined') {
|
|||||||
if (selectedType === 'delivery') {
|
if (selectedType === 'delivery') {
|
||||||
// Доставка
|
// Доставка
|
||||||
isDeliveryCheckbox.checked = true;
|
isDeliveryCheckbox.checked = true;
|
||||||
deliveryFields.style.display = '';
|
deliveryModeFields.style.display = 'block';
|
||||||
pickupFields.style.display = 'none';
|
pickupFields.style.display = 'none';
|
||||||
console.log('[DELIVERY TYPE] Delivery selected');
|
console.log('[DELIVERY TYPE] Delivery selected');
|
||||||
} else {
|
} else {
|
||||||
// Самовывоз
|
// Самовывоз
|
||||||
isDeliveryCheckbox.checked = false;
|
isDeliveryCheckbox.checked = false;
|
||||||
deliveryFields.style.display = 'none';
|
deliveryModeFields.style.display = 'none';
|
||||||
pickupFields.style.display = '';
|
pickupFields.style.display = 'block';
|
||||||
console.log('[DELIVERY TYPE] Pickup selected');
|
console.log('[DELIVERY TYPE] Pickup selected');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user