| 30859 |
tejbeer |
1 |
$(function() {
|
|
|
2 |
|
|
|
3 |
$(document).on('click', ".sd-credit", function() {
|
|
|
4 |
|
|
|
5 |
loadSdCredit("main-content");
|
|
|
6 |
});
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
$(document).on('click', ".sanction-request", function() {
|
|
|
11 |
|
|
|
12 |
loadSanctionRequest("main-content");
|
|
|
13 |
});
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
var table = $('#sdCredit').DataTable();
|
|
|
17 |
$(document).on('dblclick', '#sdCredit tbody tr', function() {
|
|
|
18 |
console.log("dblclick");
|
|
|
19 |
var data = table.row(this).data();
|
|
|
20 |
|
|
|
21 |
$(this).find(":input").attr('disabled', false).show();
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
});
|
|
|
25 |
|
|
|
26 |
$(document).on('input', 'table#sdCredit input[type=file]', function() {
|
|
|
27 |
if (confirm('Confirm upload ?')) {
|
|
|
28 |
var fileSelector = $(this)[0];
|
|
|
29 |
if (fileSelector != undefined
|
|
|
30 |
&& fileSelector.files[0] != undefined) {
|
|
|
31 |
var url = `${context}/document-upload`;
|
|
|
32 |
console.log(url);
|
|
|
33 |
var file = this.files[0];
|
|
|
34 |
console.log("file" + file);
|
|
|
35 |
let fileInput = $(this);
|
|
|
36 |
console.log("fileInput" + file);
|
|
|
37 |
doAjaxUploadRequestHandler(
|
|
|
38 |
url,
|
|
|
39 |
'POST',
|
|
|
40 |
file,
|
|
|
41 |
function(response) {
|
|
|
42 |
console.log(response);
|
|
|
43 |
var documentId = response.response.document_id;
|
|
|
44 |
console.log("documentId : " + documentId);
|
|
|
45 |
fileInput.closest('td').find("input[type=hidden]").val(documentId);
|
|
|
46 |
});
|
|
|
47 |
// alert("Retailer Shop Document
|
|
|
48 |
// is required");
|
|
|
49 |
}
|
|
|
50 |
} else {
|
|
|
51 |
// Do nothing!
|
|
|
52 |
}
|
|
|
53 |
});
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
$(document).on('click', '.credit-requirement-send', function() {
|
|
|
57 |
var row = $(this).closest("tr");
|
|
|
58 |
console.log(row);
|
|
|
59 |
var rowIndex = $(this).closest('tr').prevAll().length;
|
|
|
60 |
console.log(rowIndex);
|
|
|
61 |
var securityCheck = $(row).find(".check input[type=hidden]").val();
|
|
|
62 |
var fofoId = $(row).find("td:eq(0)").text();
|
|
|
63 |
|
|
|
64 |
var limit = $(row).find("td:eq(5) input[type='text']").val();
|
|
|
65 |
var interest = $(row).find("td:eq(8) input[type='text']").val();
|
|
|
66 |
var freedays = $(row).find("td:eq(9) input[type='text']").val();
|
|
|
67 |
var creditDays = $(row).find("td:eq(10) input[type='text']").val();
|
|
|
68 |
|
|
|
69 |
console.log(freedays)
|
|
|
70 |
|
|
|
71 |
var sdCreditReq = {};
|
|
|
72 |
sdCreditReq['fofoId'] = fofoId
|
|
|
73 |
sdCreditReq['securityCheck'] = securityCheck
|
|
|
74 |
sdCreditReq['limit'] = limit
|
|
|
75 |
sdCreditReq['interest'] = interest
|
|
|
76 |
sdCreditReq['freeDays'] = freedays
|
|
|
77 |
sdCreditReq['creditDays'] = creditDays
|
|
|
78 |
|
|
|
79 |
var jsonObject = JSON.stringify(sdCreditReq);
|
|
|
80 |
|
|
|
81 |
console.log(jsonObject);
|
|
|
82 |
if (confirm("Are you sure you want to submit the request") == true) {
|
|
|
83 |
doAjaxRequestWithJsonHandler(context + "/creditRequirement", "POST", jsonObject, function(response) {
|
|
|
84 |
row.html(response);
|
|
|
85 |
row.css("background-color", "#F8F8FF");
|
|
|
86 |
|
|
|
87 |
});
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
})
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
$(document).on('click', '.sanction-request-send', function() {
|
|
|
95 |
var row = $(this).closest("tr");
|
|
|
96 |
console.log(row);
|
|
|
97 |
var rowIndex = $(this).closest('tr').prevAll().length;
|
|
|
98 |
console.log(rowIndex);
|
|
|
99 |
var id = $(row).find("td:eq(0)").text();
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
var approvalAmount = $(row).find("td:eq(12) input[type='text']").val();
|
|
|
103 |
var freedays = $(row).find("td:eq(13) input[type='text']").val();
|
|
|
104 |
|
|
|
105 |
var status = $(row).find("td:eq(14) option:selected").val();
|
|
|
106 |
|
|
|
107 |
console.log(freedays)
|
|
|
108 |
|
|
|
109 |
var sanctionReq = {};
|
|
|
110 |
sanctionReq['id'] = id
|
|
|
111 |
sanctionReq['status'] = status
|
|
|
112 |
sanctionReq['approvalAmount'] = approvalAmount
|
|
|
113 |
sanctionReq['freeDays'] = freedays
|
|
|
114 |
|
|
|
115 |
var jsonObject = JSON.stringify(sanctionReq);
|
|
|
116 |
|
|
|
117 |
console.log(jsonObject);
|
|
|
118 |
if (confirm("Are you sure you want to submit the request") == true) {
|
|
|
119 |
doAjaxRequestWithJsonHandler(context + "/sanctionRequest", "POST", jsonObject, function(response) {
|
|
|
120 |
row.html(response);
|
|
|
121 |
row.css("background-color", "#F8F8FF");
|
|
|
122 |
|
|
|
123 |
});
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
})
|
|
|
128 |
});
|
|
|
129 |
|
|
|
130 |
function loadSdCredit(domId) {
|
|
|
131 |
|
|
|
132 |
doGetAjaxRequestHandler(context + "/getSDCreditReq", function(
|
|
|
133 |
response) {
|
|
|
134 |
$('#' + domId).html(response);
|
|
|
135 |
});
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
function loadSanctionRequest(domId) {
|
|
|
139 |
doGetAjaxRequestHandler(context + "/getSanctionRequest", function(
|
|
|
140 |
response) {
|
|
|
141 |
$('#' + domId).html(response);
|
|
|
142 |
});
|
|
|
143 |
}
|