<!--
 Copyright 2021-2023 H2020 TeraFlow (https://www.teraflow-h2020.eu/)

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

{% extends 'base.html' %}

{% block content %}
    <h1>This is the home page</h1>
    <p>Here we have have several things.</p>

    {% for field, message in context_form.errors.items() %}
        <div class="alert alert-dismissible fade show" role="alert">
        <b>{{ field }}</b>: {{ message }}
        <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>

    {% endfor %}

    <h2>Select the working context</h2>
    <form id="select_context" method="POST">
        {{ context_form.hidden_tag() }}
        <fieldset class="form-group">
            <div class="input-group mb-3">

                {% if context_form.context.errors %}
                    {{ context_form.context(class="form-select is-invalid") }}
                    <div class="invalid-feedback">
                        {% for error in context_form.context.errors %}
                            <span>{{ error }}</span>
                        {% endfor %}
                    </div>
                {% else %}
                    {{ context_form.context(class="form-select") }}
                {% endif %}

                {{ context_form.submit(class='btn btn-primary') }}
            </div>
        </fieldset>
    </form>

{% endblock %}