Subversion Repositories SmartDukaan

Rev

Rev 24159 | Rev 26132 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24159 tejbeer 1
$(function() {
2
	$(".promoter-info").live('click', function() {
3
		loadPromotor("main-content");
4
	});
5
 
6
 
7
 
8
	$("#promoter-info-paginated .next").live(
9
			'click',
10
			function() {
11
				loadPaginatedNextItems('/getPaginatedPromoterInfo', null,
12
						'promoter-info-paginated', 'promoter-Info-table',
13
						'promoter-container');
14
 
15
				$(this).blur();
16
			});
17
 
18
	$("#promoter-info-paginated .previous").live(
19
			'click',
20
			function() {
21
 
22
				loadPaginatedPreviousItems('/getPaginatedPromoterInfo', null,
23
						'promoter-info-paginated', 'promoter-Info-table',
24
						'promoter-container');
25
 
26
				$(this).blur();
27
			});
28
 
29
	var id = 0;
30
	$(".create-promoter").live(
31
			'click',
32
			function() {
33
				var name = $('#promoterName').val();
34
				var brand = $('#tag-listing-brands').val();
35
				var email=$('#promoterEmail').val();
36
				var mobile=$('#promoterMobile').val();
37
				var retailerId = currentFofoId;
24986 tejbeer 38
				var portalAccess =$('#sd-Portal-Access').val();
24159 tejbeer 39
 
40
				console.log(id);
41
 
42
				if (name === "" && brand === "" && email===""&&mobile ==="") {
43
					alert("Field can't be empty");
44
					return;
45
				}
46
 
47
				if (name === "") {
48
					alert("Promoter Name is required");
49
					return;
50
				}
51
				if (brand === "") {
52
					alert("Brand is required");
53
					return;
54
				}
55
				if (email === "") {
56
					alert("email is required");
57
					return;
58
				}
59
				if (mobile === "") {
60
					alert("mobile Number is required");
61
					return;
62
				}
63
				var promoterdetailData = {}
64
				promoterdetailData['id'] = id;
65
				promoterdetailData['name'] = $('#promoterName').val();
66
				promoterdetailData['brand'] = $('#tag-listing-brands').val();
67
				promoterdetailData['email'] = $('#promoterEmail').val();
68
				promoterdetailData['mobile'] = $('#promoterMobile').val();
69
				promoterdetailData['retailerId'] = currentFofoId;
24986 tejbeer 70
				promoterdetailData['sdPortalAccess']=$('#sd-Portal-Access').val();
24159 tejbeer 71
				console.log(promoterdetailData);
72
				if (confirm("Are you sure you want to add Promoter!") == true) {
73
					doPostAjaxRequestWithJsonHandler(context
74
							+ "/createPromoter", JSON
75
							.stringify(promoterdetailData), function(response) {
76
						if (response == 'true') {
77
							alert("successfully Add");
78
							loadPromotor("main-content");
79
							id = 0;
80
 
81
						}
82
					});
83
 
84
					return false;
85
				}
86
			});
87
 
88
	$(".updatePromoterdetail").live('click', function() {
89
		id = $(this).data('requestid');
90
		name = $(this).data('name');
91
		brand = $(this).data('brand');
92
		partner = $(this).data('partner');
93
		email =$(this).data('email')
94
		mobile=$(this).data('mobile')
95
		console.log(name);
96
		console.log(brand);
97
		console.log(partner);
98
		$('#promoterName').val(name);
99
		$('#tag-listing-brands').val(brand);
100
		$('#promoterEmail').val(email);
101
		$('#promoterMobile').val(mobile);
102
		$('#promoterName').attr('readonly', true);
103
		$('#promoterMobile').attr('readonly', true);
104
		$('#promoterEmail').attr('readonly', true);
105
		$('#promoterMobile').attr('readonly', true);
106
		$('#tag-listing-brands').attr('disabled', true);
107
 
108
	});
109
	$(".removePromoter")
110
			.live(
111
					'click',
112
					function() {
113
						id = $(this).data('requestid');
114
						if (confirm("Are you sure you want to remove Promoter Partner Store!") == true) {
115
							doPostAjaxRequestHandler(context
116
									+ "/removePromoterfromPartnerStore?id="
117
									+ id, function(response) {
118
								if (response == 'true') {
119
									alert("successfully remove");
120
									loadPromotor("main-content");
121
									id =0;
122
 
123
								}
124
							});
125
 
126
							return false;
127
						}
128
 
129
					});
130
});
131
 
132
function loadPromotor(domId) {
133
	doGetAjaxRequestHandler(context + "/getPromoterInfo", function(response) {
134
		$('#' + domId).html(response);
135
	});
136
}