mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix button callbacks for the allocation table
This commit is contained in:
parent
4d8bec9663
commit
ac3a97d4d6
@ -1153,7 +1153,36 @@ function showAllocationSubTable(index, row, element, options) {
|
|||||||
// Is the parent SalesOrder pending?
|
// Is the parent SalesOrder pending?
|
||||||
var pending = options.status == {{ SalesOrderStatus.PENDING }};
|
var pending = options.status == {{ SalesOrderStatus.PENDING }};
|
||||||
|
|
||||||
|
// Function to reload the allocation table
|
||||||
|
function reloadTable() {
|
||||||
|
table.bootstrapTable('refresh');
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupCallbacks() {
|
||||||
|
// Add callbacks for 'edit' buttons
|
||||||
|
table.find('.button-allocation-edit').click(function() {
|
||||||
|
|
||||||
|
var pk = $(this).attr('pk');
|
||||||
|
|
||||||
|
// TODO: Migrate to API forms
|
||||||
|
launchModalForm(`/order/sales-order/allocation/${pk}/edit/`, {
|
||||||
|
success: reloadTable,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add callbacks for 'delete' buttons
|
||||||
|
table.find(".button-allocation-delete").click(function() {
|
||||||
|
var pk = $(this).attr('pk');
|
||||||
|
|
||||||
|
// TODO: Migrate to API forms
|
||||||
|
launchModalForm(`/order/sales-order/allocation/${pk}/delete/`, {
|
||||||
|
success: reloadTable,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
table.bootstrapTable({
|
table.bootstrapTable({
|
||||||
|
onPostBody: setupCallbacks,
|
||||||
data: row.allocations,
|
data: row.allocations,
|
||||||
showHeader: false,
|
showHeader: false,
|
||||||
columns: [
|
columns: [
|
||||||
@ -1214,27 +1243,6 @@ function showAllocationSubTable(index, row, element, options) {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add callbacks for 'edit' buttons
|
|
||||||
table.find(".button-allocation-edit").click(function() {
|
|
||||||
|
|
||||||
var pk = $(this).attr('pk');
|
|
||||||
|
|
||||||
// TODO: Migrate to API forms
|
|
||||||
launchModalForm(`/order/sales-order/allocation/${pk}/edit/`, {
|
|
||||||
success: reloadTable,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add callbacks for 'delete' buttons
|
|
||||||
table.find(".button-allocation-delete").click(function() {
|
|
||||||
var pk = $(this).attr('pk');
|
|
||||||
|
|
||||||
// TODO: Migrate to API forms
|
|
||||||
launchModalForm(`/order/sales-order/allocation/${pk}/delete/`, {
|
|
||||||
success: reloadTable,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user