diff --git a/frontend/admin.html b/frontend/admin.html index 9465084..feb9fc9 100644 --- a/frontend/admin.html +++ b/frontend/admin.html @@ -1387,27 +1387,6 @@ - -
Начислить монеты
-
-
- -
- - -
-
- - -
- -
-
diff --git a/frontend/js/admin/sections/shop.js b/frontend/js/admin/sections/shop.js index 31345d3..bd18b57 100644 --- a/frontend/js/admin/sections/shop.js +++ b/frontend/js/admin/sections/shop.js @@ -1,13 +1,11 @@ 'use strict'; -/* admin → shop section: items + purchases + award coins */ +/* admin → shop section: items + purchases */ (function () { 'use strict'; let inited = false; let _shopItems = []; let _shopEditId = null; let _shopSaving = false; - let _shopSearchTimer = null; - let _coinsAwarding = false; async function load() { try { @@ -156,46 +154,6 @@ } catch(e) { LS.toast('Ошибка: ' + e.message, 'error'); } } - async function shopSearchUser(q) { - clearTimeout(_shopSearchTimer); - const box = document.getElementById('shop-award-results'); - if (q.length < 2) { box.classList.remove('open'); return; } - _shopSearchTimer = setTimeout(async () => { - try { - const r = await LS.adminGetUsers({ q, limit: 8 }); - const label = u => u.name || u.email; - box.innerHTML = (r.users || []).map(u => `
- ${esc(label(u))}${esc(u.role)} -
`).join('') || '
Не найдено
'; - box.classList.add('open'); - } catch(e) { box.classList.remove('open'); } - }, 300); - } - - function shopPickUser(el) { - document.getElementById('shop-award-uid').value = el.dataset.uid; - document.getElementById('shop-award-user').value = el.dataset.name || ''; - document.getElementById('shop-award-results').classList.remove('open'); - } - - async function shopAdminAwardCoins() { - if (_coinsAwarding) return; - const userId = parseInt(document.getElementById('shop-award-uid').value); - const amount = parseInt(document.getElementById('shop-award-amount').value); - const reason = document.getElementById('shop-award-reason').value.trim(); - if (!userId) { LS.toast('Выберите пользователя', 'error'); return; } - if (!amount || amount <= 0) { LS.toast('Введите количество монет', 'error'); return; } - _coinsAwarding = true; - try { - const r = await LS.adminShopAwardCoins({ userId, amount, reason }); - LS.toast(`Начислено ${amount} монет. Баланс: ${r.coins}`, 'success'); - document.getElementById('shop-award-uid').value = ''; - document.getElementById('shop-award-user').value = ''; - document.getElementById('shop-award-reason').value = ''; - } catch(e) { LS.toast('Ошибка: ' + e.message, 'error'); } - finally { _coinsAwarding = false; } - } - // Expose onclick handlers window.shopAdminCreateItem = shopAdminCreateItem; window.shopAdminEditItem = shopAdminEditItem; @@ -203,9 +161,6 @@ window.shopAdminSaveItem = shopAdminSaveItem; window.shopAdminDeleteItem = shopAdminDeleteItem; window.shopAdminToggleActive = shopAdminToggleActive; - window.shopSearchUser = shopSearchUser; - window.shopPickUser = shopPickUser; - window.shopAdminAwardCoins = shopAdminAwardCoins; window.AdminSections = window.AdminSections || {}; window.AdminSections.shop = {