Files
bakery-ia/frontend/src/pages/app/DashboardPage.tsx

129 lines
3.2 KiB
TypeScript
Raw Normal View History

2025-08-28 10:41:04 +02:00
import React from 'react';
import { PageHeader } from '../../components/layout';
2025-09-19 16:17:04 +02:00
import StatsGrid from '../../components/ui/Stats/StatsGrid';
import RealTimeAlerts from '../../components/domain/dashboard/RealTimeAlerts';
import ProcurementPlansToday from '../../components/domain/dashboard/ProcurementPlansToday';
import ProductionPlansToday from '../../components/domain/dashboard/ProductionPlansToday';
import {
AlertTriangle,
Clock,
DollarSign,
Package,
TrendingUp,
TrendingDown
} from 'lucide-react';
2025-08-28 10:41:04 +02:00
const DashboardPage: React.FC = () => {
2025-09-19 16:17:04 +02:00
const criticalStats = [
2025-08-28 10:41:04 +02:00
{
title: 'Ventas Hoy',
2025-09-19 16:17:04 +02:00
value: '€1,247',
icon: DollarSign,
variant: 'success' as const,
2025-08-28 10:41:04 +02:00
trend: {
value: 12,
2025-09-19 16:17:04 +02:00
direction: 'up' as const,
label: '% vs ayer'
2025-08-28 10:41:04 +02:00
},
2025-09-19 16:17:04 +02:00
subtitle: '+€135 más que ayer'
2025-08-28 10:41:04 +02:00
},
{
title: 'Órdenes Pendientes',
2025-09-19 16:17:04 +02:00
value: '23',
icon: Clock,
variant: 'warning' as const,
2025-08-28 10:41:04 +02:00
trend: {
2025-09-19 16:17:04 +02:00
value: 4,
2025-08-28 10:41:04 +02:00
direction: 'down' as const,
2025-09-19 16:17:04 +02:00
label: '% vs ayer'
2025-08-28 10:41:04 +02:00
},
2025-09-19 16:17:04 +02:00
subtitle: 'Requieren atención'
2025-08-28 10:41:04 +02:00
},
{
title: 'Productos Vendidos',
2025-09-19 16:17:04 +02:00
value: '156',
icon: Package,
variant: 'info' as const,
2025-08-28 10:41:04 +02:00
trend: {
2025-09-19 16:17:04 +02:00
value: 8,
2025-08-28 10:41:04 +02:00
direction: 'up' as const,
2025-09-19 16:17:04 +02:00
label: '% vs ayer'
2025-08-28 10:41:04 +02:00
},
2025-09-19 16:17:04 +02:00
subtitle: '+12 unidades más'
2025-08-28 10:41:04 +02:00
},
{
title: 'Stock Crítico',
2025-09-19 16:17:04 +02:00
value: '4',
icon: AlertTriangle,
variant: 'error' as const,
2025-08-28 10:41:04 +02:00
trend: {
value: 100,
2025-09-19 16:17:04 +02:00
direction: 'up' as const,
label: '% vs ayer'
2025-08-28 10:41:04 +02:00
},
2025-09-19 16:17:04 +02:00
subtitle: 'Acción requerida'
}
2025-08-28 10:41:04 +02:00
];
2025-09-19 16:17:04 +02:00
const handleOrderItem = (itemId: string) => {
console.log('Ordering item:', itemId);
2025-08-28 10:41:04 +02:00
};
2025-09-19 16:17:04 +02:00
const handleStartOrder = (orderId: string) => {
console.log('Starting production order:', orderId);
2025-08-28 10:41:04 +02:00
};
2025-09-19 16:17:04 +02:00
const handlePauseOrder = (orderId: string) => {
console.log('Pausing production order:', orderId);
};
2025-08-28 10:41:04 +02:00
2025-09-19 16:17:04 +02:00
const handleViewDetails = (id: string) => {
console.log('Viewing details for:', id);
};
2025-08-28 10:41:04 +02:00
2025-09-19 16:17:04 +02:00
const handleViewAllPlans = () => {
console.log('Viewing all plans');
};
2025-08-28 10:41:04 +02:00
return (
2025-09-19 16:17:04 +02:00
<div className="space-y-6 p-4 sm:p-6">
2025-08-28 10:41:04 +02:00
<PageHeader
title="Panel de Control"
description="Vista general de tu panadería"
/>
2025-09-19 16:17:04 +02:00
{/* Critical Metrics using StatsGrid */}
<StatsGrid
stats={criticalStats}
columns={4}
title="Métricas Críticas"
description="Los datos más importantes para la gestión diaria de tu panadería"
gap="lg"
className="mb-6"
/>
2025-08-28 10:41:04 +02:00
2025-09-19 16:17:04 +02:00
{/* Full width blocks - one after another */}
<div className="space-y-6">
{/* 1. Real-time alerts block */}
<RealTimeAlerts />
{/* 2. Procurement plans block */}
<ProcurementPlansToday
onOrderItem={handleOrderItem}
onViewDetails={handleViewDetails}
onViewAllPlans={handleViewAllPlans}
/>
{/* 3. Production plans block */}
<ProductionPlansToday
onStartOrder={handleStartOrder}
onPauseOrder={handlePauseOrder}
onViewDetails={handleViewDetails}
onViewAllPlans={handleViewAllPlans}
/>
2025-08-28 10:41:04 +02:00
</div>
</div>
);
};
export default DashboardPage;