2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 20:45:44 +00:00

Refactor allocation form

- The data is already loaded in the main table!
- Why would we want to throw that data away?
This commit is contained in:
Oliver
2021-10-05 00:57:58 +11:00
parent 28509dbd68
commit 17df4ca91e
2 changed files with 181 additions and 168 deletions

View File

@ -191,7 +191,19 @@
</div>
{% endif %}
{% endif %}
<table class='table table-striped table-condensed' id='allocation-table-untracked'></table>
<div id='unallocated-toolbar'>
<div class='button-toolbar container-fluid' style='float: right;'>
<div class='btn-group'>
<button id='allocate-selected-items' class='btn btn-success' title='{% trans "Allocate selected items" %}'>
<span class='fas fa-sign-in-alt'></span>
</button>
<div class='filter-list' id='filter-list-build-items'>
<!-- Empty div for table filters-->
</div>
</div>
</div>
</div>
<table class='table table-striped table-condensed' id='allocation-table-untracked' data-toolbar='#unallocated-toolbar'></table>
{% else %}
<div class='alert alert-block alert-info'>
{% trans "This Build Order does not have any associated untracked BOM items" %}
@ -419,9 +431,12 @@ function reloadTable() {
{% if build.active %}
$("#btn-auto-allocate").on('click', function() {
var bom_items = $("#allocation-table-untracked").bootstrapTable("getData");
allocateStockToBuild(
{{ build.pk }},
{{ build.part.pk }},
bom_items,
{
success: function(data) {
$('#allocation-table-untracked').bootstrapTable('refresh');
@ -439,6 +454,22 @@ $('#btn-unallocate').on('click', function() {
);
});
$('#allocate-selected-items').click(function() {
var bom_items = $("#allocation-table-untracked").bootstrapTable("getSelections");
allocateStockToBuild(
{{ build.pk }},
{{ build.part.pk }},
bom_items,
{
success: function(data) {
$('#allocation-table-untracked').bootstrapTable('refresh');
}
}
);
});
$("#btn-order-parts").click(function() {
launchModalForm("/order/purchase-order/order-parts/", {
data: {