From 1117e059b0b01af461e7d990e92eff16f5ceac1a Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 23 Jun 2018 14:50:23 -0600 Subject: [PATCH] Add date/time filter options to transaction search tool --- pages.php | 3 +++ pages/pos.php | 21 +++++++++++++++++ static/js/pos_management.js | 45 ++++++++++++++++++++++++++++++++----- 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/pages.php b/pages.php index d9e01d3..89fc69a 100644 --- a/pages.php +++ b/pages.php @@ -16,6 +16,7 @@ define("PAGES", [ "navbar" => true, "icon" => "fas fa-store-alt", "styles" => [ + "static/css/tempusdominus-bootstrap-4.min.css", "static/css/pos.css", ], "scripts" => [ @@ -23,6 +24,8 @@ define("PAGES", [ "static/js/bsalert.js", "static/js/bsnumpad.js", "static/js/bsmoneypad.js", + "static/js/moment.min.js", + "static/js/tempusdominus-bootstrap-4.min.js", "static/js/pos_items.js", "static/js/pos_customer.js", "static/js/pos_gridview.js", diff --git a/pages/pos.php b/pages/pos.php index ae81718..cdb8272 100644 --- a/pages/pos.php +++ b/pages/pos.php @@ -105,9 +105,30 @@ if (isset($_GET['switch']) || !isset($_SESSION['register']) || !$registeropen) { + + + + + + + +
+
+
+ +
+ +
+
+
+ +
+ +
+
diff --git a/static/js/pos_management.js b/static/js/pos_management.js index d8a9762..76297db 100644 --- a/static/js/pos_management.js +++ b/static/js/pos_management.js @@ -38,13 +38,15 @@ $("#xprintbtn").click(function () { } }); -function showTransactionList(search) { - if (search == "") { +function showTransactionList(search, start, end) { + if (search == "" && start == "" && end == "") { return; } $.get('action.php', { action: 'transactionsearch', - q: search + q: search, + start: start, + end: end }, function (data) { var html = ""; if (data['transactions'].length > 0) { @@ -83,14 +85,16 @@ function showTransactionList(search) { $("#transactionsearch").on('keypress', function (e) { if (e.which === 13) { - showTransactionList($("#transactionsearch").val()); + showTransactionList($("#transactionsearch").val(), $("#tx-startdate").val(), $("#tx-enddate").val()); $("#transactionsearch").val(""); + $("#txsearch-datetimefilters").addClass("d-none"); } }); $("#transactionsearchbtn").on("click", function () { - showTransactionList($("#transactionsearch").val()); + showTransactionList($("#transactionsearch").val(), $("#tx-startdate").val(), $("#tx-enddate").val()); $("#transactionsearch").val(""); + $("#txsearch-datetimefilters").addClass("d-none"); }); $("#managermodal").on("click", ".printreceiptbtn", function () { @@ -122,4 +126,35 @@ $("#managermodal .open-number-pad-btn").click(function () { bsnumpad("Keyboard", value, ' Search', "Cancel", function (answer) { showTransactionList(answer); }); +}); + +$("#txsearch-datetime-btn").click(function () { + if ($("#txsearch-datetimefilters").hasClass("d-none")) { + $("#txsearch-datetimefilters").removeClass("d-none"); + } else { + $("#txsearch-datetimefilters").addClass("d-none"); + } +}); + +$("#managermodal").on("hidden.bs.modal", function () { + $("#txsearch-datetimefilters").addClass("d-none"); +}) + +$('#tx-startdate').datetimepicker({ + useCurrent: false, + icons: { + time: "fas fa-clock fa-fw fa-2x", + date: "fas fa-calendar fa-fw fa-2x", + up: "fas fa-arrow-up fa-fw fa-2x", + down: "fas fa-arrow-down fa-fw fa-2x" + } +}); +$('#tx-enddate').datetimepicker({ + useCurrent: true, + icons: { + time: "fas fa-clock fa-fw fa-2x", + date: "fas fa-calendar fa-fw fa-2x", + up: "fas fa-arrow-up fa-fw fa-2x", + down: "fas fa-arrow-down fa-fw fa-2x" + } }); \ No newline at end of file