{% extends "page_base.html" %}

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

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

{% block heading %}
{% trans "Purchase Orders" %}
{% endblock heading %}

{% block actions %}
{% if roles.purchase_order.add %}
<button class='btn btn-success' type='button' id='po-create' title='{% trans "Create new purchase order" %}'>
    <span class='fas fa-plus-circle'></span> {% trans "New Purchase Order" %}
</button>
{% endif %}
{% endblock actions %}

{% block page_info %}

<div class='panel-content'>
    <div id='table-buttons'>
        {% include "filter_list.html" with id="purchaseorder" %}
    </div>

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

    <div id='purchase-order-calendar'></div>

</div>

{% endblock page_info %}

{% block js_load %}
{{ block.super }}

{% endblock js_load %}

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

$("#po-create").click(function() {
    createPurchaseOrder();
});

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

{% endblock js_ready %}
