{% extends "base_view.html" %}

{% block title %} meliza-lab : order : {{ order.name }} {% endblock %}

{% block content %}

<p class="lead">{{ order.name }}</p>
<p>date: {{ order.order_date }}<br/>
ptao: {{ order.ptao }}<br/>
ordered: {{ order.ordered }}<br/>
</p>

<table class="table table-striped table-condensed">
  <thead>
    <th>Vendor</th>
    <th>Catalog</th>
    <th>Unit</th>
    <th>Price</th>
    <th>Quantity</th>
    <th>Total Price</th>
    <th>Description</th>
    <th></th>
  </thead>
  <tbody>
    {% for oit in lineitems.iterator %}
        <tr>
          <td>
            {% if oit.item.vendor.url %}<a href="{{ oit.item.vendor.url }}">{{ oit.item.vendor }}</a>
            {% else %}{{ oit.item.vendor }}{% endif %}
          </td>
          <td>
            {% if oit.item.vendor_url %}<a href="{{ oit.item.vendor_url }}">{{ oit.item.catalog }}</a>
            {% else %}{{ oit.item.catalog }}{% endif %}
          </td>
          <td>{{ oit.item.unit_size }}</td>
          <td>{{ oit.cost }}</td>
          <td>{{ oit.units_purchased }}</td>
          <td>{{ oit.total_price }}</td>
          <td><a href="{% url 'inventory:item' oit.item.id %}">{{ oit.item.name }}</a></td>
          <td><a href="{% url 'admin:inventory_orderitem_change' oit.id %}"
                 class="glyphicon glyphicon-edit" alt="[edit]" aria-label="Edit"></a></td>
        </tr>
    {% endfor %}
  </tbody>
</table>

<hr>
<a href="{% url 'admin:inventory_order_change' order.id %}">edit order</a><br/>
<a href="{% url 'inventory:orders' %}">back to order list</a>

{% endblock %}
