import React, { useState } from 'react'; import { Plus, Search, Filter, Download, AlertTriangle } from 'lucide-react'; import { Button, Input, Card, Badge } from '../../../../components/ui'; import { PageHeader } from '../../../../components/layout'; import { InventoryTable, InventoryForm, LowStockAlert } from '../../../../components/domain/inventory'; const InventoryPage: React.FC = () => { const [searchTerm, setSearchTerm] = useState(''); const [showForm, setShowForm] = useState(false); const [selectedItem, setSelectedItem] = useState(null); const [filterCategory, setFilterCategory] = useState('all'); const [filterStatus, setFilterStatus] = useState('all'); const mockInventoryItems = [ { id: '1', name: 'Harina de Trigo', category: 'Harinas', currentStock: 45, minStock: 20, maxStock: 100, unit: 'kg', cost: 1.20, supplier: 'Molinos del Sur', lastRestocked: '2024-01-20', expirationDate: '2024-06-30', status: 'normal', }, { id: '2', name: 'Levadura Fresca', category: 'Levaduras', currentStock: 8, minStock: 10, maxStock: 25, unit: 'kg', cost: 8.50, supplier: 'Levaduras SA', lastRestocked: '2024-01-25', expirationDate: '2024-02-15', status: 'low', }, { id: '3', name: 'Mantequilla', category: 'Lácteos', currentStock: 15, minStock: 5, maxStock: 30, unit: 'kg', cost: 5.80, supplier: 'Lácteos Frescos', lastRestocked: '2024-01-24', expirationDate: '2024-02-10', status: 'normal', }, ]; const lowStockItems = mockInventoryItems.filter(item => item.status === 'low'); const stats = { totalItems: mockInventoryItems.length, lowStockItems: lowStockItems.length, totalValue: mockInventoryItems.reduce((sum, item) => sum + (item.currentStock * item.cost), 0), needsReorder: lowStockItems.length, }; return (
setShowForm(true)}> Nuevo Artículo } /> {/* Stats Cards */}

Total Artículos

{stats.totalItems}

Stock Bajo

{stats.lowStockItems}

Valor Total

€{stats.totalValue.toFixed(2)}

Necesita Reorden

{stats.needsReorder}

{/* Low Stock Alert */} {lowStockItems.length > 0 && ( )} {/* Filters and Search */}
setSearchTerm(e.target.value)} className="pl-10" />
{/* Inventory Table */} { setSelectedItem(item); setShowForm(true); }} /> {/* Inventory Form Modal */} {showForm && ( { setShowForm(false); setSelectedItem(null); }} onSave={(item) => { // Handle save logic console.log('Saving item:', item); setShowForm(false); setSelectedItem(null); }} /> )}
); }; export default InventoryPage;