From 9d30585761a4fcf63d34fb6f864d44e5cb63ffde Mon Sep 17 00:00:00 2001 From: marina Date: Tue, 17 Jun 2025 09:08:52 +0300 Subject: [PATCH] =?utf8?q?ERP-360=20=D0=A1=D0=B1=D0=BE=D1=80=D0=BA=D0=B0?= =?utf8?q?=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B=20=D0=B0?= =?utf8?q?=D0=B2=D1=82=D0=BE=D0=BF=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../js/autoplannogramma/autoplannogramma.js | 47 ++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/erp24/web/js/autoplannogramma/autoplannogramma.js b/erp24/web/js/autoplannogramma/autoplannogramma.js index f8df9689..08b49083 100644 --- a/erp24/web/js/autoplannogramma/autoplannogramma.js +++ b/erp24/web/js/autoplannogramma/autoplannogramma.js @@ -373,4 +373,49 @@ function getMonthNumberByWeek(week, year) { return startMonth; } return startMonth; -} \ No newline at end of file +} + +document.addEventListener("DOMContentLoaded", async () => { + const week = '23'; + const month = 6; + const storeId = 6; + const year = new Date().getFullYear(); + + if (!week) return; + + try { + const response = await fetch(`/auto-plannogramma/weekly-bouquet-products-forecast?month=${month}&year=${year}&week=${week}&storeId=${storeId}`); + const json = await response.json(); + if (json.success && json.data) { + Object.assign(forecastCache, json.data); + } + console.log(json); + console.log(forecastCache); + } catch (e) { + console.error("Ошибка загрузки прогнозов:", e); + } +}); + +function buildForecastTooltip(week, storeId, guid) { + console.log(week, storeId, guid); + const weekData = forecastCache[week]; + if (!weekData) return null; + + const storeData = weekData[storeId]; + if (!storeData) return null; + + const productData = storeData[guid]; + if (!productData) return null; + + let tooltip = `
Прогноз:
`; + for (const [type, groups] of Object.entries(productData)) { + tooltip += `
${type}
    `; + for (const [group, value] of Object.entries(groups)) { + tooltip += `
  • ${group}: ${value}
  • `; + } + tooltip += `
`; + } + tooltip += `
`; + + return tooltip; +} -- 2.39.5