Blame view

script.js 28 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
7
8
9
10
11
12
  	    $routeProvider
  
  	        // route for the home page
  	        .when('/', {
  	            templateUrl: 'pages/home.html',
  	            controller: 'mainController'
  	        })
2d6a9fbea   Palak Handa   complete bugs
13
  	        // route for the paymentVerify page
4de569579   Palak Handa   design update
14
  	        .when('/pendingPayment/:id', {
6ae8d3cdd   Palak Handa   add new module
15
16
17
18
19
20
21
22
23
  	            templateUrl: 'pages/verify.html',
  	            controller: 'verifyController'
  	        })
  
  	        // route for the ambassador page
  	        .when('/ambassador', {
  	            templateUrl: 'pages/ambassador.html',
  	            controller: 'ambassadorController'
  	        })
5348de778   Palak Handa   design updated
24
25
26
27
28
29
  
  	        // route for the confirmation page
  	        .when('/confirmation', {
  	            templateUrl: 'pages/confirmation.html',
  	            controller: 'mainController'
  	        })
6ae8d3cdd   Palak Handa   add new module
30
  	});
53b83aa9e   Palak Handa   first commit
31

f263889f0   Palak Handa   analytics work
32
33
  	scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) {
  	   	// Add configuration code as desired
61b69ada0   Palak Handa   design updated
34
  	   	 AnalyticsProvider.setAccount('UA-106416759-1');  //UU-XXXXXXX-X should be your tracking code
f263889f0   Palak Handa   analytics work
35
36
37
38
39
40
41
42
  
  	   	// Track all routes (default is true).
  	  	AnalyticsProvider.trackPages(true);
  
  	  	// Track all URL query params (default is false).
  	  	AnalyticsProvider.trackUrlParams(true);
  
  	}]).run(['Analytics', function(Analytics) { }]);
c98129dd2   Palak Handa   baseurl change
43
44
  	scotchApp.constant("BASE_URL", "http://139.59.68.74:4001/api")
  	//scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/api")
6ae8d3cdd   Palak Handa   add new module
45

2d6a9fbea   Palak Handa   complete bugs
46
  	// create the controller and inject Angular's $scope
