{{define "head"}}
<title>Audit Logs - ari melody 💫</title>
<link rel="shortcut icon" href="/img/favicon.png" type="image/x-icon">
<link rel="stylesheet" href="/admin/static/admin.css">
<link rel="stylesheet" href="/admin/static/logs.css">
{{end}}

{{define "content"}}
<main>
    <h1>Audit Logs</h1>

    <form action="/admin/logs" method="GET">
        <div id="search">
            <input type="text" name="q" value="" placeholder="Filter by message...">
            <button type="submit" class="save">Search</button>
        </div>
        <div id="filters">
            <div>
                <p>Level:</p>
                <label for="level-info">Info</label>
                <input type="checkbox" name="level-info" id="level-info">
                <label for="level-warn">Warning</label>
                <input type="checkbox" name="level-warn" id="level-warn">
            </div>
            <div>
                <p>Type:</p>
                <label for="type-account">Account</label>
                <input type="checkbox" name="type-account" id="type-account">
                <label for="type-music">Music</label>
                <input type="checkbox" name="type-music" id="type-music">
                <label for="type-artist">Artist</label>
                <input type="checkbox" name="type-artist" id="type-artist">
                <label for="type-blog">Blog</label>
                <input type="checkbox" name="type-blog" id="type-blog">
                <label for="type-artwork">Artwork</label>
                <input type="checkbox" name="type-artwork" id="type-artwork">
                <label for="type-files">Files</label>
                <input type="checkbox" name="type-files" id="type-files">
                <label for="type-misc">Misc</label>
                <input type="checkbox" name="type-misc" id="type-misc">
            </div>
        </div>
    </form>
    
    <hr>

    <table id="logs">
        <thead>
            <tr>
                <th class="log-time">Time</th>
                <th class="log-level">Level</th>
                <th class="log-type">Type</th>
                <th class="log-content">Message</th>
            </tr>
        </thead>
        <tbody>
            {{range .Logs}}
            <tr class="log {{lower (parseLevel .Level)}}">
                <td class="log-time">{{prettyTime .CreatedAt}}</td>
                <td class="log-level">{{parseLevel .Level}}</td>
                <td class="log-type">{{titleCase .Type}}</td>
                <td class="log-content">{{.Content}}</td>
            </tr>
            {{end}}
        </tbody>
    </table>
</main>
{{end}}
