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

{% block form_id %}upload_package{% endblock %}
{% block form_action %}{% url 'horizon:murano: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>{% blocktrans %}<strong>Categories</strong> Select one or more categories for a package{% endblocktrans %}</p>
            <p>{% blocktrans %} Specifying a category helps to filter applications in the catalog {% endblocktrans %}</p>
        {% else %}
            <div class='description-upload'>
                <h3>{% trans 'Description:' %}</h3>
                <p>{% blocktrans %}Choose a Zip archive to upload into the catalog.{% endblocktrans %}</p>
                <p>{% blocktrans %}Packages should contain:<br>
                    * Manifest file<br>
                    * UI definition folder<br>
                    * Classes definition folder<br>
                    * Execution plans folder{% endblocktrans %}</p>
            </div>
            <div class='description-by_name'>
                <h3>{% trans 'Description:' %}</h3>
                <p>{% blocktrans %}<strong>Package Name:</strong> Fully qualified package name.{% endblocktrans %}</p>
                <p>{% blocktrans %}<strong>Package Version:</strong> Version of the package (optional).{% endblocktrans %}</p>
                <p>{% blocktrans %}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>{% blocktrans %}<strong>Package URL:</strong> HTTP/HTTPS URL of the package file.{% endblocktrans %}</p>
            </div>
            <div class='description-common'>
                <p>{% blocktrans %}<strong><i>Note: </i></strong>If the package depends upon other packages and/or requires specific glance images, those are going to be installed with it from murano repository.{% endblocktrans %}</p>
            </div>
        {% endif %}
    </div>
{% endblock %}

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