Blame view

script.js 17.8 KB
53b83aa9e   Palak Handa   first commit
1
  	// create the module and name it scotchApp
f263889f0   Palak Handa   analytics work
2
  	var scotchApp = angular.module('scotchApp', ['ngRoute','angular-google-analytics']);
53b83aa9e   Palak Handa   first commit
3
4
5
  
  	// configure our routes
  	scotchApp.config(function($routeProvider) {
6ae8d3cdd   Palak Handa   add new module
6
  	    $routeProvider
dcb703070   Palak Handa   updated new form ...
7
  	    	// route for the Home page
6ae8d3cdd   Palak Handa   add new module
8
  	        .when('/', {
dcb703070   Palak Handa   updated new form ...
9
10
11
  	            templateUrl: 'pages/Home.html',
  	            controller: 'mainController'
  	        })
b96c88383   Palak Handa   amount change
12
  	        // route for the caricatures page
e856f2161   Palak Handa   new page design
13
  	        .when('/caricatures', {
b96c88383   Palak Handa   amount change
14
  	            templateUrl: 'pages/caricatures.html',
6ae8d3cdd   Palak Handa   add new module
15
16
  	            controller: 'mainController'
  	        })
317a80571   Palak Handa   city selected
17
18
19
20
21
  	        // // route for the paymentVerify page
  	        // .when('/pendingPayment/:id', {
  	        //     templateUrl: 'pages/verify.html',
  	        //     controller: 'verifyController'
  	        // })
6ae8d3cdd   Palak Handa   add new module
22

b96c88383   Palak Handa   amount change
23
  	        // route for the registration page
e856f2161   Palak Handa   new page design
24
  	        .when('/registration', {
b96c88383   Palak Handa   amount change
25
26
27
28
29
30
  	            templateUrl: 'pages/registration.html',
  	            controller: 'registrationController'
  	        })
  
  	        // route for the ambassador page
  	        .when('/startupJalsaPromocode', {
6ae8d3cdd   Palak Handa   add new module
31
32
33
  	            templateUrl: 'pages/ambassador.html',
  	            controller: 'ambassadorController'
  	        })
5348de778   Palak Handa   design updated
34
35
36
37
  
  	        // route for the confirmation page
  	        .when('/confirmation', {
  	            templateUrl: 'pages/confirmation.html',
b96c88383   Palak Handa   amount change
38
  	            controller: 'registrationController'
5348de778   Palak Handa   design updated
39
  	        })
6ae8d3cdd   Palak Handa   add new module
40
  	});
53b83aa9e   Palak Handa   first commit
41

f263889f0   Palak Handa   analytics work
42
43
  	scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) {
  	   	// Add configuration code as desired
61b69ada0   Palak Handa   design updated
44
  	   	 AnalyticsProvider.setAccount('UA-106416759-1');  //UU-XXXXXXX-X should be your tracking code
f263889f0   Palak Handa   analytics work
45
46
47
48
49
50
51
52
  
  	   	// Track all routes (default is true).
  	  	AnalyticsProvider.trackPages(true);
  
  	  	// Track all URL query params (default is false).
  	  	AnalyticsProvider.trackUrlParams(true);
  
  	}]).run(['Analytics', function(Analytics) { }]);
124f7528f   Palak Handa   minor change
53
54
  	scotchApp.constant("BASE_URL", "http://35.154.24.158:4001/v1")
  	//scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/v1")
6ae8d3cdd   Palak Handa   add new module
55

2d6a9fbea   Palak Handa   complete bugs
56
  	// create the controller and inject Angular's $scope
