import React, { useState } from 'react'; import { Globe, Clock, DollarSign, MapPin, Save, ChevronRight, Mail, Smartphone } from 'lucide-react'; import { useSelector } from 'react-redux'; import { RootState } from '../../store'; import toast from 'react-hot-toast'; interface GeneralSettings { language: string; timezone: string; currency: string; bakeryName: string; bakeryAddress: string; businessType: string; operatingHours: { open: string; close: string; }; operatingDays: number[]; } interface NotificationSettings { emailNotifications: boolean; smsNotifications: boolean; dailyReports: boolean; weeklyReports: boolean; forecastAlerts: boolean; stockAlerts: boolean; orderReminders: boolean; } const GeneralSettingsPage: React.FC = () => { const { user } = useSelector((state: RootState) => state.auth); const { currentTenant } = useSelector((state: RootState) => state.tenant); const [isLoading, setIsLoading] = useState(false); const [settings, setSettings] = useState({ language: 'es', timezone: 'Europe/Madrid', currency: 'EUR', bakeryName: currentTenant?.name || 'Mi Panadería', bakeryAddress: currentTenant?.address || '', businessType: currentTenant?.business_type || 'individual', operatingHours: { open: currentTenant?.settings?.operating_hours?.open || '07:00', close: currentTenant?.settings?.operating_hours?.close || '20:00' }, operatingDays: currentTenant?.settings?.operating_days || [1, 2, 3, 4, 5, 6] }); const [notifications, setNotifications] = useState({ emailNotifications: true, smsNotifications: false, dailyReports: true, weeklyReports: true, forecastAlerts: true, stockAlerts: true, orderReminders: true }); const handleSaveSettings = async () => { setIsLoading(true); try { // Simulate API call await new Promise(resolve => setTimeout(resolve, 1000)); toast.success('Configuración guardada exitosamente'); } catch (error) { toast.error('Error al guardar la configuración'); } finally { setIsLoading(false); } }; const dayLabels = ['L', 'M', 'X', 'J', 'V', 'S', 'D']; return (
{/* Business Information */}

Información del Negocio

setSettings(prev => ({ ...prev, bakeryName: e.target.value }))} className="w-full px-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-primary-500 focus:border-primary-500" />
setSettings(prev => ({ ...prev, bakeryAddress: e.target.value }))} placeholder="Calle Mayor, 123, Madrid" className="w-full pl-10 pr-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-primary-500 focus:border-primary-500" />
{/* Operating Hours */}

Horarios de Operación

setSettings(prev => ({ ...prev, operatingHours: { ...prev.operatingHours, open: e.target.value } }))} className="w-full px-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-primary-500 focus:border-primary-500" />
setSettings(prev => ({ ...prev, operatingHours: { ...prev.operatingHours, close: e.target.value } }))} className="w-full px-4 py-3 border border-gray-300 rounded-xl focus:ring-2 focus:ring-primary-500 focus:border-primary-500" />
{dayLabels.map((day, index) => ( ))}
{/* Regional Settings */}

Configuración Regional

{/* Notification Settings */}

Notificaciones

{/* Notification Channels */}
Notificaciones por Email
Recibe alertas y reportes por correo
Notificaciones SMS
Alertas urgentes por mensaje de texto
{/* Notification Types */}

Tipos de Notificación

{[ { key: 'dailyReports', label: 'Reportes Diarios', desc: 'Resumen diario de ventas y predicciones' }, { key: 'weeklyReports', label: 'Reportes Semanales', desc: 'Análisis semanal de rendimiento' }, { key: 'forecastAlerts', label: 'Alertas de Predicción', desc: 'Cambios significativos en demanda' }, { key: 'stockAlerts', label: 'Alertas de Stock', desc: 'Inventario bajo o próximos vencimientos' }, { key: 'orderReminders', label: 'Recordatorios de Pedidos', desc: 'Próximas entregas y fechas límite' } ].map((item) => (
{item.label}
{item.desc}
))}
{/* Data Export */}

Exportar Datos

{/* Save Button */}
); }; export default GeneralSettingsPage;