'use client' import * as React from 'react' import Link from 'next/link' import { usePathname } from 'next/navigation' import Image from 'next/image' import { cn } from '@/lib/utils' import { Button } from '@/components/ui/button' import { ScrollArea } from '@/components/ui/scroll-area' import { Avatar, AvatarFallback } from '@/components/ui/avatar' import { Badge } from '@/components/ui/badge' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' import { Sheet, SheetContent, SheetTrigger, } from '@/components/ui/sheet' import { LayoutDashboard, FileText, ClipboardCheck, Users, BarChart3, Settings, Bell, ChevronLeft, ChevronRight, LogOut, User, Building2, PlusCircle, Briefcase, Clock, AlertTriangle, Menu, } from 'lucide-react' import { currentUser, notifications } from '@/lib/mock-data' interface NavItem { title: string href: string icon: React.ComponentType<{ className?: string }> badge?: number roles?: string[] } const mainNavItems: NavItem[] = [ { title: 'Dashboard', href: '/dashboard', icon: LayoutDashboard, }, { title: 'Nueva Requisición', href: '/requisiciones/nueva', icon: PlusCircle, }, { title: 'Mis Requisiciones', href: '/requisiciones', icon: FileText, }, { title: 'Aprobaciones', href: '/aprobaciones', icon: ClipboardCheck, badge: 2, roles: ['rrhh_local', 'rrhh_regional', 'administracion', 'director_rrhh'], }, { title: 'Pipeline Reclutamiento', href: '/pipeline', icon: Briefcase, roles: ['reclutador', 'director_rrhh', 'rrhh_regional'], }, ] const secondaryNavItems: NavItem[] = [ { title: 'Reclutadores', href: '/reclutadores', icon: Users, roles: ['director_rrhh', 'rrhh_regional'], }, { title: 'Reportes', href: '/reportes', icon: BarChart3, roles: ['director_rrhh', 'rrhh_regional', 'country_lead'], }, { title: 'Administración', href: '/admin', icon: Settings, roles: ['admin_sistema', 'director_rrhh'], }, ] function getInitials(name: string): string { return name .split(' ') .map(n => n[0]) .join('') .toUpperCase() .slice(0, 2) } export function MainLayout({ children }: { children: React.ReactNode }) { const pathname = usePathname() const [collapsed, setCollapsed] = React.useState(false) const unreadNotifications = notifications.filter(n => !n.read).length const userRole = currentUser.role const filterByRole = (items: NavItem[]) => { return items.filter(item => { if (!item.roles) return true return item.roles.includes(userRole) }) } const filteredMainNav = filterByRole(mainNavItems) const filteredSecondaryNav = filterByRole(secondaryNavItems) return (
{/* Desktop Sidebar */} {/* Main Content */}
{/* Top Header */}
{/* Logo */}
GomezLee Marketing
Portal GLM Requisiciones
{/* Navigation */} {/* User Section */}
Mi Cuenta Perfil Configuración Cerrar Sesión
{new Date().toLocaleDateString('es-ES', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' })}
{/* Quick Stats */}
2 Pendientes
3 En riesgo
{/* Notifications */} Notificaciones {unreadNotifications > 0 && ( {unreadNotifications} nuevas )} {notifications.slice(0, 5).map((notif) => (
{notif.title} {!notif.read && ( )}
{notif.message} {new Date(notif.createdAt).toLocaleDateString('es-ES')}
))}
Ver todas las notificaciones
{/* Page Content */}
{children}
) }