<!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>@yield('title', 'Venue Events Manager') | {{ config('app.name') }}</title>
    @php
        $assetBase = 'assets';
        $hasBootstrap = file_exists(public_path("{$assetBase}/vendor/bootstrap/css/bootstrap.min.css"));
        $hasIcons = file_exists(public_path("{$assetBase}/vendor/bootstrap-icons/css/bootstrap-icons.min.css"));
        $hasAppCss = file_exists(public_path("{$assetBase}/css/app.css"));
        $hasFullCalendar = file_exists(public_path("{$assetBase}/vendor/fullcalendar/index.global.min.css"));
    @endphp
    @if ($hasBootstrap)
        <link rel="stylesheet" href="{{ asset("{$assetBase}/vendor/bootstrap/css/bootstrap.min.css") }}">
    @endif
    @if ($hasIcons)
        <link rel="stylesheet" href="{{ asset("{$assetBase}/vendor/bootstrap-icons/css/bootstrap-icons.min.css") }}">
    @endif
    @if ($hasFullCalendar && ($includeFullCalendar ?? false))
        <link rel="stylesheet" href="{{ asset("{$assetBase}/vendor/fullcalendar/index.global.min.css") }}">
    @endif
    @if (($includeFlatpickr ?? false) && file_exists(public_path("{$assetBase}/vendor/flatpickr/flatpickr.min.css")))
        <link rel="stylesheet" href="{{ asset("{$assetBase}/vendor/flatpickr/flatpickr.min.css") }}">
    @endif
    @if ($hasAppCss)
        <link rel="stylesheet" href="{{ asset("{$assetBase}/css/app.css") }}">
    @endif
    @stack('styles')
</head>
<body>
    @include('layouts.partials.topbar')
    @include('layouts.partials.sidebar')

    <main class="vem-main" id="vemMain">
        <div class="vem-content">
            @include('layouts.partials.flash')
            @yield('content')
        </div>
        @include('layouts.partials.footer')
    </main>

    @include('layouts.partials.assets-foot', [
        'includeFullCalendar' => $includeFullCalendar ?? false,
        'includeFlatpickr' => $includeFlatpickr ?? false,
    ])
</body>
</html>
