demo seed change
This commit is contained in:
@@ -36,6 +36,7 @@ import {
|
||||
PendingPurchasesBlock,
|
||||
PendingDeliveriesBlock,
|
||||
ProductionStatusBlock,
|
||||
AIInsightsBlock,
|
||||
} from '../../components/dashboard/blocks';
|
||||
import { UnifiedPurchaseOrderModal } from '../../components/domain/procurement/UnifiedPurchaseOrderModal';
|
||||
import { UnifiedAddWizard } from '../../components/domain/unified-wizard';
|
||||
@@ -50,7 +51,7 @@ import { useSubscription } from '../../api/hooks/subscription';
|
||||
import { SUBSCRIPTION_TIERS } from '../../api/types/subscription';
|
||||
|
||||
// Rename the existing component to BakeryDashboard
|
||||
export function BakeryDashboard() {
|
||||
export function BakeryDashboard({ plan }: { plan?: string }) {
|
||||
const { t } = useTranslation(['dashboard', 'common', 'alerts']);
|
||||
const { currentTenant } = useTenant();
|
||||
const tenantId = currentTenant?.id || '';
|
||||
@@ -415,10 +416,25 @@ export function BakeryDashboard() {
|
||||
lateToStartBatches={dashboardData?.lateToStartBatches || []}
|
||||
runningBatches={dashboardData?.runningBatches || []}
|
||||
pendingBatches={dashboardData?.pendingBatches || []}
|
||||
alerts={dashboardData?.alerts || []}
|
||||
loading={dashboardLoading}
|
||||
onStartBatch={handleStartBatch}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* BLOCK 5: AI Insights (Professional/Enterprise only) */}
|
||||
{(plan === SUBSCRIPTION_TIERS.PROFESSIONAL || plan === SUBSCRIPTION_TIERS.ENTERPRISE) && (
|
||||
<div data-tour="ai-insights">
|
||||
<AIInsightsBlock
|
||||
insights={dashboardData?.aiInsights || []}
|
||||
loading={dashboardLoading}
|
||||
onViewAll={() => {
|
||||
// Navigate to AI Insights page
|
||||
window.location.href = '/app/analytics/ai-insights';
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
@@ -480,7 +496,7 @@ export function DashboardPage() {
|
||||
return <EnterpriseDashboardPage tenantId={tenantId} />;
|
||||
}
|
||||
|
||||
return <BakeryDashboard />;
|
||||
return <BakeryDashboard plan={plan} />;
|
||||
}
|
||||
|
||||
export default DashboardPage;
|
||||
|
||||
@@ -193,7 +193,7 @@ const MaquinariaPage: React.FC = () => {
|
||||
maintenance: { color: getStatusColor('info'), text: t('equipment_status.maintenance'), icon: Wrench },
|
||||
down: { color: getStatusColor('error'), text: t('equipment_status.down'), icon: AlertTriangle }
|
||||
};
|
||||
return configs[status];
|
||||
return configs[status] || { color: getStatusColor('other'), text: status, icon: Settings };
|
||||
};
|
||||
|
||||
const getTypeIcon = (type: Equipment['type']) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { useState, useMemo } from 'react';
|
||||
import { Plus, Clock, AlertCircle, CheckCircle, Timer, ChefHat, Eye, Edit, Package, PlusCircle, Play } from 'lucide-react';
|
||||
import { Plus, Clock, AlertCircle, CheckCircle, Timer, ChefHat, Eye, Edit, Package, PlusCircle, Play, Info } from 'lucide-react';
|
||||
import { Button, StatsGrid, EditViewModal, Toggle, SearchAndFilter, type FilterConfig, EmptyState } from '../../../../components/ui';
|
||||
import { statusColors } from '../../../../styles/colors';
|
||||
import { formatters } from '../../../../components/ui/Stats/StatsPresets';
|
||||
@@ -666,6 +666,58 @@ const ProductionPage: React.FC = () => {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Detalles del Razonamiento',
|
||||
icon: Info,
|
||||
fields: [
|
||||
{
|
||||
label: 'Causa Principal',
|
||||
value: selectedBatch.reasoning_data?.trigger_type
|
||||
? t(`reasoning:triggers.${selectedBatch.reasoning_data.trigger_type.toLowerCase()}`)
|
||||
: 'No especificado',
|
||||
span: 2
|
||||
},
|
||||
{
|
||||
label: 'Descripción del Razonamiento',
|
||||
value: selectedBatch.reasoning_data?.trigger_description || 'No especificado',
|
||||
type: 'textarea',
|
||||
span: 2
|
||||
},
|
||||
{
|
||||
label: 'Factores Clave',
|
||||
value: selectedBatch.reasoning_data?.factors && Array.isArray(selectedBatch.reasoning_data.factors)
|
||||
? selectedBatch.reasoning_data.factors.map(factor =>
|
||||
t(`reasoning:factors.${factor.toLowerCase()}`) || factor
|
||||
).join(', ')
|
||||
: 'No especificados',
|
||||
span: 2
|
||||
},
|
||||
{
|
||||
label: 'Consecuencias Potenciales',
|
||||
value: selectedBatch.reasoning_data?.consequence || 'No especificado',
|
||||
type: 'textarea',
|
||||
span: 2
|
||||
},
|
||||
{
|
||||
label: 'Nivel de Confianza',
|
||||
value: selectedBatch.reasoning_data?.confidence_score
|
||||
? `${selectedBatch.reasoning_data.confidence_score}%`
|
||||
: 'No especificado'
|
||||
},
|
||||
{
|
||||
label: 'Variación Histórica',
|
||||
value: selectedBatch.reasoning_data?.variance
|
||||
? `${selectedBatch.reasoning_data.variance}%`
|
||||
: 'No especificado'
|
||||
},
|
||||
{
|
||||
label: 'Detalles de la Predicción',
|
||||
value: selectedBatch.reasoning_data?.prediction_details || 'No especificado',
|
||||
type: 'textarea',
|
||||
span: 2
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Calidad y Costos',
|
||||
icon: CheckCircle,
|
||||
@@ -733,6 +785,10 @@ const ProductionPage: React.FC = () => {
|
||||
'Estado': 'status',
|
||||
'Prioridad': 'priority',
|
||||
'Personal Asignado': 'staff_assigned',
|
||||
// Reasoning section editable fields
|
||||
'Descripción del Razonamiento': 'reasoning_data.trigger_description',
|
||||
'Consecuencias Potenciales': 'reasoning_data.consequence',
|
||||
'Detalles de la Predicción': 'reasoning_data.prediction_details',
|
||||
// Schedule - most fields are read-only datetime
|
||||
// Quality and Costs
|
||||
'Notas de Producción': 'production_notes',
|
||||
@@ -744,6 +800,7 @@ const ProductionPage: React.FC = () => {
|
||||
['Producto', 'Número de Lote', 'Cantidad Planificada', 'Cantidad Producida', 'Estado', 'Prioridad', 'Personal Asignado', 'Equipos Utilizados'],
|
||||
['Inicio Planificado', 'Fin Planificado', 'Duración Planificada', 'Inicio Real', 'Fin Real', 'Duración Real'],
|
||||
[], // Process Stage Tracker section - no editable fields
|
||||
['Causa Principal', 'Descripción del Razonamiento', 'Factores Clave', 'Consecuencias Potenciales', 'Nivel de Confianza', 'Variación Histórica', 'Detalles de la Predicción'], // Reasoning section
|
||||
['Puntuación de Calidad', 'Rendimiento', 'Costo Estimado', 'Costo Real', 'Notas de Producción', 'Notas de Calidad']
|
||||
];
|
||||
|
||||
@@ -760,10 +817,22 @@ const ProductionPage: React.FC = () => {
|
||||
processedValue = parseFloat(value as string) || 0;
|
||||
}
|
||||
|
||||
setSelectedBatch({
|
||||
...selectedBatch,
|
||||
[propertyName]: processedValue
|
||||
});
|
||||
// Handle nested reasoning_data fields
|
||||
if (propertyName.startsWith('reasoning_data.')) {
|
||||
const nestedProperty = propertyName.split('.')[1];
|
||||
setSelectedBatch({
|
||||
...selectedBatch,
|
||||
reasoning_data: {
|
||||
...(selectedBatch.reasoning_data || {}),
|
||||
[nestedProperty]: processedValue
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setSelectedBatch({
|
||||
...selectedBatch,
|
||||
[propertyName]: processedValue
|
||||
});
|
||||
}
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user