Commit 9842ccd2733df85e1a24f54f3fbc3240e2e58129

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

changes api call

Showing 1 changed file with 53 additions and 26 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']); 2 var scotchApp = angular.module('scotchApp', ['ngRoute']);
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 paymentVerify page 14 // route for the paymentVerify page
15 .when('/paymentVerification/:id', { 15 .when('/paymentVerification/:id', {
16 templateUrl: 'pages/verify.html', 16 templateUrl: 'pages/verify.html',
17 controller: 'verifyController' 17 controller: 'verifyController'
18 }) 18 })
19 19
20 // route for the ambassador page 20 // route for the ambassador page
21 .when('/ambassador', { 21 .when('/ambassador', {
22 templateUrl: 'pages/ambassador.html', 22 templateUrl: 'pages/ambassador.html',
23 controller: 'ambassadorController' 23 controller: 'ambassadorController'
24 }) 24 })
25 }); 25 });
26 26
27 scotchApp.constant("BASE_URL", "http://139.59.68.74:4001/api") 27 scotchApp.constant("BASE_URL", "http://139.59.68.74:4001/api")
28 28
29 // create the controller and inject Angular's $scope 29 // create the controller and inject Angular's $scope
30 scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL) { 30 scotchApp.controller('mainController', function($scope, $http, $location, $route, $rootScope, BASE_URL) {
31 $scope.data = { 31 $scope.data = {
32 show: true, 32 show: true,
33 hide: false 33 hide: false
34 }; 34 };
35 35
36 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ 36 $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/
37 37
38 $scope.max = 100; 38 $scope.max = 100;
39 $scope.current = 0; 39 $scope.current = 0;
40 $scope.payingAmnt = 0; 40 $scope.payingAmnt = 0;
41 if ($scope.data.stage == 'select') { 41 if ($scope.data.stage == 'select') {
42 console.log("sdsaasd"); 42 console.log("sdsaasd");
43 43
44 } 44 }
45 45
46 $scope.author = 'Swarn Singh'; 46 $scope.author = 'Swarn Singh';
47 $scope.data = {}; 47 $scope.data = {};
48 $scope.data.stage = 'Idea'; 48 $scope.data.stage = 'Idea';
49 $scope.discountAmount = 0; 49 $scope.discountAmount = 0;
50 $scope.check = false; 50 $scope.check = false;
51 $scope.numberCheck = false; 51 $scope.numberCheck = false;
52 $scope.paymentResult = {}; 52 $scope.paymentResult = {};
53 var data = { 53 var data = {
54 "amount": $scope.payingAmnt, 54 "amount": $scope.payingAmnt,
55 "currency": "INR", 55 "currency": "INR",
56 "status": "pending" 56 "status": "pending"
57 } 57 }
58 58
59 $scope.removeError = function() { 59 $scope.removeError = function() {
60 $('#invalidEmail').css('display', 'none'); 60 $('#invalidEmail').css('display', 'none');
61 $('#alreadyExist').css('display', 'none'); 61 $('#alreadyExist').css('display', 'none');
62 }; 62 };
63 63
64 $scope.emailcheck = function(val) { 64 $scope.emailcheck = function(val) {
65 if (val == undefined) { 65 if (val == undefined) {
66 $('#invalidEmail').css('display', 'block'); 66 $('#invalidEmail').css('display', 'block');
67 } else { 67 } else {
68 $http({ 68 $http({
69 method: 'GET', 69 method: 'GET',
70 url: BASE_URL + '/applicants?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}', 70 url: BASE_URL + '/applicants?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}',
71 headers: {} 71 headers: {}
72 }).then(function mySuccess(searchResult) { 72 }).then(function mySuccess(searchResult) {
73 console.log("searchResult1===>", searchResult) 73 console.log("searchResult1===>", searchResult)
74 if (searchResult.data.length == 0) { 74 if (searchResult.data.length == 0) {
75 $scope.check = false; 75 $scope.check = false;
76 } else { 76 } else {
77 $scope.check = true; 77 $scope.check = true;
78 $('#alreadyExist').css('display', 'block'); 78 $('#alreadyExist').css('display', 'block');
79 } 79 }
80 }, function myError(error) {}); 80 }, function myError(error) {});
81 } 81 }
82 }; 82 };
83 83
84 $scope.removeNoError = function() { 84 $scope.removeNoError = function() {
85 $('#noExist').css('display', 'none'); 85 $('#noExist').css('display', 'none');
86 }; 86 };
87 87
88 $scope.numbercheck = function(number) { 88 $scope.numbercheck = function(number) {
89 $http({ 89 $http({
90 method: 'GET', 90 method: 'GET',
91 url: BASE_URL + '/applicants?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}', 91 url: BASE_URL + '/applicants?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}',
92 data: $scope.data, 92 data: $scope.data,
93 headers: {} 93 headers: {}
94 }).then(function mySuccess(searchResult) { 94 }).then(function mySuccess(searchResult) {
95 console.log("searchResult===>", searchResult) 95 console.log("searchResult===>", searchResult)
96 if (searchResult.data.length == 0) { 96 if (searchResult.data.length == 0) {
97 $scope.numberCheck = false; 97 $scope.numberCheck = false;
98 98
99 } else { 99 } else {
100 $scope.numberCheck = true; 100 $scope.numberCheck = true;
101 $('#noExist').css('display', 'block'); 101 $('#noExist').css('display', 'block');
102 } 102 }
103 }, function myError(error) {}); 103 }, function myError(error) {});
104 }; 104 };
105 105
106 $rootScope.tokenCall = function(val) { 106 $rootScope.tokenCall = function(val) {
107 console.log('val-------->', val); 107 console.log('val-------->', val);
108 if (val == undefined) { 108 if (val == undefined) {
109 $('#invalidEmail').css('display', 'block'); 109 $('#invalidEmail').css('display', 'block');
110 } else { 110 } else {
111 val = val.toUpperCase(); 111 val = val.toUpperCase();
112 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}') 112 $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": {"like":"%25' + val + '%25"}}}')
113 .then(function(searchResult) { 113 .then(function(searchResult) {
114 if (searchResult.data.length == 0) { 114 if (searchResult.data.length == 0) {
115 $scope.tokencheck = false; 115 $scope.tokencheck = false;
116 $scope.discountAmount = 0; 116 $scope.discountAmount = 0;
117 } else { 117 } else {
118 $scope.tokencheck = true; 118 $scope.tokencheck = true;
119 } 119 }
120 },function(err){ 120 },function(err){
121 console.log(err) 121 console.log(err)
122 }); 122 });
123 123
124 } 124 }
125 }; 125 };
126 126
127 /*THIS CODE FOR ENABLED SUBMIT BUTTON AFTER UPLOAD IMAGE*/ 127 /*THIS CODE FOR ENABLED SUBMIT BUTTON AFTER UPLOAD IMAGE*/
128 $(document).ready( 128 $(document).ready(
129 function() { 129 function() {
130 $('input:submit').attr('disabled', true); 130 $('input:submit').attr('disabled', true);
131 $('input:file').change( 131 $('input:file').change(
132 function() { 132 function() {
133 if ($("#picture").val()) { 133 if ($("#picture").val()) {
134 $('input:submit').removeAttr('disabled'); 134 $('input:submit').removeAttr('disabled');
135 } else { 135 } else {
136 $('input:submit').attr('disabled', true); 136 $('input:submit').attr('disabled', true);
137 } 137 }
138 }); 138 });
139 }); 139 });
140 140
141 /*****THIS IS FOR STEP ONE FORM ******/ 141 /*****THIS IS FOR STEP ONE FORM ******/
142 $scope.next = function() { 142 $scope.next = function() {
143 $scope.data.status = null 143 $scope.data.status = null
144 if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) { 144 if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) {
145 var x = document.getElementById("snackbar") 145 var x = document.getElementById("snackbar")
146 x.className = "show"; 146 x.className = "show";
147 setTimeout(function() { 147 setTimeout(function() {
148 x.className = x.className.replace("show", ""); 148 x.className = x.className.replace("show", "");
149 }, 3000); 149 }, 3000);
150 } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) { 150 } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) {
151 $scope.infoForm = true; 151 $scope.infoForm = true;
152 console.log("sdasdasdsa"); 152 console.log("sdasdasdsa");
153 $scope.data.stage = $scope.data.stage; 153 $scope.data.stage = $scope.data.stage;
154 $scope.detail = {}; 154 $scope.detail = {};
155 $scope.data.phone = "+91" + $scope.data.number; 155 $scope.data.phone = "+91" + $scope.data.number;
156 $http({ 156 $http({
157 method: 'POST', 157 method: 'POST',
158 url: BASE_URL + '/information', 158 url: BASE_URL + '/information',
159 data: $scope.data, 159 data: $scope.data,
160 headers: {} 160 headers: {}
161 }).then(function mySuccess(result) { 161 }).then(function mySuccess(result) {
162 console.log("result", result) 162 console.log("result", result)
163 $scope.detail = result; 163 $scope.detail = result;
164 data.applicantId = result.data.id; 164 data.applicantId = result.data.id;
165 $scope.userId = result.data.id; 165 $scope.userId = result.data.id;
166 166
167 }, function myError(error) {}); 167 }, function myError(error) {});
168 } 168 }
169 169
170 } 170 }
171 171
172 $scope.calculateAmount = function(){ 172 $scope.calculateAmount = function(){
173
174 if ($scope.data.stage == undefined || $scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined || $scope.data.city == undefined) {
175 var x = document.getElementById("snackbar")
176 x.className = "show";
177 setTimeout(function() {
178 x.className = x.className.replace("show", "");
179 }, 3000);
180 } else if ($scope.data.stage != undefined && $scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined && $scope.data.city != undefined) {
181 $scope.infoForm = true;
182 console.log("sdasdasdsa");
183 $scope.data.stage = $scope.data.stage;
184 $scope.detail = {};
185 $scope.data.phone = "+91" + $scope.data.number;
186 $http({
187 method: 'POST',
188 url: BASE_URL + '/applicants',
189 data: $scope.data,
190 headers: {}
191 }).then(function mySuccess(result) {
192 console.log("result", result)
193 $scope.detail = result;
194 data.applicantId = result.data.id;
195 $scope.userId = result.data.id;
196
197 }, function myError(error) {});
198 }
199
173 if ($scope.data.stage == "Idea") { 200 if ($scope.data.stage == "Idea") {
174 console.log("$scope.data", $scope.data) 201 console.log("$scope.data", $scope.data)
175 $scope.ticketAmnt = 500; 202 $scope.ticketAmnt = 500;
176 } 203 }
177 204
178 if ($scope.data.stage == "Product") { 205 if ($scope.data.stage == "Product") {
179 $scope.ticketAmnt = 1000; 206 $scope.ticketAmnt = 1000;
180 } 207 }
181 208
182 if ($scope.data.stage == "Growth") { 209 if ($scope.data.stage == "Growth") {
183 $scope.ticketAmnt = 2000; 210 $scope.ticketAmnt = 2000;
184 } 211 }
185 212
186 if($scope.tokencheck == true){ 213 if($scope.tokencheck == true){
187 var amount = $scope.ticketAmnt 214 var amount = $scope.ticketAmnt
188 $scope.discountAmount = (amount * 10)/100 215 $scope.discountAmount = (amount * 10)/100
189 console.log("finalAmount====>",$scope.payingAmnt) 216 console.log("finalAmount====>",$scope.payingAmnt)
190 } 217 }
191 218
192 var taxAmount = $scope.ticketAmnt - $scope.discountAmount 219 var taxAmount = $scope.ticketAmnt - $scope.discountAmount
193 $scope.taxTotal = (taxAmount * 18)/100 220 $scope.taxTotal = (taxAmount * 18)/100
194 $scope.payingAmnt = taxAmount + $scope.taxTotal 221 $scope.payingAmnt = taxAmount + $scope.taxTotal
195 console.log("taxincludedamount----", $scope.payingAmnt) 222 console.log("taxincludedamount----", $scope.payingAmnt)
196 } 223 }
197 224
198 /*****THIS IS FOR STEP THREE FORM ******/ 225 /*****THIS IS FOR STEP THREE FORM ******/
199 $scope.create = function() { 226 $scope.create = function() {
200 if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { 227 // if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) {
201 var x = document.getElementById("snackbar") 228 // var x = document.getElementById("snackbar")
202 x.className = "show"; 229 // x.className = "show";
203 setTimeout(function() { 230 // setTimeout(function() {
204 x.className = x.className.replace("show", ""); 231 // x.className = x.className.replace("show", "");
205 }, 3000); 232 // }, 3000);
206 } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) { 233 // } else if ($scope.data.name != undefined && $scope.data.email != undefined && $scope.data.number != undefined) {
207 $scope.infoForm = true; 234 // $scope.infoForm = true;
208 console.log("sdasdasdsa"); 235 // console.log("sdasdasdsa");
209 $scope.data.stage = $scope.data.stage; 236 // $scope.data.stage = $scope.data.stage;
210 $scope.detail = {}; 237 // $scope.detail = {};
211 $scope.data.phone = "+91" + $scope.data.number; 238 // $scope.data.phone = "+91" + $scope.data.number;
212 $http({ 239 // $http({
213 method: 'POST', 240 // method: 'POST',
214 url: BASE_URL + '/applicants', 241 // url: BASE_URL + '/applicants',
215 data: $scope.data, 242 // data: $scope.data,
216 headers: {} 243 // headers: {}
217 }).then(function mySuccess(result) { 244 // }).then(function mySuccess(result) {
218 245
219 console.log("=====result=====", result) 246 // console.log("=====result=====", result)
220 $scope.detail = result; 247 // $scope.detail = result;
221 data.applicantId = result.data.id; 248 // data.applicantId = result.data.id;
222 $scope.userId = result.data.id; 249 // $scope.userId = result.data.id;
223 console.log("=====data=====", data) 250 // console.log("=====data=====", data)
224 data.amount = $scope.payingAmnt; 251 data.amount = $scope.payingAmnt;
225 if ($scope.detail != null) { 252 if ($scope.detail != null) {
226 $http({ 253 $http({
227 method: 'POST', 254 method: 'POST',
228 url: BASE_URL + '/payments', 255 url: BASE_URL + '/payments',
229 data: data, 256 data: data,
230 headers: {} 257 headers: {}
231 }).then(function mySuccess(paymentResult) { 258 }).then(function mySuccess(paymentResult) {
232 console.log("paymentResult",paymentResult) 259 console.log("paymentResult",paymentResult)
233 $scope.paymentResult = paymentResult; 260 $scope.paymentResult = paymentResult;
234 }, function myError(error) {}); 261 }, function myError(error) {});
235 } 262 }
236 var i = 0; 263 var i = 0;
237 $scope.payingAmnt = $scope.payingAmnt * 100; 264 $scope.payingAmnt = $scope.payingAmnt * 100;
238 var options = { 265 var options = {
239 "key": "rzp_test_YwHsVFiDIQ2WUQ", 266 "key": "rzp_test_YwHsVFiDIQ2WUQ",
240 "amount": $scope.payingAmnt, 267 "amount": $scope.payingAmnt,
241 268
242 "name": "Startup Jalsa", 269 "name": "Startup Jalsa",
243 "description": "amount", 270 "description": "amount",
244 "currency": "INR", 271 "currency": "INR",
245 "status": "done", 272 "status": "done",
246 273
247 "theme": { 274 "theme": {
248 "color": "#2196f3 ", 275 "color": "#2196f3 ",
249 "image_padding": "NO" 276 "image_padding": "NO"
250 }, 277 },
251 "modal": { 278 "modal": {
252 "ondismiss": function() {} 279 "ondismiss": function() {}
253 }, 280 },
254 "handler": function(response) { 281 "handler": function(response) {
255 createPayment(response); 282 createPayment(response);
256 } 283 }
257 }; 284 };
258 var rzp1 = new Razorpay(options); 285 var rzp1 = new Razorpay(options);
259 rzp1.open(); 286 rzp1.open();
260 $scope.paymentResponse = {}; 287 $scope.paymentResponse = {};
261 288
262 function createPayment(response) { 289 function createPayment(response) {
263 console.log("response====from===razorpay",response) 290 console.log("response====from===razorpay",response)
264 $route.reload(); 291 $route.reload();
265 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; 292 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
266 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; 293 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId;
267 $scope.paymentResponse.amount = data.amount; 294 $scope.paymentResponse.amount = data.amount;
268 $scope.paymentResponse.currency = "INR"; 295 $scope.paymentResponse.currency = "INR";
269 $scope.paymentResponse.status = $scope.paymentResult.data.status; 296 $scope.paymentResponse.status = $scope.paymentResult.data.status;
270 $http({ 297 $http({
271 method: 'PUT', 298 method: 'PUT',
272 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id, 299 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id,
273 data: $scope.paymentResponse, 300 data: $scope.paymentResponse,
274 headers: {} 301 headers: {}
275 }).then(function mySuccess(searchResult) { 302 }).then(function mySuccess(searchResult) {
276 console.log("searchResult", searchResult) 303 console.log("searchResult", searchResult)
277 $scope.showToastr() 304 $scope.showToastr()
278 //toaster.success("Registration done successfully"); 305 //toaster.success("Registration done successfully");
279 306
280 }, function myError(error) {}); 307 }, function myError(error) {});
281 } 308 }
282 309
283 }, function myError(error) {}); 310 //}, function myError(error) {});
284 } 311 //}
285 312
286 } 313 }
287 314
288 $scope.showToastr = function() { 315 $scope.showToastr = function() {
289 console.log("called toast") 316 console.log("called toast")
290 var x = document.getElementById("snacsskbar") 317 var x = document.getElementById("snacsskbar")
291 x.className = "show"; 318 x.className = "show";
292 setTimeout(function() { 319 setTimeout(function() {
293 x.className = x.className.replace("show", ""); 320 x.className = x.className.replace("show", "");
294 }, 3000); 321 }, 3000);
295 } 322 }
296 323
297 /*kk***This code for change data when click to chooses stages***/ 324 /*kk***This code for change data when click to chooses stages***/
298 $scope.businessmodel = true; 325 $scope.businessmodel = true;
299 $scope.Idea = true; 326 $scope.Idea = true;
300 $scope.current = true; 327 $scope.current = true;
301 328
302 $scope.stage = function(stage) { 329 $scope.stage = function(stage) {
303 $scope.stagekeyPress(); 330 $scope.stagekeyPress();
304 console.log("stage--2",stage) 331 console.log("stage--2",stage)
305 if (stage == 'Idea') { 332 if (stage == 'Idea') {
306 $scope.current = 10; 333 $scope.current = 10;
307 $scope.prototyp = false; 334 $scope.prototyp = false;
308 $scope.market = false; 335 $scope.market = false;
309 $scope.risks = false; 336 $scope.risks = false;
310 $scope.team = false; 337 $scope.team = false;
311 $scope.pitch = false; 338 $scope.pitch = false;
312 $scope.financials = false; 339 $scope.financials = false;
313 $scope.businessmodel = true; 340 $scope.businessmodel = true;
314 $scope.data.stage = stage; 341 $scope.data.stage = stage;
315 // for right content 342 // for right content
316 $scope.Idea = true; 343 $scope.Idea = true;
317 $scope.Product = false; 344 $scope.Product = false;
318 $scope.Growth = false; 345 $scope.Growth = false;
319 } else if (stage == 'Product') { 346 } else if (stage == 'Product') {
320 $scope.current = 10; 347 $scope.current = 10;
321 $scope.prototyp = true; 348 $scope.prototyp = true;
322 $scope.market = true; 349 $scope.market = true;
323 $scope.risks = true; 350 $scope.risks = true;
324 $scope.team = true; 351 $scope.team = true;
325 $scope.pitch = true; 352 $scope.pitch = true;
326 $scope.financials = true; 353 $scope.financials = true;
327 $scope.businessmodel = false; 354 $scope.businessmodel = false;
328 $scope.data.stage = stage; 355 $scope.data.stage = stage;
329 // for right content 356 // for right content
330 $scope.Idea = false; 357 $scope.Idea = false;
331 $scope.Product = true; 358 $scope.Product = true;
332 $scope.Growth = false; 359 $scope.Growth = false;
333 } else if (stage == 'Growth') { 360 } else if (stage == 'Growth') {
334 $scope.current = 10; 361 $scope.current = 10;
335 $scope.prototyp = true; 362 $scope.prototyp = true;
336 $scope.market = true; 363 $scope.market = true;
337 $scope.risks = true; 364 $scope.risks = true;
338 $scope.team = true; 365 $scope.team = true;
339 $scope.pitch = true; 366 $scope.pitch = true;
340 $scope.financials = true; 367 $scope.financials = true;
341 $scope.businessmodel = false; 368 $scope.businessmodel = false;
342 // for right content 369 // for right content
343 $scope.Idea = false; 370 $scope.Idea = false;
344 $scope.Product = false; 371 $scope.Product = false;
345 $scope.Growth = true; 372 $scope.Growth = true;
346 $scope.data.stage = stage; 373 $scope.data.stage = stage;
347 } 374 }
348 } 375 }
349 $scope.enterbusiness = function(business) { 376 $scope.enterbusiness = function(business) {
350 console.log("business", business); 377 console.log("business", business);
351 if (name == undefined) { 378 if (name == undefined) {
352 $scope.current = false; 379 $scope.current = false;
353 380
354 } else if (name != undefined) { 381 } else if (name != undefined) {
355 $scope.current = true; 382 $scope.current = true;
356 } 383 }
357 } 384 }
358 /*******FOR FILL THE DATA AND SHOWS ICON GREEN*/ 385 /*******FOR FILL THE DATA AND SHOWS ICON GREEN*/
359 $scope.stagekeyPress = function() { 386 $scope.stagekeyPress = function() {
360 $('.icon-circle-a').css('background-color', 'rgb(66, 181, 73)'); 387 $('.icon-circle-a').css('background-color', 'rgb(66, 181, 73)');
361 } 388 }
362 $scope.sectorkeyPress = function() { 389 $scope.sectorkeyPress = function() {
363 $('.icon-circle-b').css('background-color', 'rgb(66, 181, 73)'); 390 $('.icon-circle-b').css('background-color', 'rgb(66, 181, 73)');
364 } 391 }
365 392
366 $scope.studentkeyPress = function() { 393 $scope.studentkeyPress = function() {
367 $('.icon-circle-ab').css('background-color', 'rgb(66, 181, 73)'); 394 $('.icon-circle-ab').css('background-color', 'rgb(66, 181, 73)');
368 } 395 }
369 396
370 $scope.namekeyPress = function(name) { 397 $scope.namekeyPress = function(name) {
371 console.log("name", name); 398 console.log("name", name);
372 if (name == undefined) { 399 if (name == undefined) {
373 $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)'); 400 $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)');
374 } else { 401 } else {
375 $('.icon-circle-c').css('background-color', 'rgb(66, 181, 73)'); 402 $('.icon-circle-c').css('background-color', 'rgb(66, 181, 73)');
376 } 403 }
377 } 404 }
378 $scope.emailkeyPress = function(email) { 405 $scope.emailkeyPress = function(email) {
379 console.log("email", email); 406 console.log("email", email);
380 if (email == undefined) { 407 if (email == undefined) {
381 $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)'); 408 $('.icon-circle-d').css('background-color', 'rgb(102, 102, 102)');
382 } else { 409 } else {
383 $('.icon-circle-d').css('background-color', 'rgb(66, 181, 73)'); 410 $('.icon-circle-d').css('background-color', 'rgb(66, 181, 73)');
384 } 411 }
385 } 412 }
386 413
387 414
388 $scope.phonekeyPress = function(number) { 415 $scope.phonekeyPress = function(number) {
389 console.log("number", number); 416 console.log("number", number);
390 if (number == undefined) { 417 if (number == undefined) {
391 $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)'); 418 $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)');
392 } else { 419 } else {
393 $('.icon-circle-e').css('background-color', 'rgb(66, 181, 73)'); 420 $('.icon-circle-e').css('background-color', 'rgb(66, 181, 73)');
394 } 421 }
395 } 422 }
396 423
397 $scope.citykeyPress = function(city) { 424 $scope.citykeyPress = function(city) {
398 console.log("city", city); 425 console.log("city", city);
399 if (city == undefined) { 426 if (city == undefined) {
400 $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)'); 427 $('.icon-circle-f').css('background-color', 'rgb(102, 102, 102)');
401 } else { 428 } else {
402 $('.icon-circle-f').css('background-color', 'rgb(66, 181, 73)'); 429 $('.icon-circle-f').css('background-color', 'rgb(66, 181, 73)');
403 } 430 }
404 } 431 }
405 432
406 $scope.questionkeyPress = function(q) { 433 $scope.questionkeyPress = function(q) {
407 if (q == undefined) { 434 if (q == undefined) {
408 $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)'); 435 $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)');
409 } else { 436 } else {
410 $('.icon-circle-x').css('background-color', 'rgb(66, 181, 73)'); 437 $('.icon-circle-x').css('background-color', 'rgb(66, 181, 73)');
411 } 438 }
412 } 439 }
413 440
414 $scope.technologykeyPress = function(technology) { 441 $scope.technologykeyPress = function(technology) {
415 if (technology == undefined) { 442 if (technology == undefined) {
416 $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)'); 443 $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)');
417 } else { 444 } else {
418 $('.icon-circle-h').css('background-color', 'rgb(66, 181, 73)'); 445 $('.icon-circle-h').css('background-color', 'rgb(66, 181, 73)');
419 } 446 }
420 } 447 }
421 $scope.problemkeyPress = function(problem) { 448 $scope.problemkeyPress = function(problem) {
422 if (problem == undefined) { 449 if (problem == undefined) {
423 $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)'); 450 $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)');
424 } else { 451 } else {
425 $('.icon-circle-i').css('background-color', 'rgb(66, 181, 73)'); 452 $('.icon-circle-i').css('background-color', 'rgb(66, 181, 73)');
426 } 453 }
427 } 454 }
428 $scope.solutionkeyPress = function(solution) { 455 $scope.solutionkeyPress = function(solution) {
429 if (solution == undefined) { 456 if (solution == undefined) {
430 $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)'); 457 $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)');
431 } else { 458 } else {
432 $('.icon-circle-j').css('background-color', 'rgb(66, 181, 73)'); 459 $('.icon-circle-j').css('background-color', 'rgb(66, 181, 73)');
433 } 460 }
434 } 461 }
435 $scope.businesskeyPress = function(business) { 462 $scope.businesskeyPress = function(business) {
436 $('.icon-circle-p').css('background-color', 'rgb(66, 181, 73)'); 463 $('.icon-circle-p').css('background-color', 'rgb(66, 181, 73)');
437 } 464 }
438 465
439 $scope.prototypekeyPress = function(prototype) { 466 $scope.prototypekeyPress = function(prototype) {
440 if (prototype == undefined) { 467 if (prototype == undefined) {
441 $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)'); 468 $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)');
442 } else { 469 } else {
443 $('.icon-circle-k').css('background-color', 'rgb(66, 181, 73)'); 470 $('.icon-circle-k').css('background-color', 'rgb(66, 181, 73)');
444 } 471 }
445 } 472 }
446 473
447 $scope.marketkeyPress = function(market) { 474 $scope.marketkeyPress = function(market) {
448 if (market == undefined) { 475 if (market == undefined) {
449 $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)'); 476 $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)');
450 } else { 477 } else {
451 $('.icon-circle-l').css('background-color', 'rgb(66, 181, 73)'); 478 $('.icon-circle-l').css('background-color', 'rgb(66, 181, 73)');
452 } 479 }
453 } 480 }
454 481
455 $scope.riskkeyPress = function(risk) { 482 $scope.riskkeyPress = function(risk) {
456 if (risk == undefined) { 483 if (risk == undefined) {
457 $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)'); 484 $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)');
458 } else { 485 } else {
459 $('.icon-circle-m').css('background-color', 'rgb(66, 181, 73)'); 486 $('.icon-circle-m').css('background-color', 'rgb(66, 181, 73)');
460 } 487 }
461 } 488 }
462 489
463 $scope.teamkeyPress = function(team) { 490 $scope.teamkeyPress = function(team) {
464 if (team == undefined) { 491 if (team == undefined) {
465 $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)'); 492 $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)');
466 } else { 493 } else {
467 $('.icon-circle-n').css('background-color', 'rgb(66, 181, 73)'); 494 $('.icon-circle-n').css('background-color', 'rgb(66, 181, 73)');
468 } 495 }
469 } 496 }
470 497
471 $scope.pitchkeyPress = function(pitch) { 498 $scope.pitchkeyPress = function(pitch) {
472 if (pitch == undefined) { 499 if (pitch == undefined) {
473 $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)'); 500 $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)');
474 } else { 501 } else {
475 $('.icon-circle-z').css('background-color', 'rgb(66, 181, 73)'); 502 $('.icon-circle-z').css('background-color', 'rgb(66, 181, 73)');
476 } 503 }
477 } 504 }
478 505
479 $scope.financialskeyPress = function(financial) { 506 $scope.financialskeyPress = function(financial) {
480 console.log("financial", financial); 507 console.log("financial", financial);
481 if (financial == undefined) { 508 if (financial == undefined) {
482 $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)'); 509 $('.icon-circle-q').css('background-color', 'rgb(102, 102, 102)');
483 } else { 510 } else {
484 $('.icon-circle-q').css('background-color', 'rgb(66, 181, 73)'); 511 $('.icon-circle-q').css('background-color', 'rgb(66, 181, 73)');
485 } 512 }
486 } 513 }
487 $scope.changeReferalIconColor = function(referalToken){ 514 $scope.changeReferalIconColor = function(referalToken){
488 if (referalToken == undefined || referalToken == '') { 515 if (referalToken == undefined || referalToken == '') {
489 $('.referel-icon').css('background-color', 'rgb(102, 102, 102)'); 516 $('.referel-icon').css('background-color', 'rgb(102, 102, 102)');
490 }else { 517 }else {
491 $('.referel-icon').css('background-color', 'rgb(66, 181, 73)'); 518 $('.referel-icon').css('background-color', 'rgb(66, 181, 73)');
492 } 519 }
493 } 520 }
494 521
495 }); 522 });
496 523
497 scotchApp.controller('verifyController', function($scope, $http, $location, $route,BASE_URL) { 524 scotchApp.controller('verifyController', function($scope, $http, $location, $route,BASE_URL) {
498 $scope.pendingPaymentId = $route.current.params.id 525 $scope.pendingPaymentId = $route.current.params.id
499 $http({ 526 $http({
500 method: "GET", 527 method: "GET",
501 url: BASE_URL + '/applicants/' + $scope.pendingPaymentId, 528 url: BASE_URL + '/applicants/' + $scope.pendingPaymentId,
502 }).then(function mySuccess(response) { 529 }).then(function mySuccess(response) {
503 $scope.data = response.data; 530 $scope.data = response.data;
504 console.log("response-1", response); 531 console.log("response-1", response);
505 $scope.pendingPaymentId = $route.current.params.id; 532 $scope.pendingPaymentId = $route.current.params.id;
506 533
507 $http({ 534 $http({
508 method: "GET", 535 method: "GET",
509 url: BASE_URL + '/payments?filter={"where":{"applicantId":' + $scope.pendingPaymentId + '}}', 536 url: BASE_URL + '/payments?filter={"where":{"applicantId":' + $scope.pendingPaymentId + '}}',
510 }).then(function mySuccess(response) { 537 }).then(function mySuccess(response) {
511 $scope.paymentRecord = response.data; 538 $scope.paymentRecord = response.data;
512 }, function myError(response) { 539 }, function myError(response) {
513 }); 540 });
514 }, function myError(response) { 541 }, function myError(response) {
515 $scope.myWelcome = response.statusText; 542 $scope.myWelcome = response.statusText;
516 }); 543 });
517 544
518 $scope.checkView = false; 545 $scope.checkView = false;
519 $scope.verifyView = false; 546 $scope.verifyView = false;
520 547
521 $scope.pendingPaymentId = ''; 548 $scope.pendingPaymentId = '';
522 549
523 $scope.update = function() { 550 $scope.update = function() {
524 551
525 $http({ 552 $http({
526 method: 'GET', 553 method: 'GET',
527 url: BASE_URL + '/payments?filter={"where":{"applicantId": ' + $scope.pendingPaymentId + '}}', 554 url: BASE_URL + '/payments?filter={"where":{"applicantId": ' + $scope.pendingPaymentId + '}}',
528 headers: {} 555 headers: {}
529 }).then(function mySuccess(searchResult) { 556 }).then(function mySuccess(searchResult) {
530 if (searchResult.data[0].status == "pending") { 557 if (searchResult.data[0].status == "pending") {
531 $scope.checkView = true; 558 $scope.checkView = true;
532 $scope.verifyView = false; 559 $scope.verifyView = false;
533 $scope.amount = searchResult.data[0].amount * 100; 560 $scope.amount = searchResult.data[0].amount * 100;
534 console.log('pending data', searchResult); 561 console.log('pending data', searchResult);
535 var i = 0; 562 var i = 0;
536 var options = { 563 var options = {
537 // "key": "rzp_live_mhSE1uOBlXvFyJ", 564 // "key": "rzp_live_mhSE1uOBlXvFyJ",
538 "key" : "rzp_test_YwHsVFiDIQ2WUQ", 565 "key" : "rzp_test_YwHsVFiDIQ2WUQ",
539 "amount": $scope.amount, 566 "amount": $scope.amount,
540 567
541 "name": "Startup Jalsa", 568 "name": "Startup Jalsa",
542 "description": "amount", 569 "description": "amount",
543 "currency": "INR", 570 "currency": "INR",
544 "status": "done", 571 "status": "done",
545 572
546 "theme": { 573 "theme": {
547 "color": "#2196f3 ", 574 "color": "#2196f3 ",
548 "image_padding": "NO" 575 "image_padding": "NO"
549 }, 576 },
550 "modal": { 577 "modal": {
551 "ondismiss": function() {} 578 "ondismiss": function() {}
552 }, 579 },
553 "handler": function(response) { 580 "handler": function(response) {
554 createPayment(response); 581 createPayment(response);
555 } 582 }
556 }; 583 };
557 var rzp1 = new Razorpay(options); 584 var rzp1 = new Razorpay(options);
558 rzp1.open(); 585 rzp1.open();
559 $scope.paymentResponse = {}; 586 $scope.paymentResponse = {};
560 587
561 function createPayment(response) { 588 function createPayment(response) {
562 console.log("response",response); 589 console.log("response",response);
563 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; 590 $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id;
564 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; 591 $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId;
565 $scope.paymentResponse.amount = $scope.amount; 592 $scope.paymentResponse.amount = $scope.amount;
566 $scope.paymentResponse.currency = "INR"; 593 $scope.paymentResponse.currency = "INR";
567 $scope.paymentResponse.status = "captured"; 594 $scope.paymentResponse.status = "captured";
568 $scope.paymentResponse.applicantId = $scope.userId; 595 $scope.paymentResponse.applicantId = $scope.userId;
569 console.log("$scope.paymentResponse", $scope.paymentResponse) 596 console.log("$scope.paymentResponse", $scope.paymentResponse)
570 $http({ 597 $http({
571 method: 'PUT', 598 method: 'PUT',
572 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id, 599 url: BASE_URL + '/payments/' + $scope.paymentResult.data.id,
573 data: $scope.paymentResponse, 600 data: $scope.paymentResponse,
574 headers: {} 601 headers: {}
575 }).then(function mySuccess(searchResult) { 602 }).then(function mySuccess(searchResult) {
576 console.log("finalsearchResult",searchResult) 603 console.log("finalsearchResult",searchResult)
577 }, function myError(error) { 604 }, function myError(error) {
578 605
579 }); 606 });
580 } 607 }
581 } else { 608 } else {
582 609
583 } 610 }
584 611
585 }, function myError(error) {}); 612 }, function myError(error) {});
586 } 613 }
587 }); 614 });
588 615
589 scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) { 616 scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) {
590 $scope.data = {}; 617 $scope.data = {};
591 $scope.check = false; 618 $scope.check = false;
592 $scope.numberCheck = false; 619 $scope.numberCheck = false;
593 620
594 $scope.emailcheck = function(val) { 621 $scope.emailcheck = function(val) {
595 if (val == undefined) { 622 if (val == undefined) {
596 $('#invalidEmail').css('display', 'block'); 623 $('#invalidEmail').css('display', 'block');
597 } else { 624 } else {
598 $http({ 625 $http({
599 method: 'GET', 626 method: 'GET',
600 url: BASE_URL + '/ambassadors?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}', 627 url: BASE_URL + '/ambassadors?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}',
601 headers: {} 628 headers: {}
602 }).then(function mySuccess(searchResult) { 629 }).then(function mySuccess(searchResult) {
603 console.log("searchResult1===>", searchResult) 630 console.log("searchResult1===>", searchResult)
604 if (searchResult.data.length == 0) { 631 if (searchResult.data.length == 0) {
605 $scope.check = false; 632 $scope.check = false;
606 } else { 633 } else {
607 $scope.check = true; 634 $scope.check = true;
608 $('#alreadyExist').css('display', 'block'); 635 $('#alreadyExist').css('display', 'block');
609 } 636 }
610 }, function myError(error) {}); 637 }, function myError(error) {});
611 } 638 }
612 }; 639 };
613 640
614 $scope.removeNoError = function() { 641 $scope.removeNoError = function() {
615 $('#noExist').css('display', 'none'); 642 $('#noExist').css('display', 'none');
616 }; 643 };
617 644
618 $scope.numbercheck = function(number) { 645 $scope.numbercheck = function(number) {
619 $http({ 646 $http({
620 method: 'GET', 647 method: 'GET',
621 url: BASE_URL + '/ambassadors?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}', 648 url: BASE_URL + '/ambassadors?filter={"where": {"phone": {"like":"%25' + number + '%25"}}}',
622 data: $scope.data, 649 data: $scope.data,
623 headers: {} 650 headers: {}
624 }).then(function mySuccess(searchResult) { 651 }).then(function mySuccess(searchResult) {
625 console.log("searchResult===>", searchResult) 652 console.log("searchResult===>", searchResult)
626 if (searchResult.data.length == 0) { 653 if (searchResult.data.length == 0) {
627 $scope.numberCheck = false; 654 $scope.numberCheck = false;
628 655
629 } else { 656 } else {
630 $scope.numberCheck = true; 657 $scope.numberCheck = true;
631 $('#noExist').css('display', 'block'); 658 $('#noExist').css('display', 'block');
632 } 659 }
633 }, function myError(error) {}); 660 }, function myError(error) {});
634 }; 661 };
635 662
636 $scope.submit = function() { 663 $scope.submit = function() {
637 console.log($scope.data.name) 664 console.log($scope.data.name)
638 var randomNumber = ""+Math.random(); 665 var randomNumber = ""+Math.random();
639 var nameSpliced = $scope.data.name.slice(0,3); 666 var nameSpliced = $scope.data.name.slice(0,3);
640 var numberSpliced = randomNumber.slice(2,5); 667 var numberSpliced = randomNumber.slice(2,5);
641 $scope.data.referalToken = nameSpliced+numberSpliced; 668 $scope.data.referalToken = nameSpliced+numberSpliced;
642 $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); 669 $scope.data.referalToken = $scope.data.referalToken.toUpperCase();
643 670
644 $http({ 671 $http({
645 method: 'POST', 672 method: 'POST',
646 url: BASE_URL + '/ambassadors', 673 url: BASE_URL + '/ambassadors',
647 data: $scope.data, 674 data: $scope.data,
648 headers: {} 675 headers: {}
649 }).then(function mySuccess(result) { 676 }).then(function mySuccess(result) {
650 console.log("result", result) 677 console.log("result", result)
651 $scope.detail = result; 678 $scope.detail = result;
652 $('#myModal').modal('show'); 679 $('#myModal').modal('show');
653 $scope.data.name = ''; 680 $scope.data.name = '';
654 $scope.data.email = ''; 681 $scope.data.email = '';
655 $scope.data.mobile = ''; 682 $scope.data.mobile = '';
656 683
657 }, function myError(error) {}); 684 }, function myError(error) {});
658 console.log($scope.data) 685 console.log($scope.data)
659 } 686 }
660 }); 687 });
661 688
662 689