f263889f0   Palak Handa   analytics work
47
  	scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL, Analytics) {
6ae8d3cdd   Palak Handa   add new module
48
49
50
51
52
53
54
55
56
57
58
  	    $scope.data = {
  	        show: true,
  	        hide: false
  	    };
  
  	    $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
  
  	    $scope.max = 100;
  	    $scope.current = 0;
  	    $scope.payingAmnt = 0;
  	    if ($scope.data.stage == 'select') {
6ae8d3cdd   Palak Handa   add new module
59

53b83aa9e   Palak Handa   first commit
60
  	    }
439352ca6   Palak Handa   base url changes
61
  	    //$scope.author = 'Swarn Singh';
6ae8d3cdd   Palak Handa   add new module
62
63
  	    $scope.data = {};
  	    $scope.data.stage = 'Idea';
ea3c31126   Palak Handa   complete
64
  	    $scope.discountAmount = 0;
6ae8d3cdd   Palak Handa   add new module
65
66
  	    $scope.check = false;
  	    $scope.numberCheck = false;
6ae8d3cdd   Palak Handa   add new module
67
  	    $scope.paymentResult = {};
6ae8d3cdd   Palak Handa   add new module
68
69
70
71
72
  	    var data = {
  	        "amount": $scope.payingAmnt,
  	        "currency": "INR",
  	        "status": "pending"
  	    }
53b83aa9e   Palak Handa   first commit
73

5259a7d0e   Digvijay Singh   video links added
74
  	    /*open videos in modal*/
b8938eb77   Palak Handa   add content
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
  	  //   $scope.openyoutube16 = function(){
  			// $('#videoModel').modal('show');
  	  //   }
  
  	  //    $scope.openyoutube17 = function(){
  			// $('#videoModels').modal('show');
  	  //   }
  
  	  //      $scope.closeModal = function(){
  	  //   	var url = $('#youtubePlayer').attr('src');
  			// $('#youtubePlayer').attr('src', '');
  			// $('#youtubePlayer').attr('src', url);
  	  //   }
  
  
  	  //   $scope.closed = function(){
  	  //   	var url = $('#youtubePlayersss').attr('src');
  			// $('#youtubePlayersss').attr('src', '');
  			// $('#youtubePlayersss').attr('src', url);
  	  //   }
5259a7d0e   Digvijay Singh   video links added
95
  	    /*open videos ends here*/
5348de778   Palak Handa   design updated
96
97
98
99
  	    $scope.removeError = function() {
  	        $('#invalidEmail').css('display', 'none');
  	        $('#alreadyExist').css('display', 'none');
  	    };
6ae8d3cdd   Palak Handa   add new module
100
  	    $scope.emailcheck = function(val) {
6ae8d3cdd   Palak Handa   add new module
101
102
103
104
105
106
  	        if (val == undefined) {
  	            $('#invalidEmail').css('display', 'block');
  	        } else {
  	            $http({
  	                method: 'GET',
  	                url: BASE_URL + '/applicants?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}',
6ae8d3cdd   Palak Handa   add new module
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
  	                headers: {}
  	            }).then(function mySuccess(searchResult) {
  	                console.log("searchResult1===>", searchResult)
  	                if (searchResult.data.length == 0) {
  	                    $scope.check = false;
  	                } else {
  	                    $scope.check = true;
  	                    $('#alreadyExist').css('display', 'block');
  	                }
  	            }, function myError(error) {});
  	        }
  	    };
  
  	    $scope.removeNoError = function() {
  	        $('#noExist').css('display', 'none');
  	    };
  
  	    $scope.numbercheck = function(number) {
  	        $http({
  	            method: 'GET',
  	            url: BASE_URL + '/applicants?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}',
  	            data: $scope.data,
  	            headers: {}
  	        }).then(function mySuccess(searchResult) {
  	            console.log("searchResult===>", searchResult)
  	            if (searchResult.data.length == 0) {
  	                $scope.numberCheck = false;
ea3c31126   Palak Handa   complete
134

6ae8d3cdd   Palak Handa   add new module
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
  	            } else {
  	                $scope.numberCheck = true;
  	                $('#noExist').css('display', 'block');
  	            }
  	        }, function myError(error) {});
  	    };
  
  	    $rootScope.tokenCall = function(val) {
  	        console.log('val-------->', val);
  	        if (val == undefined) {
  	            $('#invalidEmail').css('display', 'block');
  	        } else {
  	        	val = val.toUpperCase();
  	        	$http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}')
  				    .then(function(searchResult) {
  				        if (searchResult.data.length == 0) {
  	                    	$scope.tokencheck = false;
ea3c31126   Palak Handa   complete
152
  	                    	 $scope.discountAmount = 0;
6ae8d3cdd   Palak Handa   add new module
153
  	                	} else {
6ae8d3cdd   Palak Handa   add new module
154
  	                    	$scope.tokencheck = true;
6ae8d3cdd   Palak Handa   add new module
155
156
157
158
  	                	}
  				    },function(err){
  				    	console.log(err)
  				});
53b83aa9e   Palak Handa   first commit
159
  	           
6ae8d3cdd   Palak Handa   add new module
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
  	        }
  	    };
  
  	    /*THIS CODE FOR ENABLED SUBMIT BUTTON AFTER UPLOAD IMAGE*/
  	    $(document).ready(
  	        function() {
  	            $('input:submit').attr('disabled', true);
  	            $('input:file').change(
  	                function() {
  	                    if ($("#picture").val()) {
  	                        $('input:submit').removeAttr('disabled');
  	                    } else {
  	                        $('input:submit').attr('disabled', true);
  	                    }
  	                });
53b83aa9e   Palak Handa   first commit
175
  	        });
6ae8d3cdd   Palak Handa   add new module
176
177
  
  	    /*****THIS IS FOR STEP ONE FORM ******/
