From 1e97ec533e4000f8ff3cd54b08e08ebafee304b7 Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Sat, 8 Nov 2025 23:14:42 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D1=81=D0=B5=D0=BB=D0=B5=D0=BA=D1=82=D0=BE=D1=80?= =?UTF-8?q?=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20=D0=B2=20draft-creator.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Заменил form[action*="create"] на #order-form, т.к. у формы нет атрибута action. Добавлены дополнительные проверки и логирование для отладки. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- myproject/orders/static/orders/js/draft-creator.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/myproject/orders/static/orders/js/draft-creator.js b/myproject/orders/static/orders/js/draft-creator.js index 7f6549e..094ce6c 100644 --- a/myproject/orders/static/orders/js/draft-creator.js +++ b/myproject/orders/static/orders/js/draft-creator.js @@ -27,11 +27,19 @@ // Проверяем, что мы на странице создания заказа const isCreatePage = window.location.pathname.includes('/orders/create/'); if (!isCreatePage) { + console.log('[DraftCreator] Not on create page, exiting'); return; } - const orderForm = document.querySelector('form[action*="create"]'); + const orderForm = document.getElementById('order-form'); if (!orderForm) { + console.log('[DraftCreator] Order form not found, exiting'); + return; + } + + // Проверяем, что это не черновик (для черновиков есть autosave.js) + if (orderForm.dataset.isDraft === 'true') { + console.log('[DraftCreator] This is a draft, exiting (autosave.js will handle it)'); return; } @@ -45,7 +53,7 @@ * Прикрепляет обработчики событий к полям формы */ function attachEventListeners() { - const form = document.querySelector('form[action*="create"]'); + const form = document.getElementById('order-form'); if (!form) { return; } @@ -225,7 +233,7 @@ * Собирает данные формы для отправки */ function collectFormData() { - const form = document.querySelector('form[action*="create"]'); + const form = document.getElementById('order-form'); const data = {}; // Основные поля заказа