From ffb319e1360d27d2ac4e1bfa66d2f4d9c4861462 Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 10 Feb 2022 00:00:23 +1100 Subject: [PATCH] Disable "submit" button to prevent multiple simultaneous uploads --- InvenTree/part/templates/part/upload_bom.html | 5 ++++- InvenTree/templates/js/translated/bom.js | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/InvenTree/part/templates/part/upload_bom.html b/InvenTree/part/templates/part/upload_bom.html index 07213069a6..57c7014197 100644 --- a/InvenTree/part/templates/part/upload_bom.html +++ b/InvenTree/part/templates/part/upload_bom.html @@ -22,8 +22,11 @@ + {% endblock %} diff --git a/InvenTree/templates/js/translated/bom.js b/InvenTree/templates/js/translated/bom.js index f1c749320f..0c70bd3d86 100644 --- a/InvenTree/templates/js/translated/bom.js +++ b/InvenTree/templates/js/translated/bom.js @@ -210,6 +210,10 @@ function submitBomTable(part_id, options={}) { getApiEndpointOptions(url, function(response) { var fields = response.actions.POST; + // Disable the "Submit BOM" button + $('#bom-submit').prop('disabled', true); + $('#bom-submit-icon').show(); + inventreePut(url, data, { method: 'POST', success: function(response) { @@ -224,6 +228,10 @@ function submitBomTable(part_id, options={}) { showApiError(xhr, url); break; } + + // Re-enable the submit button + $('#bom-submit').prop('disabled', false); + $('#bom-submit-icon').hide(); } }); });