Rev 27754 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(document).on('click', ".partner-po", function() {loadCreatePo("main-content");});$(document).on('click', ".partner-item-detail",function() {var fofoId = $('#fofo-users').val();var url = "/getPartnerloadContent?fofoId=" + fofoId+ "&counterSize=" + "TEN_LAC";doAjaxRequestHandler(context + url, "GET", function(response) {{}$('.partner-po-container').html(response);});});$(document).on("click", ".selectItemQty",function() {var catalogId = parseInt($(this).data("catalog-id"));doGetAjaxRequestHandler(context + "/selectItemColor?catalogId="+ catalogId, function(response) {$('.select-item-container .modal-content').html(response);$('#select-item-table').find('tr').each(function() {var selectRow = $(this);var selectCurrentRow = $(this).closest("tr");var itemId = selectCurrentRow.find("td:eq(1)").html();console.log(itemId)if (itemId != undefined) {$('#po-table').find('tr').each(function() {var row = $(this);var currentRow = $(this).closest("tr");var item = currentRow.find("td:eq(0)").html();if (item != undefined) {console.log(item)if (item == itemId) {selectCurrentRow.remove();}}});}});});});$(document).on('click', ".btnDelete", function() {console.log("Hello");$(this).closest("tr").remove();});$(document).on("click", ".submit-item",function(e) {var seletedIds;var seletedIdsJson = [];$('#select-item-table').find('tr').each(function() {var row = $(this);console.log(row);if (row.find('input[type="checkbox"]').is(':checked')) {var currentRow = $(this).closest("tr");var itemId = currentRow.find("td:eq(1)").html();var name = currentRow.find("td:eq(2)").html();var quantity = currentRow.find("td:eq(3) input").val();console.log(quantity)if (quantity == "") {alert("Select the Quantity");return false;}seletedIds = {"itemId" : itemId,"name" : name,"qty" : quantity}seletedIdsJson.push(seletedIds)}});console.log(seletedIdsJson);for (let i = 0; i < seletedIdsJson.length; i++) {console.log(seletedIdsJson[i].itemId)markup = "<tr><td>"+ seletedIdsJson[i].itemId+ "</td><td>"+ seletedIdsJson[i].name+ "</td><td>"+ seletedIdsJson[i].qty+ "</td><td><button type = 'button' class='btnDelete'>Delete</button></td></tr>";$('#po-table > tbody:last-child').append(markup);}$("#selectItem").modal("hide");});$(document).on('click', ".confirm_po",function() {var jsonObject = {};var poIdsJSon = [];var poIds;var fofoId = $('#fofo-users').val();$('#po-table').find('tr').each(function() {var row = $(this);console.log(row);var currentRow = $(this).closest("tr");var itemId = currentRow.find("td:eq(0)").html();var qty = currentRow.find("td:eq(2)").html();console.log(itemId);if (itemId != undefined) {poIds = {"itemId" : itemId,"qty" : qty}console.log(poIds);poIdsJSon.push(poIds);}});console.log(poIdsJSon)console.log(fofoId)if (fofoId == null) {alert("fofoId is required");return false;}if (poIdsJSon.length === 0) {alert("Atleast one Item selected");return false;}jsonObject['poIds'] = poIdsJSon;jsonObject['fofoId'] = fofoId;console.log(jsonObject)if (confirm("Are you sure you want to create po") == true) {doPostAjaxRequestWithJsonHandler(context + "/createPo",JSON.stringify(jsonObject), function(response) {if (response == 'true') {alert("successfully create");loadCreatePo("main-content");}});}});});function loadCreatePo(domId) {doGetAjaxRequestHandler(context + "/partnerPendingOrder",function(response) {$('#' + domId).html(response);});}