Rev 25066 | Rev 25698 | 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", "");});var cancelOrderId;var cancelSatus;$(".review_order").live('click', function() {loadOrder("main-content");});$(".keep-a-tab").live('click', function() {loadtabOrder("main-content");});$(".notify_order").live('click', function() {loadnotifyOrder("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")});$(".order-request-submit").live("click", function(e) {requestcancelOrder();});$(".keepatab").live("click", function(e) {orderid = $(this).data('orderid');cancelOrder(orderid, "KEEP_A_TAB")});$(".request-cancel").live('click', function() {});$(".mk_button").on("click", function() {});$(".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=" + orderd,function(response) {if (response == 'true') {alert("successfully close");loadtabOrder("main-content");}});}});$('#notify-table').find(':checkbox').live('change', function(e) {var colormessage = [];$("#notify-table input[type=checkbox]:checked").each(function() {var row = $(this).closest("tr")[0];colormessage.push(row.cells[0].innerText);console.log(colormessage)});$("#colorValue").text(colormessage);});$('#overridemessage').live('change', function() {if ($(this).is(':checked')) {$('#textnotifymessage').show();$('#textnotifymessage').focus();} else {$('#textnotifymessage').hide();}});$(".notify-submit").live("click",function(e) {var jsonObject = {};var orderIdsJSon = [];var ItemIdsJson = [];var itemIds;var orderIds;var message;if ($('#overridemessage').is(':checked')) {message = $('#textnotifymessage').val();} else {message = $('#notifymessage').text();}console.log(message);var itemchecked = $("input[name='itemCheck']:checked").length;if (!itemchecked) {alert("You must check at least one item.");return false;}var partnerchecked = $("input[name='partnerCheck']:checked").length;if (!partnerchecked) {alert("You must check at least one partner.");return false;}if(message === ""){alert("message is required");return false;}$('#notify-table').find('tr').each(function() {var row = $(this);console.log(row);if (row.find('input[name="itemCheck"]').is(':checked')) {var currentRow = $(this).closest("tr");var col1 = currentRow.find("td:eq(0) input[type='checkbox']").val(); // get current// row 1st TD// valuevar col2 = currentRow.find("td:eq(1) input[name='responseTime']").data('daterangepicker').startDate.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);// get// current// row 2nd TDvar col3 = currentRow.find("td:eq(2) input[name='procuredDate']").data('daterangepicker').startDate.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);; // get current// row 3rd TDitemIds = {"itemId" : col1,"responseTime" : col2,"procuredTime" : col3}ItemIdsJson.push(itemIds);}});$('#notify-order-table').find('tr').each(function() {var row = $(this);console.log(row);if (row.find('input[name="partnerCheck"]').is(':checked')) {var currentRow = $(this).closest("tr");var col5 = currentRow.find("td:eq(2)").html();var col6 = currentRow.find("td:eq(1)").html();orderIds = {"orderId" : col5,"olditemId" : col6}orderIdsJSon.push(orderIds)}});jsonObject['itemIds'] = ItemIdsJson;jsonObject['orderIds'] = orderIdsJSon;jsonObject['message'] = message;console.log(jsonObject)if (confirm("Are you sure you want to notify the order") == true) {doPostAjaxRequestWithJsonHandler(context+ "/notifyOrder", JSON.stringify(jsonObject), function(response) {if (response == 'true') {alert("successfully Add");loadOrder("main-content");}});}});});function getItemColor(catalogId, itemId) {console.log(catalogId);doGetAjaxRequestHandler(context + "/getNotifyItemColor?catalogItemId="+ catalogId + "&itemId=" + itemId, function(response) {$('.notify-container .modal-content').html(response);$('#textnotifymessage').hide();});}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 loadnotifyOrder(domId) {doGetAjaxRequestHandler(context + "/getAllNotifyOrder", 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) {cancelOrderId = orderId;cancelSatus = status;console.log(cancelOrderId)console.log(cancelSatus)$('#orderCancelModal').modal('show');$("#textreason").hide();}function myFunction() {var val = $("#selectreason").val();console.log(val);if (val == "other") {$("#textreason").show();} else {$("#textreason").hide();}}function requestcancelOrder() {val = $('#selectreason').val();if (val == "other") {reason = $('#textreason').val();} else {reason = val;}console.log(reason);console.log(cancelSatus);console.log(cancelOrderId);orderId = cancelOrderId;status = cancelSatus;if (reason == "" || reason == null || reason == undefined) {alert("reason field can't be empty");return false;}doPostAjaxRequestHandler(context + "/cancelOrder?orderId=" + orderId+ "&reason=" + reason + "&orderStatus=" + status,function(response) {if (response == 'true') {alert("successfully cancel");loadOrder("main-content");}});}