Subversion Repositories SmartDukaan

Rev

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

Rev 25366 Rev 25570
Line 5... Line 5...
5
	});
5
	});
6
	$(".change-auth-user-password").live('click', function() {
6
	$(".change-auth-user-password").live('click', function() {
7
		console.log("change auth user password clicked......");
7
		console.log("change auth user password clicked......");
8
		loadChangeAuthUserPassword("main-content");
8
		loadChangeAuthUserPassword("main-content");
9
	});
9
	});
10
	$(".mk_gmail_edit").live('click', function(){
10
	$(".mk_gmail_edit")
-
 
11
			.live(
-
 
12
					'click',
-
 
13
					function() {
11
		var $that = $(this);
14
						var $that = $(this);
-
 
15
						bootbox
-
 
16
								.prompt(
-
 
17
										"New Gmail Id",
12
		bootbox.prompt("New Gmail Id", function(result){
18
										function(result) {
-
 
19
											if (result
-
 
20
													&& result
13
			if(result && result.indexOf('@gmail.com') > 0) {
21
															.indexOf('@gmail.com') > 0) {
-
 
22
												doGetAjaxRequestHandler(
-
 
23
														context
14
				doGetAjaxRequestHandler(context + "/authuser/edit?emailId=" + $that.data("id") + "&gmailId=" + result, function(response) {
24
																+ "/authuser/edit?emailId="
-
 
25
																+ $that
-
 
26
																		.data("id")
-
 
27
																+ "&gmailId="
-
 
28
																+ result,
-
 
29
														function(response) {
15
					if(response=="true") {
30
															if (response == "true") {
-
 
31
																bootbox
16
						bootbox.alert("Gmail Id updated successfully");
32
																		.alert("Gmail Id updated successfully");
-
 
33
																$that
-
 
34
																		.closest(
-
 
35
																				'td')
-
 
36
																		.find(
-
 
37
																				'span')
-
 
38
																		.html(
17
						$that.closest('td').find('span').html(result);
39
																				result);
-
 
40
																$that
-
 
41
																		.closest(
-
 
42
																				'td')
-
 
43
																		.find(
18
						$that.closest('td').find('button').html('Edit');
44
																				'button')
-
 
45
																		.html(
-
 
46
																				'Edit');
19
						return;
47
																return;
20
					}
48
															}
21
				});
49
														});
22
			} else {
50
											} else {
-
 
51
												bootbox
23
				bootbox.alert("Gmail id is required");
52
														.alert("Gmail id is required");
24
			}
53
											}
25
		});
54
										});
26
	});
55
					});
27
 
56
 
28
	$(".reset-password")
57
	$(".reset-password")
29
			.live(
58
			.live(
30
					'click',
59
					'click',
31
					function() {
60
					function() {
Line 35... Line 64...
35
						if (confirm("Are you sure you want to reset password of Auth userEmail=!"
64
						if (confirm("Are you sure you want to reset password of Auth userEmail=!"
36
								+ emailId) == true) {
65
								+ emailId) == true) {
37
							resetAuthUserPassword("main-content", emailId);
66
							resetAuthUserPassword("main-content", emailId);
38
						}
67
						}
39
					});
68
					});
-
 
69
 
-
 
70
	$(".remove-user").live(
-
 
71
			'click',
-
 
72
			function() {
-
 
73
				console.log("heelo");
-
 
74
				var $that = $(this);
-
 
75
 
-
 
76
				if (confirm("Are you sure you want to remove the user")) {
-
 
77
					doPostAjaxRequestHandler(context + "/authuser/remove?id="
-
 
78
						+ $that.data("id"), function(response) {
-
 
79
					if (response == "true") {
-
 
80
						alert("Remove User Successfully");
-
 
81
						loadAddAuthUser("main-content");
-
 
82
					}
-
 
83
				});
-
 
84
			}
-
 
85
			});
-
 
86
 
40
	$(".change-password")
87
	$(".change-password")
41
			.live(
88
			.live(
42
					'click',
89
					'click',
43
					function() {
90
					function() {
44
						console.log("change-password button clicked......");
91
						console.log("change-password button clicked......");
Line 82... Line 129...
82
						if (emailId == "" || emailId == null
129
						if (emailId == "" || emailId == null
83
								|| emailId == undefined) {
130
								|| emailId == undefined) {
84
							alert("emailId cann't be blank");
131
							alert("emailId cann't be blank");
85
							return;
132
							return;
86
						}
133
						}
87
						
134
 
88
						if (gmailId == "" || gmailId == null
135
						if (gmailId == "" || gmailId == null
89
								|| gmailId == undefined) {
136
								|| gmailId == undefined) {
90
							gmailId=null;
137
							gmailId = null;
91
						}
138
						}
92
						validateEmail(emailId);
139
						validateEmail(emailId);
93
						if (firstName == "" || firstName == null
140
						if (firstName == "" || firstName == null
94
								|| firstName == undefined) {
141
								|| firstName == undefined) {
95
							alert("firstName can't be blank");
142
							alert("firstName can't be blank");
Line 110... Line 157...
110
							alert("required 10 digits, match requested format!");
157
							alert("required 10 digits, match requested format!");
111
							return;
158
							return;
112
						}
159
						}
113
						if (confirm("Are you sure you want to create Auth user!") == true) {
160
						if (confirm("Are you sure you want to create Auth user!") == true) {
114
							addAuthUser(emailId, firstName, lastName,
161
							addAuthUser(emailId, firstName, lastName,
115
									mobileNumber,gmailId);
162
									mobileNumber, gmailId);
116
						}
163
						}
117
					});
164
					});
118
	$("#authUsers-paginated .next").live(
165
	$("#authUsers-paginated .next").live(
119
			'click',
166
			'click',
120
			function() {
167
			function() {
Line 151... Line 198...
151
			function(response) {
198
			function(response) {
152
				alert("Password changed successfully");
199
				alert("Password changed successfully");
153
				loadChangeAuthUserPassword("main-content");
200
				loadChangeAuthUserPassword("main-content");
154
			});
201
			});
155
}
202
}
156
function addAuthUser(emailId, firstName, lastName, mobileNumber,gmailId) {
203
function addAuthUser(emailId, firstName, lastName, mobileNumber, gmailId) {
157
	var params = {
204
	var params = {
158
		"emailId" : emailId,
205
		"emailId" : emailId,
159
		"firstName" : firstName,
206
		"firstName" : firstName,
160
		"lastName" : lastName,
207
		"lastName" : lastName,
161
		"mobileNumber" : mobileNumber,
208
		"mobileNumber" : mobileNumber,
162
		"gmailId":gmailId
209
		"gmailId" : gmailId
163
	}
210
	}
164
	doPostAjaxRequestWithParamsHandler(
211
	doPostAjaxRequestWithParamsHandler(
165
			context + "/createAuthUser",
212
			context + "/createAuthUser",
166
			params,
213
			params,
167
			function(response) {
214
			function(response) {