{% extends "build/build_base.html" %}
{% load static %}

{% block details %}

{% include "build/tabs.html" with tab='details' %}

<h4>Build Details</h4>

<hr>

<table class='table table-striped'>
<tr>
    <td>Title</td><td>{{ build.title }}</td>
</tr>
<tr>
    <td>Part</td><td><a href="{% url 'part-build' build.part.id %}">{{ build.part.full_name }}</a></td>
</tr>
<tr>
    <td>Quantity</td><td>{{ build.quantity }}</td>
</tr>
<tr>
    <td>Stock Source</td>
    <td>
        {% if build.take_from %}
        <a href="{% url 'stock-location-detail' build.take_from.id %}">{{ build.take_from }}</a>
        {% else %}
        Stock can be taken from any available location.
        {% endif %}
    </td>
</tr>
<tr>
    <td>Status</td><td>{% include "build_status.html" with build=build %}</td>
</tr>
{% if build.batch %}
<tr>
    <td>Batch</td><td>{{ build.batch }}</td>
</tr>
{% endif %}
{% if build.URL %}
<tr>
    <td>URL</td><td><a href="{{ build.URL }}">{{ build.URL }}</a></td>
</tr>
{% endif %}
<tr>
    <td>Created</td><td>{{ build.creation_date }}</td>
</tr>
{% if build.is_active %}
<tr>
    <td>Enough Parts?</td>
    <td>
        {% if build.can_build %}
        Yes
        {% else %}
        No
        {% endif %}
    </td>
</tr>
{% endif %}
{% if build.completion_date %}
<tr>
    <td>Completed</td><td>{{ build.completion_date }}{% if build.completed_by %}<span class='badge'>{{ build.completed_by }}</span>{% endif %}</td>
</tr>
{% endif %}
</table>

{% if build.notes %}
<div class="panel panel-default">
  <div class="panel-heading"><b>Notes</b></div>
  <div class="panel-body">{{ build.notes }}</div>
</div>
{% endif %}

{% endblock %}
