{% extends "base.html" %}
{% load static %}

{% block page_title %}
InvenTree | Build List 
{% endblock %}

{% block content %}


<div class='row'>
    <div class='col-sm-6'>
        <h3>Part Builds</h3>
    </div>
    <div class='col-sm-6'>
        <div class='container' id='active-build-toolbar' style='float: right;'>
            <div class='btn-group' style='float: right;'>
                <button type='button' class="btn btn-success" id='new-build'>Start New Build</button>
            </div>
        </div>
    </div>
</div>

<hr>

{% include "build/build_list.html" with builds=active title="Active Builds" completed=False collapse_id='active' %}

{% include "build/build_list.html" with builds=completed completed=True title="Completed Builds" collapse_id="complete" %}

{% include "build/build_list.html" with builds=cancelled title="Cancelled Builds" completed=False collapse_id="cancelled" %}

{% endblock %}

{% block js_ready %}
{{ block.super }}

    $("#collapse-item-active").collapse().show();

    $("#new-build").click(function() {
        launchModalForm(
                        "{% url 'build-create' %}",
                        {
                            follow: true
                        });
    });

    $(".build-table").bootstrapTable({
        sortable: true,
        search: true,
        formatNoMatches: function() { return 'No builds found'; },
        columns: [
            {
                field: 'name',
                title: 'Build',
                sortable: true,
            },
            {
                field: 'part',
                title: 'Part',
                sortable: true,
            },
            {
                title: 'Quantity',
                sortable: true,
                searchable: false
            },
            {
                title: 'Status',
                sortable: true,
            },
            {
                sortable: true,
            },
        ]
    });

{% endblock %}