Commit e8488da0732506b174a3a71241153f5a46372e97

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

amount regarding issue solve

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