{% extends 'oscar/dashboard/layout.html' %}
{% load i18n %}

{% block body_class %}{{ block.super }} create-page{% endblock %}

{% block title %}
    {{ title }} | {% trans "Ranges" %} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a></li>
            <li class="breadcrumb-item">
                <a href="{% url 'dashboard:range-list' %}">{% trans "Ranges" %}</a>
            </li>
            {% if range %}
                <li class="breadcrumb-item active" aria-current="page">'{{ range.name }}'</li>
            {% else %}
                <li class="breadcrumb-item active" aria-current="page">{{ title }}</li>
            {% endif %}
        </ol>
    </nav>
{% endblock %}

{% block headertext %}
    {% if range %}{{ range.name }}{% else %}{% trans "Create new range" %}{% endif %}
{% endblock %}

{% block dashboard_content %}
    <form method="post" class="form-stacked card card-body bg-light wysiwyg">
        {% csrf_token %}
        {% include "oscar/dashboard/partials/form_fields.html" with form=form %}
        {% block form_actions %}
            <div class="form-actions">
                <button class="btn btn-primary" type="submit" data-loading-text="{% trans 'Saving...' %}">{% trans "Save" %}</button> {% trans "or" %}
                {# This is an input so we distinguish between which button was pressed #}
                <input class="btn btn-primary" type="submit" name="action" value="{% trans "Save and edit products" %}"/>
                {% trans "or" %}
                <a href="{% url 'dashboard:range-list' %}">{% trans "cancel" %}</a>
            </div>
        {% endblock form_actions %}
    </form>
{% endblock dashboard_content %}
