@php use App\Models\AdminMenu; use App\Models\AdminModule; use App\Models\AppSetting; use App\Models\LiudNotification; use Illuminate\Support\Facades\Schema; $appName = AppSetting::getValue('app_name', 'Liud Panel'); $appIcon = AppSetting::getValue('app_icon', 'bi bi-grid-1x2-fill'); $logoUrl = AppSetting::getValue('logo_url', ''); $faviconUrl = AppSetting::getValue('favicon_url', ''); $sidebarColor = AppSetting::getValue('sidebar_color', '#111827'); $sidebarTextColor = AppSetting::getValue('sidebar_text_color', '#ffffff'); $sidebarScrollbarColor = AppSetting::getValue('sidebar_scrollbar_color', '#94a3b8'); $sidebarScrollbarTrackColor = AppSetting::getValue('sidebar_scrollbar_track_color', $sidebarColor); $sidebarScrollbarSize = max(4, min(12, (int) AppSetting::getValue('sidebar_scrollbar_size', 6))); $topbarColor = AppSetting::getValue('topbar_color', '#ffffff'); $contentBgColor = AppSetting::getValue('content_bg_color', '#f5f6fb'); $accentColor = AppSetting::getValue('accent_color', '#7c3aed'); $sidebarMode = AppSetting::getValue('sidebar_mode', 'normal'); $themeMode = AppSetting::getValue('theme_mode', 'light'); $displayVersion = AppSetting::getValue('display_version', 'standard'); $fontFamily = AppSetting::getValue('font_family', 'Inter'); $fontConfig = AppSetting::googleFontConfig($fontFamily); $buttonSearchColor = AppSetting::getValue('button_search_color', '#0ea5e9'); $buttonEditColor = AppSetting::getValue('button_edit_color', '#f59e0b'); $buttonDeleteColor = AppSetting::getValue('button_delete_color', '#dc2626'); $buttonSaveColor = AppSetting::getValue('button_save_color', $accentColor); $moduleAccentColor = AppSetting::getValue('module_accent_color', $sidebarColor); $modulePageBgColor = AppSetting::getValue('module_page_bg_color', $contentBgColor); $moduleSurfaceColor = AppSetting::getValue('module_surface_color', '#ffffff'); $moduleTitleColor = AppSetting::getValue('module_title_color', '#17324d'); $moduleBorderColor = AppSetting::getValue('module_border_color', '#dfe6ef'); $moduleRadius = max(10, min(28, (int) AppSetting::getValue('module_radius', 18))); $contrastColor = function (?string $hex): string { $hex = ltrim(trim((string) $hex), '#'); if (! preg_match('/^[0-9a-fA-F]{6}$/', $hex)) { return '#ffffff'; } $red = hexdec(substr($hex, 0, 2)); $green = hexdec(substr($hex, 2, 2)); $blue = hexdec(substr($hex, 4, 2)); $luminance = (($red * 299) + ($green * 587) + ($blue * 114)) / 1000; return $luminance >= 155 ? '#111827' : '#ffffff'; }; // Convierte rutas locales guardadas en BD a una URL válida incluso cuando // Laravel está instalado dentro de una subcarpeta, como /vasetesting/public. $publicAsset = function (?string $path) { $path = trim((string) $path); if ($path === '') { return ''; } if (str_starts_with($path, 'http://') || str_starts_with($path, 'https://') || str_starts_with($path, 'data:')) { return $path; } return asset(ltrim($path, '/')); }; $logoSrc = $publicAsset($logoUrl); $faviconSrc = $publicAsset($faviconUrl); $currentUserName = trim((string) (auth()->user()->name ?? 'Usuario')); $userInitials = collect(preg_split('/\s+/', $currentUserName)) ->filter() ->take(2) ->map(fn ($part) => mb_strtoupper(mb_substr((string) $part, 0, 1))) ->implode(''); $userInitials = $userInitials !== '' ? $userInitials : 'U'; $hasModules = Schema::hasTable('admin_modules'); $hasMenus = Schema::hasTable('admin_menus'); $hasNotifications = Schema::hasTable('liud_notifications'); $isCompact = $sidebarMode === 'compact'; $notificationCount = $hasNotifications ? LiudNotification::forUser(auth()->user())->unread()->count() : 0; $adminModules = collect(); $adminMenusWithoutModule = collect(); if ($hasMenus && $hasModules) { $adminModules = AdminModule::active() ->with(['menus' => function ($q) { $q->active() ->whereNull('parent_id') ->with(['children' => fn ($child) => $child->active()->orderBy('order')->orderBy('title')]) ->orderBy('order') ->orderBy('title'); }]) ->orderBy('order') ->orderBy('name') ->get(); $adminMenusWithoutModule = AdminMenu::active() ->whereNull('module_id') ->whereNull('parent_id') ->with(['children' => fn ($q) => $q->active()->orderBy('order')->orderBy('title')]) ->orderBy('order') ->orderBy('title') ->get(); } // Detecta correctamente la opción activa aunque Laravel esté instalado // dentro de una subcarpeta, por ejemplo /vasetesting/public. $normalizeMenuPath = function (?string $url): string { $path = trim(parse_url((string) $url, PHP_URL_PATH) ?? '', '/'); $basePath = trim(parse_url(url('/'), PHP_URL_PATH) ?? '', '/'); if ($basePath !== '' && ($path === $basePath || str_starts_with($path, $basePath . '/'))) { $path = ltrim(substr($path, strlen($basePath)), '/'); } return $path; }; $routeIsActive = function ($menu) use ($normalizeMenuPath): bool { if (!empty($menu->route_name) && request()->routeIs($menu->route_name)) { return true; } $url = $menu->resolvedUrl(); if ($url === '' || $url === '#') { return false; } $menuPath = $normalizeMenuPath($url); $currentPath = trim(request()->path(), '/'); if ($menuPath === '') { return $currentPath === ''; } return $currentPath === $menuPath || str_starts_with($currentPath, $menuPath . '/'); }; @endphp {{ trim($__env->yieldContent('page_title')) ?: (trim($__env->yieldContent('title')) ?: $appName) }} @if($faviconSrc) @endif @yield('css') @yield('styles') @if(request()->query('tutorial')) @endif @unless(request()->is('pos') || request()->is('pos/*')) @endunless @stack('styles')
@hasSection('page_actions')
@yield('page_actions')
@endif @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @if($errors->any())
Revisa estos datos:
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @yield('page_header') @include('partials.module-tutorial') @yield('content')
@if(request()->query('tutorial')) @endif @yield('javascript') @yield('js') @stack('scripts')