Subversion Repositories SmartDukaan

Rev

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

Rev 24986 Rev 26132
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
	
-
 
7
	
5
 
8
	$("#promoter-info-paginated .next").live(
6
	$("#promoter-info-paginated .next").live(
9
			'click',
7
			'click',
10
			function() {
8
			function() {
11
				loadPaginatedNextItems('/getPaginatedPromoterInfo', null,
9
				loadPaginatedNextItems('/getPaginatedPromoterInfo', null,
12
						'promoter-info-paginated', 'promoter-Info-table',
10
						'promoter-info-paginated', 'promoter-Info-table',
Line 25... Line 23...
25
 
23
 
26
				$(this).blur();
24
				$(this).blur();
27
			});
25
			});
28
 
26
 
29
	var id = 0;
27
	var id = 0;
-
 
28
	var currentFofoId;
30
	$(".create-promoter").live(
29
	$(".create-promoter").live(
31
			'click',
30
			'click',
32
			function() {
31
			function() {
33
				var name = $('#promoterName').val();
32
				var name = $('#promoterName').val();
34
				var brand = $('#tag-listing-brands').val();
33
				var brand = $('#tag-listing-brands').val();
35
				var email=$('#promoterEmail').val();
34
				var email = $('#promoterEmail').val();
36
				var mobile=$('#promoterMobile').val();
35
				var mobile = $('#promoterMobile').val();
37
				var retailerId = currentFofoId;
36
				var retailerId = currentFofoId;
38
				var portalAccess =$('#sd-Portal-Access').val();
37
				var portalAccess = $('#sd-Portal-Access').val();
-
 
38
				var status = $('#status').val();
39
 
39
 
40
				console.log(id);
40
				console.log(id);
41
 
41
 
42
				if (name === "" && brand === "" && email===""&&mobile ==="") {
42
				if (name === "" && brand === "" && email === ""
-
 
43
						&& mobile === "") {
43
					alert("Field can't be empty");
44
					alert("Field can't be empty");
44
					return;
45
					return;
45
				}
46
				}
46
 
47
 
47
				if (name === "") {
48
				if (name === "") {
Line 58... Line 59...
58
				}
59
				}
59
				if (mobile === "") {
60
				if (mobile === "") {
60
					alert("mobile Number is required");
61
					alert("mobile Number is required");
61
					return;
62
					return;
62
				}
63
				}
-
 
64
				if (status === "") {
-
 
65
					alert("Status is required");
-
 
66
				}
-
 
67
 
63
				var promoterdetailData = {}
68
				var promoterdetailData = {}
64
				promoterdetailData['id'] = id;
69
				promoterdetailData['id'] = id;
65
				promoterdetailData['name'] = $('#promoterName').val();
70
				promoterdetailData['name'] = $('#promoterName').val();
66
				promoterdetailData['brand'] = $('#tag-listing-brands').val();
71
				promoterdetailData['brand'] = $('#tag-listing-brands').val();
67
				promoterdetailData['email'] = $('#promoterEmail').val();
72
				promoterdetailData['email'] = $('#promoterEmail').val();
68
				promoterdetailData['mobile'] = $('#promoterMobile').val();
73
				promoterdetailData['mobile'] = $('#promoterMobile').val();
69
				promoterdetailData['retailerId'] = currentFofoId;
74
				promoterdetailData['retailerId'] = currentFofoId;
70
				promoterdetailData['sdPortalAccess']=$('#sd-Portal-Access').val();
75
				promoterdetailData['sdPortalAccess'] = $('#sd-Portal-Access')
-
 
76
						.val();
-
 
77
				promoterdetailData['status'] = $('#status').val();
71
				console.log(promoterdetailData);
78
				console.log(promoterdetailData);
72
				if (confirm("Are you sure you want to add Promoter!") == true) {
79
				if (confirm("Are you sure you want to add Promoter!") == true) {
73
					doPostAjaxRequestWithJsonHandler(context
80
					doPostAjaxRequestWithJsonHandler(context
74
							+ "/createPromoter", JSON
81
							+ "/createPromoter", JSON
75
							.stringify(promoterdetailData), function(response) {
82
							.stringify(promoterdetailData), function(response) {
Line 88... Line 95...
88
	$(".updatePromoterdetail").live('click', function() {
95
	$(".updatePromoterdetail").live('click', function() {
89
		id = $(this).data('requestid');
96
		id = $(this).data('requestid');
90
		name = $(this).data('name');
97
		name = $(this).data('name');
91
		brand = $(this).data('brand');
98
		brand = $(this).data('brand');
92
		partner = $(this).data('partner');
99
		partner = $(this).data('partner');
-
 
100
		partnerid = $(this).data('partnerid');
93
		email =$(this).data('email')
101
		email = $(this).data('email')
94
		mobile=$(this).data('mobile')
102
		mobile = $(this).data('mobile')
95
		console.log(name);
103
		console.log(name);
-
 
104
 
-
 
105
		currentFofoId = partnerid;
96
		console.log(brand);
106
		console.log(brand);
97
		console.log(partner);
107
		console.log(partner);
-
 
108
		console.log(partnerid)
98
		$('#promoterName').val(name);
109
		$('#promoterName').val(name);
99
		$('#tag-listing-brands').val(brand);
110
		$('#tag-listing-brands').val(brand);
100
		$('#promoterEmail').val(email);
111
		$('#promoterEmail').val(email);
101
		$('#promoterMobile').val(mobile);
112
		$('#promoterMobile').val(mobile);
-
 
113
		$('#partnerFofoId').val(partner);
102
		$('#promoterName').attr('readonly', true);
114
		$('#promoterName').attr('readonly', true);
103
		$('#promoterMobile').attr('readonly', true);
115
		$('#promoterMobile').attr('readonly', true);
104
		$('#promoterEmail').attr('readonly', true);
116
		$('#promoterEmail').attr('readonly', true);
105
		$('#promoterMobile').attr('readonly', true);
117
		$('#promoterMobile').attr('readonly', true);
-
 
118
		$('#partnerFofoId').attr('disabled', true);
106
		$('#tag-listing-brands').attr('disabled', true);
119
		$('#tag-listing-brands').attr('disabled', true);
107
 
120
 
108
	});
121
	});
109
	$(".removePromoter")
122
	$(".removePromoter")
110
			.live(
123
			.live(
Line 116... Line 129...
116
									+ "/removePromoterfromPartnerStore?id="
129
									+ "/removePromoterfromPartnerStore?id="
117
									+ id, function(response) {
130
									+ id, function(response) {
118
								if (response == 'true') {
131
								if (response == 'true') {
119
									alert("successfully remove");
132
									alert("successfully remove");
120
									loadPromotor("main-content");
133
									loadPromotor("main-content");
121
									id =0;
134
									id = 0;
122
 
135
 
123
								}
136
								}
124
							});
137
							});
125
 
138
 
126
							return false;
139
							return false;