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

{% block title %}Commande #{{ order.pk }}{% endblock %}
{% block content-header-title %}Commande #{{ order.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>Créée le:</b> {{ order.at }}</div>
        <div class="line"><b>Fournisseur:</b> {{ order.supplier.name }}</div>
      </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>Commandé</td>
                <td>Commandé (#box)</td>
                <td>Reçu</td>
              </tr>
            </thead>
            <tbody>
              {% for orderart in orderarts %}
                {% ifchanged orderart.article.category %}
                  <tr class="section">
                    <td colspan="4">{{ orderart.article.category.name }}</td>
                  </tr>
                {% endifchanged %}
                <tr>
                  <td>{{ orderart.article.name }}</td>
                  <td>{{ orderart.quantity_ordered }}</td>
                  <td>
                    {% if orderart.article.box_capacity %}
                      {# c'est une division ! #}
                      {% widthratio orderart.quantity_ordered orderart.article.box_capacity 1 %}
                    {% endif %}
                  </td>
                  <td>
                    {{ orderart.quantity_received|default_if_none:'' }}
                  </td>
                </tr>
              {% endfor %}
            </tbody>
          </table>
        </div>
      </div>
      <div class="content-right-block">
        <h2>Mail</h2>
        <div>
          <textarea class="form-control" style="height:500px;">{{ mail }}</textarea>
        </div>
      </div>
    </div>
  </div>
</div>

{% endblock %}
