Subversion Repositories SmartDukaan

Rev

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

Rev 25496 Rev 25587
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
 
2
 
3
	$(".refferal").live('click', function() {
3
	$(".pending-refferal").live('click', function() {
4
 
4
 
5
		loadRefferals("main-content");
5
		loadRefferals("main-content");
6
	});
6
	});
7
 
7
 
-
 
8
	$(".validate-refferal").live('click', function() {
-
 
9
 
-
 
10
		loadValidateRefferals("main-content");
-
 
11
	});
-
 
12
 
8
	$(".refferal-approve").live('click', function() {
13
	$(".refferal-approve").live('click', function() {
9
 
14
 
10
		loadApproveRefferals("main-content");
15
		loadApproveRefferals("main-content");
11
	});
16
	});
12
 
17
 
Line 25... Line 30...
25
							'refferal-container');
30
							'refferal-container');
26
				} else if (url == "/getPaginatedTransferredRefferals") {
31
				} else if (url == "/getPaginatedTransferredRefferals") {
27
					loadPaginatedNextItems('/getPaginatedTransferredRefferals',
32
					loadPaginatedNextItems('/getPaginatedTransferredRefferals',
28
							null, 'refferal-paginated', 'refferal-table',
33
							null, 'refferal-paginated', 'refferal-table',
29
							'refferal-container');
34
							'refferal-container');
-
 
35
				} else if (url == "/getPaginatedValidateRefferals") {
-
 
36
					loadPaginatedNextItems('/getPaginatedValidateRefferals',
-
 
37
							null, 'refferal-paginated', 'refferal-table',
-
 
38
							'refferal-container');
30
				}
39
				}
31
				$(this).blur();
40
				$(this).blur();
32
			});
41
			});
33
 
42
 
34
	$("#refferal-paginated .previous").live(
43
	$("#refferal-paginated .previous").live(
Line 41... Line 50...
41
							'refferal-container');
50
							'refferal-container');
42
				} else if (url == "/getPaginatedTransferredRefferals") {
51
				} else if (url == "/getPaginatedTransferredRefferals") {
43
					loadPaginatedNextItems('/getPaginatedTransferredRefferals',
52
					loadPaginatedNextItems('/getPaginatedTransferredRefferals',
44
							null, 'refferal-paginated', 'refferal-table',
53
							null, 'refferal-paginated', 'refferal-table',
45
							'refferal-container');
54
							'refferal-container');
-
 
55
				} else if (url == "/getPaginatedValidateRefferals") {
-
 
56
					loadPaginatedNextItems('/getPaginatedValidateRefferals',
-
 
57
							null, 'refferal-paginated', 'refferal-table',
-
 
58
							'refferal-container');
46
				}
59
				}
47
				$(this).blur();
60
				$(this).blur();
48
			});
61
			});
49
 
62
 
50
	$(".refferal-reject")
63
	$(".refferal-reject")
Line 65... Line 78...
65
 
78
 
66
							});
79
							});
67
						}
80
						}
68
					});
81
					});
69
 
82
 
-
 
83
	$(".reffral-validate")
-
 
84
			.live(
-
 
85
					'click',
-
 
86
					function() {
-
 
87
						if (confirm("Are you sure you want to Validate the refferal") == true) {
-
 
88
 
-
 
89
							refferalId = $(this).data('requestid');
-
 
90
							console.log(refferalId);
-
 
91
							doPutAjaxRequestHandler(context
-
 
92
									+ "/validateRefferal?refferalId="
-
 
93
									+ refferalId, function(response) {
-
 
94
								if (response == 'true') {
-
 
95
									alert("successfully Rejected");
-
 
96
									loadRefferals("main-content");
-
 
97
								}
-
 
98
 
-
 
99
							});
-
 
100
						}
-
 
101
					});
-
 
102
 
70
	$(".reffral-approve")
103
	$(".reffral-approve")
71
			.live(
104
			.live(
72
					'click',
105
					'click',
73
					function() {
106
					function() {
74
						if (confirm("Are you sure you want to approve the refferal") == true) {
107
						if (confirm("Are you sure you want to approve the refferal") == true) {
Line 85... Line 118...
85
 
118
 
86
							});
119
							});
87
						}
120
						}
88
					});
121
					});
89
 
122
 
90
	$(".fetchApproveRefferals").live(
-
 
91
			'click',
-
 
92
			function() {
-
 
93
				currentFofoId = currentFofoId;
-
 
94
				currentFofoEmail = currentFofoEmail;
-
 
95
 
-
 
96
				console.log(currentFofoId);
-
 
97
				console.log(currentFofoEmail);
-
 
98
 
-
 
99
				doGetAjaxRequestHandler(context
-
 
100
						+ "/getApprovedRefferals?refereeEmail="
-
 
101
						+ currentFofoEmail, function(response) {
-
 
102
					$('.refferal-approve-info-container').html(response);
-
 
103
				});
-
 
104
 
-
 
105
			});
-
 
106
 
-
 
