{% extends "kfet/base_col_1.html" %}
{% load widget_tweaks %}

{% block title %}Nouvel inventaire{% endblock %}
{% block header-title %}Création d'inventaire depuis la commande #{{ order.pk }}{% endblock %}

{% block main-size %}col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2{% endblock %}

{% block main %}

<form action="" method="post">
  {% csrf_token %}
  <div class="table-responsive">
  <table class='table table-condensed table-condensed-input text-center'>
    <thead>
      <tr>
        <td style="width: 25%">Article</td>
        <td>Prix HT</td>
        <td>TVA</td>
        <td>Droits</td>
        <td>Commandé</td>
        <td>Reçu</td>
      </tr>
    </thead>
    <tbody>
      {% for form in formset %}
      {% ifchanged form.category %}
      <tr class='section text-left'>
        <td colspan="6">{{ form.category_name }}</td>
      </tr>
      {% endifchanged %}
      <tr>
        {{ form.article }}
        <td class="text-left">{{ form.name }}</td>
        <td class="nopadding">{{ form.price_HT | add_class:"form-control" }}</td>
        <td class="nopadding">{{ form.TVA | add_class:"form-control" }}</td>
        <td class="nopadding">{{ form.rights | add_class:"form-control" }}</td>
        <td>{{ form.quantity_ordered }}</td>
        <td class="nopadding">{{ form.quantity_received | add_class:"form-control" }}</td>
      </tr>
      {% endfor %}
    </tbody>
  </table>
  </div>
  {{ formset.management_form }}
  {% if not perms.kfet.add_inventory %}
  <div class='auth-form form-horizontal'>
    {% include "kfet/form_authentication_snippet.html" %}
  </div>
  {% endif %}
  <input type="submit" value="Enregistrer" class="btn btn-primary btn-lg btn-block">
</form>

{% endblock %}
