Implemented searching in receipts SKu adding
This commit is contained in:
parent
780a83a2ac
commit
6a8a90bf95
Binary file not shown.
@ -366,11 +366,13 @@ async function getReceipt(id) {
|
|||||||
|
|
||||||
// SKU Modal functions
|
// SKU Modal functions
|
||||||
let items_limit = 50;
|
let items_limit = 50;
|
||||||
|
var ItemsModal_search_string = ""
|
||||||
async function getItems() {
|
async function getItems() {
|
||||||
console.log("getting items")
|
console.log("getting items")
|
||||||
const url = new URL('/receipts/api/getItems', window.location.origin);
|
const url = new URL('/receipts/api/getItems', window.location.origin);
|
||||||
url.searchParams.append('page', pagination_current);
|
url.searchParams.append('page', pagination_current);
|
||||||
url.searchParams.append('limit', items_limit);
|
url.searchParams.append('limit', items_limit);
|
||||||
|
url.searchParams.append('search_string', ItemsModal_search_string);
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
data = await response.json();
|
data = await response.json();
|
||||||
pagination_end = data.end
|
pagination_end = data.end
|
||||||
@ -385,6 +387,15 @@ async function setPage(page) {
|
|||||||
await updateItemsPaginationElement()
|
await updateItemsPaginationElement()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function ItemsModalSearch(event) {
|
||||||
|
if (event.key === "Enter"){
|
||||||
|
ItemsModal_search_string = document.getElementById('ItemsModalSearchInput').value
|
||||||
|
let items = await getItems()
|
||||||
|
await replenishItemsTable(items)
|
||||||
|
await updateItemsPaginationElement()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function updateItemsPaginationElement() {
|
async function updateItemsPaginationElement() {
|
||||||
let paginationElement = document.getElementById("itemsPage");
|
let paginationElement = document.getElementById("itemsPage");
|
||||||
paginationElement.innerHTML = "";
|
paginationElement.innerHTML = "";
|
||||||
@ -463,6 +474,8 @@ async function updateItemsPaginationElement() {
|
|||||||
|
|
||||||
async function openSKUModal() {
|
async function openSKUModal() {
|
||||||
pagination_current = 1
|
pagination_current = 1
|
||||||
|
ItemsModal_search_string = ""
|
||||||
|
document.getElementById('ItemsModalSearchInput').value = ""
|
||||||
let items = await getItems()
|
let items = await getItems()
|
||||||
await replenishItemsTable(items)
|
await replenishItemsTable(items)
|
||||||
await updateItemsPaginationElement()
|
await updateItemsPaginationElement()
|
||||||
|
|||||||
@ -271,6 +271,10 @@
|
|||||||
<div id="itemsModalInner" class="uk-modal-dialog uk-modal-body " uk-overflow-auto>
|
<div id="itemsModalInner" class="uk-modal-dialog uk-modal-body " uk-overflow-auto>
|
||||||
<h2 class="uk-modal-title">Select Item</h2>
|
<h2 class="uk-modal-title">Select Item</h2>
|
||||||
<p>Select an Item from the system...</p>
|
<p>Select an Item from the system...</p>
|
||||||
|
<div id="searchItemsForm" onkeydown="ItemsModalSearch(event)" class="uk-search uk-search-default uk-align-center">
|
||||||
|
<input id="ItemsModalSearchInput" class="uk-search-input" type="search" placeholder="" aria-label="">
|
||||||
|
<span class="" uk-search-icon></span>
|
||||||
|
</div>
|
||||||
<nav aria-label="Pagination">
|
<nav aria-label="Pagination">
|
||||||
<ul id="itemsPage" class="uk-pagination uk-flex-center" uk-margin>
|
<ul id="itemsPage" class="uk-pagination uk-flex-center" uk-margin>
|
||||||
<li><a href="#"><span uk-pagination-previous></span></a></li>
|
<li><a href="#"><span uk-pagination-previous></span></a></li>
|
||||||
@ -301,7 +305,7 @@
|
|||||||
<div id="ItemBarcodeSelectModalInner" class="uk-modal-dialog uk-modal-body " uk-overflow-auto>
|
<div id="ItemBarcodeSelectModalInner" class="uk-modal-dialog uk-modal-body " uk-overflow-auto>
|
||||||
<h2 class="uk-modal-title">Select Item</h2>
|
<h2 class="uk-modal-title">Select Item</h2>
|
||||||
<p>Select an Item from the system that you would like to associate this unknown barcode to...</p>
|
<p>Select an Item from the system that you would like to associate this unknown barcode to...</p>
|
||||||
<div id="searchItemsForm" onkeydown="ItemBarcodeSelectModalSearch(event)" class="uk-search uk-search-default uk-align-center">
|
<div id="ItemBarcodeSelectSearchForm" onkeydown="ItemBarcodeSelectModalSearch(event)" class="uk-search uk-search-default uk-align-center">
|
||||||
<input id="ItemBarcodeSelectSearchInput" class="uk-search-input" type="search" placeholder="" aria-label="">
|
<input id="ItemBarcodeSelectSearchInput" class="uk-search-input" type="search" placeholder="" aria-label="">
|
||||||
<span class="" uk-search-icon></span>
|
<span class="" uk-search-icon></span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user