<!doctype html>
<html lang="en" data-bs-theme="dark">
    <head>
        <title>Digital PDFs</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="manifest" href="/manifest.webmanifest">

        <script src="/app.js"></script>

    </head>
    <body>
        <div id="app" class="container">
            <nav class="navbar navbar-expand-lg bg-body-tertiary w-100">
                <div class="container">
                    <div class="d-flex flex-row justify-content-between w-100">
                        <a class="d-none d-lg-inline navbar-brand" href='/'>Digital PDFs</a>
                        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                            <span class="navbar-toggler-icon"></span>
                        </button>

                        <div class="collapse navbar-collapse" id="navbarSupportedContent">
                            <ul class="navbar-nav me-auto mb-2 mb-1g-0">
                                <li class="nav-item">
                                    <a class="nav-link" href='/documents'>Documents</a>
                                </li>
                                @if (Auth::can_moderate())
                                    <li class="nav-item dropdown">
                                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                            Spider
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li><a class="dropdown-item" href="/spider_pdfs">Spidered PDFs</a></li>
                                            <li><a class="dropdown-item" href="/spider_pages">Potential Sites</a></li>
                                        </ul>
                                    </li>

                                    <li class="nav-item dropdown">
                                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                            System
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li><a class="dropdown-item" href="/status">System Status</a></li>
											<li><a class="dropdown-item" href="/idmatch">ID Matches</a></li>
                                        </ul>
                                    </li>
                                @endif
								@if (Auth::logged_in())
                                    <li class="nav-item dropdown">
                                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                            {{ get_user()->username }}
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li><a class="dropdown-item" href="/account">My Account</a></li>

                                            <?php if (Auth::can_upload()) { ?>
                                                <li><a class="dropdown-item" href="/upload">Upload PDF</a></li>
                                                <li><a class="dropdown-item" href="/downloads">My Downloads</a></li>
                                                <li><a class="dropdown-item" href="/imports">My Imports</a></li>
                                            <?php } ?>

                                            <li><hr></li>
                                            <li><a class="dropdown-item text-danger" href="/logout">Log Out</a></li>
                                        </ul>
                                    </li>
                                @else
                                    <li class="nav-item dropdown">
                                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
                                            Guest
                                        </a>
                                        <ul class="dropdown-menu">
                                            <li><a class="dropdown-item" href="/register">Register</a></li>
                                            <li><hr></li>
                                            <li><a class="dropdown-item" href="/login">Log In</a></li>
                                        </ul>
                                    </li>
                                @endif
                            </ul>
                        </div>
                        <div>
							<search/>
                        </div>
                    </div>
                </div>
            </nav>

            <div class="container">
				@if($flash_error)
                    <div class="my-2 alert alert-danger">{{ $flash_error }}</div>
				@endif

				@if($flash_warn)
                    <div class="my-2 alert alert-warning">{{ $flash_warn }}</div>
				@endif

				@if($flash_info)
                    <div class="my-2 alert alert-info">{{ $flash_info }}</div>
				@endif

				@if($flash_success)
                    <div class="my-2 alert alert-success">{{ $flash_success }}</div>
				@endif
            </div>
@yield('content')

			<hr>
			<nav class="navbar">
					<ul class="navbar-nav">
						<li class="nav-item"><a href='/' class="nav-link small p-0">Home</a></li>
					</ul>
					<ul class="navbar-nav">
						<li class="nav-item"><a href='/privacy' class="nav-link small p-0">Privacy and Data</a></li>
					</ul>
			</nav>
			<p class="text-center small text-secondary">Site structure and layout &copy;2025 Majenko Technologies</p>

        </div>

    </body>
</html>
