{% extends "part/part_app_base.html" %}
{% load inventree_extras %}
{% load i18n %}
{% load static %}

{% block sidebar %}
{% url 'part-index' as url %}
{% trans "Return to Parts" as text %}
{% include "sidebar_link.html" with url=url text=text icon="fa-undo" %}
{% endblock %}

{% block content %}
    <div class='panel'>
        <div class='panel-heading'>
            <h4>
                {% trans "Import Parts from File" %}
                {{ wizard.form.media }}
            </h4>
        </div>
        <div class='panel-content'>   
    {% if roles.part.change %}

        <p>{% blocktrans with step=wizard.steps.step1 count=wizard.steps.count %}Step {{step}} of {{count}}{% endblocktrans %}
        {% if description %}- {{ description }}{% endif %}</p>

        {% block form_alert %}
        {% endblock form_alert %}

        <form action="" method="post" class='js-modal-form' enctype="multipart/form-data">
        {% csrf_token %}
        {% load crispy_forms_tags %}

        {% block form_buttons_top %}
        {% endblock form_buttons_top %}

        <table class='table table-striped' style='margin-top: 12px; margin-bottom: 0px'>
        {{ wizard.management_form }}
        {% block form_content %}
        {% crispy wizard.form %}
        {% endblock form_content %}
        </table>

        {% block form_buttons_bottom %}
        {% if wizard.steps.prev %}
        <button name="wizard_goto_step" type="submit" value="{{ wizard.steps.prev }}" class="save btn btn-outline-secondary">{% trans "Previous Step" %}</button>
        {% endif %}
        <button type="submit" class="save btn btn-outline-secondary">{% trans "Upload File" %}</button>
        </form>
        {% endblock form_buttons_bottom %}

    {% else %}
        <div class='alert alert-danger alert-block' role='alert'>
            {% trans "Unsuffitient privileges." %}
        </div>
    {% endif %}
    </div>
</div>
{% endblock %}

{% block js_ready %}
{{ block.super }}

enableSidebar('partupload');

{% endblock %}