{% extends "page_base.html" %}

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

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

{% block breadcrumb_list %}
{% endblock breadcrumb_list %}

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

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

{% block page_info %}

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

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

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

{% endblock page_info %}

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

loadSalesOrderTable("#sales-order-table", {
    url: "{% url 'api-so-list' %}",
});

$("#so-create").click(function() {
    createSalesOrder();
});

{% endblock js_ready %}
