222 lines
12 KiB
PHP
222 lines
12 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="csrf-token" content="{{ csrf_token() }}">
|
|
|
|
<title>{{ config('app.name', 'Laravel') }} - NetGesCon</title>
|
|
|
|
<!-- Fonts -->
|
|
<link rel="preconnect" href="https://fonts.bunny.net">
|
|
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
|
|
|
<!-- FontAwesome (per icone menu) -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha512-papm6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q6Q==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
|
|
<!-- Scripts -->
|
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
|
<link rel="stylesheet" href="{{ asset('css/dark-mode.css') }}">
|
|
</head>
|
|
<body class="font-sans antialiased bg-gray-100 dark:bg-gray-900 dark:text-white transition-colors duration-300" id="main-body">
|
|
<div class="min-h-screen flex">
|
|
<!-- DESKTOP: Colonna launcher (icone) - nascosta su mobile -->
|
|
<aside class="hidden md:flex w-16 bg-gradient-to-b from-blue-800 to-indigo-900 dark:from-gray-800 dark:to-gray-900 flex-shrink-0 flex-col items-center justify-between">
|
|
@include('components.menu.launcher')
|
|
</aside>
|
|
|
|
<!-- DESKTOP: Sidebar principale - nascosta su mobile, mostrata con toggle -->
|
|
<aside class="hidden md:flex w-56 bg-gradient-to-b from-green-300 to-green-400 dark:from-gray-700 dark:to-gray-800 border-r-4 border-blue-500 flex-shrink-0 relative transition-all duration-300" id="sidebar-menu">
|
|
@include('components.menu.sidebar')
|
|
<!-- Pulsante per ridimensionare/nascondere su desktop -->
|
|
<button id="toggle-sidebar" class="absolute top-2 right-0 -mr-3 bg-blue-500 text-white rounded-full p-1 shadow hover:bg-blue-700 transition">
|
|
<i class="fa-solid fa-chevron-left"></i>
|
|
</button>
|
|
</aside>
|
|
|
|
<!-- DESKTOP: Colonna separatrice sottile -->
|
|
<aside class="hidden md:flex w-3 bg-blue-700 flex-shrink-0 flex-col items-center justify-center">
|
|
<button id="show-sidebar" class="text-white opacity-70 hover:opacity-100 transition" style="display:none">
|
|
<i class="fa-solid fa-chevron-right"></i>
|
|
</button>
|
|
</aside>
|
|
|
|
<!-- MOBILE: Overlay sidebar (nascosta di default) -->
|
|
<aside class="md:hidden fixed inset-y-0 left-0 z-50 w-64 bg-gradient-to-b from-green-300 to-green-400 dark:from-gray-700 dark:to-gray-800 transform -translate-x-full transition-transform duration-300 ease-in-out" id="mobile-sidebar">
|
|
<div class="flex items-center justify-between p-4 border-b border-green-500">
|
|
<h2 class="text-lg font-semibold text-gray-800 dark:text-white">Menu</h2>
|
|
<button id="close-mobile-sidebar" class="text-gray-800 dark:text-white hover:text-gray-600">
|
|
<i class="fas fa-times text-xl"></i>
|
|
</button>
|
|
</div>
|
|
@include('components.menu.sidebar')
|
|
</aside>
|
|
|
|
<!-- MOBILE: Overlay scuro quando sidebar è aperta -->
|
|
<div class="md:hidden fixed inset-0 z-40 bg-black bg-opacity-50 transition-opacity duration-300 ease-in-out opacity-0 pointer-events-none" id="mobile-overlay"></div>
|
|
|
|
<!-- Main Content -->
|
|
<div class="flex-1 flex flex-col min-h-screen">
|
|
<!-- Navigation con hamburger menu per mobile -->
|
|
<nav class="bg-white dark:bg-gray-800 shadow-sm border-b border-gray-200 dark:border-gray-700">
|
|
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
|
<div class="flex justify-between h-16">
|
|
<div class="flex items-center">
|
|
<!-- MOBILE: Hamburger menu button -->
|
|
<button id="mobile-menu-button" class="md:hidden mr-4 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-white">
|
|
<i class="fas fa-bars text-xl"></i>
|
|
</button>
|
|
|
|
<!-- Logo -->
|
|
<div class="shrink-0 flex items-center">
|
|
<a href="{{ auth()->user()->hasRole('super-admin') ? route('superadmin.dashboard') : route('admin.dashboard') }}"
|
|
class="text-xl font-bold text-gray-800 dark:text-white">
|
|
NetGesCon
|
|
@if(auth()->user()->hasRole('super-admin'))
|
|
<span class="text-sm text-red-600 dark:text-red-400">Super</span>
|
|
@elseif(auth()->user()->hasRole('amministratore'))
|
|
<span class="text-sm text-blue-600 dark:text-blue-400">Admin</span>
|
|
@endif
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Settings Dropdown (sempre visibile) -->
|
|
<div class="flex items-center space-x-4">
|
|
<!-- Dark Mode Toggle -->
|
|
<button id="dark-mode-toggle" class="p-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 focus:outline-none">
|
|
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
|
|
<path id="sun-icon" d="M10 2L13.09 8.26L20 9L14 14.74L15.18 21.02L10 17.77L4.82 21.02L6 14.74L0 9L6.91 8.26L10 2Z" />
|
|
<path id="moon-icon" class="hidden" d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z" />
|
|
</svg>
|
|
</button>
|
|
|
|
<!-- User dropdown -->
|
|
<x-dropdown align="right" width="48">
|
|
<x-slot name="trigger">
|
|
<button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300 focus:outline-none transition ease-in-out duration-150">
|
|
<div class="flex items-center">
|
|
<div class="mr-2">
|
|
<!-- Indicatore ruolo con colore -->
|
|
@if(auth()->user()->hasRole('super-admin'))
|
|
<div class="w-3 h-3 bg-red-500 rounded-full"></div>
|
|
@elseif(auth()->user()->hasRole('amministratore'))
|
|
<div class="w-3 h-3 bg-blue-500 rounded-full"></div>
|
|
@else
|
|
<div class="w-3 h-3 bg-gray-500 rounded-full"></div>
|
|
@endif
|
|
</div>
|
|
<div>{{ Auth::user()->name }}</div>
|
|
</div>
|
|
|
|
<div class="ml-1">
|
|
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
|
|
</svg>
|
|
</div>
|
|
</button>
|
|
</x-slot>
|
|
|
|
<x-slot name="content">
|
|
<x-dropdown-link :href="route('profile.edit')">
|
|
{{ __('Profile') }}
|
|
</x-dropdown-link>
|
|
|
|
<!-- Mostra ruoli utente -->
|
|
<div class="px-4 py-2 text-xs text-gray-400 border-t border-gray-200">
|
|
Ruoli: {{ auth()->user()->roles->pluck('name')->join(', ') }}
|
|
</div>
|
|
|
|
<!-- Authentication -->
|
|
<form method="POST" action="{{ route('logout') }}">
|
|
@csrf
|
|
<x-dropdown-link :href="route('logout')"
|
|
onclick="event.preventDefault();
|
|
this.closest('form').submit();">
|
|
{{ __('Log Out') }}
|
|
</x-dropdown-link>
|
|
</form>
|
|
</x-slot>
|
|
</x-dropdown>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- Page Content -->
|
|
<main class="flex-1 overflow-x-hidden overflow-y-auto bg-gray-100 dark:bg-gray-900 p-4 sm:p-6">
|
|
@yield('content')
|
|
</main>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- JavaScript per gestione responsive e dark mode -->
|
|
<script>
|
|
// Toggle mobile sidebar
|
|
document.getElementById('mobile-menu-button').addEventListener('click', function() {
|
|
const sidebar = document.getElementById('mobile-sidebar');
|
|
const overlay = document.getElementById('mobile-overlay');
|
|
|
|
sidebar.classList.remove('-translate-x-full');
|
|
overlay.classList.remove('opacity-0', 'pointer-events-none');
|
|
overlay.classList.add('opacity-100');
|
|
});
|
|
|
|
// Close mobile sidebar
|
|
function closeMobileSidebar() {
|
|
const sidebar = document.getElementById('mobile-sidebar');
|
|
const overlay = document.getElementById('mobile-overlay');
|
|
|
|
sidebar.classList.add('-translate-x-full');
|
|
overlay.classList.add('opacity-0', 'pointer-events-none');
|
|
overlay.classList.remove('opacity-100');
|
|
}
|
|
|
|
document.getElementById('close-mobile-sidebar').addEventListener('click', closeMobileSidebar);
|
|
document.getElementById('mobile-overlay').addEventListener('click', closeMobileSidebar);
|
|
|
|
// Toggle desktop sidebar
|
|
document.getElementById('toggle-sidebar').addEventListener('click', function() {
|
|
const sidebar = document.getElementById('sidebar-menu');
|
|
const showBtn = document.getElementById('show-sidebar');
|
|
|
|
sidebar.style.display = 'none';
|
|
showBtn.style.display = 'block';
|
|
});
|
|
|
|
document.getElementById('show-sidebar').addEventListener('click', function() {
|
|
const sidebar = document.getElementById('sidebar-menu');
|
|
const showBtn = document.getElementById('show-sidebar');
|
|
|
|
sidebar.style.display = 'block';
|
|
showBtn.style.display = 'none';
|
|
});
|
|
|
|
// Dark mode toggle
|
|
document.getElementById('dark-mode-toggle').addEventListener('click', function() {
|
|
document.body.classList.toggle('dark');
|
|
const isDark = document.body.classList.contains('dark');
|
|
localStorage.setItem('dark-mode', isDark);
|
|
|
|
// Toggle icons
|
|
document.getElementById('sun-icon').classList.toggle('hidden', isDark);
|
|
document.getElementById('moon-icon').classList.toggle('hidden', !isDark);
|
|
});
|
|
|
|
// Load dark mode preference
|
|
if (localStorage.getItem('dark-mode') === 'true') {
|
|
document.body.classList.add('dark');
|
|
document.getElementById('sun-icon').classList.add('hidden');
|
|
document.getElementById('moon-icon').classList.remove('hidden');
|
|
}
|
|
|
|
// Responsive: chiudi sidebar mobile su resize
|
|
window.addEventListener('resize', function() {
|
|
if (window.innerWidth >= 768) { // md breakpoint
|
|
closeMobileSidebar();
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|