{% extends "index.html" %}

{% block content %}
    <div class="card-header">
        <h5 class="card-title">Set the initial model</h5>
        <h6 class="card-subtitle text-muted">{{ message }}</h6>
    </div>
    <div class="card">
        <div class="card-body">
            {% if not h_latest_model_id %}
                <form id="seed_upload_form" method="post" action="/models"
                      enctype="multipart/form-data">

                    <div class="mb-3 row">
                        <label class="col-form-label col-sm-2 text-sm-right" for="file">File input:
                        </label>
                        <div class="col-sm-10">
                            <input class="form-control" type="file" id="file" name="seed" required>
                        </div>
                    </div>
                    <div class="mb-3 row">
                        <div class="col-sm-10 ml-sm-auto">
                            <button type="submit" class="btn btn-square btn-primary">Upload</button>
                        </div>
                    </div>
                </form>
            {% else %}
                <form id="delete_models_form" method="post" action="/delete_model_trail"
                      enctype="multipart/form-data" style="margin-bottom: 24px;">
                    <div class="mb-3 row">
                        <div class="col-sm-10 ml-sm-auto">
                            <button type="submit" class="btn btn-square btn-danger">Delete models
                                [{{ model_info|length }}]
                            </button>
                        </div>
                    </div>
                </form>
                <table class="table">
                    <thead>
                    <tr>
                        <th style="width:70%;">Model ID</th>
                        <th style="width:30%">Committed at</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for key in model_info.keys() %}
                        <tr>
                            <td>{{ key }}</td>
                            <td>{{ model_info[key] }}</td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            {% endif %}
        </div>
    </div>
{% endblock %}
