Subversion Repositories SmartDukaan

Rev

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

Rev 26136 Rev 27489
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
	$(".promoter-info").live('click', function() {
2
	$(".promoter-info").live('click', function() {
3
		loadPromotor("main-content");
3
		loadPromotor("main-content");
4
	});
4
	});
-
 
5
	
-
 
6
	var id = 0;
-
 
7
	var retailerId;
-
 
8
	var fofoId;
5
 
9
 
6
	$("#promoter-info-paginated .next").live(
10
	$("#promoter-info-paginated .next").live(
7
			'click',
11
		'click',
8
			function() {
12
		function() {
-
 
13
 
-
 
14
			var fofo = fofoId;
-
 
15
			console.log(fofoId)
-
 
16
			if ((fofoId)) {
-
 
17
 
-
 
18
				var params = {};
-
 
19
				params['fofoId'] = fofo;
-
 
20
				loadPaginatedNextItems('/getPaginatedSchemes', params,
-
 
21
					'promoter-info-paginated', 'promoter-Info-table',
-
 
22
					'promoter-container');
-
 
23
 
-
 
24
			} else {
9
				loadPaginatedNextItems('/getPaginatedPromoterInfo', null,
25
				loadPaginatedNextItems('/getPaginatedPromoterInfo', null,
10
						'promoter-info-paginated', 'promoter-Info-table',
26
					'promoter-info-paginated', 'promoter-Info-table',
11
						'promoter-container');
27
					'promoter-container');
12
 
28
 
13
				$(this).blur();
29
				$(this).blur();
-
 
30
			}
14
			});
31
		});
-
 
32
 
15
 
33
 
16
	$("#promoter-info-paginated .previous").live(
34
	$("#promoter-info-paginated .previous").live(
17
			'click',
35
		'click',
18
			function() {
36
		function() {
-
 
37
			var fofo = fofoId;
-
 
38
			console.log(fofoId)
-
 
39
			if ((fofoId)) {
-
 
40
 
-
 
41
				var params = {};
-
 
42
				params['fofoId'] = fofo;
-
 
43
				loadPaginatedPreviousItems('/getPaginatedSchemes', params,
-
 
44
					'promoter-info-paginated', 'promoter-Info-table',
-
 
45
					'promoter-container');
-
 
46
 
-
 
47
			} else {
19
 
48
 
20
				loadPaginatedPreviousItems('/getPaginatedPromoterInfo', null,
49
				loadPaginatedPreviousItems('/getPaginatedPromoterInfo', null,
21
						'promoter-info-paginated', 'promoter-Info-table',
50
					'promoter-info-paginated', 'promoter-Info-table',
22
						'promoter-container');
51
					'promoter-container');
23
 
52
 
24
				$(this).blur();
53
				$(this).blur();
-
 
54
			}
25
			});
55
		});
26
 
56
 
27
	var id = 0;
57
	
28
	var retailerId;
-
 
29
	$(".create-promoter").live(
58
	$(".create-promoter").live(
30
			'click',
59
		'click',
31
			function() {
60
		function() {
32
				var name = $('#promoterName').val();
61
			var name = $('#promoterName').val();
33
				var brand = $('#tag-listing-brands').val();
62
			var brand = $('#tag-listing-brands').val();
34
				var email = $('#promoterEmail').val();
63
			var email = $('#promoterEmail').val();
35
				var mobile = $('#promoterMobile').val();
64
			var mobile = $('#promoterMobile').val();
36
				var retailerId = currentFofoId;
65
			var retailerId = currentFofoId;
37
				var portalAccess = $('#sd-Portal-Access').val();
66
			var portalAccess = $('#sd-Portal-Access').val();
38
				var status = $('#status').val();
67
			var status = $('#status').val();
39
				retailerId = currentFofoId;
68
			retailerId = currentFofoId;
40
				console.log(id);
69
			console.log(id);
41
 
70
 
42
				if (name === "" && brand === "" && email === ""
71
			if (name === "" && brand === "" && email === ""
43
						&& mobile === "") {
72
				&& mobile === "") {
44
					alert("Field can't be empty");
73
				alert("Field can't be empty");
45
					return;
74
				return;
46
				}
75
			}
47
 
76
 
48
				if (name === "") {
77
			if (name === "") {
49
					alert("Promoter Name is required");
78
				alert("Promoter Name is required");
50
					return;
79
				return;
51
				}
80
			}
52
				if (brand === "") {
81
			if (brand === "") {
53
					alert("Brand is required");
82
				alert("Brand is required");
54
					return;
83
				return;
55
				}
84
			}
56
				if (email === "") {
85
			if (email === "") {
57
					alert("email is required");
86
				alert("email is required");
58
					return;
87
				return;
59
				}
88
			}
60
				if (mobile === "") {
89
			if (mobile === "") {
61
					alert("mobile Number is required");
90
				alert("mobile Number is required");
62
					return;
91
				return;
63
				}
92
			}
64
				if (status === "") {
93
			if (status === "") {
65
					alert("Status is required");
94
				alert("Status is required");
66
				}
95
			}
67
 
96
 
68
				var promoterdetailData = {}
97
			var promoterdetailData = {}
69
				promoterdetailData['id'] = id;
98
			promoterdetailData['id'] = id;
70
				promoterdetailData['name'] = $('#promoterName').val();
99
			promoterdetailData['name'] = $('#promoterName').val();
71
				promoterdetailData['brand'] = $('#tag-listing-brands').val();
100
			promoterdetailData['brand'] = $('#tag-listing-brands').val();
72
				promoterdetailData['email'] = $('#promoterEmail').val();
101
			promoterdetailData['email'] = $('#promoterEmail').val();
73
				promoterdetailData['mobile'] = $('#promoterMobile').val();
102
			promoterdetailData['mobile'] = $('#promoterMobile').val();
74
				promoterdetailData['retailerId'] = retailerId;
103
			promoterdetailData['retailerId'] = retailerId;
75
				promoterdetailData['sdPortalAccess'] = $('#sd-Portal-Access')
104
			promoterdetailData['sdPortalAccess'] = $('#sd-Portal-Access')
76
						.val();
105
				.val();
77
				promoterdetailData['status'] = $('#status').val();
106
			promoterdetailData['status'] = $('#status').val();
78
				console.log(promoterdetailData);
107
			console.log(promoterdetailData);
79
				if (confirm("Are you sure you want to add Promoter!") == true) {
108
			if (confirm("Are you sure you want to add Promoter!") == true) {
80
					doPostAjaxRequestWithJsonHandler(context
109
				doPostAjaxRequestWithJsonHandler(context
81
							+ "/createPromoter", JSON
110
					+ "/createPromoter", JSON
82
							.stringify(promoterdetailData), function(response) {
111
						.stringify(promoterdetailData), function(response) {
83
						if (response == 'true') {
112
							if (response == 'true') {
84
							alert("successfully Add");
113
								alert("successfully Add");
85
							loadPromotor("main-content");
114
								loadPromotor("main-content");
86
							id = 0;
115
								id = 0;
87
 
116
 
88
						}
117
							}
89
					});
118
						});
90
 
119
 
91
					return false;
120
				return false;
92
				}
121
			}
93
			});
122
		});