107
	$(".refferalAmountSubmit").live(
123
	$(".refferalAmountSubmit").live(
108
			'click',
124
			'click',
109
			function() {
125
			function() {
110
				currentFofoId = currentFofoId;
-
 
111
				currentFofoEmail = currentFofoEmail;
-
 
-
 
126
 
112
				var count = $('#count').val();
127
				var count = $('#count').val();
-
 
128
				var refereeEmail = $('#refereeEmail').val();
113
				var refferalAmount = $('#refferalAmount').val();
129
				var refferalAmount = $('#refferalAmount').val();
114
				var month = $('#previousMonth').val();
130
				var month = $('#previousMonth').val();
115
				$('#count').attr('readonly', true);
131
				$('#count').attr('readonly', true);
-
 
132
				$('#refereeEmail').attr('readonly', true);
116
				$('#refferalAmount').attr('readonly', true);
133
				$('#refferalAmount').attr('readonly', true);
117
				$('#previousMonth').attr('readonly', true);
134
				$('#previousMonth').attr('readonly', true);
118
				
135
 
119
				if (confirm("Are you sure you want add money!") == true) {
136
				if (confirm("Are you sure you want add money!") == true) {
120
					doPostAjaxRequestHandler(context
137
					doPostAjaxRequestHandler(context
121
							+ "/addMoneyToWallet?amount=" + refferalAmount
138
							+ "/addMoneyToWallet?amount=" + refferalAmount
122
							+ "&count=" + count + "&refereeEmail="
139
							+ "&count=" + count + "&refereeEmail="
123
							+ currentFofoEmail + "&month=" + month,
140
							+ refereeEmail + "&month=" + month, function(
124
							function(response) {
141
							response) {
125
								if (response == 'true') {
142
						if (response == 'true') {
126
									alert("successfully submit");
143
							alert("successfully submit");
127
 
144
 
128
									loadApproveRefferals("main-content");
145
							loadApproveRefferals("main-content");
129
								}
146
						}
130
 
147
 
131
								return false;
148
						return false;
132
							});
149
					});
133
				}
150
				}
134
 
151
 
135
			});
152
			});
136
 
153
 
137
	$(".oldRefferalAmountSubmit").live(
154
	$(".oldRefferalAmountSubmit").live(
138
			'click',
155
			'click',
139
			function() {
156
			function() {
140
				currentFofoId = currentFofoId;
-
 
141
				currentFofoEmail = currentFofoEmail;
-
 
142
				var count = $('#oldMonthCount').val();
157
				var count = $('#oldMonthCount').val();
-
 
158
				var refereeEmail = $('#refereeEmail').val();
-
 
159
				console.log(refereeEmail);
143
				var refferalAmount = $('#oldMonthrefferalAmount').val();
160
				var refferalAmount = $('#oldMonthrefferalAmount').val();
144
				var month = $('#oldMonth').val();
161
				var month = $('#oldMonth').val();
145
				$('#oldMonthCount').attr('readonly', true);
162
				$('#oldMonthCount').attr('readonly', true);
-
 
163
				$('#refereeEmail').attr('readonly', true);
-
 
164
 
146
				$('#oldMonthrefferalAmount').attr('readonly', true);
165
				$('#oldMonthrefferalAmount').attr('readonly', true);
147
				$('#oldMonth').attr('readonly', true);
166
				$('#oldMonth').attr('readonly', true);
148
 
167
 
149
				if (confirm("Are you sure you want add money!") == true) {
168
				if (confirm("Are you sure you want add money!") == true) {
150
					doPostAjaxRequestHandler(context
169
					doPostAjaxRequestHandler(context
151
							+ "/addMoneyToWalletPreviousMonth?amount="
170
							+ "/addMoneyToWalletPreviousMonth?amount="
152
							+ refferalAmount + "&count=" + count
171
							+ refferalAmount + "&count=" + count
153
							+ "&refereeEmail=" + currentFofoEmail + "&month="
172
							+ "&refereeEmail=" + refereeEmail + "&month="
154
							+ month, function(response) {
173
							+ month, function(response) {
155
						if (response == 'true') {
174
						if (response == 'true') {
156
							alert("successfully submit");
175
							alert("successfully submit");
157
 
176
 
158
							loadApproveRefferals("main-content");
177
							loadApproveRefferals("main-content");
Line 172... Line 191...
172
				$('#' + domId).html(response);
191
				$('#' + domId).html(response);
173
			});
192
			});
174
 
193
 
175
}
194
}
176
 
195
 
-
 
196
function loadValidateRefferals(domId) {
-
 
197
	doGetAjaxRequestHandler(context + "/getValidateRefferals", function(
-
 
198
			response) {
-
 
199
		$('#' + domId).html(response);
-
 
200
	});
-
 
201
 
-
 
202
}
-
 
203
 
177
function loadTransferredRefferals(domId) {
204
function loadTransferredRefferals(domId) {
178
	doGetAjaxRequestHandler(context + "/getTransferredRefferals", function(
205
	doGetAjaxRequestHandler(context + "/getTransferredRefferals", function(
179
			response) {
206
			response) {
180
		$('#' + domId).html(response);
207
		$('#' + domId).html(response);
181
	});
208
	});