From 78a870ab703eb8521aaaa0ea1da1e1892c153f3f Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Wed, 3 Jun 2026 14:02:05 +0300 Subject: [PATCH] =?UTF-8?q?fix(shop):=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=20?= =?UTF-8?q?=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D0=B0=20=D1=81=D0=BA=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D0=BB=D0=B8=D1=82=D1=81=D1=8F=20=D0=B2=20=D0=B2=D0=B8?= =?UTF-8?q?=D0=B4=D0=B8=D0=BC=D1=83=D1=8E=20=D0=BE=D0=B1=D0=BB=D0=B0=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20+=20=D1=82=D0=B8=D0=BF=20=C2=AB=D0=A4=D0=BE?= =?UTF-8?q?=D0=BD=C2=BB=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20=D0=BC?= =?UTF-8?q?=D1=91=D1=80=D1=82=D0=B2=D0=BE=D0=B3=D0=BE=20=C2=AB=D0=A2=D0=B5?= =?UTF-8?q?=D0=BC=D0=B0=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - shopAdminCreateItem/EditItem открывали форму под таблицей на 51 строку — вне экрана, выглядело как «кнопки не работают». Добавлен showShopForm(): scrollIntoView + фокус в поле названия. - В выпадающем списке типов «Тема» (theme) не поддерживается бэкендом (валидация POST: frame/title/effect/background) → создание падало с 400. Заменён на рабочий «Фон» (background); добавлена подпись в typeLabels. Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/admin.html | 2 +- frontend/js/admin/sections/shop.js | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/admin.html b/frontend/admin.html index c813f1f..9465084 100644 --- a/frontend/admin.html +++ b/frontend/admin.html @@ -1350,7 +1350,7 @@ diff --git a/frontend/js/admin/sections/shop.js b/frontend/js/admin/sections/shop.js index a880d27..31345d3 100644 --- a/frontend/js/admin/sections/shop.js +++ b/frontend/js/admin/sections/shop.js @@ -48,7 +48,7 @@ function renderShopItems() { const body = document.getElementById('shop-items-body'); if (!_shopItems.length) { body.innerHTML = 'Нет товаров'; return; } - const typeLabels = { frame:'Рамка', title:'Титул', theme:'Тема', effect:'Эффект' }; + const typeLabels = { frame:'Рамка', title:'Титул', theme:'Тема', effect:'Эффект', background:'Фон' }; body.innerHTML = _shopItems.map(it => ` ${it.id} ${esc(it.name)} @@ -69,6 +69,13 @@ if (window.lucide) lucide.createIcons(); } + function showShopForm() { + const form = document.getElementById('shop-item-form'); + form.style.display = ''; + form.scrollIntoView({ behavior: 'smooth', block: 'center' }); + document.getElementById('shop-f-name').focus(); + } + function shopAdminCreateItem() { _shopEditId = null; document.getElementById('shop-form-title').textContent = 'Добавить товар'; @@ -79,7 +86,7 @@ document.getElementById('shop-f-icon').value = ''; document.getElementById('shop-f-data').value = ''; document.getElementById('shop-f-active').checked = true; - document.getElementById('shop-item-form').style.display = ''; + showShopForm(); } function shopAdminEditItem(id) { @@ -94,7 +101,7 @@ document.getElementById('shop-f-icon').value = it.icon || ''; document.getElementById('shop-f-data').value = it.data ? (typeof it.data === 'string' ? it.data : JSON.stringify(it.data)) : ''; document.getElementById('shop-f-active').checked = !!it.is_active; - document.getElementById('shop-item-form').style.display = ''; + showShopForm(); } function shopAdminCancelForm() {