94
 
123
 
95
	$(".updatePromoterdetail").live('click', function() {
124
	$(".updatePromoterdetail").live('click', function() {
96
		id = $(this).data('requestid');
125
		id = $(this).data('requestid');
97
		name = $(this).data('name');
126
		name = $(this).data('name');
98
		brand = $(this).data('brand');
127
		brand = $(this).data('brand');
Line 100... Line 129...
100
		partnerid = $(this).data('partnerid');
129
		partnerid = $(this).data('partnerid');
101
		email = $(this).data('email')
130
		email = $(this).data('email')
102
		mobile = $(this).data('mobile')
131
		mobile = $(this).data('mobile')
103
		console.log(name);
132
		console.log(name);
104
 
133
 
105
		retailerId = partnerid;
134
		currentFofoId = partnerid;
106
		console.log(brand);
135
		console.log(brand);
107
		console.log(partner);
136
		console.log(partner);
108
		console.log(partnerid)
137
		console.log(partnerid)
109
		$('#promoterName').val(name);
138
		$('#promoterName').val(name);
110
		$('#tag-listing-brands').val(brand);
139
		$('#tag-listing-brands').val(brand);
111
		$('#promoterEmail').val(email);
140
		$('#promoterEmail').val(email);
112
		$('#promoterMobile').val(mobile);
141
		$('#promoterMobile').val(mobile);
113
		$('#partnerFofoId').val(partner);
142
		$('#partnerFofoId').val(partner);
114
		$('#promoterName').attr('readonly', true);
143
		/*$('#promoterName').attr('readonly', true);
115
		$('#promoterMobile').attr('readonly', true);
144
		$('#promoterMobile').attr('readonly', true);
116
		$('#promoterEmail').attr('readonly', true);
145
		$('#promoterEmail').attr('readonly', true);
117
		$('#promoterMobile').attr('readonly', true);
146
		$('#promoterMobile').attr('readonly', true);*/
118
		$('#partnerFofoId').attr('disabled', true);
147
		$('#partnerFofoId').attr('disabled', true);
119
		$('#tag-listing-brands').attr('disabled', true);
148
		$('#tag-listing-brands').attr('disabled', true);
120
 
149
 
121
	});
150
	});
122
	$(".removePromoter")
151
	$(".removePromoter")
123
			.live(
152
		.live(
124
					'click',
153
			'click',
125
					function() {
154
			function() {
126
						id = $(this).data('requestid');
155
				id = $(this).data('requestid');
127
						if (confirm("Are you sure you want to remove Promoter Partner Store!") == true) {
156
				if (confirm("Are you sure you want to remove Promoter Partner Store!") == true) {
128
							doPostAjaxRequestHandler(context
157
					doPostAjaxRequestHandler(context
129
									+ "/removePromoterfromPartnerStore?id="
158
						+ "/removePromoterfromPartnerStore?id="
130
									+ id, function(response) {
159
						+ id, function(response) {
131
								if (response == 'true') {
160
							if (response == 'true') {
132
									alert("successfully remove");
161
								alert("successfully remove");
133
									loadPromotor("main-content");
162
								loadPromotor("main-content");
134
									id = 0;
163
								id = 0;
135
 
164
 
136
								}
165
							}
137
							});
166
						});
138
 
167
 
139
							return false;
168
					return false;
140
						}
169
				}
141
 
170
 
142
					});
171
			});
-
 
172
 
-
 
173
	$("#promoter-fofo-search").live('click', function() {
-
 
174
 
-
 
175
		fofoId = partnerId;
-
 
176
		doGetAjaxRequestHandler(context + "/getPromoterInfo?fofoId=" + fofoId, function(response) {
-
 
177
			$('#' + "main-content").html(response);
-
 
178
		});
-
 
179
	});
143
});
180
});
144
 
181
 
145
function loadPromotor(domId) {
182
function loadPromotor(domId) {
146
	doGetAjaxRequestHandler(context + "/getPromoterInfo", function(response) {
183
	doGetAjaxRequestHandler(context + "/getPromoterInfo", function(response) {
147
		$('#' + domId).html(response);
184
		$('#' + domId).html(response);