Blame view

script.js 32.6 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
  
  	// configure our routes
0d7cf45ec   Palak Handa   timer use
5
  	scotchApp.config(function($routeProvider,$locationProvider) {
8586ba494   Palak Handa   html5 mode
6

8586ba494   Palak Handa   html5 mode
7
  		// use the HTML5 History API
6a702f93c   apple   country & citynam...
8
9
10
11
          // $locationProvider.html5Mode({
          // 	enabled: true,
          // 	requireBase: false
          // });
3c4db43f3   apple   design new form
12
         	//$locationProvider.hashPrefix('!');
6ae8d3cdd   Palak Handa   add new module
13
  	    $routeProvider
dcb703070   Palak Handa   updated new form ...
14
  	    	// route for the Home page
6ae8d3cdd   Palak Handa   add new module
15
  	        .when('/', {
dcb703070   Palak Handa   updated new form ...
16
17
18
  	            templateUrl: 'pages/Home.html',
  	            controller: 'mainController'
  	        })
b96c88383   Palak Handa   amount change
19
  	        // route for the caricatures page
e856f2161   Palak Handa   new page design
20
  	        .when('/caricatures', {
b96c88383   Palak Handa   amount change
21
  	            templateUrl: 'pages/caricatures.html',
6ae8d3cdd   Palak Handa   add new module
22
23
  	            controller: 'mainController'
  	        })
857ebc69e   Palak Handa   timer add
24
25
26
27
28
  	        // route for the paymentVerify page
  	        .when('/pendingPayment/:id', {
  	            templateUrl: 'pages/verify.html',
  	            controller: 'verifyController'
  	        })
6ae8d3cdd   Palak Handa   add new module
29

b96c88383   Palak Handa   amount change
30
  	        // route for the registration page
5734bf6dc   apple   design change
31
  	        .when('/registration', {
b96c88383   Palak Handa   amount change
32
33
34
  	            templateUrl: 'pages/registration.html',
  	            controller: 'registrationController'
  	        })
8586ba494   Palak Handa   html5 mode
35
  	        //route for the ambassador page
2aba79170   Palak Handa   minor change
36
37
38
39
  	        // .when('/startupJalsaPromocode', {
  	        //     templateUrl: 'pages/ambassador.html',
  	        //     controller: 'ambassadorController'
  	        // })
5348de778   Palak Handa   design updated
40
41
42
43
  
  	        // route for the confirmation page
  	        .when('/confirmation', {
  	            templateUrl: 'pages/confirmation.html',
b96c88383   Palak Handa   amount change
44
  	            controller: 'registrationController'
5348de778   Palak Handa   design updated
45
  	        })
3c4db43f3   apple   design new form
46
47
48
  	        .otherwise({ 
  	        	redirectTo: '/' 
  	        });
8586ba494   Palak Handa   html5 mode
49

6ae8d3cdd   Palak Handa   add new module
50
  	});
53b83aa9e   Palak Handa   first commit
51

