2025-12-26 13:37:23 +01:00
|
|
|
<!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', 'Dish Planner') }}</title>
|
|
|
|
|
|
|
|
|
|
<!-- Scripts -->
|
|
|
|
|
@vite(['resources/css/app.css', 'resources/js/app.js'])
|
|
|
|
|
@livewireStyles
|
|
|
|
|
</head>
|
|
|
|
|
<body class="font-sans antialiased bg-gray-600 text-gray-100">
|
|
|
|
|
<div class="min-h-screen">
|
|
|
|
|
<!-- Navigation -->
|
|
|
|
|
<nav class="border-b-2 border-secondary shadow-sm z-50 mb-8 bg-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">
|
|
|
|
|
<!-- Logo -->
|
|
|
|
|
<div class="flex-shrink-0 flex items-center">
|
|
|
|
|
<a href="{{ route('dashboard') }}" class="text-2xl font-syncopate text-primary">
|
|
|
|
|
DISH PLANNER
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Navigation Links -->
|
|
|
|
|
@auth
|
|
|
|
|
<div class="hidden space-x-8 sm:ml-10 sm:flex">
|
|
|
|
|
<a href="{{ route('dashboard') }}"
|
|
|
|
|
class="inline-flex items-center px-3 py-2 text-sm font-medium {{ request()->routeIs('dashboard') ? 'text-accent-blue' : 'text-gray-100 hover:text-accent-blue' }} transition">
|
|
|
|
|
Dashboard
|
|
|
|
|
</a>
|
|
|
|
|
<a href="{{ route('dishes.index') }}"
|
|
|
|
|
class="inline-flex items-center px-3 py-2 text-sm font-medium {{ request()->routeIs('dishes.*') ? 'text-accent-blue' : 'text-gray-100 hover:text-accent-blue' }} transition">
|
|
|
|
|
Dishes
|
|
|
|
|
</a>
|
|
|
|
|
<a href="{{ route('schedule.index') }}"
|
|
|
|
|
class="inline-flex items-center px-3 py-2 text-sm font-medium {{ request()->routeIs('schedule.*') ? 'text-accent-blue' : 'text-gray-100 hover:text-accent-blue' }} transition">
|
|
|
|
|
Schedule
|
|
|
|
|
</a>
|
|
|
|
|
<a href="{{ route('users.index') }}"
|
|
|
|
|
class="inline-flex items-center px-3 py-2 text-sm font-medium {{ request()->routeIs('users.*') ? 'text-accent-blue' : 'text-gray-100 hover:text-accent-blue' }} transition">
|
|
|
|
|
Users
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
@endauth
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Right Side Of Navbar -->
|
|
|
|
|
<div class="hidden sm:flex sm:items-center">
|
|
|
|
|
@auth
|
|
|
|
|
<div class="ml-3 relative" x-data="{ open: false }">
|
|
|
|
|
<button @click="open = !open" class="flex items-center text-sm font-medium text-gray-100 hover:text-accent-blue focus:outline-none transition">
|
|
|
|
|
{{ Auth::user()->name }}
|
|
|
|
|
<svg class="ml-1 h-4 w-4" fill="currentColor" 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>
|
|
|
|
|
</button>
|
|
|
|
|
<div x-show="open"
|
|
|
|
|
@click.away="open = false"
|
|
|
|
|
x-cloak
|
|
|
|
|
x-transition
|
|
|
|
|
class="origin-top-right absolute right-0 mt-2 w-48 rounded-md shadow-lg bg-gray-700 ring-1 ring-secondary">
|
|
|
|
|
<div class="py-1">
|
|
|
|
|
<form method="POST" action="{{ route('logout') }}">
|
|
|
|
|
@csrf
|
|
|
|
|
<button type="submit" class="block w-full text-left px-4 py-2 text-sm text-gray-100 hover:bg-gray-600 hover:text-accent-blue">
|
|
|
|
|
Logout
|
|
|
|
|
</button>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
@else
|
|
|
|
|
<a href="{{ route('login') }}" class="text-sm text-accent-blue hover:underline">Login</a>
|
|
|
|
|
@if (Route::has('register'))
|
|
|
|
|
<a href="{{ route('register') }}" class="ml-4 text-sm text-accent-blue hover:underline">Register</a>
|
|
|
|
|
@endif
|
|
|
|
|
@endauth
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Mobile menu button -->
|
|
|
|
|
<div class="-mr-2 flex items-center sm:hidden" x-data="{ open: false }">
|
|
|
|
|
<button @click="open = !open" class="inline-flex items-center justify-center p-2 rounded-md text-gray-100 hover:text-accent-blue hover:bg-gray-700 focus:outline-none focus:bg-gray-700 focus:text-accent-blue transition">
|
|
|
|
|
<svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
|
|
|
|
|
<path :class="{'hidden': open, 'inline-flex': !open }" class="inline-flex" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
|
|
|
|
|
<path :class="{'hidden': !open, 'inline-flex': open }" class="hidden" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
|
|
|
|
|
</svg>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<!-- Page Content -->
|
|
|
|
|
<main>
|
|
|
|
|
{{ $slot }}
|
|
|
|
|
</main>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@livewireScripts
|
2025-12-29 02:57:25 +01:00
|
|
|
|
|
|
|
|
{{-- CSRF Token Auto-Refresh for Livewire --}}
|
|
|
|
|
<script>
|
|
|
|
|
// Handle CSRF token expiration gracefully
|
|
|
|
|
Livewire.hook("request", ({ fail }) => {
|
|
|
|
|
fail(async ({ status, preventDefault, retry }) => {
|
|
|
|
|
if (status === 419) {
|
|
|
|
|
// Prevent the default error handling
|
|
|
|
|
preventDefault();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// Fetch a new CSRF token
|
|
|
|
|
const response = await fetch("/refresh-csrf", {
|
|
|
|
|
method: "GET",
|
|
|
|
|
headers: {
|
|
|
|
|
"Accept": "application/json",
|
|
|
|
|
"X-Requested-With": "XMLHttpRequest"
|
|
|
|
|
},
|
|
|
|
|
credentials: "same-origin",
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (response.ok) {
|
|
|
|
|
const data = await response.json();
|
|
|
|
|
const newToken = data.token;
|
|
|
|
|
|
|
|
|
|
// Update the CSRF token in the meta tag
|
|
|
|
|
const csrfMeta = document.querySelector("meta[name='csrf-token']");
|
|
|
|
|
if (csrfMeta) {
|
|
|
|
|
csrfMeta.setAttribute("content", newToken);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Update Livewire's CSRF token
|
|
|
|
|
if (window.Livewire && Livewire.csrfToken) {
|
|
|
|
|
Livewire.csrfToken = newToken;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Retry the original request with the new token
|
|
|
|
|
retry();
|
|
|
|
|
} else {
|
|
|
|
|
// If we can't refresh the token, redirect to login
|
|
|
|
|
window.location.href = '/login';
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Failed to refresh CSRF token:', error);
|
|
|
|
|
// Fallback: redirect to login
|
|
|
|
|
window.location.href = '/login';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
2025-12-26 13:37:23 +01:00
|
|
|
<style>
|
|
|
|
|
[x-cloak] { display: none !important; }
|
|
|
|
|
</style>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|