Add button to receive selected items

This commit is contained in:
Oliver 2021-10-05 16:52:24 +11:00
parent 8684b55582
commit 87f1bd87e7

View File

@ -18,13 +18,19 @@
</div> </div>
<div class='panel-content'> <div class='panel-content'>
<div id='order-toolbar-buttons' class='btn-group' style='float: right;'> <div id='order-toolbar-buttons' class='btn-group' style='float: right;'>
{% if order.status == PurchaseOrderStatus.PENDING and roles.purchase_order.change %} {% if roles.purchase_order.change %}
{% if order.status == PurchaseOrderStatus.PENDING %}
<button type='button' class='btn btn-success' id='new-po-line'> <button type='button' class='btn btn-success' id='new-po-line'>
<span class='fas fa-plus-circle'></span> {% trans "Add Line Item" %} <span class='fas fa-plus-circle'></span> {% trans "Add Line Item" %}
</button> </button>
<a class='btn btn-primary' href='{% url "po-upload" order.id %}' role='button'> <a class='btn btn-primary' href='{% url "po-upload" order.id %}' role='button'>
<span class='fas fa-file-upload side-icon'></span> {% trans "Upload File" %} <span class='fas fa-file-upload side-icon'></span> {% trans "Upload File" %}
</a> </a>
{% elif order.status == PurchaseOrderStatus.PLACED %}
<button type='button' class='btn btn-success' id='receive-selected-items' title='{% trans "Receive selected items" %}'>
<span class='fas fa-sign-in-alt'></span> {% trans "Receive Items" %}
</button>
{% endif %}
{% endif %} {% endif %}
</div> </div>
@ -207,6 +213,22 @@ $('#new-po-line').click(function() {
}); });
}); });
{% elif order.status == PurchaseOrderStatus.PLACED %}
$('#receive-selected-items').click(function() {
var items = $("#po-line-table").bootstrapTable('getSelections');
receivePurchaseOrderItems(
{{ order.id }},
items,
{
success: function() {
$("#po-line-table").bootstrapTable('refresh');
}
}
);
});
{% endif %} {% endif %}
loadPurchaseOrderLineItemTable('#po-line-table', { loadPurchaseOrderLineItemTable('#po-line-table', {