'Dashboard', 'icon' => 'fas fa-tachometer-alt', 'route' => '/erp.php?m=turnero&v=dashboard'], ['name' => 'Historial', 'icon' => 'fas fa-history', 'route' => '/erp.php?m=turnero&v=historial'], ['name' => 'Configuración', 'icon' => 'fas fa-sliders-h', 'route' => '/erp.php?m=turnero&v=configuracion'], ['name' => 'Kiosko', 'icon' => 'fas fa-desktop', 'route' => '/erp.php?m=turnero&v=kiosko'], ['name' => 'Pantalla TV Global', 'icon' => 'fas fa-th-large', 'route' => '/erp.php?m=turnero&v=display_global'], ]; // ── Links dinámicos: un enlace por escritorio de Recepción ──── try { $_trPdo = Database::getInstance()->getConnection(); $_trDesks = $_trPdo->query( "SELECT id, nombre FROM turnero_lugares WHERE activo = 1 AND tipo = 'recepcion' ORDER BY sort_order ASC" )->fetchAll(PDO::FETCH_ASSOC); if (!empty($_trDesks)) { foreach ($_trDesks as $_d) { $_trLinks[] = [ 'name' => $_d['nombre'], 'icon' => 'fas fa-concierge-bell', 'route' => '/erp.php?m=turnero&v=recepcion&desk_id=' . (int)$_d['id'], ]; } } else { // Sin escritorios configurados: enlace genérico $_trLinks[] = ['name' => 'Recepción', 'icon' => 'fas fa-concierge-bell', 'route' => '/erp.php?m=turnero&v=recepcion']; } } catch (\Throwable $_) { // BD no disponible todavía (instalación inicial) $_trLinks[] = ['name' => 'Recepción', 'icon' => 'fas fa-concierge-bell', 'route' => '/erp.php?m=turnero&v=recepcion']; } // ── Links dinámicos: un enlace por estación de Muestras ────── try { $_trMuestras = $_trPdo->query( "SELECT id, nombre FROM turnero_lugares WHERE activo = 1 AND tipo = 'muestras' ORDER BY sort_order ASC" )->fetchAll(PDO::FETCH_ASSOC); foreach ($_trMuestras as $_m) { $_trLinks[] = [ 'name' => $_m['nombre'], 'icon' => 'fas fa-flask', 'route' => '/erp.php?m=turnero&v=lugar&lugar_id=' . (int)$_m['id'], ]; } } catch (\Throwable $_) {} return [ 'slug' => 'turnero', 'name' => 'Turnero', 'icon' => 'fas fa-ticket-alt', 'category' => 'turnero', 'route' => '/erp.php?m=turnero&v=dashboard', 'is_active' => true, 'sort_order' => 40, 'oleada' => 1, 'description' => 'Sistema de turnos presenciales en recepción con prioridades, consentimientos y pantallas TV', 'links' => $_trLinks, ];