Добавлено логирование в select2:clear для отладки
This commit is contained in:
@@ -1201,11 +1201,17 @@ window.initOrderItemSelect2 = function(element) {
|
||||
|
||||
// Очистка при удалении выбора
|
||||
$element.on('select2:clear', function() {
|
||||
console.log('[Select2 Clear] Очистка товара в форме');
|
||||
const form = element.closest('.order-item-form');
|
||||
const formIndex = Array.from(document.querySelectorAll('.order-item-form')).indexOf(form);
|
||||
console.log(`[Select2 Clear] Индекс формы: ${formIndex}`);
|
||||
|
||||
form.querySelector('[name$="-product"]').value = '';
|
||||
form.querySelector('[name$="-product_kit"]').value = '';
|
||||
form.querySelector('[name$="-price"]').value = '';
|
||||
form.querySelector('[name$="-quantity"]').value = '';
|
||||
|
||||
console.log('[Select2 Clear] Все поля очищены, форма осталась в DOM');
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user