{{define "title"}}
    Models : AI Stuff
{{end}}

{{define "mainbody"}}
    <main>
        {{ if (lt 0 (len .List)) }}
            <div class="list-header">
                <h2>My Models</h2>
                <div class="expand"></div>
                <a class="button" hx-get="/models/add" hx-headers='{"REQUEST-TYPE": "htmlfull"}' hx-push-url="true" hx-swap="outerHTML" hx-target=".app">
                    New
                </a>
            </div>
            <table>
                <thead>
                    <tr>
                        <th>
                            Name
                        </th>
                        <th>
                            <!-- Open Button -->
                        </th>
                    </tr>
                </thead>
                <tbody>
                    {{range .List}}
                        <tr>
                            <td>
                                {{.Name}}
                            </td>
                            <td class="text-center">
                                <a class="button simple" hx-get="/models/edit?id={{.Id}}" hx-headers='{"REQUEST-TYPE": "htmlfull"}' hx-push-url="true" hx-swap="outerHTML" hx-target=".app">
                                    Edit
                                </a>
                            </td>
                        </tr>
                    {{end}}
                </tbody>
            </table>
        {{else}}
            <h2 class="text-center">
                You don't have any models
            </h2>
            <div class="text-center">
                <a class="button padded" hx-get="/models/add" hx-headers='{"REQUEST-TYPE": "htmlfull"}' hx-push-url="true" hx-swap="outerHTML" hx-target=".app">
                    Create a new model
                </a>
            </div>
        {{end}}
    </main>
{{end}}