New enterprise feature

This commit is contained in:
Urtzi Alfaro
2025-11-30 09:12:40 +01:00
parent f9d0eec6ec
commit 972db02f6d
176 changed files with 19741 additions and 1361 deletions

View File

@@ -151,13 +151,17 @@ const DemoPage = () => {
const getLoadingMessage = (tier, progress) => {
if (tier === 'enterprise') {
if (progress < 25) return 'Creando obrador central...';
if (progress < 50) return 'Configurando puntos de venta...';
if (progress < 75) return 'Generando rutas de distribución...';
if (progress < 15) return 'Preparando entorno enterprise...';
if (progress < 35) return 'Creando obrador central en Madrid...';
if (progress < 55) return 'Configurando outlets en Barcelona, Valencia y Bilbao...';
if (progress < 75) return 'Generando rutas de distribución optimizadas...';
if (progress < 90) return 'Configurando red de distribución...';
return 'Finalizando configuración enterprise...';
} else {
if (progress < 50) return 'Configurando tu panadería...';
return 'Cargando datos de demostración...';
if (progress < 30) return 'Preparando tu panadería...';
if (progress < 60) return 'Configurando inventario y recetas...';
if (progress < 85) return 'Generando datos de ventas y producción...';
return 'Finalizando configuración...';
}
};
@@ -380,8 +384,13 @@ const DemoPage = () => {
};
const updateProgressFromBackendStatus = (statusData, tier) => {
// Calculate progress based on the actual status from backend
if (statusData.progress) {
// IMPORTANT: Backend only provides progress AFTER cloning completes
// During cloning (status=PENDING), progress is empty {}
// So we rely on estimated progress for visual feedback
const hasRealProgress = statusData.progress && Object.keys(statusData.progress).length > 0;
if (hasRealProgress) {
if (tier === 'enterprise') {
// Handle enterprise progress structure which may be different
// Enterprise demos may have a different progress structure with parent, children, distribution
@@ -391,12 +400,29 @@ const DemoPage = () => {
handleIndividualProgress(statusData.progress);
}
} else {
// If no detailed progress available, use estimated progress or increment gradually
// No detailed progress available - backend is still cloning
// Use estimated progress for smooth visual feedback
// This is NORMAL during the cloning phase
setCloneProgress(prev => {
const newProgress = Math.max(
estimatedProgress,
Math.min(prev.overall + 2, 95) // Increment by 2% instead of 1%
prev.overall // Never go backward
);
// For enterprise, also update sub-components based on estimated progress
if (tier === 'enterprise') {
return {
parent: Math.min(95, Math.round(estimatedProgress * 0.4)), // 40% weight
children: [
Math.min(95, Math.round(estimatedProgress * 0.35)),
Math.min(95, Math.round(estimatedProgress * 0.35)),
Math.min(95, Math.round(estimatedProgress * 0.35))
],
distribution: Math.min(95, Math.round(estimatedProgress * 0.25)), // 25% weight
overall: newProgress
};
}
return {
...prev,
overall: newProgress