f263889f0   Palak Handa   analytics work
52
53
  	scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) {
  	   	// Add configuration code as desired
61b69ada0   Palak Handa   design updated
54
  	   	 AnalyticsProvider.setAccount('UA-106416759-1');  //UU-XXXXXXX-X should be your tracking code
f263889f0   Palak Handa   analytics work
55
56
57
58
59
60
61
62
  
  	   	// 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
63
64
  	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
65

2d6a9fbea   Palak Handa   complete bugs
66
  	// create the controller and inject Angular's $scope
857ebc69e   Palak Handa   timer add
67
  	scotchApp.controller('mainController', function($scope, $http, $window, $location, $route, $rootScope, BASE_URL, Analytics) {
6ae8d3cdd   Palak Handa   add new module
68
69
70
  	    $scope.data = {
  	        show: true,
  	        hide: false
5734bf6dc   apple   design change
71
72
73
  		};
  		window.onload = function(){
  			var element = document.getElementById("defaultcountry");
6a702f93c   apple   country & citynam...
74
  			   element.classList.add("btn-active");
a006f2b11   apple   name changes
75
  			   //document.getElementById("ahmedabad").src = "images/Ahmedabad_1.png";
5734bf6dc   apple   design change
76
  		}
6ae8d3cdd   Palak Handa   add new module
77

0d7cf45ec   Palak Handa   timer use
78
  		var chennai = new Date("Sept 19, 2018 12:00:00").getTime();
e3d25d261   Palak Handa   delete url
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = chennai - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("chennai").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("chennai").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
857ebc69e   Palak Handa   timer add
101
  		var hyderabad = new Date("Sept 22, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = hyderabad - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("hyderabad").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("hyderabad").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
857ebc69e   Palak Handa   timer add
124
  		var mumbai = new Date("Sept 26, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = mumbai - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("mumbai").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("mumbai").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
50e8f0737   Palak Handa   minor change
147

857ebc69e   Palak Handa   timer add
148
  		var kolkata = new Date("Oct 3, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = kolkata - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("kolkata").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("kolkata").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
50e8f0737   Palak Handa   minor change
171

857ebc69e   Palak Handa   timer add
172
  		var jaipur = new Date("Oct 5, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = jaipur - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("jaipur").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("jaipur").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
50e8f0737   Palak Handa   minor change
195

857ebc69e   Palak Handa   timer add
196
  		var delhi = new Date("Oct 8, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = delhi - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("delhi").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("delhi").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
50e8f0737   Palak Handa   minor change
219

857ebc69e   Palak Handa   timer add
220
  		var kanpur = new Date("Oct 10, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = kanpur - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("kanpur").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("kanpur").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
50e8f0737   Palak Handa   minor change
243

857ebc69e   Palak Handa   timer add
244
  		var ahmedabad = new Date("Oct 12, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = ahmedabad - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("ahmedabad").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("ahmedabad").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
50e8f0737   Palak Handa   minor change
267

857ebc69e   Palak Handa   timer add
268
  		var bengaluru = new Date("Oct 13, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = bengaluru - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("bengaluru").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("bengaluru").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
50e8f0737   Palak Handa   minor change
291

857ebc69e   Palak Handa   timer add
292
  		var dharamsala = new Date("Dec 14, 2018 14:00:00").getTime();
e3d25d261   Palak Handa   delete url
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
  		// Update the count down every 1 second
  		var x = setInterval(function() {
  		    // Get todays date and time
  		    var now = new Date().getTime();
  		    // Find the distance between now an the count down date
  		    var distance = dharamsala - now;
  		    // Time calculations for days, hours, minutes and seconds
  		    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  		    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  		    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  		    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  		    $scope.timer = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s "
  		    // Output the result in an element with id="demo"
  		    document.getElementById("dharamsala").innerHTML = days + "d " + hours + "h "
  		    + minutes + "m " + seconds + "s ";
  		    // If the count down is over, write some text 
  		    if (distance < 0) {
  		        clearInterval(x);
  		        document.getElementById("dharamsala").innerHTML = "EXPIRED";
  		    }
  		}, 1000);
50e8f0737   Palak Handa   minor change
315

6ae8d3cdd   Palak Handa   add new module
316
  	    $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
e847b36f8   Palak Handa   minor changes
317
  	    $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
c62079487   Palak Handa   updated design
318
  	    // $scope.Textshow = "yes"
6ae8d3cdd   Palak Handa   add new module
319
  	    $scope.max = 100;
88dd26b3d   Palak Handa   update
320
  	    $scope.formPage = false;
6ae8d3cdd   Palak Handa   add new module
321
322
  	    $scope.current = 0;
  	    $scope.payingAmnt = 0;
6ae8d3cdd   Palak Handa   add new module
323
  	    $scope.data = {};
ea3c31126   Palak Handa   complete
324
  	    $scope.discountAmount = 0;
7b2bef227   Palak Handa   background image ...
325
  	    // $scope.data.quantity = "1";
6ae8d3cdd   Palak Handa   add new module
326
327
  	    $scope.check = false;
  	    $scope.numberCheck = false;
6ae8d3cdd   Palak Handa   add new module
328
  	    $scope.paymentResult = {};
6ae8d3cdd   Palak Handa   add new module
329
330
331
332
  	    var data = {
  	        "amount": $scope.payingAmnt,
  	        "currency": "INR",
  	        "status": "pending"
dcb703070   Palak Handa   updated new form ...
333
  		}
5734bf6dc   apple   design change
334
335
336
337
338
339
340
  		
  		$scope.showval = true;
  		$scope.hideval = false;
  		$scope.showvalue = false;
  		$scope.hidevalue = false;
  		$scope.isShowHide = function (value) {
  			console.log(value)
1b31b20bf   apple   auto highlighted ...
341
342
  			var element = document.getElementById("defaultcountry");
  			element.classList.remove("btn-active");
5734bf6dc   apple   design change
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
  			if (value == "INDIA") {
  				console.log("value",value)
  				$scope.showval = true;
  				$scope.hideval = false;
  				$scope.showvalue = false;
  				$scope.hidevalue = false;
  			}
  			else if (value == "SRI LANKA") {
  				console.log("value1",value)
  				$scope.showval = false;
  				$scope.hideval = true;
  				$scope.showvalue = false;
  				$scope.hidevalue = false;
  			}
  			else if (value == "BANGLADESH") {
  				console.log("value2",value)
  				$scope.showval = false;
  				$scope.hideval = false;
  				$scope.showvalue = true;
  				$scope.hidevalue = false;
  			}
  			else {
  				console.log("value3",value)
  				$scope.showval = false;
  				$scope.hideval = false;
  				$scope.showvalue = false;
  				$scope.hidevalue = true;
  			}
  		}
  
  	    // $scope.apply = function() {
  	    // 	//Analytics.trackEvent('register', 'click', 'Registration');
  		// 	$location.path("/caricatures")
  		// }
629cc1f8f   Palak Handa   minor changes
377

3c4db43f3   apple   design new form
378
379
  	    // $scope.data.city = '';
  	    $scope.watch =  function(){
a006f2b11   apple   name changes
380
  			//document.getElementById("ahmedabad").src = "";
3c4db43f3   apple   design new form
381
382
  	    	// console.log("cllll",value)
  	    	// $scope.data.city = value;
857ebc69e   Palak Handa   timer add
383
384
385
386
  	    	// if($scope.data.city == "Chennai"){
  	    	// 	console.log("cllll1",value)
  	    	// 	$window.location.href = 'http://35.154.24.158:8007';
  	    	// }else{
3c4db43f3   apple   design new form
387
388
  	    		// console.log("cllll2",value)
  		    	// localStorage.setItem("city" ,value);
857ebc69e   Palak Handa   timer add
389
  		    	//$location.path('/registration').search({city: value});
5734bf6dc   apple   design change
390
391
  				// $location.path('/registration/'+value+'');
  				$location.path('/registration');
857ebc69e   Palak Handa   timer add
392
393
  		    	//$state.go('registration', { 'city': value})
  	    	// }
163c5adae   Palak Handa   minor changes
394
  	    }
e847b36f8   Palak Handa   minor changes
395

6a9f1f41e   Palak Handa   add left side but...
396
397
398
399
  	    $scope.select =  function(url){
  	    	console.log("cllll")
  	    	window.open(url)
  	    }
6ae8d3cdd   Palak Handa   add new module
400
  	    $scope.stagekeyPress = function() {
f8b43c6f8   Palak Handa   design changes
401
  	        $('.icon-circle-a').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
402
403
  	    }
  	    $scope.sectorkeyPress = function() {
f8b43c6f8   Palak Handa   design changes
404
  	        $('.icon-circle-b').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
405
  	    }
163c5adae   Palak Handa   minor changes
406
  	    $scope.productLaunchkeyPress = function() {
f8b43c6f8   Palak Handa   design changes
407
  	        $('.icon-circle-ab').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
408
  	    }
163c5adae   Palak Handa   minor changes
409
  	    $scope.launchPeriodkeyPress = function() {
f8b43c6f8   Palak Handa   design changes
410
  	        $('.icon-circle-abc').css('background-color', 'rgb(25, 104, 157)');
c62079487   Palak Handa   updated design
411
  	    }
7b2bef227   Palak Handa   background image ...
412
413
  	    $scope.industrykeyPress = function(quantity) {
  	    	console.log("fghj",quantity)
f8b43c6f8   Palak Handa   design changes
414
  	    	$('.icon-circle-abcdefg').css('background-color', 'rgb(25, 104, 157)');
c62079487   Palak Handa   updated design
415
  	    }
204302c02   Palak Handa   minor changes
416
417
418
419
420
  	    $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
421
  	            $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)');
204302c02   Palak Handa   minor changes
422
423
  	        }
  	    }
c62079487   Palak Handa   updated design
424
  	    $scope.amountkeyPress = function() {
f8b43c6f8   Palak Handa   design changes
425
  	        $('.icon-circle-bc').css('background-color', 'rgb(25, 104, 157)');
c62079487   Palak Handa   updated design
426
  	    }
2321f803a   Palak Handa   updated changes
427
428
429
  	    $scope.firstNamekeyPress = function(name) {
  	        console.log("lastName==", name);
  	        if (name == undefined) {
6ae8d3cdd   Palak Handa   add new module
430
431
  	            $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
432
  	            $('.icon-circle-c').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
433
434
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
435

6ae8d3cdd   Palak Handa   add new module
436
437
438
439
440
  	    $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
441
  	            $('.icon-circle-d').css('background-color', 'rgb(25, 104, 157)');
8ddc94e00   Palak Handa   update
442
  	        }	                
6ae8d3cdd   Palak Handa   add new module
443
  	    }
6ae8d3cdd   Palak Handa   add new module
444
445
  	    $scope.phonekeyPress = function(number) {
  	        console.log("number", number);
204302c02   Palak Handa   minor changes
446
  	        if (number == undefined || number == '') {
6ae8d3cdd   Palak Handa   add new module
447
448
  	            $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
449
  	            $('.icon-circle-e').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
450
451
452
453
454
455
456
457
  	        }
  	    }
  
  	    $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
458
  	            $('.icon-circle-f').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
459
460
  	        }
  	    }
7e3bb1018   Palak Handa   field added
461
  	    $scope.startupNamekeyPress = function(q) {
6ae8d3cdd   Palak Handa   add new module
462
463
464
  	        if (q == undefined) {
  	            $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
465
  	            $('.icon-circle-x').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
466
467
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
468
  	    $scope.linkedInkeyPress = function(technology) {
204302c02   Palak Handa   minor changes
469
  	        if (technology == undefined || technology == '') {
6ae8d3cdd   Palak Handa   add new module
470
471
  	            $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
472
  	            $('.icon-circle-h').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
473
474
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
475
  	    $scope.companykeyPress = function(problem) {
6ae8d3cdd   Palak Handa   add new module
476
477
478
  	        if (problem == undefined) {
  	            $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
479
  	            $('.icon-circle-i').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
480
481
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
482
  	    $scope.productNamekeyPress = function(solution) {
6ae8d3cdd   Palak Handa   add new module
483
484
485
  	        if (solution == undefined) {
  	            $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
486
  	            $('.icon-circle-j').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
487
488
489
  	        }
  	    }
  	    $scope.businesskeyPress = function(business) {
58efec61e   Palak Handa   color change
490
491
492
493
494
  	    	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
495
  	    }
dcb703070   Palak Handa   updated new form ...
496
  	    $scope.websitekeyPress = function(prototype) {
204302c02   Palak Handa   minor changes
497
  	        if (prototype == undefined  || prototype == '') {
6ae8d3cdd   Palak Handa   add new module
498
499
  	            $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
500
  	            $('.icon-circle-k').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
501
502
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
503
  	    $scope.employeekeyPress = function(market) {
204302c02   Palak Handa   minor changes
504
  	        if (market == undefined || market == '') {
6ae8d3cdd   Palak Handa   add new module
505
506
  	            $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
507
  	            $('.icon-circle-l').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
508
509
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
510
  	    $scope.annualkeyPress = function(risk) {
204302c02   Palak Handa   minor changes
511
  	        if (risk == undefined || risk == '') {
6ae8d3cdd   Palak Handa   add new module
512
513
  	            $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
514
  	            $('.icon-circle-m').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
515
516
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
517
  	    $scope.revenuekeyPress = function(team) {
81526b56d   Palak Handa   minor change
518
  	        if (team == undefined) {
6ae8d3cdd   Palak Handa   add new module
519
520
  	            $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
521
  	            $('.icon-circle-n').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
522
523
  	        }
  	    }
dcb703070   Palak Handa   updated new form ...
524
  	    $scope.descriptionkeyPress = function(pitch) {
6ae8d3cdd   Palak Handa   add new module
525
526
527
  	        if (pitch == undefined) {
  	            $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
528
  	            $('.icon-circle-z').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
529
530
  	        }
  	    }
e284785e4   Palak Handa   update new field
531
  	    $scope.discountkeyPress = function(discount) {
e284785e4   Palak Handa   update new field
532
533
534
  	        if (discount == undefined) {
  	            $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
535
  	            $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)');
e284785e4   Palak Handa   update new field
536
537
  	        }
  	    }
91eeb4455   Palak Handa   modify
538
539
540
541
  	    $scope.removeNooError = function() {
  	    	$('#invalidIdea').css('display', 'block');
  	        $('#noExist').css('display', 'none');
  	    };
c62079487   Palak Handa   updated design
542
  	    $scope.ideakeyPress = function(financial) {
6ae8d3cdd   Palak Handa   add new module
543
544
545
546
  	        console.log("financial", financial);
  	        if (financial == undefined) {
  	            $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
f8b43c6f8   Palak Handa   design changes
547
  	            $('.icon-circle-q').css('background-color', 'rgb(25, 104, 157)');
6ae8d3cdd   Palak Handa   add new module
548
549
  	        }
  	    }
c62079487   Palak Handa   updated design
550
551
552
553
554
555
  
  	    $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
556
  	            $('.icon-circle-y').css('background-color', 'rgb(25, 104, 157)');
c62079487   Palak Handa   updated design
557
558
  	        }
  	    }
2d6a9fbea   Palak Handa   complete bugs
559
560
561
562
  	    $scope.changeReferalIconColor = function(referalToken){
  	    	if (referalToken == undefined || referalToken == '') {
  	    		$('.referel-icon').css('background-color', 'rgb(102, 102, 102)');
  	    	}else {
f8b43c6f8   Palak Handa   design changes
563
  	            $('.referel-icon').css('background-color', 'rgb(25, 104, 157)');
2d6a9fbea   Palak Handa   complete bugs
564
565
  	        }
  	    }
6ae8d3cdd   Palak Handa   add new module
566

53b83aa9e   Palak Handa   first commit
567
  	});
1b31b20bf   apple   auto highlighted ...
568
  	scotchApp.controller('registrationController', function($q, $scope, $http, $location, $rootScope,$route,BASE_URL) {
6ae8d3cdd   Palak Handa   add new module
569
  		$scope.data = {};
8e25d825b   Palak Handa   changes the rajor...
570
571
  		$scope.check = false;
  	    $scope.numberCheck = false;
e856f2161   Palak Handa   new page design
572
573
  	    $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
574
575
576
577
  	    $scope.max = 100;
  	    $scope.formPage = false;
  	    $scope.current = 0;
  	    $scope.payingAmnt = 0;
e856f2161   Palak Handa   new page design
578
579
580
581
582
583
584
585
586
587
  	    $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...
588

5348de778   Palak Handa   design updated
589
590
591
592
  	    $scope.removeError = function() {
  	        $('#invalidEmail').css('display', 'none');
  	        $('#alreadyExist').css('display', 'none');
  	    };
248bd9b7c   Palak Handa   link validation
593
594
595
596
597
  		$scope.emailcheck = function(val) {
  	        if (val == undefined) {
  	            $('#invalidEmail').css('display', 'block');
  	        } else {
  	        	$('#alreadyExist').css('display', 'block');
248bd9b7c   Palak Handa   link validation
598
599
  	        }
  	    };
b678502c9   Palak Handa   update
600

dee1f7479   Palak Handa   validation use
601
602
603
604
605
606
607
608
609
610
611
612
  	    $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
613
  	 	// $scope.$on('city', function (event, value) {
3c4db43f3   apple   design new form
614
615
  			// $scope.data.city = localStorage.getItem("city");
  			// console.log("HERE===",$scope.data.city );
317a80571   Palak Handa   city selected
616
  		// });
500aaf838   apple   add new fields & ...
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
  		var handleFileSelect = function(evt) {
  			var files = evt.target.files;
  			var file = files[0];
  
  			if (files && file) {
  			var reader = new FileReader();
  
  			reader.onload = function(readerEvt) {
  				var binaryString = readerEvt.target.result;
  				$scope.base64textString = btoa(binaryString);
  				console.log("base64textarea",$scope.base64textString)
  			};
  
  			reader.readAsBinaryString(file);
  			}
  		};
  		if (window.File && window.FileReader && window.FileList && window.Blob) {
  			document.getElementById('filePicker').addEventListener('change', handleFileSelect, false);
  		}
c70ffa5ac   apple   add one text field
636
637
638
639
640
641
642
643
644
  		$scope.ngShowhide = false;
  		$scope.GetValue = function(){
  			console.log("====$scope.value===",$scope.data.sector)
  			if($scope.data.sector == "Other"){
  				$scope.ngShowhide = true;
  			}else{
  				$scope.ngShowhide = false;
  			}
  		}
b96c88383   Palak Handa   amount change
645
646
647
648
649
650
651
  
  		$rootScope.tokenCall = function(val) {
  	        console.log('val-------->', val);
  	        if (val == undefined) {
  	            $('#invalidToken').css('display', 'block');
  	        } else {
  	        	val = val.toUpperCase();
a65d2455e   Palak Handa   minor change
652
653
654
655
  	        	if((val == "IITH99" && $scope.data.city != "Hyderabad") || (val == "IITM99" && $scope.data.city != "Chennai") || (val == "IITD99" && $scope.data.city != "Delhi") || (val == "IITB99" && $scope.data.city != "Mumbai") || (val == "IITK99" && $scope.data.city != "Kanpur") || (val == "IIMC99" && $scope.data.city != "Kolkata") || (val == "IIMA99" && $scope.data.city != "Ahmedabad") || (val == "JAI40" && $scope.data.city != "Jaipur")){
  	        		$scope.tokencheck = false;
  	        		return;
  	        	}
eb567dbaa   Palak Handa   minr change
656
  	        	$http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "' + val + '"}}')
b96c88383   Palak Handa   amount change
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
  				    .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
674
  		$scope.submit = function() {
500aaf838   apple   add new fields & ...
675
  		//$scope.data.uploadFile = $scope.base64textString;
b96c88383   Palak Handa   amount change
676
677
678
679
  		$scope.ticketAmnt = 500;
  		if($scope.tokencheck == false){
      		$scope.data.referalToken = null;
      	}
500aaf838   apple   add new fields & ...
680
681
682
683
  		// if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) {
  		// 	var x = document.getElementById("snackbar")
  		//     setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
  		// }else if($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) {	
e856f2161   Palak Handa   new page design
684
  			$scope.infoForm = true;
e856f2161   Palak Handa   new page design
685
686
  			$scope.detail = {};
  			$scope.data.phone = "+91"+$scope.data.number;
7cdbd289e   Palak Handa   content change
687
688
  			if($scope.data.referalToken == null){
              	$scope.data.referalToken = "N.A."
1b31b20bf   apple   auto highlighted ...
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
  			}
  			var file =document.getElementById('filePicker').files[0];
  			console.log("file",filePicker)
  			var image = BASE_URL+'/containers/applicants/download/'
  			console.log("file",image)
  			var imagePath = filePicker.name;
  			$scope.data.uploadFile = image + imagePath;
  			var fd = new FormData()
  			fd.append('filePicker',data);
  				
  			var deferred = $q.defer();
  			$http({
  				method:'POST',
  				url: BASE_URL+'/containers/applicants/upload',
  				data:fd,
  				transformRequest:angular.identity,
  				headers:{'Content-Type':undefined}
  			})
  			.success(function(result){
  				deferred.resolve(result);
  			})
e856f2161   Palak Handa   new page design
710
711
712
713
714
715
716
  			$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
717
718
719
  	           		$scope.detail = result;
  	               data.applicantId = result.data.id;
  	               $scope.userId = result.data.id;
b96c88383   Palak Handa   amount change
720
721
722
723
724
  	                console.log("=====data=====",data)
  	                var amount = $scope.ticketAmnt * 100
  			        if($scope.tokencheck == true){
  				        var amount = $scope.ticketAmnt
  				        console.log("====$scope.discountpercentage====",$scope.discountpercentage);
a65d2455e   Palak Handa   minor change
725
726
  			        	console.log("resultcity===",$scope.data.city)
  						if($scope.discountpercentage == "100") {
8e38c5b71   Palak Handa   integrate timer
727
728
  			        		$scope.discountpercentage = "99.8";
  			        		console.log("$scope.discountpercentage====",$scope.discountpercentage)
b96c88383   Palak Handa   amount change
729
730
731
732
733
734
735
736
737
738
739
  				        }
  				        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 ...
740
  		        	console.log("====$scope.payingAmnt====",$scope.payingAmnt)
b96c88383   Palak Handa   amount change
741
  		        	$scope.payingAmnt = $scope.payingAmnt.toFixed()	                
e8488da07   Palak Handa   amount regarding ...
742
743
  	                data.amount = $scope.payingAmnt;
  	                console.log("data.amount==",data.amount)
e856f2161   Palak Handa   new page design
744
745
746
747
748
749
750
751
752
753
754
755
  	               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
756
  				$scope.payingAmnt =  $scope.payingAmnt * 100;
e856f2161   Palak Handa   new page design
757
  				var options = {
50e8f0737   Palak Handa   minor change
758
759
  					//"key": "rzp_test_YwHsVFiDIQ2WUQ",
  					"key": "rzp_live_mkmCb4FkstuWaS",
e856f2161   Palak Handa   new page design
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
  					"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 ...
794
  					console.log("$scope.paymentResponse.amount=====",$scope.paymentResponse.amount)
e856f2161   Palak Handa   new page design
795
796
797
798
799
800
801
  					$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
802
  					   	$location.path("/confirmation")
e856f2161   Palak Handa   new page design
803
804
805
  					   }, function myError(error) {
  					});
  				}
a65d2455e   Palak Handa   minor change
806
  				//}
e856f2161   Palak Handa   new page design
807
808
  
  	           }, function myError(error) {
317a80571   Palak Handa   city selected
809

e856f2161   Palak Handa   new page design
810
  	        });
317a80571   Palak Handa   city selected
811

500aaf838   apple   add new fields & ...
812
  		//}
e856f2161   Palak Handa   new page design
813

317a80571   Palak Handa   city selected
814
815
816
  	}
  	
  });
53b83aa9e   Palak Handa   first commit
817

b96c88383   Palak Handa   amount change
818
819
820
821
822
823
824
  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
825
826
827
  			var randomNumber = ""+Math.random();
  			var nameSpliced = $scope.data.name.slice(0,5);
  			var numberSpliced = randomNumber.slice(2,4);;
b96c88383   Palak Handa   amount change
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
  			$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
849
850
  	        }
  	});
96991e0c1   Palak Handa   update
851