diff --git a/web/templates/admin_pricing.html b/web/templates/admin_pricing.html index 7f4f67f..9f3ed44 100644 --- a/web/templates/admin_pricing.html +++ b/web/templates/admin_pricing.html @@ -213,6 +213,7 @@ let componentsCache = []; let sortField = 'popularity_score'; let sortDir = 'desc'; let pricelistsPage = 1; +let pricelistsCanWrite = false; async function loadTab(tab) { currentTab = tab; @@ -896,9 +897,9 @@ async function checkPricelistWritePermission() { try { const resp = await fetch('/api/pricelists/can-write'); const data = await resp.json(); - canWrite = data.can_write; + pricelistsCanWrite = data.can_write; - if (canWrite) { + if (pricelistsCanWrite) { document.getElementById('pricelists-create-btn-container').innerHTML = ` Создать прайслист @@ -934,7 +935,7 @@ function renderPricelists(pricelists) { document.getElementById('pricelists-body').innerHTML = ` - Прайслисты не найдены. ${canWrite ? 'Создайте первый прайслист.' : ''} + Прайслисты не найдены. ${pricelistsCanWrite ? 'Создайте первый прайслист.' : ''} `; @@ -947,7 +948,7 @@ function renderPricelists(pricelists) { const statusText = pl.is_active ? 'Активен' : 'Неактивен'; let actions = `Просмотр`; - if (canWrite && pl.usage_count === 0) { + if (pricelistsCanWrite && pl.usage_count === 0) { actions += ` Удалить`; }