{% extends 'timeseer.html' %}

{% from 'macros.html' import alerter, menu_back %}
{% from 'series-set-template-form.html' import series_set_template_form, series_sets_preview %}

{% block menu %}
{{ menu_back(url_for('series_sets.list_templates', sourcename=source_name)) }}
{% endblock %}

{% block main %}
<div class="ts-section py-3 my-3">
    <h2 class="h4">Create a new series set template</h2>
</div>

<div class="pt-3 my-3">
    {{ alerter() }}

    {{ series_set_template_form('Create', template, sources, source_name=source_name) }}

    {% if series_sets is not none %}
    {% if series_sets|count > 0 %}
    <div class="mt-3">
        {{ series_sets_preview(series_sets) }}
    </div>
    {% else %}
    <div class="alert alert-info mt-3">
        No series sets found.
    </div>
    {% endif %}
    {% endif %}
</div>
{% endblock %}

{% block scripts_bottom %}
<script src="{{ url_for('static', filename='dist/define-series-set-template.js') }}"></script>
{% endblock %}