9ad22ae22   Palak Handa   work on google an...
178
  	    $scope.next = function() {	  
6ae8d3cdd   Palak Handa   add new module
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
  	        $scope.data.status = null
  	        if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) {
  	            var x = document.getElementById("snackbar")
  	            x.className = "show";
  	            setTimeout(function() {
  	                x.className = x.className.replace("show", "");
  	            }, 3000);
  	        } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) {
  	            $scope.infoForm = true;
  	            console.log("sdasdasdsa");
  	            $scope.data.stage = $scope.data.stage;
  	            $scope.detail = {};
  	            $scope.data.phone = "+91" + $scope.data.number;
  	            $http({
  	                method: 'POST',
  	                url: BASE_URL + '/information',
  	                data: $scope.data,
  	                headers: {}
  	            }).then(function mySuccess(result) {
9ad22ae22   Palak Handa   work on google an...
198
  					Analytics.trackEvent('information', 'click', 'django.mp4');
6ae8d3cdd   Palak Handa   add new module
199
200
201
202
203
204
  	                console.log("result", result)
  	                $scope.detail = result;
  	                data.applicantId = result.data.id;
  	                $scope.userId = result.data.id;
  
  	            }, function myError(error) {});
f263889f0   Palak Handa   analytics work
205

6ae8d3cdd   Palak Handa   add new module
206
207
208
  	        }
  
  	    }
ea3c31126   Palak Handa   complete
209
  	    $scope.calculateAmount =  function(){
9842ccd27   Palak Handa   changes api call
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
  	        if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) {
  	            var x = document.getElementById("snackbar")
  	            x.className = "show";
  	            setTimeout(function() {
  	                x.className = x.className.replace("show", "");
  	            }, 3000);
  	        } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) {
  	            $scope.infoForm = true;
  	            console.log("sdasdasdsa");
  	            $scope.data.stage = $scope.data.stage;
  	            $scope.detail = {};
  	            $scope.data.phone = "+91" + $scope.data.number;
  	            $http({
  	                method: 'POST',
  	                url: BASE_URL + '/applicants',
  	                data: $scope.data,
  	                headers: {}
  	            }).then(function mySuccess(result) {
9ad22ae22   Palak Handa   work on google an...
228
  	            	Analytics.trackEvent('applicants', 'click', 'django.mp4');
9842ccd27   Palak Handa   changes api call
229
230
231
232
233
234
235
  	                console.log("result", result)
  	                $scope.detail = result;
  	                data.applicantId = result.data.id;
  	                $scope.userId = result.data.id;
  
  	            }, function myError(error) {});
  	        }
ea3c31126   Palak Handa   complete
236
  	    	if ($scope.data.stage == "Idea") {
6ae8d3cdd   Palak Handa   add new module
237
  	            console.log("$scope.data", $scope.data)
ea3c31126   Palak Handa   complete
238
  	            $scope.ticketAmnt = 500;
6ae8d3cdd   Palak Handa   add new module
239
240
241
  	        }
  
  	        if ($scope.data.stage == "Product") {
ea3c31126   Palak Handa   complete
242
  	            $scope.ticketAmnt = 1000;
6ae8d3cdd   Palak Handa   add new module
243
244
245
  	        }
  
  	        if ($scope.data.stage == "Growth") {
ea3c31126   Palak Handa   complete
246
  	            $scope.ticketAmnt = 2000;
6ae8d3cdd   Palak Handa   add new module
247
248
249
  	        }
  
  	        if($scope.tokencheck == true){
ea3c31126   Palak Handa   complete
250
251
  		        var amount = $scope.ticketAmnt
  			    $scope.discountAmount = (amount * 10)/100
6ae8d3cdd   Palak Handa   add new module
252
253
  			    console.log("finalAmount====>",$scope.payingAmnt)
  	        }
ea3c31126   Palak Handa   complete
254
255
256
257
258
259
260
  	        var taxAmount = $scope.ticketAmnt - $scope.discountAmount
              $scope.taxTotal = (taxAmount * 18)/100
              $scope.payingAmnt = taxAmount +  $scope.taxTotal
              console.log("taxincludedamount----", $scope.payingAmnt)
  	    }
  
  	    /*****THIS IS FOR STEP THREE FORM ******/
