Исправлен селектор формы в draft-creator.js
Заменил form[action*="create"] на #order-form, т.к. у формы нет атрибута action. Добавлены дополнительные проверки и логирование для отладки. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -27,11 +27,19 @@
|
|||||||
// Проверяем, что мы на странице создания заказа
|
// Проверяем, что мы на странице создания заказа
|
||||||
const isCreatePage = window.location.pathname.includes('/orders/create/');
|
const isCreatePage = window.location.pathname.includes('/orders/create/');
|
||||||
if (!isCreatePage) {
|
if (!isCreatePage) {
|
||||||
|
console.log('[DraftCreator] Not on create page, exiting');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const orderForm = document.querySelector('form[action*="create"]');
|
const orderForm = document.getElementById('order-form');
|
||||||
if (!orderForm) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +53,7 @@
|
|||||||
* Прикрепляет обработчики событий к полям формы
|
* Прикрепляет обработчики событий к полям формы
|
||||||
*/
|
*/
|
||||||
function attachEventListeners() {
|
function attachEventListeners() {
|
||||||
const form = document.querySelector('form[action*="create"]');
|
const form = document.getElementById('order-form');
|
||||||
if (!form) {
|
if (!form) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -225,7 +233,7 @@
|
|||||||
* Собирает данные формы для отправки
|
* Собирает данные формы для отправки
|
||||||
*/
|
*/
|
||||||
function collectFormData() {
|
function collectFormData() {
|
||||||
const form = document.querySelector('form[action*="create"]');
|
const form = document.getElementById('order-form');
|
||||||
const data = {};
|
const data = {};
|
||||||
|
|
||||||
// Основные поля заказа
|
// Основные поля заказа
|
||||||
|
|||||||
Reference in New Issue
Block a user