$0.00
+
diff --git a/static/js/pos_customer.js b/static/js/pos_customer.js
new file mode 100644
index 0000000..7604713
--- /dev/null
+++ b/static/js/pos_customer.js
@@ -0,0 +1,74 @@
+/*
+ * 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/.
+ */
+
+var customerid = "";
+var customername = "";
+var customeremail = "";
+var customerphone = "";
+
+function showCustomerList(search) {
+ if (search == "") {
+ return;
+ }
+ $.get('action.php', {
+ action: 'customersearch',
+ q: search
+ }, function (data) {
+ var html = "";
+ if (data['customers'].length > 0) {
+ for (var i = 0; i < data['customers'].length; i++) {
+ var id = data['customers'][i]['id'];
+ var name = data['customers'][i]['name'];
+ var email = "";
+ if (typeof data['customers'][i]['email'] == 'string' && data['customers'][i]['email'].includes("@")) {
+ email = data['customers'][i]['email'];
+ }
+ var phone = "";
+ if (typeof data['customers'][i]['phone'] == 'string') {
+ phone = data['customers'][i]['phone'];
+ }
+ html += '
'
+ + '
' + name + '
'
+ + '
' + email + '
'
+ + '
' + phone + '
'
+ + '
';
+ }
+ } else {
+ html = '
No results.
';
+ }
+ $("#customerselection").html(html);
+ });
+}
+
+$("#addcustomerbtn").click(function () {
+ $("#customermodal").modal();
+});
+
+$("#customersearch").on('keypress', function (e) {
+ if (e.which === 13) {
+ showCustomerList($("#customersearch").val());
+ $("#customersearch").val("");
+ }
+});
+
+$("#customersearchbtn").on("click", function () {
+ showCustomerList($("#customersearch").val());
+ $("#customersearch").val("");
+});
+
+$("#customermodal").on("shown.bs.modal", function () {
+ $("#customersearch").focus();
+})
+
+$("#customerselection").on("click", ".list-group-item.customer", function () {
+ customerid = $(this).data("id");
+ customername = $(this).data("name");
+ customeremail = $(this).data("email");
+ customerphone = $(this).data("phone");
+ $("#customerbtnlabel").text(customername);
+ console.log(customername);
+ $("#customermodal").modal('hide');
+});
\ No newline at end of file
diff --git a/static/js/pos_finish.js b/static/js/pos_finish.js
index 49d8ca0..fc37670 100644
--- a/static/js/pos_finish.js
+++ b/static/js/pos_finish.js
@@ -7,7 +7,7 @@
function sendTransactionToServer(callback) {
var items = [];
var payments = [];
- var customer = '';
+ var customer = customerid;
var register = '';
$("#pos-lines-box .list-group-item").each(function () {
var each = $(".item-price", this).val() * 1.0;