Commit 0d7cf45ece5368b899a70c06451ccdc518d57206

Authored by Palak Handa
1 parent d923c2f8fd
Exists in master and in 1 other branch paytm

timer use

Showing 1 changed file with 15 additions and 11 deletions   Show diff stats
1 // create the module and name it scotchApp 1 // create the module and name it scotchApp
2 var scotchApp = angular.module('scotchApp', ['ngRoute','angular-google-analytics']); 2 var scotchApp = angular.module('scotchApp', ['ngRoute','angular-google-analytics']);
3 3
4 // configure our routes 4 // configure our routes
5 scotchApp.config(function($routeProvider) { 5 scotchApp.config(function($routeProvider,$locationProvider) {
6 $routeProvider 6 $routeProvider
7 7
8 // route for the Home page 8 // route for the Home page
9 .when('/', { 9 .when('/', {
10 templateUrl: 'pages/Home.html', 10 templateUrl: 'pages/Home.html',
11 controller: 'mainController' 11 controller: 'mainController'
12 }) 12 })
13 13
14 // route for the caricatures page 14 // route for the caricatures page
15 .when('/caricatures', { 15 .when('/caricatures', {
16 templateUrl: 'pages/caricatures.html', 16 templateUrl: 'pages/caricatures.html',
17 controller: 'mainController' 17 controller: 'mainController'
18 }) 18 })
19 19
20 // // route for the paymentVerify page 20 // // route for the paymentVerify page
21 // .when('/pendingPayment/:id', { 21 // .when('/pendingPayment/:id', {
22 // templateUrl: 'pages/verify.html', 22 // templateUrl: 'pages/verify.html',
23 // controller: 'verifyController' 23 // controller: 'verifyController'
24 // }) 24 // })
25 25
26 // route for the registration page 26 // route for the registration page
27 .when('/registration/:city', { 27 .when('/registration/:city', {
28 templateUrl: 'pages/registration.html', 28 templateUrl: 'pages/registration.html',
29 controller: 'registrationController' 29 controller: 'registrationController'
30 }) 30 })
31 31
32 // route for the ambassador page 32 // route for the ambassador page
33 // .when('/startupJalsaPromocode', { 33 // .when('/startupJalsaPromocode', {
34 // templateUrl: 'pages/ambassador.html', 34 // templateUrl: 'pages/ambassador.html',
35 // controller: 'ambassadorController' 35 // controller: 'ambassadorController'
36 // }) 36 // })
37 37
38 // route for the confirmation page 38 // route for the confirmation page
39 .when('/confirmation', { 39 .when('/confirmation', {
40 templateUrl: 'pages/confirmation.html', 40 templateUrl: 'pages/confirmation.html',
41 controller: 'registrationController' 41 controller: 'registrationController'
42 }) 42 })
43 43
44 // use the HTML5 History API
45 // $locationProvider.html5Mode(true);
46 // $routeProvider.otherwise({ redirectTo: '' });
47
44 }); 48 });
45 49
46 scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) { 50 scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) {
47 // Add configuration code as desired 51 // Add configuration code as desired
48 AnalyticsProvider.setAccount('UA-106416759-1'); //UU-XXXXXXX-X should be your tracking code 52 AnalyticsProvider.setAccount('UA-106416759-1'); //UU-XXXXXXX-X should be your tracking code
49 53
50 // Track all routes (default is true). 54 // Track all routes (default is true).
51 AnalyticsProvider.trackPages(true); 55 AnalyticsProvider.trackPages(true);
52 56
53 // Track all URL query params (default is false). 57 // Track all URL query params (default is false).
54 AnalyticsProvider.trackUrlParams(true); 58 AnalyticsProvider.trackUrlParams(true);
55 59
56 }]).run(['Analytics', function(Analytics) { }]); 60 }]).run(['Analytics', function(Analytics) { }]);
57 61
58 scotchApp.constant("BASE_URL", "http://35.154.24.158:4001/v1") 62 scotchApp.constant("BASE_URL", "http://35.154.24.158:4001/v1")
59 //scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/v1") 63 //scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/v1")
60 64
61 // create the controller and inject Angular's $scope 65 // create the controller and inject Angular's $scope
62 scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL, Analytics) { 66 scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL, Analytics) {
63 $scope.data = { 67 $scope.data = {
64 show: true, 68 show: true,
65 hide: false 69 hide: false
66 }; 70 };
67 71
68 var chennai = new Date("Sept 18, 2018 12:00:00").getTime(); 72 var chennai = new Date("Sept 19, 2018 12:00:00").getTime();
69 // Update the count down every 1 second 73 // Update the count down every 1 second
70 var x = setInterval(function() { 74 var x = setInterval(function() {
71 // Get todays date and time 75 // Get todays date and time
72 var now = new Date().getTime(); 76 var now = new Date().getTime();
73 // Find the distance between now an the count down date 77 // Find the distance between now an the count down date
74 var distance = chennai - now; 78 var distance = chennai - now;
75 // Time calculations for days, hours, minutes and seconds 79 // Time calculations for days, hours, minutes and seconds
76 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 80 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
77 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 81 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
78 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 82 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
79 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 83 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
80 $scope.timer = days + "d " + hours + "h " 84 $scope.timer = days + "d " + hours + "h "
81 + minutes + "m " + seconds + "s " 85 + minutes + "m " + seconds + "s "
82 // Output the result in an element with id="demo" 86 // Output the result in an element with id="demo"
83 document.getElementById("chennai").innerHTML = days + "d " + hours + "h " 87 document.getElementById("chennai").innerHTML = days + "d " + hours + "h "
84 + minutes + "m " + seconds + "s "; 88 + minutes + "m " + seconds + "s ";
85 // If the count down is over, write some text 89 // If the count down is over, write some text
86 if (distance < 0) { 90 if (distance < 0) {
87 clearInterval(x); 91 clearInterval(x);
88 document.getElementById("chennai").innerHTML = "EXPIRED"; 92 document.getElementById("chennai").innerHTML = "EXPIRED";
89 } 93 }
90 }, 1000); 94 }, 1000);
91 95
92 var hyderabad = new Date("Sept 20, 2018 12:00:00").getTime(); 96 var hyderabad = new Date("Sept 21, 2018 12:00:00").getTime();
93 // Update the count down every 1 second 97 // Update the count down every 1 second
94 var x = setInterval(function() { 98 var x = setInterval(function() {
95 // Get todays date and time 99 // Get todays date and time
96 var now = new Date().getTime(); 100 var now = new Date().getTime();
97 // Find the distance between now an the count down date 101 // Find the distance between now an the count down date
98 var distance = hyderabad - now; 102 var distance = hyderabad - now;
99 // Time calculations for days, hours, minutes and seconds 103 // Time calculations for days, hours, minutes and seconds
100 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 104 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
101 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 105 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
102 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 106 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
103 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 107 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
104 $scope.timer = days + "d " + hours + "h " 108 $scope.timer = days + "d " + hours + "h "
105 + minutes + "m " + seconds + "s " 109 + minutes + "m " + seconds + "s "
106 // Output the result in an element with id="demo" 110 // Output the result in an element with id="demo"
107 document.getElementById("hyderabad").innerHTML = days + "d " + hours + "h " 111 document.getElementById("hyderabad").innerHTML = days + "d " + hours + "h "
108 + minutes + "m " + seconds + "s "; 112 + minutes + "m " + seconds + "s ";
109 // If the count down is over, write some text 113 // If the count down is over, write some text
110 if (distance < 0) { 114 if (distance < 0) {
111 clearInterval(x); 115 clearInterval(x);
112 document.getElementById("hyderabad").innerHTML = "EXPIRED"; 116 document.getElementById("hyderabad").innerHTML = "EXPIRED";
113 } 117 }
114 }, 1000); 118 }, 1000);
115 119
116 var mumbai = new Date("Sept 24, 2018 12:00:00").getTime(); 120 var mumbai = new Date("Sept 25, 2018 12:00:00").getTime();
117 // Update the count down every 1 second 121 // Update the count down every 1 second
118 var x = setInterval(function() { 122 var x = setInterval(function() {
119 // Get todays date and time 123 // Get todays date and time
120 var now = new Date().getTime(); 124 var now = new Date().getTime();
121 // Find the distance between now an the count down date 125 // Find the distance between now an the count down date
122 var distance = mumbai - now; 126 var distance = mumbai - now;
123 // Time calculations for days, hours, minutes and seconds 127 // Time calculations for days, hours, minutes and seconds
124 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 128 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
125 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 129 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
126 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 130 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
127 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 131 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
128 $scope.timer = days + "d " + hours + "h " 132 $scope.timer = days + "d " + hours + "h "
129 + minutes + "m " + seconds + "s " 133 + minutes + "m " + seconds + "s "
130 // Output the result in an element with id="demo" 134 // Output the result in an element with id="demo"
131 document.getElementById("mumbai").innerHTML = days + "d " + hours + "h " 135 document.getElementById("mumbai").innerHTML = days + "d " + hours + "h "
132 + minutes + "m " + seconds + "s "; 136 + minutes + "m " + seconds + "s ";
133 // If the count down is over, write some text 137 // If the count down is over, write some text
134 if (distance < 0) { 138 if (distance < 0) {
135 clearInterval(x); 139 clearInterval(x);
136 document.getElementById("mumbai").innerHTML = "EXPIRED"; 140 document.getElementById("mumbai").innerHTML = "EXPIRED";
137 } 141 }
138 }, 1000); 142 }, 1000);
139 143
140 var kolkata = new Date("Oct 1, 2018 12:00:00").getTime(); 144 var kolkata = new Date("Oct 2, 2018 12:00:00").getTime();
141 // Update the count down every 1 second 145 // Update the count down every 1 second
142 var x = setInterval(function() { 146 var x = setInterval(function() {
143 // Get todays date and time 147 // Get todays date and time
144 var now = new Date().getTime(); 148 var now = new Date().getTime();
145 // Find the distance between now an the count down date 149 // Find the distance between now an the count down date
146 var distance = kolkata - now; 150 var distance = kolkata - now;
147 // Time calculations for days, hours, minutes and seconds 151 // Time calculations for days, hours, minutes and seconds
148 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 152 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
149 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 153 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
150 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 154 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
151 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 155 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
152 $scope.timer = days + "d " + hours + "h " 156 $scope.timer = days + "d " + hours + "h "
153 + minutes + "m " + seconds + "s " 157 + minutes + "m " + seconds + "s "
154 // Output the result in an element with id="demo" 158 // Output the result in an element with id="demo"
155 document.getElementById("kolkata").innerHTML = days + "d " + hours + "h " 159 document.getElementById("kolkata").innerHTML = days + "d " + hours + "h "
156 + minutes + "m " + seconds + "s "; 160 + minutes + "m " + seconds + "s ";
157 // If the count down is over, write some text 161 // If the count down is over, write some text
158 if (distance < 0) { 162 if (distance < 0) {
159 clearInterval(x); 163 clearInterval(x);
160 document.getElementById("kolkata").innerHTML = "EXPIRED"; 164 document.getElementById("kolkata").innerHTML = "EXPIRED";
161 } 165 }
162 }, 1000); 166 }, 1000);
163 167
164 var jaipur = new Date("Oct 3, 2018 12:00:00").getTime(); 168 var jaipur = new Date("Oct 4, 2018 12:00:00").getTime();
165 // Update the count down every 1 second 169 // Update the count down every 1 second
166 var x = setInterval(function() { 170 var x = setInterval(function() {
167 // Get todays date and time 171 // Get todays date and time
168 var now = new Date().getTime(); 172 var now = new Date().getTime();
169 // Find the distance between now an the count down date 173 // Find the distance between now an the count down date
170 var distance = jaipur - now; 174 var distance = jaipur - now;
171 // Time calculations for days, hours, minutes and seconds 175 // Time calculations for days, hours, minutes and seconds
172 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 176 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
173 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 177 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
174 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 178 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
175 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 179 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
176 $scope.timer = days + "d " + hours + "h " 180 $scope.timer = days + "d " + hours + "h "
177 + minutes + "m " + seconds + "s " 181 + minutes + "m " + seconds + "s "
178 // Output the result in an element with id="demo" 182 // Output the result in an element with id="demo"
179 document.getElementById("jaipur").innerHTML = days + "d " + hours + "h " 183 document.getElementById("jaipur").innerHTML = days + "d " + hours + "h "
180 + minutes + "m " + seconds + "s "; 184 + minutes + "m " + seconds + "s ";
181 // If the count down is over, write some text 185 // If the count down is over, write some text
182 if (distance < 0) { 186 if (distance < 0) {
183 clearInterval(x); 187 clearInterval(x);
184 document.getElementById("jaipur").innerHTML = "EXPIRED"; 188 document.getElementById("jaipur").innerHTML = "EXPIRED";
185 } 189 }
186 }, 1000); 190 }, 1000);
187 191
188 var delhi = new Date("Oct 6, 2018 12:00:00").getTime(); 192 var delhi = new Date("Oct 7, 2018 12:00:00").getTime();
189 // Update the count down every 1 second 193 // Update the count down every 1 second
190 var x = setInterval(function() { 194 var x = setInterval(function() {
191 // Get todays date and time 195 // Get todays date and time
192 var now = new Date().getTime(); 196 var now = new Date().getTime();
193 // Find the distance between now an the count down date 197 // Find the distance between now an the count down date
194 var distance = delhi - now; 198 var distance = delhi - now;
195 // Time calculations for days, hours, minutes and seconds 199 // Time calculations for days, hours, minutes and seconds
196 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 200 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
197 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 201 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
198 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 202 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
199 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 203 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
200 $scope.timer = days + "d " + hours + "h " 204 $scope.timer = days + "d " + hours + "h "
201 + minutes + "m " + seconds + "s " 205 + minutes + "m " + seconds + "s "
202 // Output the result in an element with id="demo" 206 // Output the result in an element with id="demo"
203 document.getElementById("delhi").innerHTML = days + "d " + hours + "h " 207 document.getElementById("delhi").innerHTML = days + "d " + hours + "h "
204 + minutes + "m " + seconds + "s "; 208 + minutes + "m " + seconds + "s ";
205 // If the count down is over, write some text 209 // If the count down is over, write some text
206 if (distance < 0) { 210 if (distance < 0) {
207 clearInterval(x); 211 clearInterval(x);
208 document.getElementById("delhi").innerHTML = "EXPIRED"; 212 document.getElementById("delhi").innerHTML = "EXPIRED";
209 } 213 }
210 }, 1000); 214 }, 1000);
211 215
212 var kanpur = new Date("Oct 8, 2018 12:00:00").getTime(); 216 var kanpur = new Date("Oct 9, 2018 12:00:00").getTime();
213 // Update the count down every 1 second 217 // Update the count down every 1 second
214 var x = setInterval(function() { 218 var x = setInterval(function() {
215 // Get todays date and time 219 // Get todays date and time
216 var now = new Date().getTime(); 220 var now = new Date().getTime();
217 // Find the distance between now an the count down date 221 // Find the distance between now an the count down date
218 var distance = kanpur - now; 222 var distance = kanpur - now;
219 // Time calculations for days, hours, minutes and seconds 223 // Time calculations for days, hours, minutes and seconds
220 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 224 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
221 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 225 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
222 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 226 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
223 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 227 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
224 $scope.timer = days + "d " + hours + "h " 228 $scope.timer = days + "d " + hours + "h "
225 + minutes + "m " + seconds + "s " 229 + minutes + "m " + seconds + "s "
226 // Output the result in an element with id="demo" 230 // Output the result in an element with id="demo"
227 document.getElementById("kanpur").innerHTML = days + "d " + hours + "h " 231 document.getElementById("kanpur").innerHTML = days + "d " + hours + "h "
228 + minutes + "m " + seconds + "s "; 232 + minutes + "m " + seconds + "s ";
229 // If the count down is over, write some text 233 // If the count down is over, write some text
230 if (distance < 0) { 234 if (distance < 0) {
231 clearInterval(x); 235 clearInterval(x);
232 document.getElementById("kanpur").innerHTML = "EXPIRED"; 236 document.getElementById("kanpur").innerHTML = "EXPIRED";
233 } 237 }
234 }, 1000); 238 }, 1000);
235 239
236 var ahmedabad = new Date("Oct 10, 2018 12:00:00").getTime(); 240 var ahmedabad = new Date("Oct 11, 2018 12:00:00").getTime();
237 // Update the count down every 1 second 241 // Update the count down every 1 second
238 var x = setInterval(function() { 242 var x = setInterval(function() {
239 // Get todays date and time 243 // Get todays date and time
240 var now = new Date().getTime(); 244 var now = new Date().getTime();
241 // Find the distance between now an the count down date 245 // Find the distance between now an the count down date
242 var distance = ahmedabad - now; 246 var distance = ahmedabad - now;
243 // Time calculations for days, hours, minutes and seconds 247 // Time calculations for days, hours, minutes and seconds
244 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 248 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
245 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 249 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
246 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 250 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
247 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 251 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
248 $scope.timer = days + "d " + hours + "h " 252 $scope.timer = days + "d " + hours + "h "
249 + minutes + "m " + seconds + "s " 253 + minutes + "m " + seconds + "s "
250 // Output the result in an element with id="demo" 254 // Output the result in an element with id="demo"
251 document.getElementById("ahmedabad").innerHTML = days + "d " + hours + "h " 255 document.getElementById("ahmedabad").innerHTML = days + "d " + hours + "h "
252 + minutes + "m " + seconds + "s "; 256 + minutes + "m " + seconds + "s ";
253 // If the count down is over, write some text 257 // If the count down is over, write some text
254 if (distance < 0) { 258 if (distance < 0) {
255 clearInterval(x); 259 clearInterval(x);
256 document.getElementById("ahmedabad").innerHTML = "EXPIRED"; 260 document.getElementById("ahmedabad").innerHTML = "EXPIRED";
257 } 261 }
258 }, 1000); 262 }, 1000);
259 263
260 var bengaluru = new Date("Oct 11, 2018 12:00:00").getTime(); 264 var bengaluru = new Date("Oct 12, 2018 12:00:00").getTime();
261 // Update the count down every 1 second 265 // Update the count down every 1 second
262 var x = setInterval(function() { 266 var x = setInterval(function() {
263 // Get todays date and time 267 // Get todays date and time
264 var now = new Date().getTime(); 268 var now = new Date().getTime();
265 // Find the distance between now an the count down date 269 // Find the distance between now an the count down date
266 var distance = bengaluru - now; 270 var distance = bengaluru - now;
267 // Time calculations for days, hours, minutes and seconds 271 // Time calculations for days, hours, minutes and seconds
268 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 272 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
269 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 273 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
270 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 274 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
271 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 275 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
272 $scope.timer = days + "d " + hours + "h " 276 $scope.timer = days + "d " + hours + "h "
273 + minutes + "m " + seconds + "s " 277 + minutes + "m " + seconds + "s "
274 // Output the result in an element with id="demo" 278 // Output the result in an element with id="demo"
275 document.getElementById("bengaluru").innerHTML = days + "d " + hours + "h " 279 document.getElementById("bengaluru").innerHTML = days + "d " + hours + "h "
276 + minutes + "m " + seconds + "s "; 280 + minutes + "m " + seconds + "s ";
277 // If the count down is over, write some text 281 // If the count down is over, write some text
278 if (distance < 0) { 282 if (distance < 0) {
279 clearInterval(x); 283 clearInterval(x);
280 document.getElementById("bengaluru").innerHTML = "EXPIRED"; 284 document.getElementById("bengaluru").innerHTML = "EXPIRED";
281 } 285 }
282 }, 1000); 286 }, 1000);
283 287
284 var dharamsala = new Date("Dec 12, 2018 12:00:00").getTime(); 288 var dharamsala = new Date("Dec 13, 2018 12:00:00").getTime();
285 // Update the count down every 1 second 289 // Update the count down every 1 second
286 var x = setInterval(function() { 290 var x = setInterval(function() {
287 // Get todays date and time 291 // Get todays date and time
288 var now = new Date().getTime(); 292 var now = new Date().getTime();
289 // Find the distance between now an the count down date 293 // Find the distance between now an the count down date
290 var distance = dharamsala - now; 294 var distance = dharamsala - now;
291 // Time calculations for days, hours, minutes and seconds 295 // Time calculations for days, hours, minutes and seconds
292 var days = Math.floor(distance / (1000 * 60 * 60 * 24)); 296 var days = Math.floor(distance / (1000 * 60 * 60 * 24));
293 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); 297 var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
294 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); 298 var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
295 var seconds = Math.floor((distance % (1000 * 60)) / 1000); 299 var seconds = Math.floor((distance % (1000 * 60)) / 1000);
296 $scope.timer = days + "d " + hours + "h " 300 $scope.timer = days + "d " + hours + "h "
297 + minutes + "m " + seconds + "s " 301 + minutes + "m " + seconds + "s "
298 // Output the result in an element with id="demo" 302 // Output the result in an element with id="demo"
299 document.getElementById("dharamsala").innerHTML = days + "d " + hours + "h " 303 document.getElementById("dharamsala").innerHTML = days + "d " + hours + "h "
300 + minutes + "m " + seconds + "s "; 304 + minutes + "m " + seconds + "s ";
301 // If the count down is over, write some text 305 // If the count down is over, write some text
302 if (distance < 0) { 306 if (distance < 0) {
303 clearInterval(x); 307 clearInterval(x);
304 document.getElementById("dharamsala").innerHTML = "EXPIRED"; 308 document.getElementById("dharamsala").innerHTML = "EXPIRED";
305 } 309 }
306 }, 1000); 310 }, 1000);
307 311
308 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ 312 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
309 $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ 313 $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
310 // $scope.Textshow = "yes" 314 // $scope.Textshow = "yes"
311 $scope.max = 100; 315 $scope.max = 100;
312 $scope.formPage = false; 316 $scope.formPage = false;
313 $scope.current = 0; 317 $scope.current = 0;
314 $scope.payingAmnt = 0; 318 $scope.payingAmnt = 0;
315 $scope.data = {}; 319 $scope.data = {};
316 $scope.discountAmount = 0; 320 $scope.discountAmount = 0;
317 // $scope.data.quantity = "1"; 321 // $scope.data.quantity = "1";
318 $scope.check = false; 322 $scope.check = false;
319 $scope.numberCheck = false; 323 $scope.numberCheck = false;
320 $scope.paymentResult = {}; 324 $scope.paymentResult = {};
321 var data = { 325 var data = {
322 "amount": $scope.payingAmnt, 326 "amount": $scope.payingAmnt,
323 "currency": "INR", 327 "currency": "INR",
324 "status": "pending" 328 "status": "pending"
325 } 329 }
326 330
327 $scope.apply = function() { 331 $scope.apply = function() {
328 //Analytics.trackEvent('register', 'click', 'Registration'); 332 //Analytics.trackEvent('register', 'click', 'Registration');
329 $location.path("/caricatures") 333 $location.path("/caricatures")
330 } 334 }
331 335
332 $scope.data.city = ''; 336 $scope.data.city = '';
333 $scope.watch = function(value){ 337 $scope.watch = function(value){
334 console.log("cllll",value) 338 console.log("cllll",value)
335 $scope.data.city = value; 339 $scope.data.city = value;
336 localStorage.setItem("city" ,value); 340 localStorage.setItem("city" ,value);
337 //$location.path('/registration').search({city: value}); 341 //$location.path('/registration').search({city: value});
338 $location.path('/registration/'+value+''); 342 $location.path('/registration/'+value+'');
339 //$state.go('registration', { 'city': value}) 343 //$state.go('registration', { 'city': value})
340 } 344 }
341 345
342 $scope.select = function(url){ 346 $scope.select = function(url){
343 console.log("cllll") 347 console.log("cllll")
344 window.open(url) 348 window.open(url)
345 } 349 }
346 350
347 $scope.stagekeyPress = function() { 351 $scope.stagekeyPress = function() {
348 $('.icon-circle-a').css('background-color', 'rgb(25, 104, 157)'); 352 $('.icon-circle-a').css('background-color', 'rgb(25, 104, 157)');
349 } 353 }
350 $scope.sectorkeyPress = function() { 354 $scope.sectorkeyPress = function() {
351 $('.icon-circle-b').css('background-color', 'rgb(25, 104, 157)'); 355 $('.icon-circle-b').css('background-color', 'rgb(25, 104, 157)');
352 } 356 }
353 357
354 $scope.productLaunchkeyPress = function() { 358 $scope.productLaunchkeyPress = function() {
355 $('.icon-circle-ab').css('background-color', 'rgb(25, 104, 157)'); 359 $('.icon-circle-ab').css('background-color', 'rgb(25, 104, 157)');
356 } 360 }
357 361
358 $scope.launchPeriodkeyPress = function() { 362 $scope.launchPeriodkeyPress = function() {
359 $('.icon-circle-abc').css('background-color', 'rgb(25, 104, 157)'); 363 $('.icon-circle-abc').css('background-color', 'rgb(25, 104, 157)');
360 } 364 }
361 365
362 $scope.industrykeyPress = function(quantity) { 366 $scope.industrykeyPress = function(quantity) {
363 console.log("fghj",quantity) 367 console.log("fghj",quantity)
364 $('.icon-circle-abcdefg').css('background-color', 'rgb(25, 104, 157)'); 368 $('.icon-circle-abcdefg').css('background-color', 'rgb(25, 104, 157)');
365 } 369 }
366 370
367 $scope.industryNamekeyPress = function(firstName) { 371 $scope.industryNamekeyPress = function(firstName) {
368 console.log("lastName==", firstName); 372 console.log("lastName==", firstName);
369 if (firstName == undefined) { 373 if (firstName == undefined) {
370 $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); 374 $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)');
371 } else { 375 } else {
372 $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)'); 376 $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)');
373 } 377 }
374 } 378 }
375 379
376 $scope.amountkeyPress = function() { 380 $scope.amountkeyPress = function() {
377 $('.icon-circle-bc').css('background-color', 'rgb(25, 104, 157)'); 381 $('.icon-circle-bc').css('background-color', 'rgb(25, 104, 157)');
378 } 382 }
379 383
380 $scope.firstNamekeyPress = function(name) { 384 $scope.firstNamekeyPress = function(name) {
381 console.log("lastName==", name); 385 console.log("lastName==", name);
382 if (name == undefined) { 386 if (name == undefined) {
383 $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)'); 387 $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)');
384 } else { 388 } else {
385 $('.icon-circle-c').css('background-color', 'rgb(25, 104, 157)'); 389 $('.icon-circle-c').css('background-color', 'rgb(25, 104, 157)');
386 } 390 }
387 } 391 }
388 392
389 $scope.emailkeyPress = function(email) { 393 $scope.emailkeyPress = function(email) {
390 console.log("email", email); 394 console.log("email", email);
391 if (email == undefined) { 395 if (email == undefined) {
392 $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)'); 396 $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)');
393 } else { 397 } else {
394 $('.icon-circle-d').css('background-color', 'rgb(25, 104, 157)'); 398 $('.icon-circle-d').css('background-color', 'rgb(25, 104, 157)');
395 } 399 }
396 } 400 }
397 401
398 $scope.phonekeyPress = function(number) { 402 $scope.phonekeyPress = function(number) {
399 console.log("number", number); 403 console.log("number", number);
400 if (number == undefined || number == '') { 404 if (number == undefined || number == '') {
401 $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)'); 405 $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)');
402 } else { 406 } else {
403 $('.icon-circle-e').css('background-color', 'rgb(25, 104, 157)'); 407 $('.icon-circle-e').css('background-color', 'rgb(25, 104, 157)');
404 } 408 }
405 } 409 }
406 410
407 $scope.citykeyPress = function(city) { 411 $scope.citykeyPress = function(city) {
408 console.log("city", city); 412 console.log("city", city);
409 if (city == undefined) { 413 if (city == undefined) {
410 $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)'); 414 $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)');
411 } else { 415 } else {
412 $('.icon-circle-f').css('background-color', 'rgb(25, 104, 157)'); 416 $('.icon-circle-f').css('background-color', 'rgb(25, 104, 157)');
413 } 417 }
414 } 418 }
415 419
416 $scope.startupNamekeyPress = function(q) { 420 $scope.startupNamekeyPress = function(q) {
417 if (q == undefined) { 421 if (q == undefined) {
418 $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)'); 422 $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)');
419 } else { 423 } else {
420 $('.icon-circle-x').css('background-color', 'rgb(25, 104, 157)'); 424 $('.icon-circle-x').css('background-color', 'rgb(25, 104, 157)');
421 } 425 }
422 } 426 }
423 427
424 $scope.linkedInkeyPress = function(technology) { 428 $scope.linkedInkeyPress = function(technology) {
425 if (technology == undefined || technology == '') { 429 if (technology == undefined || technology == '') {
426 $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)'); 430 $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)');
427 } else { 431 } else {
428 $('.icon-circle-h').css('background-color', 'rgb(25, 104, 157)'); 432 $('.icon-circle-h').css('background-color', 'rgb(25, 104, 157)');
429 } 433 }
430 } 434 }
431 $scope.companykeyPress = function(problem) { 435 $scope.companykeyPress = function(problem) {
432 if (problem == undefined) { 436 if (problem == undefined) {
433 $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)'); 437 $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)');
434 } else { 438 } else {
435 $('.icon-circle-i').css('background-color', 'rgb(25, 104, 157)'); 439 $('.icon-circle-i').css('background-color', 'rgb(25, 104, 157)');
436 } 440 }
437 } 441 }
438 $scope.productNamekeyPress = function(solution) { 442 $scope.productNamekeyPress = function(solution) {
439 if (solution == undefined) { 443 if (solution == undefined) {
440 $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)'); 444 $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)');
441 } else { 445 } else {
442 $('.icon-circle-j').css('background-color', 'rgb(25, 104, 157)'); 446 $('.icon-circle-j').css('background-color', 'rgb(25, 104, 157)');
443 } 447 }
444 } 448 }
445 $scope.businesskeyPress = function(business) { 449 $scope.businesskeyPress = function(business) {
446 if (business == undefined) { 450 if (business == undefined) {
447 $('.icon-circle-p').css('background-color', 'rgb(102, 102, 102)'); 451 $('.icon-circle-p').css('background-color', 'rgb(102, 102, 102)');
448 } else { 452 } else {
449 $('.icon-circle-p').css('background-color', 'rgb(25, 104, 157)'); 453 $('.icon-circle-p').css('background-color', 'rgb(25, 104, 157)');
450 } 454 }
451 } 455 }
452 456
453 $scope.websitekeyPress = function(prototype) { 457 $scope.websitekeyPress = function(prototype) {
454 if (prototype == undefined || prototype == '') { 458 if (prototype == undefined || prototype == '') {
455 $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)'); 459 $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)');
456 } else { 460 } else {
457 $('.icon-circle-k').css('background-color', 'rgb(25, 104, 157)'); 461 $('.icon-circle-k').css('background-color', 'rgb(25, 104, 157)');
458 } 462 }
459 } 463 }
460 464
461 $scope.employeekeyPress = function(market) { 465 $scope.employeekeyPress = function(market) {
462 if (market == undefined || market == '') { 466 if (market == undefined || market == '') {
463 $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)'); 467 $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)');
464 } else { 468 } else {
465 $('.icon-circle-l').css('background-color', 'rgb(25, 104, 157)'); 469 $('.icon-circle-l').css('background-color', 'rgb(25, 104, 157)');
466 } 470 }
467 } 471 }
468 472
469 $scope.annualkeyPress = function(risk) { 473 $scope.annualkeyPress = function(risk) {
470 if (risk == undefined || risk == '') { 474 if (risk == undefined || risk == '') {
471 $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)'); 475 $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)');
472 } else { 476 } else {
473 $('.icon-circle-m').css('background-color', 'rgb(25, 104, 157)'); 477 $('.icon-circle-m').css('background-color', 'rgb(25, 104, 157)');
474 } 478 }
475 } 479 }
476 480
477 $scope.revenuekeyPress = function(team) { 481 $scope.revenuekeyPress = function(team) {
478 if (team == undefined) { 482 if (team == undefined) {
479 $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)'); 483 $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)');
480 } else { 484 } else {
481 $('.icon-circle-n').css('background-color', 'rgb(25, 104, 157)'); 485 $('.icon-circle-n').css('background-color', 'rgb(25, 104, 157)');
482 } 486 }
483 } 487 }
484 488
485 $scope.descriptionkeyPress = function(pitch) { 489 $scope.descriptionkeyPress = function(pitch) {
486 if (pitch == undefined) { 490 if (pitch == undefined) {
487 $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)'); 491 $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)');
488 } else { 492 } else {
489 $('.icon-circle-z').css('background-color', 'rgb(25, 104, 157)'); 493 $('.icon-circle-z').css('background-color', 'rgb(25, 104, 157)');
490 } 494 }
491 } 495 }
492 496
493 $scope.discountkeyPress = function(discount) { 497 $scope.discountkeyPress = function(discount) {
494 if (discount == undefined) { 498 if (discount == undefined) {
495 $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); 499 $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)');
496 } else { 500 } else {
497 $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)'); 501 $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)');
498 } 502 }
499 } 503 }
500 504
501 $scope.removeNooError = function() { 505 $scope.removeNooError = function() {
502 $('#invalidIdea').css('display', 'block'); 506 $('#invalidIdea').css('display', 'block');
503 $('#noExist').css('display', 'none'); 507 $('#noExist').css('display', 'none');
504 }; 508 };
505 509
506 $scope.ideakeyPress = function(financial) { 510 $scope.ideakeyPress = function(financial) {
507 console.log("financial", financial); 511 console.log("financial", financial);
508 if (financial == undefined) { 512 if (financial == undefined) {
509 $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)'); 513 $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)');
510 } else { 514 } else {
511 $('.icon-circle-q').css('background-color', 'rgb(25, 104, 157)'); 515 $('.icon-circle-q').css('background-color', 'rgb(25, 104, 157)');
512 } 516 }
513 } 517 }
514 518
515 $scope.fundkeyPress = function(financial) { 519 $scope.fundkeyPress = function(financial) {
516 console.log("financial", financial); 520 console.log("financial", financial);
517 if (financial == undefined) { 521 if (financial == undefined) {
518 $('.icon-circle-y').css('background-color', 'rgb(102, 102, 102)'); 522 $('.icon-circle-y').css('background-color', 'rgb(102, 102, 102)');
519 } else { 523 } else {
520 $('.icon-circle-y').css('background-color', 'rgb(25, 104, 157)'); 524 $('.icon-circle-y').css('background-color', 'rgb(25, 104, 157)');
521 } 525 }
522 } 526 }
523 527
524 $scope.changeReferalIconColor = function(referalToken){ 528 $scope.changeReferalIconColor = function(referalToken){
525 if (referalToken == undefined || referalToken == '') { 529 if (referalToken == undefined || referalToken == '') {
526 $('.referel-icon').css('background-color', 'rgb(102, 102, 102)'); 530 $('.referel-icon').css('background-color', 'rgb(102, 102, 102)');
527 }else { 531 }else {
528 $('.referel-icon').css('background-color', 'rgb(25, 104, 157)'); 532 $('.referel-icon').css('background-color', 'rgb(25, 104, 157)');
529 } 533 }
530 } 534 }
531 535
532 }); 536 });
533 537
534 scotchApp.controller('registrationController', function($scope, $http, $location, $rootScope,$route,BASE_URL) { 538 scotchApp.controller('registrationController', function($scope, $http, $location, $rootScope,$route,BASE_URL) {
535 $scope.data = {}; 539 $scope.data = {};
536 $scope.check = false; 540 $scope.check = false;
537 $scope.numberCheck = false; 541 $scope.numberCheck = false;
538 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ 542 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
539 $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ 543 $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
540 $scope.max = 100; 544 $scope.max = 100;
541 $scope.formPage = false; 545 $scope.formPage = false;
542 $scope.current = 0; 546 $scope.current = 0;
543 $scope.payingAmnt = 0; 547 $scope.payingAmnt = 0;
544 $scope.discountAmount = 0; 548 $scope.discountAmount = 0;
545 // $scope.data.quantity = "1"; 549 // $scope.data.quantity = "1";
546 $scope.check = false; 550 $scope.check = false;
547 $scope.numberCheck = false; 551 $scope.numberCheck = false;
548 $scope.paymentResult = {}; 552 $scope.paymentResult = {};
549 var data = { 553 var data = {
550 "amount": $scope.payingAmnt, 554 "amount": $scope.payingAmnt,
551 "currency": "INR", 555 "currency": "INR",
552 "status": "pending" 556 "status": "pending"
553 } 557 }
554 558
555 $scope.removeError = function() { 559 $scope.removeError = function() {
556 $('#invalidEmail').css('display', 'none'); 560 $('#invalidEmail').css('display', 'none');
557 $('#alreadyExist').css('display', 'none'); 561 $('#alreadyExist').css('display', 'none');
558 }; 562 };
559 563
560 $scope.emailcheck = function(val) { 564 $scope.emailcheck = function(val) {
561 if (val == undefined) { 565 if (val == undefined) {
562 $('#invalidEmail').css('display', 'block'); 566 $('#invalidEmail').css('display', 'block');
563 } else { 567 } else {
564 $('#alreadyExist').css('display', 'block'); 568 $('#alreadyExist').css('display', 'block');
565 } 569 }
566 }; 570 };
567 571
568 $scope.removeNoError = function() { 572 $scope.removeNoError = function() {
569 $('#invalidNumber').css('display', 'none'); 573 $('#invalidNumber').css('display', 'none');
570 $('#alreadyExist').css('display', 'none'); 574 $('#alreadyExist').css('display', 'none');
571 }; 575 };
572 576
573 $scope.numbercheck = function(val) { 577 $scope.numbercheck = function(val) {
574 if (val == undefined) { 578 if (val == undefined) {
575 $('#invalidNumber').css('display', 'block'); 579 $('#invalidNumber').css('display', 'block');
576 } else { 580 } else {
577 $('#alreadyExist').css('display', 'block'); 581 $('#alreadyExist').css('display', 'block');
578 } 582 }
579 }; 583 };
580 584
581 // $scope.$on('city', function (event, value) { 585 // $scope.$on('city', function (event, value) {
582 $scope.data.city = localStorage.getItem("city"); 586 $scope.data.city = localStorage.getItem("city");
583 console.log("HERE===",$scope.data.city ); 587 console.log("HERE===",$scope.data.city );
584 // }); 588 // });
585 589
586 $rootScope.tokenCall = function(val) { 590 $rootScope.tokenCall = function(val) {
587 console.log('val-------->', val); 591 console.log('val-------->', val);
588 if (val == undefined) { 592 if (val == undefined) {
589 $('#invalidToken').css('display', 'block'); 593 $('#invalidToken').css('display', 'block');
590 } else { 594 } else {
591 val = val.toUpperCase(); 595 val = val.toUpperCase();
592 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")){ 596 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")){
593 $scope.tokencheck = false; 597 $scope.tokencheck = false;
594 return; 598 return;
595 } 599 }
596 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "' + val + '"}}') 600 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "' + val + '"}}')
597 .then(function(searchResult) { 601 .then(function(searchResult) {
598 console.log("searchResult",searchResult) 602 console.log("searchResult",searchResult)
599 if (searchResult.data.length == 0) { 603 if (searchResult.data.length == 0) {
600 $scope.tokencheck = false; 604 $scope.tokencheck = false;
601 $scope.discountAmount = 0; 605 $scope.discountAmount = 0;
602 } else { 606 } else {
603 console.log("===searchResult.data[0].discount===",searchResult.data[0].discount); 607 console.log("===searchResult.data[0].discount===",searchResult.data[0].discount);
604 $scope.discountpercentage = searchResult.data[0].discount; 608 $scope.discountpercentage = searchResult.data[0].discount;
605 console.log("===searchResultdiscountpercentage===",$scope.discountpercentage); 609 console.log("===searchResultdiscountpercentage===",$scope.discountpercentage);
606 $scope.tokencheck = true; 610 $scope.tokencheck = true;
607 } 611 }
608 },function(err){ 612 },function(err){
609 console.log(err) 613 console.log(err)
610 }); 614 });
611 615
612 } 616 }
613 }; 617 };
614 618
615 $scope.submit = function() { 619 $scope.submit = function() {
616 $scope.ticketAmnt = 500; 620 $scope.ticketAmnt = 500;
617 if($scope.tokencheck == false){ 621 if($scope.tokencheck == false){
618 $scope.data.referalToken = null; 622 $scope.data.referalToken = null;
619 } 623 }
620 if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { 624 if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) {
621 var x = document.getElementById("snackbar") 625 var x = document.getElementById("snackbar")
622 setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); 626 setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
623 }else if($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { 627 }else if($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) {
624 $scope.infoForm = true; 628 $scope.infoForm = true;
625 $scope.detail = {}; 629 $scope.detail = {};
626 $scope.data.phone = "+91"+$scope.data.number; 630 $scope.data.phone = "+91"+$scope.data.number;
627 if($scope.data.referalToken == null){ 631 if($scope.data.referalToken == null){
628 $scope.data.referalToken = "N.A." 632 $scope.data.referalToken = "N.A."
629 } 633 }
630 $http({ 634 $http({
631 method: 'POST', 635 method: 'POST',
632 url: BASE_URL+'/applicants', 636 url: BASE_URL+'/applicants',
633 data: $scope.data, 637 data: $scope.data,
634 headers: {} 638 headers: {}
635 }).then(function mySuccess(result) { 639 }).then(function mySuccess(result) {
636 console.log("=====result=====",result) 640 console.log("=====result=====",result)
637 $scope.detail = result; 641 $scope.detail = result;
638 data.applicantId = result.data.id; 642 data.applicantId = result.data.id;
639 $scope.userId = result.data.id; 643 $scope.userId = result.data.id;
640 console.log("=====data=====",data) 644 console.log("=====data=====",data)
641 var amount = $scope.ticketAmnt * 100 645 var amount = $scope.ticketAmnt * 100
642 if($scope.tokencheck == true){ 646 if($scope.tokencheck == true){
643 var amount = $scope.ticketAmnt 647 var amount = $scope.ticketAmnt
644 console.log("====$scope.discountpercentage====",$scope.discountpercentage); 648 console.log("====$scope.discountpercentage====",$scope.discountpercentage);
645 console.log("resultcity===",$scope.data.city) 649 console.log("resultcity===",$scope.data.city)
646 if($scope.discountpercentage == "100") { 650 if($scope.discountpercentage == "100") {
647 $scope.discountpercentage = "99.8"; 651 $scope.discountpercentage = "99.8";
648 console.log("$scope.discountpercentage====",$scope.discountpercentage) 652 console.log("$scope.discountpercentage====",$scope.discountpercentage)
649 } 653 }
650 console.log("====$scope.discountpercentage====",$scope.discountpercentage); 654 console.log("====$scope.discountpercentage====",$scope.discountpercentage);
651 $scope.percDiscount = $scope.discountpercentage/100; 655 $scope.percDiscount = $scope.discountpercentage/100;
652 console.log("====$scope.percDiscount====",$scope.percDiscount); 656 console.log("====$scope.percDiscount====",$scope.percDiscount);
653 console.log("====amount=====",amount); 657 console.log("====amount=====",amount);
654 $scope.discountAmount = amount * $scope.percDiscount; 658 $scope.discountAmount = amount * $scope.percDiscount;
655 console.log("finalAmount====>",$scope.discountAmount) 659 console.log("finalAmount====>",$scope.discountAmount)
656 } 660 }
657 var taxAmount = $scope.ticketAmnt - $scope.discountAmount 661 var taxAmount = $scope.ticketAmnt - $scope.discountAmount
658 console.log("$scope.taxTotal----",taxAmount) 662 console.log("$scope.taxTotal----",taxAmount)
659 $scope.payingAmnt = taxAmount; 663 $scope.payingAmnt = taxAmount;
660 console.log("====$scope.payingAmnt====",$scope.payingAmnt) 664 console.log("====$scope.payingAmnt====",$scope.payingAmnt)
661 $scope.payingAmnt = $scope.payingAmnt.toFixed() 665 $scope.payingAmnt = $scope.payingAmnt.toFixed()
662 data.amount = $scope.payingAmnt; 666 data.amount = $scope.payingAmnt;
663 console.log("data.amount==",data.amount) 667 console.log("data.amount==",data.amount)
664 if($scope.detail != null){ 668 if($scope.detail != null){
665 $http({ 669 $http({
666 method: 'POST', 670 method: 'POST',
667 url: BASE_URL+'/payments', 671 url: BASE_URL+'/payments',
668 data: data, 672 data: data,
669 headers: {} 673 headers: {}
670 }).then(function mySuccess(paymentResult) { 674 }).then(function mySuccess(paymentResult) {
671 $scope.paymentResult = paymentResult; 675 $scope.paymentResult = paymentResult;
672 }, function myError(error) { 676 }, function myError(error) {
673 }); 677 });
674 } 678 }
675 var i = 0; 679 var i = 0;
676 $scope.payingAmnt = $scope.payingAmnt * 100; 680 $scope.payingAmnt = $scope.payingAmnt * 100;
677 var options = { 681 var options = {
678 //"key": "rzp_test_YwHsVFiDIQ2WUQ", 682 //"key": "rzp_test_YwHsVFiDIQ2WUQ",
679 "key": "rzp_live_mkmCb4FkstuWaS", 683 "key": "rzp_live_mkmCb4FkstuWaS",
680 "amount": $scope.payingAmnt, 684 "amount": $scope.payingAmnt,
681 685
682 "name": "Startup Jalsa", 686 "name": "Startup Jalsa",
683 "description":"amount", 687 "description":"amount",
684 "currency": "INR", 688 "currency": "INR",
685 "status": "done", 689 "status": "done",
686 690
687 "prefill": { 691 "prefill": {
688 "email": $scope.detail.email, 692 "email": $scope.detail.email,
689 "contact": $scope.detail.phone 693 "contact": $scope.detail.phone
690 }, 694 },
691 695
692 "theme": { 696 "theme": {
693 "color": "#2196f3 ", 697 "color": "#2196f3 ",
694 "image_padding":"NO" 698 "image_padding":"NO"
695 }, 699 },
696 "modal": { 700 "modal": {
697 "ondismiss": function(){ 701 "ondismiss": function(){
698 } 702 }
699 }, 703 },
700 "handler": function (response){ 704 "handler": function (response){
701 createPayment(response); 705 createPayment(response);
702 } 706 }
703 }; 707 };
704 var rzp1 = new Razorpay(options); 708 var rzp1 = new Razorpay(options);
705 rzp1.open(); 709 rzp1.open();
706 $scope.paymentResponse = {}; 710 $scope.paymentResponse = {};
707 function createPayment(response){ 711 function createPayment(response){
708 console.log("response12333333",response) 712 console.log("response12333333",response)
709 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; 713 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
710 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; 714 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId;
711 $scope.paymentResponse.amount = data.amount; 715 $scope.paymentResponse.amount = data.amount;
712 $scope.paymentResponse.currency = "INR"; 716 $scope.paymentResponse.currency = "INR";
713 $scope.paymentResponse.status = $scope.paymentResult.data.status; 717 $scope.paymentResponse.status = $scope.paymentResult.data.status;
714 console.log("$scope.paymentResponse.amount=====",$scope.paymentResponse.amount) 718 console.log("$scope.paymentResponse.amount=====",$scope.paymentResponse.amount)
715 $http({ 719 $http({
716 method: 'PUT', 720 method: 'PUT',
717 url: BASE_URL+'/payments/'+$scope.paymentResult.data.id, 721 url: BASE_URL+'/payments/'+$scope.paymentResult.data.id,
718 data: $scope.paymentResponse, 722 data: $scope.paymentResponse,
719 headers: {} 723 headers: {}
720 }).then(function mySuccess(searchResult) { 724 }).then(function mySuccess(searchResult) {
721 console.log("searchResult",searchResult) 725 console.log("searchResult",searchResult)
722 $location.path("/confirmation") 726 $location.path("/confirmation")
723 }, function myError(error) { 727 }, function myError(error) {
724 }); 728 });
725 } 729 }
726 //} 730 //}
727 731
728 }, function myError(error) { 732 }, function myError(error) {
729 733
730 }); 734 });
731 735
732 } 736 }
733 737
734 } 738 }
735 739
736 }); 740 });
737 741
738 scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) { 742 scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) {
739 $scope.data = {}; 743 $scope.data = {};
740 $scope.check = false; 744 $scope.check = false;
741 $scope.numberCheck = false; 745 $scope.numberCheck = false;
742 746
743 $scope.submit = function() { 747 $scope.submit = function() {
744 console.log($scope.data.name) 748 console.log($scope.data.name)
745 var randomNumber = ""+Math.random(); 749 var randomNumber = ""+Math.random();
746 var nameSpliced = $scope.data.name.slice(0,5); 750 var nameSpliced = $scope.data.name.slice(0,5);
747 var numberSpliced = randomNumber.slice(2,4);; 751 var numberSpliced = randomNumber.slice(2,4);;
748 $scope.data.referalToken = nameSpliced+numberSpliced; 752 $scope.data.referalToken = nameSpliced+numberSpliced;
749 $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); 753 $scope.data.referalToken = $scope.data.referalToken.toUpperCase();
750 console.log("dsdfs",numberSpliced); 754 console.log("dsdfs",numberSpliced);
751 $http({ 755 $http({
752 method: 'POST', 756 method: 'POST',
753 url: BASE_URL + '/ambassadors', 757 url: BASE_URL + '/ambassadors',
754 data: $scope.data, 758 data: $scope.data,
755 headers: {} 759 headers: {}
756 }).then(function mySuccess(result) { 760 }).then(function mySuccess(result) {
757 console.log("result", result) 761 console.log("result", result)
758 $scope.detail = result; 762 $scope.detail = result;
759 $('#myModal').modal('show'); 763 $('#myModal').modal('show');
760 $scope.data.name = ''; 764 $scope.data.name = '';
761 $scope.data.email = ''; 765 $scope.data.email = '';
762 $scope.data.mobile = ''; 766 $scope.data.mobile = '';
763 //$scope.data.discount = ''; 767 //$scope.data.discount = '';
764 768
765 }, function myError(error) { 769 }, function myError(error) {
766 console.log(error) 770 console.log(error)
767 console.log(error.data.error.message) 771 console.log(error.data.error.message)
768 }); 772 });
769 } 773 }
770 }); 774 });
771 775
772 776
773 777
774 778
775 779