b8938eb77   Palak Handa   add content
261
  	    $scope.create = function() {
9842ccd27   Palak Handa   changes api call
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
  	        // if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) {
  	        //     var x = document.getElementById("snackbar")
  	        //     x.className = "show";
  	        //     setTimeout(function() {
  	        //         x.className = x.className.replace("show", "");
  	        //     }, 3000);
  	        // } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) {
  	        //     $scope.infoForm = true;
  	        //     console.log("sdasdasdsa");
  	        //     $scope.data.stage = $scope.data.stage;
  	        //     $scope.detail = {};
  	        //     $scope.data.phone = "+91" + $scope.data.number;
  	        //     $http({
  	        //         method: 'POST',
  	        //         url: BASE_URL + '/applicants',
  	        //         data: $scope.data,
  	        //         headers: {}
  	        //     }).then(function mySuccess(result) {
  
  	        //         console.log("=====result=====", result)
  	        //         $scope.detail = result;
  	        //         data.applicantId = result.data.id;
  	        //         $scope.userId = result.data.id;
  	        //         console.log("=====data=====", data)
ea3c31126   Palak Handa   complete
286
  	                data.amount = $scope.payingAmnt;
6ae8d3cdd   Palak Handa   add new module
287
288
289
290
291
292
293
  	                if ($scope.detail != null) {
  	                    $http({
  	                        method: 'POST',
  	                        url: BASE_URL + '/payments',
  	                        data: data,
  	                        headers: {}
  	                    }).then(function mySuccess(paymentResult) {
9ad22ae22   Palak Handa   work on google an...
294
  	    					Analytics.trackEvent('payments', 'click', 'django.mp4');
8e25d825b   Palak Handa   changes the rajor...
295
  	                    	console.log("paymentResult",paymentResult)
6ae8d3cdd   Palak Handa   add new module
296
297
298
299
  	                        $scope.paymentResult = paymentResult;
  	                    }, function myError(error) {});
  	                }
  	                var i = 0;
ea3c31126   Palak Handa   complete
300
  	                 $scope.payingAmnt =  $scope.payingAmnt * 100;
6ae8d3cdd   Palak Handa   add new module
301
  	                var options = {
f2142e490   Palak Handa   rajorpay key updated
302
  	                    "key": "rzp_live_mhSE1uOBlXvFyJ",
6ae8d3cdd   Palak Handa   add new module
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
  	                    "amount": $scope.payingAmnt,
  
  	                    "name": "Startup Jalsa",
  	                    "description": "amount",
  	                    "currency": "INR",
  	                    "status": "done",
  
  	                    "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) {
9ad22ae22   Palak Handa   work on google an...
326
  	                	Analytics.trackEvent('payments', 'click', 'django.mp4');
8e25d825b   Palak Handa   changes the rajor...
327
  	                	console.log("response====from===razorpay",response)
6ae8d3cdd   Palak Handa   add new module
328
329
330
331
332
  	                    $route.reload();
  	                    $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
  	                    $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId;
  	                    $scope.paymentResponse.amount = data.amount;
  	                    $scope.paymentResponse.currency = "INR";
8e25d825b   Palak Handa   changes the rajor...
333
  	                    $scope.paymentResponse.status = $scope.paymentResult.data.status;
6ae8d3cdd   Palak Handa   add new module
334
335
336
337
338
339
  	                    $http({
  	                        method: 'PUT',
  	                        url: BASE_URL + '/payments/' + $scope.paymentResult.data.id,
  	                        data: $scope.paymentResponse,
  	                        headers: {}
  	                    }).then(function mySuccess(searchResult) {
9ad22ae22   Palak Handa   work on google an...
340
  	                    	Analytics.trackEvent('payments', 'click', 'django.mp4');
6ae8d3cdd   Palak Handa   add new module
341
  	                        console.log("searchResult", searchResult)
5348de778   Palak Handa   design updated
342
343
  	                        $location.path("/confirmation")
  	                        //$scope.showToastr()
6ae8d3cdd   Palak Handa   add new module
344
345
346
347
  	                        //toaster.success("Registration done successfully");
  
  	                    }, function myError(error) {});
  	                }
9842ccd27   Palak Handa   changes api call
348
349
  	            //}, function myError(error) {});
  	        //}
6ae8d3cdd   Palak Handa   add new module
350
351
  
  	    }
5348de778   Palak Handa   design updated
352
353
354
355
356
357
358
359
  	    // $scope.showToastr = function() {
  	    //     console.log("called toast")
  	    //     var x = document.getElementById("snacsskbar")
  	    //     x.className = "show";
  	    //     setTimeout(function() {
  	    //         x.className = x.className.replace("show", "");
  	    //     }, 3000);
  	    // }
