Subversion Repositories SmartDukaan

Rev

Rev 30951 | Rev 31080 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 30951 Rev 31020
Line 1... Line 1...
1
 
1
 
-
 
2
 
2
$(function() {
3
$(function() {
3
 
4
 
4
	$(document).on('click', ".sd-credit", function() {
5
	$(document).on('click', ".sd-credit", function() {
5
 
6
 
6
		loadSdCredit("main-content");
7
		loadSdCredit("main-content");
Line 18... Line 19...
18
	$(document).on('click', ".loan-summary", function() {
19
	$(document).on('click', ".loan-summary", function() {
19
 
20
 
20
		loadLoanDetail("main-content");
21
		loadLoanDetail("main-content");
21
	});
22
	});
22
 
23
 
-
 
24
 
-
 
25
 
-
 
26
 
-
 
27
	$(document).on('click', ".sanction-order-hold", function() {
-
 
28
 
-
 
29
		loadSanctionHoldOrder("main-content");
-
 
30
	});
-
 
31
 
23
	var table = $('#sdCredit').DataTable();
32
	var table = $('#sdCredit').DataTable();
24
	$(document).on('dblclick', '#sdCredit tbody tr', function() {
33
	$(document).on('dblclick', '#sdCredit tbody tr', function() {
25
		console.log("dblclick");
34
		console.log("dblclick");
26
		var data = table.row(this).data();
35
		var data = table.row(this).data();
27
 
36
 
Line 108... Line 117...
108
		}
117
		}
109
 
118
 
110
 
119
 
111
	})
120
	})
112
 
121
 
113
 
-
 
114
	$(document).on('click', '.sanction-request-send', function() {
122
	$(document).on('click', '.sanction-request-send', function() {
115
		var row = $(this).closest("tr");
123
		var row = $(this).closest("tr");
116
		console.log(row);
124
		console.log(row);
117
		var rowIndex = $(this).closest('tr').prevAll().length;
125
		var rowIndex = $(this).closest('tr').prevAll().length;
118
		console.log(rowIndex);
126
		console.log(rowIndex);
Line 120... Line 128...
120
 
128
 
121
 
129
 
122
		var approvalAmount = $(row).find("td:eq(12) input[type='text']").val();
130
		var approvalAmount = $(row).find("td:eq(12) input[type='text']").val();
123
		var freedays = $(row).find("td:eq(13) input[type='text']").val();
131
		var freedays = $(row).find("td:eq(13) input[type='text']").val();
124
 
132
 
-
 
133
 
125
		var status = $(row).find("td:eq(14) option:selected").val();
134
		var status = $(row).find("td:eq(14) option:selected").val();
126
 
135
 
-
 
136
		var stockHold = $(row).find("td:eq(15) input[type='checkbox']").is(":checked") ? true : false;
-
 
137
 
-
 
138
 
-
 
139
 
127
		console.log(freedays)
140
		console.log(freedays)
128
 
141
 
129
		var sanctionReq = {};
142
		var sanctionReq = {};
130
		sanctionReq['id'] = id
143
		sanctionReq['id'] = id
131
		sanctionReq['status'] = status
144
		sanctionReq['status'] = status
132
		sanctionReq['approvalAmount'] = approvalAmount
145
		sanctionReq['approvalAmount'] = approvalAmount
133
		sanctionReq['freeDays'] = freedays
146
		sanctionReq['freeDays'] = freedays
134
 
147
 
-
 
148
		sanctionReq['stockHold'] = stockHold
-
 
149
 
-
 
150
 
135
		var jsonObject = JSON.stringify(sanctionReq);
151
		var jsonObject = JSON.stringify(sanctionReq);
136
 
152
 
137
		console.log(jsonObject);
153
		console.log(jsonObject);
138
		if (confirm("Are you sure you want to submit the request") == true) {
154
		if (confirm("Are you sure you want to submit the request") == true) {
139
			doAjaxRequestWithJsonHandler(context + "/sanctionRequest", "POST", jsonObject, function(response) {
155
			doAjaxRequestWithJsonHandler(context + "/sanctionRequest", "POST", jsonObject, function(response) {
Line 142... Line 158...
142
 
158
 
143
			});
159
			});
144
		}
160
		}
145
 
161
 
146
 
162
 
-
 
163
 
147
	})
164
	})
148
});
-
 
149
 
165
 
-
 
166
 
-
 
167
	$(document).on('click', '.sanction-request-unhold', function() {
-
 
168
		var row = $(this).closest("tr");
-
 
169
		console.log(row);
-
 
170
		var transactionId = $(row).find("td:eq(3)").text();
-
 
171
		if (confirm("Are you sure you want to Unhold the request") == true) {
-
 
172
 
-
 
173
			doPostAjaxRequestHandler(context + "/unholdOrder?transactionId="
-
 
174
				+ transactionId, function(response) {
-
 
175
					if (response == 'true') {
-
 
176
						alert("unhold successfully");
-
 
177
						loadSanctionHoldOrder("main-content");
-
 
178
					}
-
 
179
 
-
 
180
				});
-
 
181
		}
-
 
182
 
-
 
183
 
-
 
184
	})
-
 
185
 
-
 
186
});
150
function loadSdCredit(domId) {
187
function loadSdCredit(domId) {
151
 
188
 
152
	doGetAjaxRequestHandler(context + "/getSDCreditReq", function(
189
	doGetAjaxRequestHandler(context + "/getSDCreditReq", function(
153
		response) {
190
		response) {
154
		$('#' + domId).html(response);
191
		$('#' + domId).html(response);
Line 167... Line 204...
167
	doGetAjaxRequestHandler(context + "/getLoans", function(
204
	doGetAjaxRequestHandler(context + "/getLoans", function(
168
		response) {
205
		response) {
169
		$('#' + domId).html(response);
206
		$('#' + domId).html(response);
170
	});
207
	});
171
}
208
}
-
 
209
 
-
 
210
 
-
 
211
function loadSanctionHoldOrder(domId) {
-
 
212
 
-
 
213
	doGetAjaxRequestHandler(context + "/getSanctionHoldOrder", function(
-
 
214
		response) {
-
 
215
		$('#' + domId).html(response);
-
 
216
	});
-
 
217
}