import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Badge } from '@/components/ui/badge'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Plus, Users, Clock, Calendar, Phone, Mail, Shield } from 'lucide-react'; import { toast } from 'sonner'; interface HotelStaff { id: string; name: string; role: string; department: string; email: string; phone: string; status: 'active' | 'inactive' | 'on_leave'; shift: string; hiredDate: Date; hourlyRate: number; accessLevel: string; } const StaffManagement = () => { const [staff, setStaff] = useState([ { id: '1', name: 'María González', role: 'Recepcionista', department: 'Recepción', email: 'maria@hotel.com', phone: '+34 600 111 222', status: 'active', shift: 'Mañana', hiredDate: new Date('2022-05-10'), hourlyRate: 13.00, accessLevel: 'Alto' }, { id: '2', name: 'Pedro Sánchez', role: 'Conserje', department: 'Recepción', email: 'pedro@hotel.com', phone: '+34 600 222 333', status: 'active', shift: 'Tarde', hiredDate: new Date('2023-01-15'), hourlyRate: 12.00, accessLevel: 'Medio' }, { id: '3', name: 'Carmen Ruiz', role: 'Supervisora', department: 'Limpieza', email: 'carmen@hotel.com', phone: '+34 600 333 444', status: 'active', shift: 'Mañana', hiredDate: new Date('2021-08-20'), hourlyRate: 14.50, accessLevel: 'Alto' }, { id: '4', name: 'José Martín', role: 'Camarero', department: 'Limpieza', email: 'jose@hotel.com', phone: '+34 600 444 555', status: 'active', shift: 'Mañana', hiredDate: new Date('2023-06-01'), hourlyRate: 11.00, accessLevel: 'Bajo' }, { id: '5', name: 'Isabel Torres', role: 'Técnico', department: 'Mantenimiento', email: 'isabel@hotel.com', phone: '+34 600 555 666', status: 'on_leave', shift: 'Completo', hiredDate: new Date('2022-11-12'), hourlyRate: 15.00, accessLevel: 'Alto' } ]); const roles = [ 'Recepcionista', 'Conserje', 'Supervisor', 'Camarero', 'Técnico de Mantenimiento', 'Gerente', 'Botones' ]; const departments = ['Recepción', 'Limpieza', 'Mantenimiento', 'Seguridad', 'Administración']; const shifts = ['Mañana', 'Tarde', 'Noche', 'Completo']; const accessLevels = ['Bajo', 'Medio', 'Alto']; const activeStaff = staff.filter(s => s.status === 'active').length; const onLeave = staff.filter(s => s.status === 'on_leave').length; const getStatusColor = (status: HotelStaff['status']) => { switch (status) { case 'active': return 'default'; case 'inactive': return 'secondary'; case 'on_leave': return 'outline'; default: return 'secondary'; } }; const getStatusLabel = (status: HotelStaff['status']) => { switch (status) { case 'active': return 'Activo'; case 'inactive': return 'Inactivo'; case 'on_leave': return 'De Permiso'; default: return status; } }; const updateStatus = (staffId: string, newStatus: HotelStaff['status']) => { setStaff(staff.map(s => s.id === staffId ? { ...s, status: newStatus } : s )); toast.success('Estado actualizado'); }; const getMonthsEmployed = (hiredDate: Date) => { const months = Math.floor((Date.now() - hiredDate.getTime()) / (1000 * 60 * 60 * 24 * 30)); return months; }; const staffByDepartment = departments.map(dept => ({ department: dept, count: staff.filter(s => s.department === dept).length })); return (
{/* Stats */}
Total Personal
{staff.length}

empleados totales

Activos
{activeStaff}

trabajando hoy

De Permiso
{onLeave}

ausentes hoy

Departamentos
{departments.length}

áreas operativas

{/* Department Distribution */} Distribución por Departamento
{staffByDepartment.map(dept => (
{dept.count}
{dept.department}
))}
{/* Actions */}

Equipo del Hotel

Gestiona tu personal hotelero

Agregar Nuevo Empleado
{/* Staff List */}
{staff.map((member) => (
{member.name}

{member.role}

{member.department}
{getStatusLabel(member.status)}
{member.email}
{member.phone}
Turno: {member.shift}
Acceso: {member.accessLevel}
{getMonthsEmployed(member.hiredDate)} meses en el hotel
Tarifa por Hora
€{member.hourlyRate.toFixed(2)}
))}
); }; export default StaffManagement;