6ae8d3cdd   Palak Handa   add new module
360

6ae8d3cdd   Palak Handa   add new module
361
  	    /*kk***This code for change data when click to chooses stages***/
5348de778   Palak Handa   design updated
362
  	    $scope.proto = true;
6ae8d3cdd   Palak Handa   add new module
363
364
365
366
367
  	    $scope.businessmodel = true;
  	    $scope.Idea = true;
  	    $scope.current = true;
  
  	    $scope.stage = function(stage) {
2d6a9fbea   Palak Handa   complete bugs
368
369
  	    $scope.stagekeyPress();
  	    console.log("stage--2",stage)
6ae8d3cdd   Palak Handa   add new module
370
371
  	        if (stage == 'Idea') {
  	            $scope.current = 10;
5348de778   Palak Handa   design updated
372
  	            $scope.proto = true;
6ae8d3cdd   Palak Handa   add new module
373
374
375
376
377
378
379
  	            $scope.prototyp = false;
  	            $scope.market = false;
  	            $scope.risks = false;
  	            $scope.team = false;
  	            $scope.pitch = false;
  	            $scope.financials = false;
  	            $scope.businessmodel = true;
2d6a9fbea   Palak Handa   complete bugs
380
  	            $scope.data.stage = stage;
6ae8d3cdd   Palak Handa   add new module
381
382
383
384
385
386
  	            // for right content
  	            $scope.Idea = true;
  	            $scope.Product = false;
  	            $scope.Growth = false;
  	        } else if (stage == 'Product') {
  	            $scope.current = 10;
5348de778   Palak Handa   design updated
387
  	            $scope.proto = true;
6ae8d3cdd   Palak Handa   add new module
388
389
390
391
392
393
394
  	            $scope.prototyp = true;
  	            $scope.market = true;
  	            $scope.risks = true;
  	            $scope.team = true;
  	            $scope.pitch = true;
  	            $scope.financials = true;
  	            $scope.businessmodel = false;
2d6a9fbea   Palak Handa   complete bugs
395
  	            $scope.data.stage = stage;
6ae8d3cdd   Palak Handa   add new module
396
397
398
399
400
401
  	            // for right content
  	            $scope.Idea = false;
  	            $scope.Product = true;
  	            $scope.Growth = false;
  	        } else if (stage == 'Growth') {
  	            $scope.current = 10;
5348de778   Palak Handa   design updated
402
  	            $scope.proto = false;
6ae8d3cdd   Palak Handa   add new module
403
404
405
406
407
408
409
410
411
412
413
  	            $scope.prototyp = true;
  	            $scope.market = true;
  	            $scope.risks = true;
  	            $scope.team = true;
  	            $scope.pitch = true;
  	            $scope.financials = true;
  	            $scope.businessmodel = false;
  	            // for right content
  	            $scope.Idea = false;
  	            $scope.Product = false;
  	            $scope.Growth = true;
2d6a9fbea   Palak Handa   complete bugs
414
  	            $scope.data.stage = stage;
6ae8d3cdd   Palak Handa   add new module
415
416
  	        }
  	    }
