
{% extends 'modal.html' %}

{% load i18n widget_tweaks %}


{% block title %}
    {% trans 'New product' %}
{% endblock %}


{% block body %}
    <form action="{{ request.get_full_path }}"
          method="post"
          enctype="multipart/form-data">

        {% csrf_token %}

        <div class="form-group {% if form.category.errors %}has-error{% endif %}">
            {{ form.category.label_tag }}
            {{ form.category|add_class:"form-control" }}
            <span class="text-danger">{{ form.category.errors }}</span>
        </div>

        <div class="form-group {% if form.name.errors %}has-error{% endif %}">
            {{ form.name.label_tag }}
            {{ form.name|add_class:"form-control" }}
            <span class="text-danger">{{ form.name.errors }}</span>
        </div>

        <div class="form-group {% if form.code.errors %}has-error{% endif %}">
            {{ form.code.label_tag }}
            {{ form.code|add_class:"form-control" }}
            <span class="text-danger">{{ form.code.errors }}</span>
        </div>

        <div class="form-group {% if form.price.errors %}has-error{% endif %}">
            {{ form.price.label_tag }}
            {{ form.price|add_class:"form-control" }}
            <span class="text-danger">{{ form.price.errors }}</span>
        </div>


        <div class="row">
            <div class="col-xs-6">
                <div class="form-group {% if form.price_retail.errors %}has-error{% endif %}">
                    {{ form.price_retail.label_tag }}
                    {{ form.price_retail|add_class:"form-control" }}
                    <span class="text-danger">{{ form.price_retail.errors }}</span>
                </div>
            </div>
            <div class="col-xs-6">
                <div class="form-group {% if form.stock.errors %}has-error{% endif %}">
                    {{ form.stock.label_tag }}
                    {{ form.stock|add_class:"form-control" }}
                    <span class="text-danger">{{ form.stock.errors }}</span>
                </div>
            </div>
        </div>

    </form>
{% endblock %}


{% block footer %}
    <button type="button" class="btn btn-success pull-left" data-role="submit-btn">
        <i class="fa fa-check"></i>
        {% trans 'Add product' %}
    </button>

    <button type="button" class="btn btn-default" data-dismiss="modal">
        {% trans 'Cancel' %}
    </button>
{% endblock %}