f263889f0   Palak Handa   analytics work
57
  	scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL, Analytics) {
6ae8d3cdd   Palak Handa   add new module
58
59
60
61
62
63
  	    $scope.data = {
  	        show: true,
  	        hide: false
  	    };
  
  	    $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
e847b36f8   Palak Handa   minor changes
64
  	    $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
c62079487   Palak Handa   updated design
65
  	    // $scope.Textshow = "yes"
6ae8d3cdd   Palak Handa   add new module
66
  	    $scope.max = 100;
88dd26b3d   Palak Handa   update
67
  	    $scope.formPage = false;
6ae8d3cdd   Palak Handa   add new module
68
69
  	    $scope.current = 0;
  	    $scope.payingAmnt = 0;
6ae8d3cdd   Palak Handa   add new module
70
  	    $scope.data = {};
ea3c31126   Palak Handa   complete
71
  	    $scope.discountAmount = 0;
7b2bef227   Palak Handa   background image ...
72
  	    // $scope.data.quantity = "1";
6ae8d3cdd   Palak Handa   add new module
73
74
  	    $scope.check = false;
  	    $scope.numberCheck = false;
6ae8d3cdd   Palak Handa   add new module
75
  	    $scope.paymentResult = {};
6ae8d3cdd   Palak Handa   add new module
76
77
78
79
80
  	    var data = {
  	        "amount": $scope.payingAmnt,
  	        "currency": "INR",
  	        "status": "pending"
  	    }
53b83aa9e   Palak Handa   first commit
81

dcb703070   Palak Handa   updated new form ...
82
  	    $scope.apply = function() {
317a80571   Palak Handa   city selected
83
  	    	//Analytics.trackEvent('register', 'click', 'Registration');
e856f2161   Palak Handa   new page design
84
  			$location.path("/caricatures")
dcb703070   Palak Handa   updated new form ...
85
  		}
629cc1f8f   Palak Handa   minor changes
86

317a80571   Palak Handa   city selected
87
88
89
90
91
92
  	    $scope.data.city = '';
  	    $scope.watch =  function(value){
  	    	console.log("cllll",value)
  	    	$scope.data.city = value;
  	    	localStorage.setItem("city" ,value);
  	    	//$location.path('/registration').search({city: value});
9d4fa776e   Palak Handa   minor change space
93
  	    	$location.path('/registration');
317a80571   Palak Handa   city selected
94
  	    	//$state.go('registration', { 'city': value})
163c5adae   Palak Handa   minor changes
95
  	    }
e847b36f8   Palak Handa   minor changes
96

6a9f1f41e   Palak Handa   add left side but...
97
98
99
100
  	    $scope.select =  function(url){
  	    	console.log("cllll")
  	    	window.open(url)
  	    }
6ae8d3cdd   Palak Handa   add new module
101
  	    $scope.stagekeyPress = function() {
f8b43c6f8   Palak Handa   design changes
102
  	        $('.icon-circle-a').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
103
104
  	    }
  	    $scope.sectorkeyPress = function() {
f8b43c6f8   Palak Handa   design changes
105
  	        $('.icon-circle-b').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
106
  	    }
163c5adae   Palak Handa   minor changes
107
  	    $scope.productLaunchkeyPress = function() {
f8b43c6f8   Palak Handa   design changes
108
  	        $('.icon-circle-ab').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
109
  	    }
163c5adae   Palak Handa   minor changes
110
  	    $scope.launchPeriodkeyPress = function() {
f8b43c6f8   Palak Handa   design changes
111
  	        $('.icon-circle-abc').css('background-color', 'rgb(25, 104, 157)');
c62079487   Palak Handa   updated design
112
  	    }
7b2bef227   Palak Handa   background image ...
113
114
  	    $scope.industrykeyPress = function(quantity) {
  	    	console.log("fghj",quantity)
f8b43c6f8   Palak Handa   design changes
115
  	    	$('.icon-circle-abcdefg').css('background-color', 'rgb(25, 104, 157)');
c62079487   Palak Handa   updated design
116
  	    }
204302c02   Palak Handa   minor changes
117
118
119
120
121
  	    $scope.industryNamekeyPress = function(firstName) {
  	        console.log("lastName==", firstName);
  	        if (firstName == undefined) {
  	            $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
122
  	            $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)');
204302c02   Palak Handa   minor changes
123
124
  	        }
  	    }
c62079487   Palak Handa   updated design
125
  	    $scope.amountkeyPress = function() {
f8b43c6f8   Palak Handa   design changes
126
  	        $('.icon-circle-bc').css('background-color', 'rgb(25, 104, 157)');
c62079487   Palak Handa   updated design
127
  	    }
