From b8f5c8cca74a5e890ff18f1d5e0e60d2d70e39c4 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Thu, 16 May 2019 22:12:13 +1000 Subject: [PATCH] Add confirmation box to stocktake form --- InvenTree/static/script/inventree/stock.js | 27 +++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/InvenTree/static/script/inventree/stock.js b/InvenTree/static/script/inventree/stock.js index 9f9c5fd40b..8824965c41 100644 --- a/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/static/script/inventree/stock.js @@ -87,8 +87,18 @@ function updateStock(items, options={}) { html += ''; html += "
"; + html += "

Note field must be filled

"; + + html += ` +
+
+ +

Confirm stock count

+
`; - html += "

Note field must be filled

"; var title = ''; @@ -109,6 +119,7 @@ function updateStock(items, options={}) { }); $(modal).find('#note-warning').hide(); + $(modal).find('#confirm-warning').hide(); modalEnable(modal, true); @@ -116,13 +127,23 @@ function updateStock(items, options={}) { var stocktake = []; var notes = $(modal).find('#stocktake-notes').val(); + var confirm = $(modal).find('#stocktake-confirm').is(':checked'); + + var valid = true; if (!notes) { $(modal).find('#note-warning').show(); - return false; + valid = false; } - var valid = true; + if (!confirm) { + $(modal).find('#confirm-warning').show(); + valid = false; + } + + if (!valid) { + return false; + } // Form stocktake data for (idx = 0; idx < items.length; idx++) {