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