{% extends "part/part_base.html" %}
{% load static %}
{% load i18n %}
{% block details %}

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

<h4>{% trans "Part Builds" %}</h4>
<hr>

<div id='button-toolbar'>
    <div class='button-toolbar container-flui' style='float: right';>
        {% if part.active %}
        {% if roles.build.add %}
        <button class="btn btn-success" id='start-build'><span class='fas fa-tools'></span> {% trans "Start New Build" %}</button>
        {% endif %}
        {% endif %}
        <div class='filter-list' id='filter-list-build'>
            <!-- Empty div for filters -->
        </div>
    </div>
</div>

<table class='table table-striped table-condensed' data-toolbar='#button-toolbar' id='build-table'>
</table>


{% endblock %}

{% block js_ready %}
{{ block.super }}
    $("#start-build").click(function() {
        newBuildOrder({
            data: {
                part: {{ part.id }},
            }
        });
    });

    loadBuildTable($("#build-table"), {
        url: "{% url 'api-build-list' %}",
        params: {
            part_detail: "true",
            part: {{ part.id }},
        }
    });
        
{% endblock %}