{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% load static %}

{% block form_id %}upload_package{% endblock %}
{% block form_action %}{% url 'horizon:app-catalog:packages:upload' %}{% endblock %}
{% block form_attrs %}enctype="multipart/form-data"{% endblock %}

{% block modal_id %}upload_package_modal{% endblock %}
{% block modal-header %}{% trans 'Import Package' %}{% endblock %}

{% block modal-body %}
    <div class="left" >
    {{ wizard.management_form }}
    {% if wizard.form.forms %}
        {{ wizard.form.management_form }}
        {% for form in wizard.form.forms %}
            {{ form }}
        {% endfor %}
    {% else %}
        <fieldset>
        {% with form=wizard.form %}
            {% include "horizon/common/_form_fields.html" %}
        {% endwith %}
        </fieldset>
    {% endif %}
    </div>
    <div class="right">
        {% if wizard.steps.prev == 'upload' %}
            {% include 'packages/_package_params.html' %}
        {% elif wizard.steps.prev == 'modify' %}
            <h3>{% trans "Description" %}:</h3>
            <p><strong>{% trans "Categories" %} </strong>{% trans "Select one or more categories for a package." %}</p>
            <p>{% trans "Specifying a category helps to filter applications in the catalog" %}</p>
        {% else %}
            <div class='description-upload'>
                <h3>{% trans "Description" %}:</h3>
                <p>{% trans "Choose a Zip archive to upload into the catalog." %}</p>
                <p>{% trans "Packages should contain:" %}<br>
                * {% trans "Manifest file" context "Package requirements" %}<br>
                * {% trans "UI definition folder" context "Package requirements" %}<br>
                * {% trans "Classes definition folder" context "Package requirements" %}<br>
                * {% trans "Execution plans folder" context "Package requirements" %}</p>
            </div>
            <div class='description-by_name'>
                <h3>{% trans "Description" %}:</h3>
                <p><strong>{% trans "Package Name" %}: </strong>{% trans "Fully qualified package name." %}</p>
                <p><strong>{% trans "Package Version" %}: </strong>{% trans "Version of the package (optional)." %}</p>
                <p>{% blocktrans trimmed %}The package is going to be imported from <a href="{{murano_repo_url}}" target="_blank">{{murano_repo_url}}</a> repository.{% endblocktrans %}</p>
            </div>
            <div class='description-by_url'>
                <h3>{% trans "Description" %}:</h3>
                <p><strong>{% trans "Package URL" %}: </strong>{% trans "HTTP/HTTPS URL of the package file." %}</p>
            </div>
            <div class='description-common'>
                <p><strong><i>{% trans "Note" %}: </i></strong>
                    {% trans "If the package depends upon other packages and/or requires specific glance images, those are going to be installed with it from murano repository." %}</p>
            </div>
        {% endif %}
    </div>
{% endblock %}

{% block modal-footer %}
    <a href='{% url 'horizon:app-catalog:packages:index' %}' class='btn btn-default cancel'>{% trans 'Cancel' %}</a>
    {% if wizard.steps.next %}
        <input type='submit' class='btn btn-primary'  value='{% trans 'Next' %}'/>
    {% else %}
        <input type='submit' class='btn btn-primary'  value='{% trans 'Create' %}'/>
    {% endif %}
{% endblock %}
