Fix new services implementation 3

This commit is contained in:
Urtzi Alfaro
2025-08-14 16:47:34 +02:00
parent 0951547e92
commit 03737430ee
51 changed files with 657 additions and 982 deletions

View File

@@ -115,7 +115,8 @@ export const useDashboard = () => {
const forecastPromises = products.map(async (product) => {
try {
const forecastRequest = {
product_name: product,
inventory_product_id: product, // Use product as inventory_product_id
product_name: product, // Keep for backward compatibility
forecast_date: new Date().toISOString().split('T')[0], // Today's date as YYYY-MM-DD
forecast_days: 1,
location: 'madrid_centro', // Default location for Madrid bakery

View File

@@ -101,7 +101,9 @@ export const useOrderSuggestions = () => {
for (const product of dailyProducts) {
// Find forecast for this product
const forecast = quickForecasts.find(f => f.product_name === product);
const forecast = quickForecasts.find(f =>
f.product_name === product || f.inventory_product_id === product
);
if (forecast) {
// Calculate suggested quantity based on prediction