@extends('layouts.panel') @section('title', 'Gestión de Gerentes - Piter Professional') @section('content') @php $user = Auth::guard('admin')->user() ?? Auth::user(); // --- LÓGICA DE TEMA DINÁMICO (Copiada de Navigation para consistencia) --- $convertColor = function($color) { if (empty($color)) return null; if (str_starts_with($color, '#')) return $color; if (str_starts_with($color, '0x')) return '#' . substr($color, -6); return $color; }; $getContrastColor = function($hex) { if(!$hex) return '#ffffff'; $hex = str_replace('#', '', $hex); if(strlen($hex) == 3) $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; $r = hexdec(substr($hex, 0, 2)); $g = hexdec(substr($hex, 2, 2)); $b = hexdec(substr($hex, 4, 2)); $yiq = (($r * 299) + ($g * 587) + ($b * 114)) / 1000; return ($yiq >= 128) ? '#0f172a' : '#ffffff'; }; // Preferencias del Usuario (Mapping Corregido) // color_preferido -> Panel Style (Obsidian/Blue/Red) // color_fondo_preferido -> Ambiente (Luminoso/Nocturno) $panelColor = $convertColor($user->color_preferido ?? null) ?? '#020617'; $bgColor = $convertColor($user->color_fondo_preferido ?? null); // Default si no hay ambiente definido if (!$bgColor) $bgColor = '#f8fafc'; // Default Light // Determinar si el FONDO (Ambiente) es oscuro $textColor = $getContrastColor($bgColor); $isDark = ($textColor === '#ffffff'); // Paleta Dinámica $bgPage = $bgColor; // Botones y Acentos: SIEMPRE usar el color del panel (Obsidian, Azul, Rojo) $accentColor = $panelColor; // FIX: Si el panel es Obsidian (Negro), el acento NO puede ser negro (invisible en fondo oscuro). // Forzamos Rojo Piter (#ef4444) para lograr estética "Black & Red" Premium. if ($panelColor === '#020617' || $panelColor === '#000000') { $accentColor = '#ef4444'; } if ($isDark) { // MODO OSCURO (Obsidian Premium) // Fondo Tarjeta: Casi negro, muy sutil diferencia con el fondo $bgCard = 'color-mix(in srgb, '.$bgColor.', white 2%)'; // Superficie: Un poco más claro $bgSurface = 'color-mix(in srgb, '.$bgColor.', white 5%)'; $textMain = '#ffffff'; $textMuted = '#94a3b8'; // Bordes: Extra sutiles $borderColor = 'rgba(255,255,255,0.05)'; // Sombras: Negras profundas (0 glow blanco) $shadowColor = 'rgba(0,0,0,0.8)'; // Switch Inactivo (Dark) $switchInactive = 'rgba(255, 255, 255, 0.1)'; $switchKnob = '#ffffff'; // Modal Background (Dark - Lighter than body for contrast against overlay) $modalBg = '#1e293b'; // Slate 800 } else { // MODO CLARO (Bright) $bgCard = 'rgba(255, 255, 255, 0.95)'; $bgSurface = '#f8fafc'; $textMain = '#0f172a'; $textMuted = '#64748b'; $borderColor = '#e2e8f0'; $shadowColor = 'rgba(148, 163, 184, 0.15)'; // Switch Inactivo (Light) $switchInactive = '#e2e8f0'; // Slate 200 $switchKnob = '#ffffff'; // Modal Background (Light) $modalBg = '#ffffff'; } @endphp
{{-- Web Header: Maximized Density --}}

Gestión de Gerentes

Administración Central

Visualizando {{ count($managers) }} cargos directivos

{{-- Advanced Toolbar --}}
{{-- Unified Search --}}
{{-- Status Filters & Views --}}
{{-- WEB TABLE VIEW: Optimized for High Density --}}
@forelse($managers as $manager) {{-- Identity Column --}} {{-- DNI Column --}} {{-- Sede Column --}} {{-- Status Column --}} {{-- Actions Column --}} @empty @endforelse
Gerente / Identidad DNI Sede Asignada Estado Acciones
@php $managerPhoto = 'https://ui-avatars.com/api/?name=' . urlencode($manager->nombre_completo) . '&background=fef2f2&color=ef4444'; if (!empty($manager->foto_url) && $manager->foto_url !== 'null') { $cleanPath = str_replace(['uploads / ', 'uploads/', 'uploads\ ', 'uploads\\'], '', $manager->foto_url); $cleanPath = trim(str_replace('\\', '/', $cleanPath)); if (str_starts_with($cleanPath, '/')) $cleanPath = substr($cleanPath, 1); $managerPhoto = url('/api/Security/uploads/' . $cleanPath); } @endphp

{{ $manager->nombre_completo }}

{{ $manager->email }}

{{ $manager->nro_documento ?? '7XXXXXXXX' }}
{{ $manager->sede_nombre ?? 'MIRAFLORES' }}
{{ strtoupper($manager->estado) === 'ACTIVO' ? 'ACTIVO' : 'INACTIVO' }}

Sin Cargos Directivos

No se han registrado gerentes en la empresa aún.

{{-- Table Footer Stats --}}

{{ count($managers) }} Registros en Total

ACTIVOS
INACTIVOS
{{-- Removed closing div to extend scope to modals --}} {{-- MODAL: REGISTRAR GERENTE (DISEÑO PREMIUM SÓLIDO) --}} {{-- MODAL: REGISTRAR GERENTE (DISEÑO PREMIUM SÓLIDO) --}} {{-- MODAL: REGISTRAR GERENTE (DISEÑO PREMIUM SÓLIDO) --}} {{-- MODAL: REGISTRAR GERENTE (DISEÑO PREMIUM SÓLIDO) --}} {{-- MODAL: EDITAR GERENTE (DISEÑO PREMIUM SÓLIDO) --}} {{-- MODAL: EDITAR GERENTE (DISEÑO PREMIUM SÓLIDO) --}} {{-- MODAL: EDITAR GERENTE (DISEÑO PREMIUM SÓLIDO) --}} {{-- End of #hr-dynamic-view scope --}} @endsection @push('scripts') @endpush