Rev 32051 | Rev 32459 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(document).on('click', ".sd-credit", function() {loadSdCredit("main-content");});$(document).on('click', ".sanction-request", function() {loadSanctionRequest("main-content");});$(document).on('click', ".loan-summary", function() {loadLoanDetail("main-content");});$(document).on('click', ".sanction-order-hold", function() {loadSanctionHoldOrder("main-content");});var table = $('#sdCredit').DataTable();$(document).on('dblclick', '#sdCredit tbody tr', function() {console.log("dblclick");var data = table.row(this).data();$(this).find(":input").attr('disabled', false).show();/* $(this).find("input[name=interestRate]").attr('disabled', true);$(this).find("input[name=freeDays]").attr('disabled', true);$(this).find("input[name=creditDays]").attr('disabled', true);*/});$(document).on('input', 'table#sdCredit input[type=file]', function() {if (confirm('Confirm upload ?')) {var fileSelector = $(this)[0];if (fileSelector != undefined&& fileSelector.files[0] != undefined) {var url = `${context}/document-upload`;console.log(url);var file = this.files[0];console.log("file" + file);let fileInput = $(this);console.log("fileInput" + file);doAjaxUploadRequestHandler(url,'POST',file,function(response) {console.log(response);var documentId = response.response.document_id;console.log("documentId : " + documentId);fileInput.closest('td').find("input[type=hidden]").val(documentId);});// alert("Retailer Shop Document// is required");}} else {// Do nothing!}});$(document).on('click', '.credit-requirement-send', function() {var row = $(this).closest("tr");console.log(row);var rowIndex = $(this).closest('tr').prevAll().length;console.log(rowIndex);var fofoId = $(row).find("td:eq(0)").text();var securityCheck = $(row).find("input[type=hidden]").val();console.log(securityCheck);var limit = $(row).find("td:eq(5) input[type='text']").val();var interest = $(row).find("td:eq(8) input[type='text']").val();var freedays = $(row).find("td:eq(9) input[type='text']").val();var creditDays = $(row).find("td:eq(10) input[type='text']").val();console.log(freedays)var sdCreditReq = {};sdCreditReq['fofoId'] = fofoIdsdCreditReq['securityCheck'] = securityChecksdCreditReq['limit'] = limitsdCreditReq['interest'] = interestsdCreditReq['freeDays'] = freedayssdCreditReq['creditDays'] = creditDaysvar jsonObject = JSON.stringify(sdCreditReq);console.log(jsonObject);if (confirm("Are you sure you want to submit the request") == true) {doAjaxRequestWithJsonHandler(context + "/creditRequirement", "POST", jsonObject, function(response) {row.html(response);row.css("background-color", "#F8F8FF");});}})$(document).on('click', '.sanction-request-send', function() {var row = $(this).closest("tr");console.log(row);var rowIndex = $(this).closest('tr').prevAll().length;console.log(rowIndex);var id = $(row).find("td:eq(0)").text();var approvalAmount = $(row).find(".approveamount input[type='text']").val();var freedays = $(row).find(".freedays input[type='text']").val();var status = $(row).find("td:eq(18) option:selected").val();var stockHold = $(row).find("td:eq(19) input[type='checkbox']").is(":checked") ? true : false;console.log(freedays)var sanctionReq = {};sanctionReq['id'] = idsanctionReq['status'] = statussanctionReq['approvalAmount'] = approvalAmountsanctionReq['freeDays'] = freedayssanctionReq['stockHold'] = stockHoldvar jsonObject = JSON.stringify(sanctionReq);console.log(jsonObject);if (confirm("Are you sure you want to submit the request") == true) {doAjaxRequestWithJsonHandler(context + "/sanctionRequest", "POST", jsonObject, function(response) {row.html(response);row.css("background-color", "#F8F8FF");});}})$(document).on('click', '.sanction-request-unhold', function() {var row = $(this).closest("tr");console.log(row);var transactionId = $(row).find("td:eq(3)").text();if (confirm("Are you sure you want to Unhold the request") == true) {doPostAjaxRequestHandler(context + "/unholdOrder?transactionId="+ transactionId, function(response) {if (response == 'true') {alert("unhold successfully");loadSanctionHoldOrder("main-content");}});}})});function loadSdCredit(domId) {doGetAjaxRequestHandler(context + "/getSDCreditReq", function(response) {$('#' + domId).html(response);});}function loadSanctionRequest(domId) {doGetAjaxRequestHandler(context + "/getSanctionRequest", function(response) {$('#' + domId).html(response);});}function loadLoanDetail(domId) {doGetAjaxRequestHandler(context + "/getLoans", function(response) {$('#' + domId).html(response);});}function loadSanctionHoldOrder(domId) {doGetAjaxRequestHandler(context + "/getSanctionHoldOrder", function(response) {$('#' + domId).html(response);});}