{% extends "base_view.html" %}

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

{% block content %}

<p class="lead">{{ item.name }}</p>

<hr>

<dl class="dl-horizontal">
  <dt>vendor</dt>
  <dd>
    {% if item.vendor.url %}<a href="{{ item.vendor.url }}">{{ item.vendor }}</a>
    {% else %}{{ item.vendor }}{% endif %}
  </dd>
  <dt>catalog</dt>
  <dd>
    {% if item.vendor_url %}<a href="{{ item.vendor_url }}">{{ item.catalog }}</a>
    {% else %}{{ item.catalog }}{% endif %}
  </dd>
  <dt>manufacturer</dt>
  <dd>
    {% if item.manufacturer.url %}<a href="{{ item.manufacturer.url }}">{{ item.manufacturer }}</a>
    {% else %}{{ item.manufacturer }}{% endif %}
  </dd>
  <dt>part number</dt>
  <dd>
    {% if item.mfg_url %}<a href="{{ item.mfg_url }}">{{ item.manufacturer_number }}</a>
    {% else %}{{ item.manufacturer_number }}{% endif %}
  </dd>
  <dt>unit size</dt><dd>{{ item.unit_size }}</dd>
</dl>

<dl class="dl-horizontal">
  <dt>category</dt><dd>{{ item.category }}</dd>
  <dt>part of</dt><dd>{{ item.parent_item }}</dd>
</dl>

<dl class="dl-horizontal">
  <dt>comments</dt><dd>{{ item.comments }}</dd>
</dl>

<h3>Orders</h3>

<table class="table table-striped table-condensed">
  <thead>
    <th>Order Date</th>
    <th>Price</th>
    <th>Quantity</th>
    <th>Total Price</th>
    <th>Arrival Date</th>
    <th>Location</th>
    <th>Serial</th>
    <th>Equipment #</th>
    <th></th>
  </thead>
  <tbody>
    {% for oit in lineitems.iterator %}
    <tr>
      <td><a href="{% url 'inventory:order' oit.order.id %}">{{ oit.order.order_date }}</a></td>
      <td>{{ oit.cost }}</td>
      <td>{{ oit.units_purchased }}</td>
      <td>{{ oit.total_price }}</td>
      <td>{{ oit.date_arrived }}</td>
      <td>{{ oit.location }}</td>
      <td>{{ oit.serial }}</td>
      <td>{{ oit.uva_equip }}</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_item_change' item.id %}">edit item</a><br/>


{% endblock %}
