{% extends request.is_ajax|yesno:'bajax.html,base.html' %}
{% load i18n bootstrap3 %}

{% block title %}
    {% if tarif_id == 0 %}
        {% trans 'Add' %}
    {% else %}
        {{ form.title.value }}
    {% endif %}
{% endblock %}

{% block breadcrumb %}
    <ol class="breadcrumb">
        <li><span class="glyphicon glyphicon-home"></span></li>
        <li><a href="{% url 'tarifs:home' %}">{% trans 'Tarifs' %}</a></li>
        <li class="active">
            {% if tarif_id == 0 %}
                {% trans 'Add' %}
            {% else %}
                {% trans 'Edit' %}
            {% endif %}
        </li>
    </ol>
{% endblock %}

{% block main %}
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">{% if tarif_id == 0 %}{% trans 'Create' %}{% else %}{% trans 'Edit' %}{% endif %} {% trans 'tariff' %}</h3>
        </div>
        <div class="panel-body">
            <form action="{% url 'tarifs:edit' tarif_id %}" method="post">{% csrf_token %}

                {% bootstrap_form_errors form %}

                {% bootstrap_icon 'tag' as ic %}
                {% bootstrap_field form.title addon_before=ic %}

                {% bootstrap_icon 'comment' as ic %}
                {% bootstrap_field form.descr addon_before=ic %}

                {% bootstrap_icon 'chevron-down' as ic %}
                {% bootstrap_field form.speedIn addon_before=ic %}

                {% bootstrap_icon 'chevron-up' as ic %}
                {% bootstrap_field form.speedOut addon_before=ic %}

                {% bootstrap_icon 'usd' as ic %}
                {% bootstrap_field form.amount addon_before=ic %}

                {% bootstrap_icon 'link' as ic %}
                {% bootstrap_field form.calc_type addon_before=ic %}

                {% bootstrap_field form.is_admin %}

                <div class="btn-group">
                    <button type="submit" class="btn btn-sm btn-primary">
                        <span class="glyphicon glyphicon-save"></span> {% trans 'Save' %}
                    </button>
                    <button type="reset" class="btn btn-sm btn-default">
                        <span class="glyphicon glyphicon-remove-circle"></span> {% trans 'Reset' %}
                    </button>
                </div>

            </form>
        </div>
    </div>
{% endblock %}
