{% extends "layout.html" %}

{% block content %}

<div class="content-section">
    <div class="article-metadata">
        <a class="mr-2" href="#">{{ experiment.author }}</a>
        <small class="text-muted">{{ experiment.date_created.strftime('%Y-%m-%d') }}</small>
    </div>
    <form method="POST" action="" enctype="multipart/form-data" class="needs-validation" novalidate>
        {{ form.hidden_tag() }}
        <fieldset class="form-group">
            <legend class="border-bottom">{{ experiment.title }}: {{ legend }}</legend>

            <div class="pb-3">
                <small class="text-muted">
                    Newest Version: {{ newest_version }}
                </small>
            </div>

            <div class="form-group">
                {{ form.updated_version.label(class="form-control-label") }}
                {% if form.updated_version.errors %}
                {{ form.updated_version(class="form-control form-control-lg is-invalid", placeholder="Must be equal to script.py version.") }}

                <div class="invalid-feedback">
                    {% for error in form.updated_version.errors %}
                    <span>{{ error }}</span>
                    {% endfor %}
                </div>

                {% else %}
                {{ form.updated_version(class="form-control form-control-lg", placeholder="Must be equal to script.py version.") }}
                {% endif %}
            </div>

            <div class="form-group">
                {{ form.script.label() }}
                {{ form.script(class="form-control-file") }}
                {% if form.script.errors %}
                {% for error in form.script.errors %}
                <span class="text-danger">{{ error }}</span><br>
                {% endfor %}
                {% endif %}
            </div>

            <div class="form-group">
                {{ form.changes.label(class="form-control-label") }}
                {% if form.changes.errors %}
                {{ form.changes(class="form-control form-control-lg is-invalid") }}

                <div class="invalid-feedback">
                    {% for error in form.changes.errors %}
                    <span>{{ error }}</span>
                    {% endfor %}
                </div>

                {% else %}
                {{ form.changes(class="form-control form-control-lg") }}
                {% endif %}
            </div>



        </fieldset>
        <div class="form-group">
            {{ form.submit(class="btn btn-outline-primary")}}
        </div>
    </form>
</div>

{% endblock content %}