Commit eb567dbaa2b7776bc8c22a43c2d031b600114187
1 parent
6a75328f92
Exists in
master
and in
1 other branch
minr change
Showing
1 changed file
with
2 additions
and
1 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', { | 27 | .when('/registration', { |
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 | $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ | 68 | $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ |
69 | $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ | 69 | $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ |
70 | // $scope.Textshow = "yes" | 70 | // $scope.Textshow = "yes" |
71 | $scope.max = 100; | 71 | $scope.max = 100; |
72 | $scope.formPage = false; | 72 | $scope.formPage = false; |
73 | $scope.current = 0; | 73 | $scope.current = 0; |
74 | $scope.payingAmnt = 0; | 74 | $scope.payingAmnt = 0; |
75 | $scope.data = {}; | 75 | $scope.data = {}; |
76 | $scope.discountAmount = 0; | 76 | $scope.discountAmount = 0; |
77 | // $scope.data.quantity = "1"; | 77 | // $scope.data.quantity = "1"; |
78 | $scope.check = false; | 78 | $scope.check = false; |
79 | $scope.numberCheck = false; | 79 | $scope.numberCheck = false; |
80 | $scope.paymentResult = {}; | 80 | $scope.paymentResult = {}; |
81 | var data = { | 81 | var data = { |
82 | "amount": $scope.payingAmnt, | 82 | "amount": $scope.payingAmnt, |
83 | "currency": "INR", | 83 | "currency": "INR", |
84 | "status": "pending" | 84 | "status": "pending" |
85 | } | 85 | } |
86 | 86 | ||
87 | $scope.apply = function() { | 87 | $scope.apply = function() { |
88 | //Analytics.trackEvent('register', 'click', 'Registration'); | 88 | //Analytics.trackEvent('register', 'click', 'Registration'); |
89 | $location.path("/caricatures") | 89 | $location.path("/caricatures") |
90 | } | 90 | } |
91 | 91 | ||
92 | $scope.data.city = ''; | 92 | $scope.data.city = ''; |
93 | $scope.watch = function(value){ | 93 | $scope.watch = function(value){ |
94 | console.log("cllll",value) | 94 | console.log("cllll",value) |
95 | $scope.data.city = value; | 95 | $scope.data.city = value; |
96 | localStorage.setItem("city" ,value); | 96 | localStorage.setItem("city" ,value); |
97 | //$location.path('/registration').search({city: value}); | 97 | //$location.path('/registration').search({city: value}); |
98 | $location.path('/registration'); | 98 | $location.path('/registration'); |
99 | //$state.go('registration', { 'city': value}) | 99 | //$state.go('registration', { 'city': value}) |
100 | } | 100 | } |
101 | 101 | ||
102 | $scope.select = function(url){ | 102 | $scope.select = function(url){ |
103 | console.log("cllll") | 103 | console.log("cllll") |
104 | window.open(url) | 104 | window.open(url) |
105 | } | 105 | } |
106 | 106 | ||
107 | $scope.stagekeyPress = function() { | 107 | $scope.stagekeyPress = function() { |
108 | $('.icon-circle-a').css('background-color', 'rgb(25, 104, 157)'); | 108 | $('.icon-circle-a').css('background-color', 'rgb(25, 104, 157)'); |
109 | } | 109 | } |
110 | $scope.sectorkeyPress = function() { | 110 | $scope.sectorkeyPress = function() { |
111 | $('.icon-circle-b').css('background-color', 'rgb(25, 104, 157)'); | 111 | $('.icon-circle-b').css('background-color', 'rgb(25, 104, 157)'); |
112 | } | 112 | } |
113 | 113 | ||
114 | $scope.productLaunchkeyPress = function() { | 114 | $scope.productLaunchkeyPress = function() { |
115 | $('.icon-circle-ab').css('background-color', 'rgb(25, 104, 157)'); | 115 | $('.icon-circle-ab').css('background-color', 'rgb(25, 104, 157)'); |
116 | } | 116 | } |
117 | 117 | ||
118 | $scope.launchPeriodkeyPress = function() { | 118 | $scope.launchPeriodkeyPress = function() { |
119 | $('.icon-circle-abc').css('background-color', 'rgb(25, 104, 157)'); | 119 | $('.icon-circle-abc').css('background-color', 'rgb(25, 104, 157)'); |
120 | } | 120 | } |
121 | 121 | ||
122 | $scope.industrykeyPress = function(quantity) { | 122 | $scope.industrykeyPress = function(quantity) { |
123 | console.log("fghj",quantity) | 123 | console.log("fghj",quantity) |
124 | $('.icon-circle-abcdefg').css('background-color', 'rgb(25, 104, 157)'); | 124 | $('.icon-circle-abcdefg').css('background-color', 'rgb(25, 104, 157)'); |
125 | } | 125 | } |
126 | 126 | ||
127 | $scope.industryNamekeyPress = function(firstName) { | 127 | $scope.industryNamekeyPress = function(firstName) { |
128 | console.log("lastName==", firstName); | 128 | console.log("lastName==", firstName); |
129 | if (firstName == undefined) { | 129 | if (firstName == undefined) { |
130 | $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); | 130 | $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); |
131 | } else { | 131 | } else { |
132 | $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)'); | 132 | $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)'); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | 135 | ||
136 | $scope.amountkeyPress = function() { | 136 | $scope.amountkeyPress = function() { |
137 | $('.icon-circle-bc').css('background-color', 'rgb(25, 104, 157)'); | 137 | $('.icon-circle-bc').css('background-color', 'rgb(25, 104, 157)'); |
138 | } | 138 | } |
139 | 139 | ||
140 | $scope.firstNamekeyPress = function(name) { | 140 | $scope.firstNamekeyPress = function(name) { |
141 | console.log("lastName==", name); | 141 | console.log("lastName==", name); |
142 | if (name == undefined) { | 142 | if (name == undefined) { |
143 | $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)'); | 143 | $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)'); |
144 | } else { | 144 | } else { |
145 | $('.icon-circle-c').css('background-color', 'rgb(25, 104, 157)'); | 145 | $('.icon-circle-c').css('background-color', 'rgb(25, 104, 157)'); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | $scope.emailkeyPress = function(email) { | 149 | $scope.emailkeyPress = function(email) { |
150 | console.log("email", email); | 150 | console.log("email", email); |
151 | if (email == undefined) { | 151 | if (email == undefined) { |
152 | $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)'); | 152 | $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)'); |
153 | } else { | 153 | } else { |
154 | $('.icon-circle-d').css('background-color', 'rgb(25, 104, 157)'); | 154 | $('.icon-circle-d').css('background-color', 'rgb(25, 104, 157)'); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | 157 | ||
158 | $scope.phonekeyPress = function(number) { | 158 | $scope.phonekeyPress = function(number) { |
159 | console.log("number", number); | 159 | console.log("number", number); |
160 | if (number == undefined || number == '') { | 160 | if (number == undefined || number == '') { |
161 | $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)'); | 161 | $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)'); |
162 | } else { | 162 | } else { |
163 | $('.icon-circle-e').css('background-color', 'rgb(25, 104, 157)'); | 163 | $('.icon-circle-e').css('background-color', 'rgb(25, 104, 157)'); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
167 | $scope.citykeyPress = function(city) { | 167 | $scope.citykeyPress = function(city) { |
168 | console.log("city", city); | 168 | console.log("city", city); |
169 | if (city == undefined) { | 169 | if (city == undefined) { |
170 | $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)'); | 170 | $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)'); |
171 | } else { | 171 | } else { |
172 | $('.icon-circle-f').css('background-color', 'rgb(25, 104, 157)'); | 172 | $('.icon-circle-f').css('background-color', 'rgb(25, 104, 157)'); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | $scope.startupNamekeyPress = function(q) { | 176 | $scope.startupNamekeyPress = function(q) { |
177 | if (q == undefined) { | 177 | if (q == undefined) { |
178 | $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)'); | 178 | $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)'); |
179 | } else { | 179 | } else { |
180 | $('.icon-circle-x').css('background-color', 'rgb(25, 104, 157)'); | 180 | $('.icon-circle-x').css('background-color', 'rgb(25, 104, 157)'); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | $scope.linkedInkeyPress = function(technology) { | 184 | $scope.linkedInkeyPress = function(technology) { |
185 | if (technology == undefined || technology == '') { | 185 | if (technology == undefined || technology == '') { |
186 | $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)'); | 186 | $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)'); |
187 | } else { | 187 | } else { |
188 | $('.icon-circle-h').css('background-color', 'rgb(25, 104, 157)'); | 188 | $('.icon-circle-h').css('background-color', 'rgb(25, 104, 157)'); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | $scope.companykeyPress = function(problem) { | 191 | $scope.companykeyPress = function(problem) { |
192 | if (problem == undefined) { | 192 | if (problem == undefined) { |
193 | $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)'); | 193 | $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)'); |
194 | } else { | 194 | } else { |
195 | $('.icon-circle-i').css('background-color', 'rgb(25, 104, 157)'); | 195 | $('.icon-circle-i').css('background-color', 'rgb(25, 104, 157)'); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | $scope.productNamekeyPress = function(solution) { | 198 | $scope.productNamekeyPress = function(solution) { |
199 | if (solution == undefined) { | 199 | if (solution == undefined) { |
200 | $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)'); | 200 | $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)'); |
201 | } else { | 201 | } else { |
202 | $('.icon-circle-j').css('background-color', 'rgb(25, 104, 157)'); | 202 | $('.icon-circle-j').css('background-color', 'rgb(25, 104, 157)'); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | $scope.businesskeyPress = function(business) { | 205 | $scope.businesskeyPress = function(business) { |
206 | if (business == undefined) { | 206 | if (business == undefined) { |
207 | $('.icon-circle-p').css('background-color', 'rgb(102, 102, 102)'); | 207 | $('.icon-circle-p').css('background-color', 'rgb(102, 102, 102)'); |
208 | } else { | 208 | } else { |
209 | $('.icon-circle-p').css('background-color', 'rgb(25, 104, 157)'); | 209 | $('.icon-circle-p').css('background-color', 'rgb(25, 104, 157)'); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | $scope.websitekeyPress = function(prototype) { | 213 | $scope.websitekeyPress = function(prototype) { |
214 | if (prototype == undefined || prototype == '') { | 214 | if (prototype == undefined || prototype == '') { |
215 | $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)'); | 215 | $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)'); |
216 | } else { | 216 | } else { |
217 | $('.icon-circle-k').css('background-color', 'rgb(25, 104, 157)'); | 217 | $('.icon-circle-k').css('background-color', 'rgb(25, 104, 157)'); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | $scope.employeekeyPress = function(market) { | 221 | $scope.employeekeyPress = function(market) { |
222 | if (market == undefined || market == '') { | 222 | if (market == undefined || market == '') { |
223 | $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)'); | 223 | $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)'); |
224 | } else { | 224 | } else { |
225 | $('.icon-circle-l').css('background-color', 'rgb(25, 104, 157)'); | 225 | $('.icon-circle-l').css('background-color', 'rgb(25, 104, 157)'); |
226 | } | 226 | } |
227 | } | 227 | } |
228 | 228 | ||
229 | $scope.annualkeyPress = function(risk) { | 229 | $scope.annualkeyPress = function(risk) { |
230 | if (risk == undefined || risk == '') { | 230 | if (risk == undefined || risk == '') { |
231 | $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)'); | 231 | $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)'); |
232 | } else { | 232 | } else { |
233 | $('.icon-circle-m').css('background-color', 'rgb(25, 104, 157)'); | 233 | $('.icon-circle-m').css('background-color', 'rgb(25, 104, 157)'); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | $scope.revenuekeyPress = function(team) { | 237 | $scope.revenuekeyPress = function(team) { |
238 | if (team == undefined) { | 238 | if (team == undefined) { |
239 | $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)'); | 239 | $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)'); |
240 | } else { | 240 | } else { |
241 | $('.icon-circle-n').css('background-color', 'rgb(25, 104, 157)'); | 241 | $('.icon-circle-n').css('background-color', 'rgb(25, 104, 157)'); |
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | $scope.descriptionkeyPress = function(pitch) { | 245 | $scope.descriptionkeyPress = function(pitch) { |
246 | if (pitch == undefined) { | 246 | if (pitch == undefined) { |
247 | $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)'); | 247 | $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)'); |
248 | } else { | 248 | } else { |
249 | $('.icon-circle-z').css('background-color', 'rgb(25, 104, 157)'); | 249 | $('.icon-circle-z').css('background-color', 'rgb(25, 104, 157)'); |
250 | } | 250 | } |
251 | } | 251 | } |
252 | 252 | ||
253 | $scope.discountkeyPress = function(discount) { | 253 | $scope.discountkeyPress = function(discount) { |
254 | if (discount == undefined) { | 254 | if (discount == undefined) { |
255 | $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); | 255 | $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); |
256 | } else { | 256 | } else { |
257 | $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)'); | 257 | $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)'); |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | $scope.removeNooError = function() { | 261 | $scope.removeNooError = function() { |
262 | $('#invalidIdea').css('display', 'block'); | 262 | $('#invalidIdea').css('display', 'block'); |
263 | $('#noExist').css('display', 'none'); | 263 | $('#noExist').css('display', 'none'); |
264 | }; | 264 | }; |
265 | 265 | ||
266 | $scope.ideakeyPress = function(financial) { | 266 | $scope.ideakeyPress = function(financial) { |
267 | console.log("financial", financial); | 267 | console.log("financial", financial); |
268 | if (financial == undefined) { | 268 | if (financial == undefined) { |
269 | $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)'); | 269 | $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)'); |
270 | } else { | 270 | } else { |
271 | $('.icon-circle-q').css('background-color', 'rgb(25, 104, 157)'); | 271 | $('.icon-circle-q').css('background-color', 'rgb(25, 104, 157)'); |
272 | } | 272 | } |
273 | } | 273 | } |
274 | 274 | ||
275 | $scope.fundkeyPress = function(financial) { | 275 | $scope.fundkeyPress = function(financial) { |
276 | console.log("financial", financial); | 276 | console.log("financial", financial); |
277 | if (financial == undefined) { | 277 | if (financial == undefined) { |
278 | $('.icon-circle-y').css('background-color', 'rgb(102, 102, 102)'); | 278 | $('.icon-circle-y').css('background-color', 'rgb(102, 102, 102)'); |
279 | } else { | 279 | } else { |
280 | $('.icon-circle-y').css('background-color', 'rgb(25, 104, 157)'); | 280 | $('.icon-circle-y').css('background-color', 'rgb(25, 104, 157)'); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | $scope.changeReferalIconColor = function(referalToken){ | 284 | $scope.changeReferalIconColor = function(referalToken){ |
285 | if (referalToken == undefined || referalToken == '') { | 285 | if (referalToken == undefined || referalToken == '') { |
286 | $('.referel-icon').css('background-color', 'rgb(102, 102, 102)'); | 286 | $('.referel-icon').css('background-color', 'rgb(102, 102, 102)'); |
287 | }else { | 287 | }else { |
288 | $('.referel-icon').css('background-color', 'rgb(25, 104, 157)'); | 288 | $('.referel-icon').css('background-color', 'rgb(25, 104, 157)'); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | }); | 292 | }); |
293 | 293 | ||
294 | scotchApp.controller('registrationController', function($scope, $http, $location, $rootScope,$route,BASE_URL) { | 294 | scotchApp.controller('registrationController', function($scope, $http, $location, $rootScope,$route,BASE_URL) { |
295 | $scope.data = {}; | 295 | $scope.data = {}; |
296 | $scope.check = false; | 296 | $scope.check = false; |
297 | $scope.numberCheck = false; | 297 | $scope.numberCheck = false; |
298 | $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ | 298 | $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ |
299 | $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ | 299 | $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ |
300 | $scope.max = 100; | 300 | $scope.max = 100; |
301 | $scope.formPage = false; | 301 | $scope.formPage = false; |
302 | $scope.current = 0; | 302 | $scope.current = 0; |
303 | $scope.payingAmnt = 0; | 303 | $scope.payingAmnt = 0; |
304 | $scope.discountAmount = 0; | 304 | $scope.discountAmount = 0; |
305 | // $scope.data.quantity = "1"; | 305 | // $scope.data.quantity = "1"; |
306 | $scope.check = false; | 306 | $scope.check = false; |
307 | $scope.numberCheck = false; | 307 | $scope.numberCheck = false; |
308 | $scope.paymentResult = {}; | 308 | $scope.paymentResult = {}; |
309 | var data = { | 309 | var data = { |
310 | "amount": $scope.payingAmnt, | 310 | "amount": $scope.payingAmnt, |
311 | "currency": "INR", | 311 | "currency": "INR", |
312 | "status": "pending" | 312 | "status": "pending" |
313 | } | 313 | } |
314 | 314 | ||
315 | $scope.removeError = function() { | 315 | $scope.removeError = function() { |
316 | $('#invalidEmail').css('display', 'none'); | 316 | $('#invalidEmail').css('display', 'none'); |
317 | $('#alreadyExist').css('display', 'none'); | 317 | $('#alreadyExist').css('display', 'none'); |
318 | }; | 318 | }; |
319 | 319 | ||
320 | $scope.emailcheck = function(val) { | 320 | $scope.emailcheck = function(val) { |
321 | if (val == undefined) { | 321 | if (val == undefined) { |
322 | $('#invalidEmail').css('display', 'block'); | 322 | $('#invalidEmail').css('display', 'block'); |
323 | } else { | 323 | } else { |
324 | $('#alreadyExist').css('display', 'block'); | 324 | $('#alreadyExist').css('display', 'block'); |
325 | } | 325 | } |
326 | }; | 326 | }; |
327 | 327 | ||
328 | // $scope.$on('city', function (event, value) { | 328 | // $scope.$on('city', function (event, value) { |
329 | $scope.data.city = localStorage.getItem("city"); | 329 | $scope.data.city = localStorage.getItem("city"); |
330 | console.log("HERE===",$scope.data.city ); | 330 | console.log("HERE===",$scope.data.city ); |
331 | // }); | 331 | // }); |
332 | 332 | ||
333 | $rootScope.tokenCall = function(val) { | 333 | $rootScope.tokenCall = function(val) { |
334 | console.log('val-------->', val); | 334 | console.log('val-------->', val); |
335 | if (val == undefined) { | 335 | if (val == undefined) { |
336 | $('#invalidToken').css('display', 'block'); | 336 | $('#invalidToken').css('display', 'block'); |
337 | } else { | 337 | } else { |
338 | val = val.toUpperCase(); | 338 | val = val.toUpperCase(); |
339 | $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "%25' + val + '%25"}}') | 339 | $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "' + val + '"}}') |
340 | .then(function(searchResult) { | 340 | .then(function(searchResult) { |
341 | console.log("searchResult",searchResult) | 341 | console.log("searchResult",searchResult) |
342 | if (searchResult.data.length == 0) { | 342 | if (searchResult.data.length == 0) { |
343 | $scope.tokencheck = false; | 343 | $scope.tokencheck = false; |
344 | $scope.discountAmount = 0; | 344 | $scope.discountAmount = 0; |
345 | } else { | 345 | } else { |
346 | console.log("===searchResult.data[0].discount===",searchResult.data[0].discount); | 346 | console.log("===searchResult.data[0].discount===",searchResult.data[0].discount); |
347 | $scope.discountpercentage = searchResult.data[0].discount; | 347 | $scope.discountpercentage = searchResult.data[0].discount; |
348 | console.log("===searchResultdiscountpercentage===",$scope.discountpercentage); | 348 | console.log("===searchResultdiscountpercentage===",$scope.discountpercentage); |
349 | $scope.tokencheck = true; | 349 | $scope.tokencheck = true; |
350 | } | 350 | } |
351 | },function(err){ | 351 | },function(err){ |
352 | console.log(err) | 352 | console.log(err) |
353 | }); | 353 | }); |
354 | 354 | ||
355 | } | 355 | } |
356 | }; | 356 | }; |
357 | 357 | ||
358 | $scope.submit = function() { | 358 | $scope.submit = function() { |
359 | $scope.ticketAmnt = 500; | 359 | $scope.ticketAmnt = 500; |
360 | if($scope.tokencheck == false){ | 360 | if($scope.tokencheck == false){ |
361 | $scope.data.referalToken = null; | 361 | $scope.data.referalToken = null; |
362 | } | 362 | } |
363 | if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { | 363 | if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { |
364 | var x = document.getElementById("snackbar") | 364 | var x = document.getElementById("snackbar") |
365 | setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); | 365 | setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); |
366 | }else if($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { | 366 | }else if($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { |
367 | $scope.infoForm = true; | 367 | $scope.infoForm = true; |
368 | $scope.detail = {}; | 368 | $scope.detail = {}; |
369 | $scope.data.phone = "+91"+$scope.data.number; | 369 | $scope.data.phone = "+91"+$scope.data.number; |
370 | $http({ | 370 | $http({ |
371 | method: 'POST', | 371 | method: 'POST', |
372 | url: BASE_URL+'/applicants', | 372 | url: BASE_URL+'/applicants', |
373 | data: $scope.data, | 373 | data: $scope.data, |
374 | headers: {} | 374 | headers: {} |
375 | }).then(function mySuccess(result) { | 375 | }).then(function mySuccess(result) { |
376 | console.log("=====result=====",result) | 376 | console.log("=====result=====",result) |
377 | $scope.detail = result; | 377 | $scope.detail = result; |
378 | data.applicantId = result.data.id; | 378 | data.applicantId = result.data.id; |
379 | $scope.userId = result.data.id; | 379 | $scope.userId = result.data.id; |
380 | console.log("=====data=====",data) | 380 | console.log("=====data=====",data) |
381 | var amount = $scope.ticketAmnt * 100 | 381 | var amount = $scope.ticketAmnt * 100 |
382 | if($scope.tokencheck == true){ | 382 | if($scope.tokencheck == true){ |
383 | var amount = $scope.ticketAmnt | 383 | var amount = $scope.ticketAmnt |
384 | console.log("====$scope.discountpercentage====",$scope.discountpercentage); | 384 | console.log("====$scope.discountpercentage====",$scope.discountpercentage); |
385 | if($scope.discountpercentage == "100") { | 385 | if($scope.discountpercentage == "100") { |
386 | $scope.discountpercentage = "99.8"; | 386 | $scope.discountpercentage = "99.8"; |
387 | console.log("$scope.discountpercentage====",$scope.discountpercentage) | ||
387 | } | 388 | } |
388 | console.log("====$scope.discountpercentage====",$scope.discountpercentage); | 389 | console.log("====$scope.discountpercentage====",$scope.discountpercentage); |
389 | $scope.percDiscount = $scope.discountpercentage/100; | 390 | $scope.percDiscount = $scope.discountpercentage/100; |
390 | console.log("====$scope.percDiscount====",$scope.percDiscount); | 391 | console.log("====$scope.percDiscount====",$scope.percDiscount); |
391 | console.log("====amount=====",amount); | 392 | console.log("====amount=====",amount); |
392 | $scope.discountAmount = amount * $scope.percDiscount; | 393 | $scope.discountAmount = amount * $scope.percDiscount; |
393 | console.log("finalAmount====>",$scope.discountAmount) | 394 | console.log("finalAmount====>",$scope.discountAmount) |
394 | } | 395 | } |
395 | var taxAmount = $scope.ticketAmnt - $scope.discountAmount | 396 | var taxAmount = $scope.ticketAmnt - $scope.discountAmount |
396 | console.log("$scope.taxTotal----",taxAmount) | 397 | console.log("$scope.taxTotal----",taxAmount) |
397 | $scope.payingAmnt = taxAmount; | 398 | $scope.payingAmnt = taxAmount; |
398 | console.log("====$scope.payingAmnt====",$scope.payingAmnt) | 399 | console.log("====$scope.payingAmnt====",$scope.payingAmnt) |
399 | $scope.payingAmnt = $scope.payingAmnt.toFixed() | 400 | $scope.payingAmnt = $scope.payingAmnt.toFixed() |
400 | data.amount = $scope.payingAmnt; | 401 | data.amount = $scope.payingAmnt; |
401 | console.log("data.amount==",data.amount) | 402 | console.log("data.amount==",data.amount) |
402 | if($scope.detail != null){ | 403 | if($scope.detail != null){ |
403 | $http({ | 404 | $http({ |
404 | method: 'POST', | 405 | method: 'POST', |
405 | url: BASE_URL+'/payments', | 406 | url: BASE_URL+'/payments', |
406 | data: data, | 407 | data: data, |
407 | headers: {} | 408 | headers: {} |
408 | }).then(function mySuccess(paymentResult) { | 409 | }).then(function mySuccess(paymentResult) { |
409 | $scope.paymentResult = paymentResult; | 410 | $scope.paymentResult = paymentResult; |
410 | }, function myError(error) { | 411 | }, function myError(error) { |
411 | }); | 412 | }); |
412 | } | 413 | } |
413 | var i = 0; | 414 | var i = 0; |
414 | $scope.payingAmnt = $scope.payingAmnt * 100; | 415 | $scope.payingAmnt = $scope.payingAmnt * 100; |
415 | var options = { | 416 | var options = { |
416 | //"key": "rzp_test_YwHsVFiDIQ2WUQ", | 417 | //"key": "rzp_test_YwHsVFiDIQ2WUQ", |
417 | "key": "rzp_live_mkmCb4FkstuWaS", | 418 | "key": "rzp_live_mkmCb4FkstuWaS", |
418 | "amount": $scope.payingAmnt, | 419 | "amount": $scope.payingAmnt, |
419 | 420 | ||
420 | "name": "Startup Jalsa", | 421 | "name": "Startup Jalsa", |
421 | "description":"amount", | 422 | "description":"amount", |
422 | "currency": "INR", | 423 | "currency": "INR", |
423 | "status": "done", | 424 | "status": "done", |
424 | 425 | ||
425 | "prefill": { | 426 | "prefill": { |
426 | "email": $scope.detail.email, | 427 | "email": $scope.detail.email, |
427 | "contact": $scope.detail.phone | 428 | "contact": $scope.detail.phone |
428 | }, | 429 | }, |
429 | 430 | ||
430 | "theme": { | 431 | "theme": { |
431 | "color": "#2196f3 ", | 432 | "color": "#2196f3 ", |
432 | "image_padding":"NO" | 433 | "image_padding":"NO" |
433 | }, | 434 | }, |
434 | "modal": { | 435 | "modal": { |
435 | "ondismiss": function(){ | 436 | "ondismiss": function(){ |
436 | } | 437 | } |
437 | }, | 438 | }, |
438 | "handler": function (response){ | 439 | "handler": function (response){ |
439 | createPayment(response); | 440 | createPayment(response); |
440 | } | 441 | } |
441 | }; | 442 | }; |
442 | var rzp1 = new Razorpay(options); | 443 | var rzp1 = new Razorpay(options); |
443 | rzp1.open(); | 444 | rzp1.open(); |
444 | $scope.paymentResponse = {}; | 445 | $scope.paymentResponse = {}; |
445 | function createPayment(response){ | 446 | function createPayment(response){ |
446 | console.log("response12333333",response) | 447 | console.log("response12333333",response) |
447 | $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; | 448 | $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; |
448 | $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; | 449 | $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; |
449 | $scope.paymentResponse.amount = data.amount; | 450 | $scope.paymentResponse.amount = data.amount; |
450 | $scope.paymentResponse.currency = "INR"; | 451 | $scope.paymentResponse.currency = "INR"; |
451 | $scope.paymentResponse.status = $scope.paymentResult.data.status; | 452 | $scope.paymentResponse.status = $scope.paymentResult.data.status; |
452 | console.log("$scope.paymentResponse.amount=====",$scope.paymentResponse.amount) | 453 | console.log("$scope.paymentResponse.amount=====",$scope.paymentResponse.amount) |
453 | $http({ | 454 | $http({ |
454 | method: 'PUT', | 455 | method: 'PUT', |
455 | url: BASE_URL+'/payments/'+$scope.paymentResult.data.id, | 456 | url: BASE_URL+'/payments/'+$scope.paymentResult.data.id, |
456 | data: $scope.paymentResponse, | 457 | data: $scope.paymentResponse, |
457 | headers: {} | 458 | headers: {} |
458 | }).then(function mySuccess(searchResult) { | 459 | }).then(function mySuccess(searchResult) { |
459 | console.log("searchResult",searchResult) | 460 | console.log("searchResult",searchResult) |
460 | $location.path("/confirmation") | 461 | $location.path("/confirmation") |
461 | }, function myError(error) { | 462 | }, function myError(error) { |
462 | }); | 463 | }); |
463 | } | 464 | } |
464 | 465 | ||
465 | }, function myError(error) { | 466 | }, function myError(error) { |
466 | 467 | ||
467 | }); | 468 | }); |
468 | 469 | ||
469 | } | 470 | } |
470 | 471 | ||
471 | } | 472 | } |
472 | 473 | ||
473 | }); | 474 | }); |
474 | 475 | ||
475 | scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) { | 476 | scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) { |
476 | $scope.data = {}; | 477 | $scope.data = {}; |
477 | $scope.check = false; | 478 | $scope.check = false; |
478 | $scope.numberCheck = false; | 479 | $scope.numberCheck = false; |
479 | 480 | ||
480 | $scope.submit = function() { | 481 | $scope.submit = function() { |
481 | console.log($scope.data.name) | 482 | console.log($scope.data.name) |
482 | var randomNumber = ""+Math.random(); | 483 | var randomNumber = ""+Math.random(); |
483 | var nameSpliced = $scope.data.name.slice(0,5); | 484 | var nameSpliced = $scope.data.name.slice(0,5); |
484 | var numberSpliced = randomNumber.slice(2,4);; | 485 | var numberSpliced = randomNumber.slice(2,4);; |
485 | $scope.data.referalToken = nameSpliced+numberSpliced; | 486 | $scope.data.referalToken = nameSpliced+numberSpliced; |
486 | $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); | 487 | $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); |
487 | console.log("dsdfs",numberSpliced); | 488 | console.log("dsdfs",numberSpliced); |
488 | $http({ | 489 | $http({ |
489 | method: 'POST', | 490 | method: 'POST', |
490 | url: BASE_URL + '/ambassadors', | 491 | url: BASE_URL + '/ambassadors', |
491 | data: $scope.data, | 492 | data: $scope.data, |
492 | headers: {} | 493 | headers: {} |
493 | }).then(function mySuccess(result) { | 494 | }).then(function mySuccess(result) { |
494 | console.log("result", result) | 495 | console.log("result", result) |
495 | $scope.detail = result; | 496 | $scope.detail = result; |
496 | $('#myModal').modal('show'); | 497 | $('#myModal').modal('show'); |
497 | $scope.data.name = ''; | 498 | $scope.data.name = ''; |
498 | $scope.data.email = ''; | 499 | $scope.data.email = ''; |
499 | $scope.data.mobile = ''; | 500 | $scope.data.mobile = ''; |
500 | //$scope.data.discount = ''; | 501 | //$scope.data.discount = ''; |
501 | 502 | ||
502 | }, function myError(error) { | 503 | }, function myError(error) { |
503 | console.log(error) | 504 | console.log(error) |
504 | console.log(error.data.error.message) | 505 | console.log(error.data.error.message) |
505 | }); | 506 | }); |
506 | } | 507 | } |
507 | }); | 508 | }); |
508 | 509 | ||
509 | 510 | ||
510 | 511 | ||
511 | 512 | ||
512 | 513 |