6ae8d3cdd   Palak Handa   add new module
417
418
419
420
  	    $scope.enterbusiness = function(business) {
  	        console.log("business", business);
  	        if (name == undefined) {
  	            $scope.current = false;
2d6a9fbea   Palak Handa   complete bugs
421

6ae8d3cdd   Palak Handa   add new module
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
  	        } else if (name != undefined) {
  	            $scope.current = true;
  	        }
  	    }
  	    /*******FOR FILL THE DATA AND SHOWS ICON GREEN*/
  	    $scope.stagekeyPress = function() {
  	        $('.icon-circle-a').css('background-color', 'rgb(66, 181, 73)');
  	    }
  	    $scope.sectorkeyPress = function() {
  	        $('.icon-circle-b').css('background-color', 'rgb(66, 181, 73)');
  	    }
  
  	    $scope.studentkeyPress = function() {
  	        $('.icon-circle-ab').css('background-color', 'rgb(66, 181, 73)');
  	    }
  
  	    $scope.namekeyPress = function(name) {
  	        console.log("name", name);
  	        if (name == undefined) {
  	            $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-c').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  	    $scope.emailkeyPress = function(email) {
  	        console.log("email", email);
  	        if (email == undefined) {
  	            $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-d').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  
  	    $scope.phonekeyPress = function(number) {
  	        console.log("number", number);
  	        if (number == undefined) {
  	            $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-e').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  	    $scope.citykeyPress = function(city) {
  	        console.log("city", city);
  	        if (city == undefined) {
  	            $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-f').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  	    $scope.questionkeyPress = function(q) {
  	        if (q == undefined) {
  	            $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-x').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  	    $scope.technologykeyPress = function(technology) {
  	        if (technology == undefined) {
  	            $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-h').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  	    $scope.problemkeyPress = function(problem) {
  	        if (problem == undefined) {
  	            $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-i').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  	    $scope.solutionkeyPress = function(solution) {
  	        if (solution == undefined) {
  	            $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-j').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  	    $scope.businesskeyPress = function(business) {
  	        $('.icon-circle-p').css('background-color', 'rgb(66, 181, 73)');
  	    }
  
  	    $scope.prototypekeyPress = function(prototype) {
  	        if (prototype == undefined) {
  	            $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-k').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  	    $scope.marketkeyPress = function(market) {
  	        if (market == undefined) {
  	            $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-l').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  	    $scope.riskkeyPress = function(risk) {
  	        if (risk == undefined) {
  	            $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-m').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  	    $scope.teamkeyPress = function(team) {
  	        if (team == undefined) {
  	            $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-n').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  	    $scope.pitchkeyPress = function(pitch) {
  	        if (pitch == undefined) {
  	            $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-z').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
  
  	    $scope.financialskeyPress = function(financial) {
  	        console.log("financial", financial);
  	        if (financial == undefined) {
  	            $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)');
  	        } else {
  	            $('.icon-circle-q').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
2d6a9fbea   Palak Handa   complete bugs
555
556
557
558
559
560
561
  	    $scope.changeReferalIconColor = function(referalToken){
  	    	if (referalToken == undefined || referalToken == '') {
  	    		$('.referel-icon').css('background-color', 'rgb(102, 102, 102)');
  	    	}else {
  	            $('.referel-icon').css('background-color', 'rgb(66, 181, 73)');
  	        }
  	    }
6ae8d3cdd   Palak Handa   add new module
562

53b83aa9e   Palak Handa   first commit
563
  	});
2d6a9fbea   Palak Handa   complete bugs
564
  	scotchApp.controller('verifyController', function($scope, $http, $location, $route,BASE_URL) {
d8feb0ddb   Palak Handa   design updated
565
  	    $scope.pendingPaymentId = $route.current.params.id
6ae8d3cdd   Palak Handa   add new module
566
567
568
569
570
571
  	    $http({
  	        method: "GET",
  	        url: BASE_URL + '/applicants/' + $scope.pendingPaymentId,
  	    }).then(function mySuccess(response) {
  	        $scope.data = response.data;
  	        console.log("response-1", response);
d8feb0ddb   Palak Handa   design updated
572
573
  	        $scope.pendingPaymentId = $route.current.params.id;
  	        
6ae8d3cdd   Palak Handa   add new module
574
575
576
577
578
579
  	        $http({
  	            method: "GET",
  	            url: BASE_URL + '/payments?filter={"where":{"applicantId":' + $scope.pendingPaymentId + '}}',
  	        }).then(function mySuccess(response) {
  	            $scope.paymentRecord = response.data;
  	        }, function myError(response) {
6ae8d3cdd   Palak Handa   add new module
580
581
582
583
584
585
586
587
588
  	        });
  	    }, function myError(response) {
  	        $scope.myWelcome = response.statusText;
  	    });
  
  	    $scope.checkView = false;
  	    $scope.verifyView = false;
  
  	    $scope.pendingPaymentId = '';
6ae8d3cdd   Palak Handa   add new module
589
590
591
592
593
  	    $scope.update = function() {
  
  	        $http({
  	            method: 'GET',
  	            url: BASE_URL + '/payments?filter={"where":{"applicantId": ' + $scope.pendingPaymentId + '}}',
6ae8d3cdd   Palak Handa   add new module
594
595
  	            headers: {}
  	        }).then(function mySuccess(searchResult) {
ced66f2dc   Palak Handa   minor changes
596
  	            if (searchResult.data[0].status == "created") {
6ae8d3cdd   Palak Handa   add new module
597
598
  	                $scope.checkView = true;
  	                $scope.verifyView = false;
ced66f2dc   Palak Handa   minor changes
599
600
601
602
  	                $scope.amount = searchResult.data[0].amount;
  	                $scope.searchResult = searchResult.data[0];
  	                console.log('====searchResult===', searchResult);
  	        		console.log("searchResult=====",searchResult.data[0].razorOrderId)
6ae8d3cdd   Palak Handa   add new module
603
  	                var i = 0;
ced66f2dc   Palak Handa   minor changes
604
  	                $scope.amount =  $scope.amount * 100;
6ae8d3cdd   Palak Handa   add new module
605
  	                var options = {
f2142e490   Palak Handa   rajorpay key updated
606
607
  	                    "key": "rzp_live_mhSE1uOBlXvFyJ",
  	                    //"key" : "rzp_test_YwHsVFiDIQ2WUQ",
6ae8d3cdd   Palak Handa   add new module
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
  	                    "amount": $scope.amount,
  
  	                    "name": "Startup Jalsa",
  	                    "description": "amount",
  	                    "currency": "INR",
  	                    "status": "done",
  
  	                    "theme": {
  	                        "color": "#2196f3 ",
  	                        "image_padding": "NO"
  	                    },
  	                    "modal": {
  	                        "ondismiss": function() {}
  	                    },
  	                    "handler": function(response) {
  	                        createPayment(response);
  	                    }
  	                };
  	                var rzp1 = new Razorpay(options);
  	                rzp1.open();
  	                $scope.paymentResponse = {};
6ae8d3cdd   Palak Handa   add new module
629
  	                function createPayment(response) {
ced66f2dc   Palak Handa   minor changes
630
631
  	                	$scope.amount =  $scope.amount / 100;
  	                	console.log("response======retepaymen",response);
6ae8d3cdd   Palak Handa   add new module
632
  	                    $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
ced66f2dc   Palak Handa   minor changes
633
  	                    $scope.paymentResponse.razorOrderId = $scope.searchResult.razorOrderId;
6ae8d3cdd   Palak Handa   add new module
634
  	                    $scope.paymentResponse.amount = $scope.amount;
ced66f2dc   Palak Handa   minor changes
635
636
637
  	                    $scope.paymentResponse.currency = $scope.searchResult.currency;
  	                    $scope.paymentResponse.status = $scope.searchResult.status;
  	                    $scope.paymentResponse.applicantId = $scope.searchResult.applicantId;
6ae8d3cdd   Palak Handa   add new module
638
639
640
  	                    console.log("$scope.paymentResponse", $scope.paymentResponse)
  	                    $http({
  	                        method: 'PUT',
ced66f2dc   Palak Handa   minor changes
641
  	                        url: BASE_URL + '/payments/' + $scope.searchResult.id,
6ae8d3cdd   Palak Handa   add new module
642
643
644
  	                        data: $scope.paymentResponse,
  	                        headers: {}
  	                    }).then(function mySuccess(searchResult) {
8e25d825b   Palak Handa   changes the rajor...
645
  	                    	console.log("finalsearchResult",searchResult)
ced66f2dc   Palak Handa   minor changes
646
  	                    	$location.path("/confirmation")
6ae8d3cdd   Palak Handa   add new module
647
648
649
650
651
652
653
654
655
656
657
  	                    }, function myError(error) {
  
  	                    });
  	                }
  	            } else {
  
  	            }
  
  	        }, function myError(error) {});
  	    }
  	});
53b83aa9e   Palak Handa   first commit
658

2d6a9fbea   Palak Handa   complete bugs
659
  	scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) {
6ae8d3cdd   Palak Handa   add new module
660
  		$scope.data = {};
8e25d825b   Palak Handa   changes the rajor...
661
662
  		$scope.check = false;
  	    $scope.numberCheck = false;
5348de778   Palak Handa   design updated
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
  	    /*open videos in modal*/
  	    $scope.openyoutube16 = function(){
  			$('#videoModel').modal('show');
  	    }
  
  	     $scope.openyoutube17 = function(){
  			$('#videoModels').modal('show');
  	    }
  
  	    $scope.closeModal = function(){
  	    	var url = $('#youtubePlayer').attr('src');
  			$('#youtubePlayer').attr('src', '');
  			$('#youtubePlayer').attr('src', url);
  	    }
  	    /*open videos ends here*/
  
  	    $scope.removeError = function() {
  	        $('#invalidEmail').css('display', 'none');
  	        $('#alreadyExist').css('display', 'none');
  	    };
8e25d825b   Palak Handa   changes the rajor...
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
  		$scope.emailcheck = function(val) {
  	        if (val == undefined) {
  	            $('#invalidEmail').css('display', 'block');
  	        } else {
  	            $http({
  	                method: 'GET',
  	                url: BASE_URL + '/ambassadors?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}',
  	                headers: {}
  	            }).then(function mySuccess(searchResult) {
  	                console.log("searchResult1===>", searchResult)
  	                if (searchResult.data.length == 0) {
  	                    $scope.check = false;
  	                } else {
  	                    $scope.check = true;
  	                    $('#alreadyExist').css('display', 'block');
  	                }
  	            }, function myError(error) {});
  	        }
  	    };
6db0109b5   Palak Handa   minor changes
702
703
704
705
  	    $scope.removeNoError = function() {
  	    	$('#invalidNumber').css('display', 'none');
  	        $('#noExist').css('display', 'none');
  	    };
8e25d825b   Palak Handa   changes the rajor...
706
707
  
  	    $scope.numbercheck = function(number) {
5348de778   Palak Handa   design updated
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
  	    	// if (val == undefined) {
  	     //        $('#invalidNumber').css('display', 'block');
  	     //    } else {
  	        	$http({
  	            	method: 'GET',
  	            	url: BASE_URL + '/ambassadors?filter={"where": {"mobile": {"like":"%25' + number + '%25"}}}',
  	            	data: $scope.data,
  	            	headers: {}
  	        	}).then(function mySuccess(searchResult) {
  	            	console.log("searchResult===>", searchResult)
  	            	if (searchResult.data.length == 0) {
  	                	$scope.numberCheck = false;
  	            	} else {
  	                	$scope.numberCheck = true;
  	                	$('#noExist').css('display', 'block');
  	            	}
  	        	}, function myError(error) {});
  	       	//}
8e25d825b   Palak Handa   changes the rajor...
726

8e25d825b   Palak Handa   changes the rajor...
727
  	    };
6ae8d3cdd   Palak Handa   add new module
728
729
730
731
732
733
734
  		$scope.submit = function() {
  			console.log($scope.data.name)
  			var randomNumber = ""+Math.random();
  			var nameSpliced = $scope.data.name.slice(0,3);
  			var numberSpliced = randomNumber.slice(2,5);
  			$scope.data.referalToken = nameSpliced+numberSpliced;
  			$scope.data.referalToken = $scope.data.referalToken.toUpperCase();
2d6a9fbea   Palak Handa   complete bugs
735

6ae8d3cdd   Palak Handa   add new module
736
737
738
739
740
741
742
743
  	         $http({
  	                method: 'POST',
  	                url: BASE_URL + '/ambassadors',
  	                data: $scope.data,
  	                headers: {}
  	            }).then(function mySuccess(result) {
  	                console.log("result", result)
  	                $scope.detail = result;
2d6a9fbea   Palak Handa   complete bugs
744
745
746
747
748
  	                $('#myModal').modal('show');
  	              	 $scope.data.name = '';
  	                $scope.data.email = '';
  	                $scope.data.mobile = '';
  	            
6db0109b5   Palak Handa   minor changes
749
750
751
752
  	            }, function myError(error) {
  	            	console.log(error)
  	            	console.log(error.data.error.message)
  	            });
2d6a9fbea   Palak Handa   complete bugs
753
  	        console.log($scope.data)
6ae8d3cdd   Palak Handa   add new module
754
755
  	        }
  	});
53b83aa9e   Palak Handa   first commit
756