diff --git a/lang/en_us.php b/lang/en_us.php index eb9f217..ba9ab86 100644 --- a/lang/en_us.php +++ b/lang/en_us.php @@ -136,4 +136,5 @@ define("STRINGS", [ "card saved" => "Gift card updated.", "card x added" => "Gift card #{arg} added.", "card x saved" => "Gift card #{arg} updated.", + "open drawer" => "Open Drawer", ]); diff --git a/pages/pos.php b/pages/pos.php index c7c49df..3fd20e4 100644 --- a/pages/pos.php +++ b/pages/pos.php @@ -112,7 +112,10 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$registeropen) {
- +
+ + +
diff --git a/static/js/pos_finish.js b/static/js/pos_finish.js index a13c9d5..178fb28 100644 --- a/static/js/pos_finish.js +++ b/static/js/pos_finish.js @@ -124,6 +124,29 @@ function showReceipt(txid) { function finishTransaction() { sendTransactionToServer(function (data) { + if (nickelbridge) { + var opendrawer = false; + if ($("#change-amount").text() * 1.0 != 0) { + opendrawer = true; + } + $("#payment-lines .list-group-item").each(function () { + var type = $(".payment-entry", this).data("type"); + if (type == 'cash' || type == 'check') { + opendrawer = true; + } + }); + if (opendrawer) { + $.ajax("http://127.0.0.1:64269/opendrawer", { + contentType: 'application/json', + type: 'POST', + success: function (resp) { + + } + }).fail(function (resp) { + alert("Error: " + JSON.stringify(resp)); + }); + } + } showReceipt(data.txid); }); } @@ -138,6 +161,26 @@ $("#finishbtn").click(function () { bsalert("Incomplete Transaction", "The customer would need to pay you $" + ($("#change-amount").text() * 1.0).toFixed(2) + " for the refund. Adjust payments until the change is zero."); } else { sendReturnToServer(function (data) { + if (nickelbridge) { + var opendrawer = false; + $("#payment-lines .list-group-item").each(function () { + var type = $(".payment-entry", this).data("type"); + if (type == 'cash' || type == 'check') { + opendrawer = true; + } + }); + if (opendrawer) { + $.ajax("http://127.0.0.1:64269/opendrawer", { + contentType: 'application/json', + type: 'POST', + success: function (resp) { + + } + }).fail(function (resp) { + alert("Error: " + JSON.stringify(resp)); + }); + } + } showReceipt(data.txid); }); } diff --git a/static/js/pos_management.js b/static/js/pos_management.js index db02aa5..535b3dc 100644 --- a/static/js/pos_management.js +++ b/static/js/pos_management.js @@ -6,6 +6,10 @@ $("#openmanagement").click(function () { + $("#opendrawerbtn").removeClass('d-none'); + if (!nickelbridge) { + $("#opendrawerbtn").addClass('d-none'); + } document.getElementById("xframe").contentDocument.location.reload(true); $("#managermodal").modal(); }); @@ -96,6 +100,18 @@ $("#managermodal").on("click", ".printreceiptbtn", function () { $("#receiptmodal").modal(); }); +$("#opendrawerbtn").click(function () { + $.ajax("http://127.0.0.1:64269/opendrawer", { + contentType: 'application/json', + type: 'POST', + success: function (resp) { + + } + }).fail(function (resp) { + alert("Error: " + JSON.stringify(resp)); + }); +}); + $("#managermodal .open-number-pad-btn").click(function () { var inputbox = $("#transactionsearch"); var value = inputbox.val();