import React from 'react'; import { Card, Button, Input, Select, Badge } from '../../ui'; import type { OnboardingStepProps } from './OnboardingWizard'; interface SystemConfig { timezone: string; currency: string; language: string; date_format: string; number_format: string; working_hours: { start: string; end: string; days: number[]; }; notifications: { email_enabled: boolean; sms_enabled: boolean; push_enabled: boolean; alert_preferences: string[]; }; integrations: { pos_system?: string; accounting_software?: string; payment_provider?: string; }; features: { inventory_management: boolean; production_planning: boolean; sales_analytics: boolean; customer_management: boolean; financial_reporting: boolean; quality_control: boolean; }; } const TIMEZONES = [ { value: 'Europe/Madrid', label: 'Madrid (GMT+1)' }, { value: 'Europe/London', label: 'London (GMT+0)' }, { value: 'Europe/Paris', label: 'Paris (GMT+1)' }, { value: 'America/New_York', label: 'New York (GMT-5)' }, { value: 'America/Los_Angeles', label: 'Los Angeles (GMT-8)' }, { value: 'America/Mexico_City', label: 'Mexico City (GMT-6)' }, { value: 'America/Buenos_Aires', label: 'Buenos Aires (GMT-3)' }, ]; const CURRENCIES = [ { value: 'EUR', label: 'Euro (€)', symbol: '€' }, { value: 'USD', label: 'US Dollar ($)', symbol: '$' }, { value: 'GBP', label: 'British Pound (£)', symbol: '£' }, { value: 'MXN', label: 'Mexican Peso ($)', symbol: '$' }, { value: 'ARS', label: 'Argentine Peso ($)', symbol: '$' }, { value: 'COP', label: 'Colombian Peso ($)', symbol: '$' }, ]; const LANGUAGES = [ { value: 'es', label: 'Español' }, { value: 'en', label: 'English' }, { value: 'fr', label: 'Français' }, { value: 'pt', label: 'Português' }, { value: 'it', label: 'Italiano' }, ]; const DAYS_OF_WEEK = [ { value: 1, label: 'Lunes', short: 'L' }, { value: 2, label: 'Martes', short: 'M' }, { value: 3, label: 'Miércoles', short: 'X' }, { value: 4, label: 'Jueves', short: 'J' }, { value: 5, label: 'Viernes', short: 'V' }, { value: 6, label: 'Sábado', short: 'S' }, { value: 0, label: 'Domingo', short: 'D' }, ]; const ALERT_TYPES = [ { value: 'low_stock', label: 'Stock bajo', description: 'Cuando los ingredientes están por debajo del mínimo' }, { value: 'production_delays', label: 'Retrasos de producción', description: 'Cuando los lotes se retrasan' }, { value: 'quality_issues', label: 'Problemas de calidad', description: 'Cuando se detectan problemas de calidad' }, { value: 'financial_targets', label: 'Objetivos financieros', description: 'Cuando se alcanzan o no se cumplen objetivos' }, { value: 'equipment_maintenance', label: 'Mantenimiento de equipos', description: 'Recordatorios de mantenimiento' }, { value: 'food_safety', label: 'Seguridad alimentaria', description: 'Alertas relacionadas con seguridad alimentaria' }, ]; const FEATURES = [ { key: 'inventory_management', title: 'Gestión de inventario', description: 'Control de stock, ingredientes y materias primas', recommended: true, }, { key: 'production_planning', title: 'Planificación de producción', description: 'Programación de lotes y gestión de recetas', recommended: true, }, { key: 'sales_analytics', title: 'Analytics de ventas', description: 'Reportes y análisis de ventas y tendencias', recommended: true, }, { key: 'customer_management', title: 'Gestión de clientes', description: 'Base de datos de clientes y programa de fidelización', recommended: false, }, { key: 'financial_reporting', title: 'Reportes financieros', description: 'Análisis de costos, márgenes y rentabilidad', recommended: true, }, { key: 'quality_control', title: 'Control de calidad', description: 'Seguimiento de calidad y estándares', recommended: true, }, ]; export const SystemSetupStep: React.FC = ({ data, onDataChange, }) => { const systemData: SystemConfig = { timezone: 'Europe/Madrid', currency: 'EUR', language: 'es', date_format: 'DD/MM/YYYY', number_format: 'European', working_hours: { start: '06:00', end: '20:00', days: [1, 2, 3, 4, 5, 6], // Monday to Saturday }, notifications: { email_enabled: true, sms_enabled: false, push_enabled: true, alert_preferences: ['low_stock', 'production_delays', 'quality_issues'], }, integrations: {}, features: { inventory_management: true, production_planning: true, sales_analytics: true, customer_management: false, financial_reporting: true, quality_control: true, }, ...data, }; const handleInputChange = (field: string, value: any) => { onDataChange({ ...systemData, [field]: value, }); }; const handleWorkingHoursChange = (field: string, value: any) => { onDataChange({ ...systemData, working_hours: { ...systemData.working_hours, [field]: value, }, }); }; const handleNotificationChange = (field: string, value: any) => { onDataChange({ ...systemData, notifications: { ...systemData.notifications, [field]: value, }, }); }; const handleIntegrationChange = (field: string, value: string) => { onDataChange({ ...systemData, integrations: { ...systemData.integrations, [field]: value, }, }); }; const handleFeatureToggle = (feature: string) => { onDataChange({ ...systemData, features: { ...systemData.features, [feature]: !systemData.features[feature as keyof typeof systemData.features], }, }); }; const toggleWorkingDay = (day: number) => { const currentDays = systemData.working_hours.days; const updatedDays = currentDays.includes(day) ? currentDays.filter(d => d !== day) : [...currentDays, day].sort(); handleWorkingHoursChange('days', updatedDays); }; const toggleAlertPreference = (alert: string) => { const current = systemData.notifications.alert_preferences; const updated = current.includes(alert) ? current.filter(a => a !== alert) : [...current, alert]; handleNotificationChange('alert_preferences', updated); }; return (
{/* Regional Settings */}

Configuración regional

{/* Working Hours */}

Horario de trabajo

handleWorkingHoursChange('start', e.target.value)} className="w-full" />
handleWorkingHoursChange('end', e.target.value)} className="w-full" />
{DAYS_OF_WEEK.map((day) => ( ))}
{/* Features */}

Módulos y características

Selecciona las características que quieres activar. Podrás cambiar esto más tarde.

{FEATURES.map((feature) => ( handleFeatureToggle(feature.key)} >

{feature.title}

{feature.recommended && ( Recomendado )}

{feature.description}

{systemData.features[feature.key as keyof typeof systemData.features] && ( )}
))}
{/* Notifications */}

Notificaciones

{ALERT_TYPES.map((alert) => (
toggleAlertPreference(alert.value)} >
{alert.label}

{alert.description}

{systemData.notifications.alert_preferences.includes(alert.value) && ( )}
))}
{/* Integrations */}

Integraciones (opcional)

Estas integraciones se pueden configurar más tarde desde el panel de administración.

{/* Summary */}

Configuración seleccionada

Zona horaria: {TIMEZONES.find(tz => tz.value === systemData.timezone)?.label}

Moneda: {CURRENCIES.find(c => c.value === systemData.currency)?.label}

Horario: {systemData.working_hours.start} - {systemData.working_hours.end}

Días operativos: {systemData.working_hours.days.length} días por semana

Módulos activados: {Object.values(systemData.features).filter(Boolean).length} de {Object.keys(systemData.features).length}

); }; export default SystemSetupStep;