Reload purchase order table after part order (#4219)

* Reload purchase order table after part order

When on the part page, going to the "Purchase order" sidebar tab.
You can order the part by pressing the "Order Part" button.
After a succefull order, the form closes but the table on the page
was never refreshed.

* Fixed a js styling check error
This commit is contained in:
bloemp 2023-01-24 23:32:17 +01:00 committed by GitHub
parent 1862904a2f
commit 11f147fd34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -757,7 +757,11 @@
success: function(part) {
orderParts(
[part],
{}
{
onSuccess: function() {
$("#purchase-order-table").bootstrapTable('refresh');
}
}
);
}
}

View File

@ -1032,7 +1032,7 @@ function exportOrder(redirect_url, options={}) {
/*
* Create a new form to order parts based on the list of provided parts.
*/
function orderParts(parts_list, options={}) {
function orderParts(parts_list, options) {
var parts = [];
@ -1162,6 +1162,10 @@ function orderParts(parts_list, options={}) {
// If the modal is now "empty", dismiss it
if (!($(opts.modal).find('.part-order-row').exists())) {
closeModal(opts.modal);
// If there is a onSuccess callback defined, call it
if (options && options.onSuccess) {
options.onSuccess();
}
}
}