<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>WarpBox Admin Boxes</title>
        <link rel="icon" type="image/png" href="/static/WarpBoxLogo.png">
        <link rel="stylesheet" href="/static/css/app.css">
        <link rel="stylesheet" href="/static/css/window.css">
        <link rel="stylesheet" href="/static/css/admin.css">
    </head>
    <body>
        <main>
            <section class="win98-window admin-window" aria-labelledby="admin-boxes-title">
                <header class="win98-titlebar">
                    <div class="win98-titlebar-label">
                        <img class="win98-titlebar-icon" src="/static/WarpBoxLogo.png" alt="" aria-hidden="true">
                        <h1 id="admin-boxes-title">Boxes</h1>
                    </div>
                </header>
                <div class="win98-panel admin-panel">
                    <nav class="admin-nav">
                        <a class="win98-button" href="/admin">Admin</a>
                        <a class="win98-button" href="/admin/users">Users</a>
                        <a class="win98-button" href="/admin/tags">Tags</a>
                        <a class="win98-button" href="/admin/settings">Settings</a>
                        <span class="admin-spacer"></span>
                        <span>{{ .CurrentUser }}</span>
                    </nav>
                    <div class="admin-summary">
                        <span class="win98-panel">Boxes: {{ .TotalBoxes }}</span>
                        <span class="win98-panel">Storage: {{ .TotalStorage }}</span>
                        <span class="win98-panel">Expired: {{ .ExpiredBoxes }}</span>
                    </div>
                    <table class="admin-table">
                        <thead>
                            <tr>
                                <th>Box ID</th>
                                <th>Files</th>
                                <th>Size</th>
                                <th>Created</th>
                                <th>Expires</th>
                                <th>Flags</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{ range .Boxes }}
                                <tr>
                                    <td><a href="/box/{{ .ID }}">{{ .ID }}</a></td>
                                    <td>{{ .FileCount }}</td>
                                    <td>{{ .TotalSizeLabel }}</td>
                                    <td>{{ .CreatedAt }}</td>
                                    <td>{{ .ExpiresAt }}</td>
                                    <td>
                                        {{ if .Expired }}expired {{ end }}
                                        {{ if .OneTimeDownload }}one-time {{ end }}
                                        {{ if .PasswordProtected }}password {{ end }}
                                    </td>
                                </tr>
                            {{ else }}
                                <tr><td colspan="6">No boxes found.</td></tr>
                            {{ end }}
                        </tbody>
                    </table>
                </div>
            </section>
        </main>
    </body>
</html>
