'
diff --git a/static/js/bsmoneypad.js b/static/js/bsmoneypad.js
new file mode 100644
index 0000000..712287b
--- /dev/null
+++ b/static/js/bsmoneypad.js
@@ -0,0 +1,99 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+function bsmoneypad(title, amount, okbtn, cancelbtn, denominations, callback) {
+ var html = '
'
+ + '
'
+ + '
'
+ + ' '
+ + '
'
+ + '
'
+ + '
'
+ + '
$0.00
'
+ + '
'
+ + '
'
+ + '
'
+ + '
'
+ + ' '
+ + '
'
+ + '
'
+ + '
';
+ $("body").append(html);
+ if (denominations == null) {
+ denominations = [1.00, 2.00, 5.00, 10.00, 20.00, 50.00, 100.00, null, 0.01, 0.05, 0.10, 0.25, 0.50];
+ }
+ function addButton(val, label) {
+ $("#bsmoneypad-pad").append('
' + label + '
');
+ }
+ for (var i = 0; i < denominations.length; i++) {
+ if (denominations[i] === null) {
+ $("#bsmoneypad-pad").append('
');
+ continue;
+ }
+ var lbl = "";
+ if (denominations[i] < 1) {
+ lbl = denominations[i] * 100.0 + "ยข";
+ } else if (denominations[i] % 1 === 0) {
+ lbl = "$" + denominations[i];
+ } else {
+ lbl = "$" + denominations[i].toFixed(2);
+ }
+ addButton(denominations[i], lbl);
+ }
+ $("#bsmoneypad-title").html(title);
+ $("#bsmoneypad-amount").text("$" + (amount * 1.0).toFixed(2));
+ $("#bsmoneypad-amount").data('amount', (amount * 1.0));
+ $("#bsmoneypad-ok").html(okbtn);
+ $("#bsmoneypad-cancel").html(cancelbtn);
+ $("#bsmoneypad-pad").on("click", ".moneypadbtn", function () {
+ var total = $("#bsmoneypad-amount").data('amount') * 1.0;
+ var amount = $(this).data('amount');
+ if ($("#bsmoneypad-plusminus").data("direction") == "plus") {
+ total += amount;
+ } else {
+ total -= amount;
+ }
+ $("#bsmoneypad-amount").text("$" + (total * 1.0).toFixed(2));
+ $("#bsmoneypad-amount").data('amount', (total * 1.0));
+ });
+ $("#bsmoneypad-plusminus").on("click", function () {
+ if ($(this).data("direction") == "plus") {
+ $(this).data("direction", "minus");
+ $(this).removeClass("btn-outline-success");
+ $(this).addClass("btn-outline-danger");
+ $(this).html('
');
+ } else {
+ $(this).data("direction", "plus");
+ $(this).removeClass("btn-outline-danger");
+ $(this).addClass("btn-outline-success");
+ $(this).html('
');
+ }
+ });
+ $("#bsmoneypad-reset").on("click", function () {
+ $("#bsmoneypad-amount").text("$0.00");
+ $("#bsmoneypad-amount").data('amount', 0.0);
+ });
+ $("#bsmoneypad-ok").on("click", function () {
+ callback($("#bsmoneypad-amount").data('amount').toFixed(2) * 1.0);
+ $("#bsmoneypad").modal("hide");
+ });
+ $("#bsmoneypad").on("shown.bs.modal", function () {
+ $("#bsmoneypad-input").focus();
+ });
+ $("#bsmoneypad").on("hidden.bs.modal", function () {
+ $("#bsmoneypad").remove();
+ });
+ $("#bsmoneypad").modal("show");
+}
\ No newline at end of file
diff --git a/static/js/bsnumpad.js b/static/js/bsnumpad.js
new file mode 100644
index 0000000..68dd643
--- /dev/null
+++ b/static/js/bsnumpad.js
@@ -0,0 +1,68 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+function bsnumpad(title, content, okbtn, cancelbtn, callback) {
+ var html = '
'
+ + '
'
+ + '
'
+ + ' '
+ + '
'
+ + ' '
+ + '
'
+ + '
'
+ + '
';
+ $("body").append(html);
+ function addButton(val, label) {
+ $("#bsnumpad-pad").append('
');
+ }
+ for (var i = 1; i <= 9; i++) {
+ addButton(i, i);
+ }
+ addButton('0', '0');
+ addButton('.', '.');
+ addButton('clear', '
');
+ $("#bsnumpad-pad").on("click", ".numpadbtn", function () {
+ var char = $(this).data('key');
+ var val = $("#bsnumpad-input").text();
+ if (char == "clear") {
+ val = "";
+ } else if (char == ".") {
+ if (!val.includes('.')) {
+ val += char;
+ }
+ } else {
+ val += char;
+ }
+ $("#bsnumpad-input").text(val);
+ });
+ $("#bsnumpad-title").html(title);
+ $("#bsnumpad-input").text(content);
+ $("#bsnumpad-ok").html(okbtn);
+ $("#bsnumpad-cancel").html(cancelbtn);
+ $("#bsnumpad-ok").on("click", function () {
+ callback($("#bsnumpad-input").text());
+ $("#bsnumpad").modal("hide");
+ });
+ $("#bsnumpad").on("shown.bs.modal", function () {
+ $("#bsnumpad-input").focus();
+ });
+ $("#bsnumpad").on("hidden.bs.modal", function () {
+ $("#bsnumpad").remove();
+ });
+ $("#bsnumpad").modal("show");
+}
\ No newline at end of file
diff --git a/static/js/pos_items.js b/static/js/pos_items.js
index 8ee1975..ba8e84d 100644
--- a/static/js/pos_items.js
+++ b/static/js/pos_items.js
@@ -30,6 +30,11 @@ function addItem(name, code, price, id) {
+ '
$'
+ '
';
}
var amount = "";
// Autofill the exact due amount for payment methods that are flexible like that
@@ -37,6 +42,14 @@ function addPayment(type, icon, text) {
+ ' '
+ '