{% extends 'kfet/base.html' %}

{% block title %}Inventaire #{{ inventory.pk }}{% endblock %}
{% block content-header-title %}Inventaire #{{ inventory.pk }}{% endblock %}

{% block content %}

<div class="row">
  <div class="col-sm-4 col-md-3 col-content-left">
    <div class="content-left">
      <div class="content-left-top">
        <div class="line"><b>Date:</b> {{ inventory.at }}</div>
        <div class="line"><b>Par:</b> {{ inventory.by.trigramme }}</div>
        {% if inventory.order %}
          <div class="line">
            <b>Commande relative:</b>&nbsp;
            <a href="{% url 'kfet.order.read' inventory.order.pk %}">
              #{{ inventory.order.pk }}
            </a>
          </div>
        {% endif %}
      </div>
    </div>
  </div>
  <div class="col-sm-8 col-md-9 col-content-right">
    {% include 'kfet/base_messages.html' %}
    <div class="content-right">
      <div class="content-right-block">
        <h2>Détails</h2>
        <div class="table-responsive">
          <table class="table table-condensed">
            <thead>
              <tr>
                <td>Article</td>
                <td>Stock avant</td>
                <td>Stock après</td>
                <td>Erreur</td>
              </tr>
            </thead>
            <tbody>
              {% for inventoryart in inventoryarts %}
                {% ifchanged inventoryart.article.category %}
                  <tr class="section">
                    <td colspan="4">{{ inventoryart.article.category.name }}</td>
                  </tr>
                {% endifchanged %}
                <tr>
                  <td>{{ inventoryart.article.name }}</td>
                  <td>{{ inventoryart.stock_old }}</td>
                  <td>{{ inventoryart.stock_new }}</td>
                  <td>{{ inventoryart.stock_error }}</td>
                </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>

{% endblock %}
