Fix frontend 1

This commit is contained in:
Urtzi Alfaro
2025-08-28 18:07:16 +02:00
parent 9ea6794923
commit 68bb5a6449
11 changed files with 427 additions and 400 deletions

View File

@@ -1,6 +1,7 @@
import React, { useState } from 'react';
import { Plus, Calendar, Clock, Users, AlertCircle } from 'lucide-react';
import { Button, Card, Badge } from '../../../../components/ui';
import { Button, Card, Badge, Table } from '../../../../components/ui';
import type { TableColumn } from '../../../../components/ui';
import { PageHeader } from '../../../../components/layout';
import { ProductionSchedule, BatchTracker, QualityControl } from '../../../../components/domain/production';
@@ -76,6 +77,86 @@ const ProductionPage: React.FC = () => {
return <Badge variant={config.color as any}>{config.text}</Badge>;
};
const columns: TableColumn[] = [
{
key: 'recipeName',
title: 'Receta',
dataIndex: 'recipeName',
render: (value) => (
<div className="text-sm font-medium text-[var(--text-primary)]">{value}</div>
),
},
{
key: 'quantity',
title: 'Cantidad',
dataIndex: 'quantity',
render: (value) => `${value} unidades`,
},
{
key: 'status',
title: 'Estado',
dataIndex: 'status',
render: (value) => getStatusBadge(value),
},
{
key: 'priority',
title: 'Prioridad',
dataIndex: 'priority',
render: (value) => getPriorityBadge(value),
},
{
key: 'assignedTo',
title: 'Asignado a',
dataIndex: 'assignedTo',
render: (value) => (
<div className="flex items-center">
<Users className="h-4 w-4 text-[var(--text-tertiary)] mr-2" />
<span className="text-sm text-[var(--text-primary)]">{value}</span>
</div>
),
},
{
key: 'progress',
title: 'Progreso',
dataIndex: 'progress',
render: (value) => (
<div className="flex items-center">
<div className="w-full bg-[var(--bg-quaternary)] rounded-full h-2 mr-2">
<div
className="bg-blue-600 h-2 rounded-full"
style={{ width: `${value}%` }}
></div>
</div>
<span className="text-sm text-[var(--text-primary)]">{value}%</span>
</div>
),
},
{
key: 'estimatedCompletion',
title: 'Tiempo Estimado',
dataIndex: 'estimatedCompletion',
render: (value) => new Date(value).toLocaleTimeString('es-ES', {
hour: '2-digit',
minute: '2-digit'
}),
},
{
key: 'actions',
title: 'Acciones',
align: 'right' as const,
render: () => (
<div className="flex space-x-2">
<Button variant="outline" size="sm">
Ver
</Button>
<Button variant="outline" size="sm">
Editar
</Button>
</div>
),
},
];
return (
<div className="p-6 space-y-6">
<PageHeader
@@ -216,87 +297,14 @@ const ProductionPage: React.FC = () => {
</div>
</div>
<div className="overflow-x-auto">
<table className="min-w-full divide-y divide-gray-200">
<thead className="bg-[var(--bg-secondary)]">
<tr>
<th className="px-6 py-3 text-left text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
Receta
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
Cantidad
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
Estado
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
Prioridad
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
Asignado a
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
Progreso
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
Tiempo Estimado
</th>
<th className="px-6 py-3 text-left text-xs font-medium text-[var(--text-tertiary)] uppercase tracking-wider">
Acciones
</th>
</tr>
</thead>
<tbody className="bg-white divide-y divide-gray-200">
{mockProductionOrders.map((order) => (
<tr key={order.id} className="hover:bg-[var(--bg-secondary)]">
<td className="px-6 py-4 whitespace-nowrap">
<div className="text-sm font-medium text-[var(--text-primary)]">{order.recipeName}</div>
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-[var(--text-primary)]">
{order.quantity} unidades
</td>
<td className="px-6 py-4 whitespace-nowrap">
{getStatusBadge(order.status)}
</td>
<td className="px-6 py-4 whitespace-nowrap">
{getPriorityBadge(order.priority)}
</td>
<td className="px-6 py-4 whitespace-nowrap">
<div className="flex items-center">
<Users className="h-4 w-4 text-[var(--text-tertiary)] mr-2" />
<span className="text-sm text-[var(--text-primary)]">{order.assignedTo}</span>
</div>
</td>
<td className="px-6 py-4 whitespace-nowrap">
<div className="flex items-center">
<div className="w-full bg-[var(--bg-quaternary)] rounded-full h-2 mr-2">
<div
className="bg-blue-600 h-2 rounded-full"
style={{ width: `${order.progress}%` }}
></div>
</div>
<span className="text-sm text-[var(--text-primary)]">{order.progress}%</span>
</div>
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm text-[var(--text-primary)]">
{new Date(order.estimatedCompletion).toLocaleTimeString('es-ES', {
hour: '2-digit',
minute: '2-digit'
})}
</td>
<td className="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
<Button variant="outline" size="sm" className="mr-2">
Ver
</Button>
<Button variant="outline" size="sm">
Editar
</Button>
</td>
</tr>
))}
</tbody>
</table>
</div>
<Table
columns={columns}
data={mockProductionOrders}
rowKey="id"
hover={true}
variant="default"
size="md"
/>
</div>
</Card>
)}