{% extends "base.html" %}

{% load static %}
{% load i18n %}

{% block page_title %}
InvenTree | {% trans "Purchase Orders" %}
{% endblock %}

{% block content %}

<h3>{% trans "Purchase Orders" %}</h3>
<hr>

<div id='table-buttons'>
    <div class='button-toolbar container-fluid' style='float: right;'>
        {% if roles.purchase_order.add %}
        <button class='btn btn-primary' type='button' id='po-create' title='{% trans "Create new purchase order" %}'>
            <span class='fas fa-plus-circle'></span> {% trans "New Purchase Order" %}</button>
        {% endif %}
        <div class='filter-list' id='filter-list-purchaseorder'>
            <!-- An empty div in which the filter list will be constructed -->
        </div>
    </div>
</div>

<table class='table table-striped table-condensed po-table' data-toolbar='#table-buttons' id='purchase-order-table'>
</table>

{% endblock %}

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

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

loadPurchaseOrderTable("#purchase-order-table", {
    url: "{% url 'api-po-list' %}",
});

{% endblock %}