Rev 24658 | Rev 24753 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(".good_inventory").live('click', function() {loadGoodInventory("main-content", "");});$(".catalog").live('click', function() {loadCatalog("main-content", "");});$(".review_order").live('click', function() {loadOrder("main-content");});$(".keep-a-tab").live('click', function() {loadtabOrder("main-content");});$(".item_aging").live('click', function() {getInventoryItemAgingByInterval("main-content", "");});$("#item-aging-search-button").live('click', function() {searchContent = $("#item-aging-search-text").val();if (typeof (searchContent) == "undefined" || !searchContent) {searchContent = "";}getInventoryItemAgingByInterval("main-content", searchContent);});$("#item-aging-search-text").live("keyup", function(e) {var keyCode = e.keyCode || e.which;if (keyCode == 13) {$("#item-aging-search-button").click();}});$("#item-aging-paginated .next").live('click', function() {var end = $("#item-aging-paginated .end").text();getItemAgingNextPreviousItems(end, "");$("#item-aging-paginated .next").blur();});$("#item-aging-paginated .previous").live('click', function() {var start = $("#item-aging-paginated .start").text();getItemAgingNextPreviousItems(start - 11, "");$("#item-aging-paginated .previous").blur();});$(".download_aging_report").live('click', function() {downloadAgingReport();});$(".download_reports").live('click', function() {downloadReports();});$(".item-ledger-report-download-page").live('click', function() {loadItemLedgerReportDownloadPage("main-content");});$(".bad_inventory").live('click', function() {loadBadInventory("main-content", "");});$("#good-inventory-paginated .next").live('click',function() {var searchText = $("#good-inventory-search-text").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}var params = {};params['searchTerm'] = searchText;loadPaginatedNextItems('/getPaginatedCurrentInventorySnapshot',params, 'good-inventory-paginated','good-inventory-table', null);$(this).blur();});$("#good-inventory-paginated .previous").live('click',function() {var searchText = $("#good-inventory-search-text").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}var params = {};params['searchTerm'] = searchText;loadPaginatedPreviousItems('/getPaginatedCurrentInventorySnapshot', params,'good-inventory-paginated', 'good-inventory-table',null);$(this).blur();});$("#good-inventory-search-button").live('click', function() {var searchText = $("#good-inventory-search-text").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}loadGoodInventorySearchInfo(searchText);});$("#good-inventory-search-text").live("keyup", function(e) {var keyCode = e.keyCode || e.which;if (keyCode == 13) {$("#good-inventory-search-button").click();}});$("#catalog-paginated .next").live('click',function() {var searchText = $("#catalog-search-text").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}var params = {};params['searchTerm'] = searchText;loadPaginatedNextItems('/getPaginatedCatalog', params,'catalog-paginated', 'catalog-table', null);$(this).blur();});$("#catalog-paginated .previous").live('click',function() {var searchText = $("#catalog-search-text").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}var params = {};params['searchTerm'] = searchText;loadPaginatedPreviousItems('/getPaginatedCatalog', params,'catalog-paginated', 'catalog-table', null);$(this).blur();});$("#catalog-search-button").live('click', function() {var searchText = $("#catalog-search-text").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}loadCatalogSearchInfo(searchText);});$("#catalog-search-text").live("keyup", function(e) {var keyCode = e.keyCode || e.which;if (keyCode == 13) {$("#catalog-search-button").click();}});$(".cancellation").live("click", function(e) {orderid = $(this).data('orderid');cancelOrder(orderid, "CANCELLED_DUE_TO_LOW_INVENTORY")});$(".keepatab").live("click", function(e) {orderid = $(this).data('orderid');cancelOrder(orderid, "KEEP_A_TAB")});$(".closeOrder").live("click", function(e) {orderid = $(this).data('orderid');if (confirm("Are you sure you want to close the order") == true) {doPostAjaxRequestHandler(context + "/closeOrder?orderId="+ orderid, function(response) {if (response == 'true') {alert("successfully close");loadtabOrder("main-content");}});}});});function loadGoodInventory(domId, search_text) {doGetAjaxRequestHandler(context+ "/getCurrentInventorySnapshot?searchTerm=" + search_text,function(response) {$('#' + domId).html(response);});}function loadCatalog(domId, search_text) {doGetAjaxRequestHandler(context + "/getCatalog?searchTerm=" + search_text,function(response) {$('#' + domId).html(response);});}function loadOrder(domId) {doGetAjaxRequestHandler(context + "/getInProcessOrder", function(response) {$('#' + domId).html(response);});}function loadtabOrder(domId){doGetAjaxRequestHandler(context + "/getKeepInTabOrder", function(response) {$('#' + domId).html(response);});}function getInventoryItemAgingByInterval(domId, searchContent) {doPostAjaxRequestWithJsonHandler(context + "/getInventoryItemAgingByInterval?searchContent="+ searchContent, JSON.stringify([ 5, 15, 30, 45 ]),function(response) {$('#' + domId).html(response);});}function downloadAgingReport() {data = JSON.stringify([ 5, 15, 30, 45 ]), doAjaxPostDownload(context+ "/downloadInventoryItemAgingByInterval", data,"InventoryItemAging.xlsx");}function downloadReports() {doGetAjaxRequestHandler(context + "/reports", function(response) {$('#main-content').html(response);});}function downloadItemLedgerReport() {console.log("downloadItemLedgerReport Button clicked")var dateWise = $("#dateWise").get(0).checked;doAjaxGetDownload(context + "/itemLedger/complete/download?startDateTime="+ startDate + "&endDateTime=" + endDate + "&dateWise=" + dateWise,"ItemCompleteLedegerReport.xlsx");}function getItemAgingNextPreviousItems(offset, searchContent) {console.log("getItemAgingNextPreviousItems() called");doPostAjaxRequestWithJsonHandler(context+ "/getInventoryItemAgingByInterval?offset=" + offset+ "&searchContent=" + searchContent, JSON.stringify([ 5, 15, 30, 45 ]), function(response) {$('#main-content').html(response);});}function loadBadInventory(domId, search_text) {doGetAjaxRequestHandler(context + "/getBadInventorySnapshot?searchTerm="+ search_text, function(response) {$('#' + domId).html(response);});}function loadGoodInventorySearchInfo(search_text) {loadGoodInventory("main-content", search_text);}function loadCatalogSearchInfo(search_text) {loadCatalog("main-content", search_text);}function loadItemLedgerReportDownloadPage(domId) {doGetAjaxRequestHandler(context + "/itemLedger/downloadPage", function(response) {$('#' + domId).html(response);});}function cancelOrder(orderId,status) {console.log(orderId);bootbox.prompt("reason", function(result) {if (result != null) {console.log(result);if (confirm("Are you sure you want to cancel the order") == true) {doPostAjaxRequestHandler(context + "/cancelOrder?orderId="+ orderId + "&reason=" + result+ "&orderStatus=" + status, function(response) {if (response == 'true') {alert("successfully cancel");loadOrder("main-content");}});}} else {bootbox.alert("reason is required");}});}