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