2321f803a   Palak Handa   updated changes
128
129
130
  	    $scope.firstNamekeyPress = function(name) {
  	        console.log("lastName==", name);
  	        if (name == undefined) {
6ae8d3cdd   Palak Handa   add new module
131
132
  	            $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
133
  	            $('.icon-circle-c').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
134
135
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
136

6ae8d3cdd   Palak Handa   add new module
137
138
139
140
141
  	    $scope.emailkeyPress = function(email) {
  	        console.log("email", email);
  	        if (email == undefined) {
  	            $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
142
  	            $('.icon-circle-d').css('background-color', 'rgb(25, 104, 157)');
8ddc94e00   Palak Handa   update
143
  	        }	                
6ae8d3cdd   Palak Handa   add new module
144
  	    }
6ae8d3cdd   Palak Handa   add new module
145
146
  	    $scope.phonekeyPress = function(number) {
  	        console.log("number", number);
204302c02   Palak Handa   minor changes
147
  	        if (number == undefined || number == '') {
6ae8d3cdd   Palak Handa   add new module
148
149
  	            $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
150
  	            $('.icon-circle-e').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
151
152
153
154
155
156
157
158
  	        }
  	    }
  
  	    $scope.citykeyPress = function(city) {
  	        console.log("city", city);
  	        if (city == undefined) {
  	            $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
159
  	            $('.icon-circle-f').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
160
161
  	        }
  	    }
7e3bb1018   Palak Handa   field added
162
  	    $scope.startupNamekeyPress = function(q) {
6ae8d3cdd   Palak Handa   add new module
163
164
165
  	        if (q == undefined) {
  	            $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
166
  	            $('.icon-circle-x').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
167
168
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
169
  	    $scope.linkedInkeyPress = function(technology) {
204302c02   Palak Handa   minor changes
170
  	        if (technology == undefined || technology == '') {
6ae8d3cdd   Palak Handa   add new module
171
172
  	            $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
173
  	            $('.icon-circle-h').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
174
175
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
176
  	    $scope.companykeyPress = function(problem) {
6ae8d3cdd   Palak Handa   add new module
177
178
179
  	        if (problem == undefined) {
  	            $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
180
  	            $('.icon-circle-i').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
181
182
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
183
  	    $scope.productNamekeyPress = function(solution) {
6ae8d3cdd   Palak Handa   add new module
184
185
186
  	        if (solution == undefined) {
  	            $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
187
  	            $('.icon-circle-j').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
188
189
190
  	        }
  	    }
  	    $scope.businesskeyPress = function(business) {
58efec61e   Palak Handa   color change
191
192
193
194
195
  	    	if (business == undefined) {
  	        	$('.icon-circle-p').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-p').css('background-color', 'rgb(25, 104, 157)');
  	        }
6ae8d3cdd   Palak Handa   add new module
196
  	    }
dcb703070   Palak Handa   updated new form ...
197
  	    $scope.websitekeyPress = function(prototype) {
204302c02   Palak Handa   minor changes
198
  	        if (prototype == undefined  || prototype == '') {
6ae8d3cdd   Palak Handa   add new module
199
200
  	            $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
201
  	            $('.icon-circle-k').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
202
203
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
204
  	    $scope.employeekeyPress = function(market) {
204302c02   Palak Handa   minor changes
205
  	        if (market == undefined || market == '') {
6ae8d3cdd   Palak Handa   add new module
206
207
  	            $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
208
  	            $('.icon-circle-l').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
209
210
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
211
  	    $scope.annualkeyPress = function(risk) {
204302c02   Palak Handa   minor changes
212
  	        if (risk == undefined || risk == '') {
6ae8d3cdd   Palak Handa   add new module
213
214
  	            $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
215
  	            $('.icon-circle-m').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
216
217
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
218
  	    $scope.revenuekeyPress = function(team) {
81526b56d   Palak Handa   minor change
219
  	        if (team == undefined) {
6ae8d3cdd   Palak Handa   add new module
220
221
  	            $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
222
  	            $('.icon-circle-n').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
223
224
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
225
  	    $scope.descriptionkeyPress = function(pitch) {
6ae8d3cdd   Palak Handa   add new module
226
227
228
  	        if (pitch == undefined) {
  	            $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
229
  	            $('.icon-circle-z').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
230
231
  	        }
  	    }
e284785e4   Palak Handa   update new field
232
  	    $scope.discountkeyPress = function(discount) {
e284785e4   Palak Handa   update new field
233
234
235
  	        if (discount == undefined) {
  	            $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
236
  	            $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)');
e284785e4   Palak Handa   update new field
237
238
  	        }
  	    }
91eeb4455   Palak Handa   modify
239
240
241
242
  	    $scope.removeNooError = function() {
  	    	$('#invalidIdea').css('display', 'block');
  	        $('#noExist').css('display', 'none');
  	    };
c62079487   Palak Handa   updated design
243
  	    $scope.ideakeyPress = function(financial) {
6ae8d3cdd   Palak Handa   add new module
244
245
246
247
  	        console.log("financial", financial);
  	        if (financial == undefined) {
  	            $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
248
  	            $('.icon-circle-q').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
249
250
  	        }
  	    }
c62079487   Palak Handa   updated design
251
252
253
254
255
256
  
  	    $scope.fundkeyPress = function(financial) {
  	        console.log("financial", financial);
  	        if (financial == undefined) {
  	            $('.icon-circle-y').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
257
  	            $('.icon-circle-y').css('background-color', 'rgb(25, 104, 157)');
c62079487   Palak Handa   updated design
258
259
  	        }
  	    }
2d6a9fbea   Palak Handa   complete bugs
260
261
262
263
  	    $scope.changeReferalIconColor = function(referalToken){
  	    	if (referalToken == undefined || referalToken == '') {
  	    		$('.referel-icon').css('background-color', 'rgb(102, 102, 102)');
  	    	}else {
f8b43c6f8   Palak Handa   design changes
264
  	            $('.referel-icon').css('background-color', 'rgb(25, 104, 157)');
2d6a9fbea   Palak Handa   complete bugs
265
266
  	        }
  	    }
6ae8d3cdd   Palak Handa   add new module
267

53b83aa9e   Palak Handa   first commit
268
  	});
b96c88383   Palak Handa   amount change
269
  	scotchApp.controller('registrationController', function($scope, $http, $location, $rootScope,$route,BASE_URL) {
6ae8d3cdd   Palak Handa   add new module
270
  		$scope.data = {};
8e25d825b   Palak Handa   changes the rajor...
271
272
  		$scope.check = false;
  	    $scope.numberCheck = false;
e856f2161   Palak Handa   new page design
273
274
  	    $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
  	    $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
e856f2161   Palak Handa   new page design
275
276
277
278
  	    $scope.max = 100;
  	    $scope.formPage = false;
  	    $scope.current = 0;
  	    $scope.payingAmnt = 0;
e856f2161   Palak Handa   new page design
279
280
281
282
283
284
285
286
287
288
  	    $scope.discountAmount = 0;
  	    // $scope.data.quantity = "1";
  	    $scope.check = false;
  	    $scope.numberCheck = false;
  	    $scope.paymentResult = {};
  	    var data = {
  	        "amount": $scope.payingAmnt,
  	        "currency": "INR",
  	        "status": "pending"
  	    }
8e25d825b   Palak Handa   changes the rajor...
289

5348de778   Palak Handa   design updated
290
291
292
293
  	    $scope.removeError = function() {
  	        $('#invalidEmail').css('display', 'none');
  	        $('#alreadyExist').css('display', 'none');
  	    };
248bd9b7c   Palak Handa   link validation
294
295
296
297
298
  		$scope.emailcheck = function(val) {
  	        if (val == undefined) {
  	            $('#invalidEmail').css('display', 'block');
  	        } else {
  	        	$('#alreadyExist').css('display', 'block');
248bd9b7c   Palak Handa   link validation
299
300
  	        }
  	    };
b678502c9   Palak Handa   update
301

dee1f7479   Palak Handa   validation use
302
303
304
305
306
307
308
309
310
311
312
313
  	    $scope.removeNoError = function() {
  	        $('#invalidNumber').css('display', 'none');
  	        $('#alreadyExist').css('display', 'none');
  	    };
  
  		$scope.numbercheck = function(val) {
  	        if (val == undefined) {
  	            $('#invalidNumber').css('display', 'block');
  	        } else {
  	        	$('#alreadyExist').css('display', 'block');
  	        }
  	    };
317a80571   Palak Handa   city selected
314
  	 	// $scope.$on('city', function (event, value) {
9d4fa776e   Palak Handa   minor change space
315
316
  			$scope.data.city = localStorage.getItem("city");
  			console.log("HERE===",$scope.data.city );
317a80571   Palak Handa   city selected
317
  		// });
b96c88383   Palak Handa   amount change
318
319
320
321
322
323
324
  
  		$rootScope.tokenCall = function(val) {
  	        console.log('val-------->', val);
  	        if (val == undefined) {
  	            $('#invalidToken').css('display', 'block');
  	        } else {
  	        	val = val.toUpperCase();
eb567dbaa   Palak Handa   minr change
325
  	        	$http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "' + val + '"}}')
b96c88383   Palak Handa   amount change
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
  				    .then(function(searchResult) {
  				    	console.log("searchResult",searchResult)
  				        if (searchResult.data.length == 0) {
  	                    	$scope.tokencheck = false;
  	                    	 $scope.discountAmount = 0;
  	                	} else {
  	                		console.log("===searchResult.data[0].discount===",searchResult.data[0].discount);
  	                    	 $scope.discountpercentage = searchResult.data[0].discount;
  	                    	 console.log("===searchResultdiscountpercentage===",$scope.discountpercentage);
  	                    	$scope.tokencheck = true;
  	                	}
  				    },function(err){
  				    	console.log(err)
  				});
  	           
  	        }
  	    };
6ae8d3cdd   Palak Handa   add new module
343
  		$scope.submit = function() {
b96c88383   Palak Handa   amount change
344
345
346
347
348
  		$scope.ticketAmnt = 500;
  		if($scope.tokencheck == false){
      		$scope.data.referalToken = null;
      	}
  		if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) {
e856f2161   Palak Handa   new page design
349
  			var x = document.getElementById("snackbar")
e856f2161   Palak Handa   new page design
350
  		    setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
317a80571   Palak Handa   city selected
351
  		}else if($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) {	
e856f2161   Palak Handa   new page design
352
  			$scope.infoForm = true;
e856f2161   Palak Handa   new page design
353
354
  			$scope.detail = {};
  			$scope.data.phone = "+91"+$scope.data.number;
7cdbd289e   Palak Handa   content change
355
356
357
  			if($scope.data.referalToken == null){
              	$scope.data.referalToken = "N.A."
              }
e856f2161   Palak Handa   new page design
358
359
360
361
362
363
364
  			$http({
  	           method: 'POST',
  	           url: BASE_URL+'/applicants',
  	           data: $scope.data,
  	           headers: {}
  	           }).then(function mySuccess(result) {
  	           		console.log("=====result=====",result)
e856f2161   Palak Handa   new page design
365
366
367
  	           		$scope.detail = result;
  	               data.applicantId = result.data.id;
  	               $scope.userId = result.data.id;
b96c88383   Palak Handa   amount change
368
369
370
371
372
373
374
  	                console.log("=====data=====",data)
  	                var amount = $scope.ticketAmnt * 100
  			        if($scope.tokencheck == true){
  				        var amount = $scope.ticketAmnt
  				        console.log("====$scope.discountpercentage====",$scope.discountpercentage);
  				        if($scope.discountpercentage == "100") {
  				        	$scope.discountpercentage = "99.8";
eb567dbaa   Palak Handa   minr change
375
  				        	console.log("$scope.discountpercentage====",$scope.discountpercentage)
b96c88383   Palak Handa   amount change
376
377
378
379
380
381
382
383
384
385
386
  				        }
  				        console.log("====$scope.discountpercentage====",$scope.discountpercentage);
  				        $scope.percDiscount = $scope.discountpercentage/100;
  				        console.log("====$scope.percDiscount====",$scope.percDiscount);
  				        console.log("====amount=====",amount);
  					    $scope.discountAmount = amount * $scope.percDiscount;
  					    console.log("finalAmount====>",$scope.discountAmount)
  			        }
  			        var taxAmount = $scope.ticketAmnt - $scope.discountAmount
  		        	console.log("$scope.taxTotal----",taxAmount)
  		        	$scope.payingAmnt = taxAmount;
e8488da07   Palak Handa   amount regarding ...
387
  		        	console.log("====$scope.payingAmnt====",$scope.payingAmnt)
b96c88383   Palak Handa   amount change
388
  		        	$scope.payingAmnt = $scope.payingAmnt.toFixed()	                
e8488da07   Palak Handa   amount regarding ...
389
390
  	                data.amount = $scope.payingAmnt;
  	                console.log("data.amount==",data.amount)
e856f2161   Palak Handa   new page design
391
392
393
394
395
396
397
398
399
400
401
402
  	               if($scope.detail != null){
  					$http({
  					   method: 'POST',
  					   url: BASE_URL+'/payments',
  					   data: data,
  					   headers: {}
  					   }).then(function mySuccess(paymentResult) {
  					       $scope.paymentResult = paymentResult;
  					   }, function myError(error) {
  					});
  				}
  				var i = 0;
b96c88383   Palak Handa   amount change
403
  				$scope.payingAmnt =  $scope.payingAmnt * 100;
e856f2161   Palak Handa   new page design
404
  				var options = {
321ed3c51   Palak Handa   delete one card
405
406
  					//"key": "rzp_test_YwHsVFiDIQ2WUQ",
  					"key": "rzp_live_mkmCb4FkstuWaS",
e856f2161   Palak Handa   new page design
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
  					"amount": $scope.payingAmnt,
  
  					"name": "Startup Jalsa",
  					"description":"amount",
  					"currency": "INR",
  					"status": "done",
  
  					"prefill": {
  						"email": $scope.detail.email,
  						"contact": $scope.detail.phone
  					},
  
  					"theme": {
  						"color": "#2196f3 ",
  						"image_padding":"NO"
  					},
  					"modal": {
  						"ondismiss": function(){
  						}
  					},
  					"handler": function (response){
  						createPayment(response);
  					}
  				};
  				var rzp1 = new Razorpay(options);
  				rzp1.open();
  				$scope.paymentResponse = {};
  				function createPayment(response){
  					console.log("response12333333",response)
  					$scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
  					$scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId;
  					$scope.paymentResponse.amount = data.amount;
  					$scope.paymentResponse.currency = "INR";
  					$scope.paymentResponse.status = $scope.paymentResult.data.status;
e8488da07   Palak Handa   amount regarding ...
441
  					console.log("$scope.paymentResponse.amount=====",$scope.paymentResponse.amount)
e856f2161   Palak Handa   new page design
442
443
444
445
446
447
448
  					$http({
  					   method: 'PUT',
  					   url: BASE_URL+'/payments/'+$scope.paymentResult.data.id,
  					   data: $scope.paymentResponse,
  					   headers: {}
  					   }).then(function mySuccess(searchResult) {
  					   	console.log("searchResult",searchResult)
5e3b90de3   Palak Handa   add new field
449
  					   	$location.path("/confirmation")
e856f2161   Palak Handa   new page design
450
451
452
453
454
  					   }, function myError(error) {
  					});
  				}
  
  	           }, function myError(error) {
317a80571   Palak Handa   city selected
455

e856f2161   Palak Handa   new page design
456
  	        });
317a80571   Palak Handa   city selected
457

e856f2161   Palak Handa   new page design
458
  		}
e856f2161   Palak Handa   new page design
459

317a80571   Palak Handa   city selected
460
461
462
  	}
  	
  });
53b83aa9e   Palak Handa   first commit
463

b96c88383   Palak Handa   amount change
464
465
466
467
468
469
470
  scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) {
  		$scope.data = {};
  		$scope.check = false;
  	    $scope.numberCheck = false;
  
  		$scope.submit = function() {
  			console.log($scope.data.name)
04ffff01c   Palak Handa   minor change
471
472
473
  			var randomNumber = ""+Math.random();
  			var nameSpliced = $scope.data.name.slice(0,5);
  			var numberSpliced = randomNumber.slice(2,4);;
b96c88383   Palak Handa   amount change
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
  			$scope.data.referalToken = nameSpliced+numberSpliced;
  			$scope.data.referalToken = $scope.data.referalToken.toUpperCase();
  			console.log("dsdfs",numberSpliced);
  	         $http({
  	                method: 'POST',
  	                url: BASE_URL + '/ambassadors',
  	                data: $scope.data,
  	                headers: {}
  	            }).then(function mySuccess(result) {
  	                console.log("result", result)
  	                $scope.detail = result;
  	                $('#myModal').modal('show');
  	              	$scope.data.name = '';
  	                $scope.data.email = '';
  	                $scope.data.mobile = '';
  	                //$scope.data.discount = '';
  	            
  	            }, function myError(error) {
  	            	console.log(error)
  	            	console.log(error.data.error.message)
  	            });
b96c88383   Palak Handa   amount change
495
496
  	        }
  	});
96991e0c1   Palak Handa   update
497