{% extends "collapse.html" %}

{% block collapse_title %}
<b>{{ title }}</b> - {{ builds | length }}
{% endblock %}

{% block collapse_content %}
<table class='table table-striped table-condensed build-table' id='build-table-{{collapse_id}}' data-toolbar='#button-toolbar'>
        <thead>
        <tr>
            <th>Build</th>
            <th>Part</th>
            <th>Quantity</th>
            <th>Status</th>
            {% if completed %}
            <th>Completed</th>
            {% else %}
            <th>Created</th>
            {% endif %}
        </tr>
        </thead>
        <tbody>
{% for build in builds %}
<tr>
    <td><a href="{% url 'build-detail' build.id %}">{{ build.title }}</a></td>
    <td><a href="{% url 'part-build' build.part.id %}">{{ build.part.full_name }}</a></td>
    <td>{{ build.quantity }}</td>
    <td>{% include "build_status.html" with build=build %}
    {% if completed %}
    <td>{{ build.completion_date }}<span class='badge'>{{ build.completed_by.username }}</span></td>
    {% else %}
    <td>{{ build.creation_date }}</td>
    {% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}