// create the module and name it scotchApp var scotchApp = angular.module('scotchApp', ['ngRoute','angular-google-analytics']); // configure our routes scotchApp.config(function($routeProvider,$locationProvider) { // use the HTML5 History API // $locationProvider.html5Mode({ // enabled: true, // requireBase: false // }); //$locationProvider.hashPrefix('!'); $routeProvider // route for the Home page .when('/', { templateUrl: 'pages/Home.html', controller: 'mainController' }) // route for the caricatures page .when('/caricatures', { templateUrl: 'pages/caricatures.html', controller: 'mainController' }) // route for the registration page .when('/registration', { templateUrl: 'pages/registration.html', controller: 'registrationController' }) // route for the registration page .when('/registrationForm', { templateUrl: 'pages/registrationForm.html', controller: 'registrationFormController' }) //route for the ambassador page .when('/startupJalsaPromocode', { templateUrl: 'pages/ambassador.html', controller: 'ambassadorController' }) //route for the campusAmbassador page .when('/campusAmbassador', { templateUrl: 'pages/campusAmbassador.html', controller: 'mainController' }) //route for the campusAmbassador page .when('/campusAmbassadorForm', { templateUrl: 'pages/campusAmbassadorForm.html', controller: 'campusAmbassadorController' }) // route for the confirmation page // .when('/confirmation', { // templateUrl: 'pages/confirmation.html', // controller: 'confirmationController' // }) // route for the confirmation page .when('/confirmation', { templateUrl: 'pages/campusAmbassadorConfirm.html', controller: 'confirmationController' }) // route for the confirmation page .when('/confirm', { templateUrl: 'pages/confirm.html', controller: 'confirmationController' }) // route for the paytm page .when('/paytm', { templateUrl: 'pages/paytm.html', controller: 'mainController' }) // route for the paytm page .when('/paytm/caricatures', { templateUrl: 'pages/paytmCaricatures.html', controller: 'mainController' }) // route for the paytm page .when('/paytm/checkout', { templateUrl: 'pages/paytmCheckout.html', controller: 'paytmController' }) // route for the confirmation page .when('/paytm/confirm', { templateUrl: 'pages/confirmed.html', controller: 'paytmController' }) .otherwise({ redirectTo: '/' }); }); scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) { // Add configuration code as desired AnalyticsProvider.setAccount('UA-123583154-1'); //UU-XXXXXXX-X should be your tracking code // Track all routes (default is true). AnalyticsProvider.trackPages(true); // Track all URL query params (default is false). AnalyticsProvider.trackUrlParams(true); }]).run(['Analytics', function(Analytics) { }]); scotchApp.constant("BASE_URL", "https://events.startupjalsa.com/v1") //scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/v1") scotchApp.directive('validFile',function(){ return { require:'ngModel', link:function(scope,el,attrs,ngModel){ //change event is fired when file is selected el.bind('change',function(){ scope.$apply(function(){ ngModel.$setViewValue(el.val()); ngModel.$render(); }) }) } } }) // create the controller and inject Angular's $scope scotchApp.controller('mainController', function($scope, $http, $window, $location, $route, $rootScope, BASE_URL, Analytics) { $scope.data = { show: true, hide: false }; jQuery('#defaultcountry').addClass('btn-active') // window.onload = function(){ // // var element = document.getElementById("defaultcountry"); // // element.classList.add("btn-active"); // jQuery('#defaultcountry').addClass('btn-active') // //document.getElementById("ahmedabad").src = "images/Ahmedabad_1.png"; // } var chennai = new Date("Sept 19, 2018 12:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = chennai - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("chennai").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("chennai").innerHTML = "EXPIRED"; } }, 1000); var hyderabad = new Date("Sept 22, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = hyderabad - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("hyderabad").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("hyderabad").innerHTML = "EXPIRED"; } }, 1000); var mumbai = new Date("Sept 26, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = mumbai - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("mumbai").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("mumbai").innerHTML = "EXPIRED"; } }, 1000); var kolkata = new Date("Oct 3, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = kolkata - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("kolkata").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("kolkata").innerHTML = "EXPIRED"; } }, 1000); var jaipur = new Date("Oct 5, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = jaipur - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("jaipur").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("jaipur").innerHTML = "EXPIRED"; } }, 1000); var delhi = new Date("Oct 8, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = delhi - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("delhi").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("delhi").innerHTML = "EXPIRED"; } }, 1000); var kanpur = new Date("Oct 10, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = kanpur - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("kanpur").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("kanpur").innerHTML = "EXPIRED"; } }, 1000); var ahmedabad = new Date("Oct 12, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = ahmedabad - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("ahmedabad").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("ahmedabad").innerHTML = "EXPIRED"; } }, 1000); var bengaluru = new Date("Oct 13, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = bengaluru - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("bengaluru").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("bengaluru").innerHTML = "EXPIRED"; } }, 1000); var dharamsala = new Date("Dec 14, 2018 14:00:00").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get todays date and time var now = new Date().getTime(); // Find the distance between now an the count down date var distance = dharamsala - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); $scope.timer = days + "d " + hours + "h " + minutes + "m " + seconds + "s " // Output the result in an element with id="demo" document.getElementById("dharamsala").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is over, write some text if (distance < 0) { clearInterval(x); document.getElementById("dharamsala").innerHTML = "EXPIRED"; } }, 1000); $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ // $scope.Textshow = "yes" $scope.max = 100; $scope.formPage = false; $scope.current = 0; $scope.payingAmnt = 0; $scope.data = {}; $scope.discountAmount = 0; // $scope.data.quantity = "1"; $scope.check = false; $scope.numberCheck = false; $scope.paymentResult = {}; var data = { "amount": $scope.payingAmnt, "currency": "INR", "status": "pending" } $scope.showval = true; $scope.hideval = false; $scope.showvalue = false; $scope.hidevalue = false; localStorage.setItem("country",'INDIA'); $scope.isShowHide = function (value) { var element = document.getElementById("defaultcountry"); element.classList.remove("btn-active"); localStorage.setItem("country",value); if (value == "INDIA") { console.log("value",value) $scope.showval = true; $scope.hideval = false; $scope.showvalue = false; $scope.hidevalue = false; } else if (value == "SRI LANKA") { console.log("value1",value) $scope.showval = false; $scope.hideval = true; $scope.showvalue = false; $scope.hidevalue = false; } else if (value == "BANGLADESH") { console.log("value2",value) $scope.showval = false; $scope.hideval = false; $scope.showvalue = true; $scope.hidevalue = false; } else { console.log("value3",value) $scope.showval = false; $scope.hideval = false; $scope.showvalue = false; $scope.hidevalue = true; } } $scope.apply = function() { $location.path("/caricatures") //window.location.href = "https://startupjalsa.com/events#/caricatures?utm_source=RegisterNowUp&utm_medium=Reg"; } $scope.applyRegister = function() { $location.path("/paytm/caricatures") //window.location.href = "https://startupjalsa.com/events#/caricatures?utm_source=RegisterNowDown&utm_medium=Register"; } $scope.applyForm = function() { //console.log("palak") $location.path("/campusAmbassadorForm") //window.location.href = "https://startupjalsa.com/events#/caricatures?utm_source=RegisterNowDown&utm_medium=Register"; } $scope.click=function(){ Analytics.trackEvent('whatsapp', 'click', 'Registration'); let redirectUrl = "https://wa.me/919855051678"; window.open(redirectUrl,"_blank") } // $scope.data.city = ''; $scope.watch = function(value){ //document.getElementById("ahmedabad").src = ""; // console.log("cllll",value) $scope.data.city = value; // if($scope.data.city == "Chennai"){ // console.log("cllll1",value) // $window.location.href = 'http://35.154.24.158:8007'; // }else{ // console.log("cllll2",value) localStorage.setItem("city" ,value); //$location.path('/registration').search({city: value}); // $location.path('/registration/'+value+''); $location.path('/registration'); //$state.go('registration', { 'city': value}) // } } $scope.watch1 = function(value){ //document.getElementById("ahmedabad").src = ""; // console.log("cllll",value) $scope.data.city = value; // if($scope.data.city == "Chennai"){ // console.log("cllll1",value) // $window.location.href = 'http://35.154.24.158:8007'; // }else{ // console.log("cllll2",value) localStorage.setItem("city" ,value); //$location.path('/registration').search({city: value}); // $location.path('/registration/'+value+''); $location.path('/registrationForm'); //$state.go('registration', { 'city': value}) // } } $scope.watchCity = function(value){ $scope.data.city = value; localStorage.setItem("city" ,value); $location.path('/paytm/checkout'); } $scope.select = function(url){ console.log("cllll") window.open(url) } $scope.stagekeyPress = function() { $('.icon-circle-a').css('background-color', 'rgb(25, 104, 157)'); } $scope.sectorkeyPress = function() { $('.icon-circle-b').css('background-color', 'rgb(25, 104, 157)'); } $scope.productLaunchkeyPress = function() { $('.icon-circle-ab').css('background-color', 'rgb(25, 104, 157)'); } $scope.launchPeriodkeyPress = function() { $('.icon-circle-abc').css('background-color', 'rgb(25, 104, 157)'); } $scope.industrykeyPress = function(quantity) { console.log("fghj",quantity) $('.icon-circle-abcdefg').css('background-color', 'rgb(25, 104, 157)'); } $scope.industryNamekeyPress = function(firstName) { console.log("lastName==", firstName); if (firstName == undefined) { $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)'); } } $scope.amountkeyPress = function() { $('.icon-circle-bc').css('background-color', 'rgb(25, 104, 157)'); } $scope.firstNamekeyPress = function(name) { console.log("lastName==", name); if (name == undefined) { $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-c').css('background-color', 'rgb(25, 104, 157)'); } } $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(25, 104, 157)'); } } $scope.phonekeyPress = function(number) { console.log("number", number); if (number == undefined || number == '') { $('.icon-circle-e').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-e').css('background-color', 'rgb(25, 104, 157)'); } } $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(25, 104, 157)'); } } $scope.startupNamekeyPress = function(q) { if (q == undefined) { $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-x').css('background-color', 'rgb(25, 104, 157)'); } } $scope.linkedInkeyPress = function(technology) { if (technology == undefined || technology == '') { $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-h').css('background-color', 'rgb(25, 104, 157)'); } } $scope.companykeyPress = function(problem) { if (problem == undefined) { $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-i').css('background-color', 'rgb(25, 104, 157)'); } } $scope.productNamekeyPress = function(solution) { if (solution == undefined) { $('.icon-circle-j').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-j').css('background-color', 'rgb(25, 104, 157)'); } } $scope.businesskeyPress = function(business) { if (business == undefined) { $('.icon-circle-p').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-p').css('background-color', 'rgb(25, 104, 157)'); } } $scope.websitekeyPress = function(prototype) { if (prototype == undefined || prototype == '') { $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-k').css('background-color', 'rgb(25, 104, 157)'); } } $scope.employeekeyPress = function(market) { if (market == undefined || market == '') { $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-l').css('background-color', 'rgb(25, 104, 157)'); } } $scope.annualkeyPress = function(risk) { if (risk == undefined || risk == '') { $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-m').css('background-color', 'rgb(25, 104, 157)'); } } $scope.revenuekeyPress = function(team) { if (team == undefined) { $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-n').css('background-color', 'rgb(25, 104, 157)'); } } $scope.descriptionkeyPress = function(pitch) { if (pitch == undefined) { $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-z').css('background-color', 'rgb(25, 104, 157)'); } } $scope.discountkeyPress = function(discount) { if (discount == undefined) { $('.icon-circle-o').css('background-color', 'rgb(102, 102, 102)'); } else { $('.icon-circle-o').css('background-color', 'rgb(25, 104, 157)'); } } $scope.removeNooError = function() { $('#invalidIdea').css('display', 'block'); $('#noExist').css('display', 'none'); }; $scope.ideakeyPress = function(financial) { 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(25, 104, 157)'); } } $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(25, 104, 157)'); } } $scope.changeReferalIconColor = function(referalToken){ if (referalToken == undefined || referalToken == '') { $('.referel-icon').css('background-color', 'rgb(102, 102, 102)'); }else { $('.referel-icon').css('background-color', 'rgb(25, 104, 157)'); } } }); scotchApp.controller('registrationController', function($q, $scope, $http, $location, $rootScope,$route,BASE_URL,Analytics) { $scope.data = {}; $scope.check = false; $scope.numberCheck = false; $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ $scope.space = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ $scope.max = 100; $scope.formPage = false; $scope.current = 0; $scope.payingAmnt = 0; $scope.discountAmount = 0; $scope.approvedMsg = false; $scope.disApprovedMsg = false; // $scope.data.quantity = "1"; $scope.check = false; $scope.numberCheck = false; $scope.paymentResult = {}; // var myParam = window.location.href.split('status=').splice(1).join('').split('&')[0] // if(myParam){ // if(myParam == "approved"){ // $scope.showResponse = true; // }else{ // $scope.disApprovedMsg = true; // } // }else{ // $scope.disApprovedMsg = true; // } $scope.click=function(){ Analytics.trackEvent('whatsapp', 'click', 'Registration'); let redirectUrl = "https://wa.me/919855051678"; window.open(redirectUrl,"_blank") } $scope.removeError = function() { $('#invalidEmail').css('display', 'none'); $('#alreadyExist').css('display', 'none'); }; $scope.emailcheck = function(val) { if (val == undefined) { $('#invalidEmail').css('display', 'block'); } else { $('#alreadyExist').css('display', 'block'); } }; $scope.removeNoError = function() { $('#invalidNumber').css('display', 'none'); $('#alreadyExist').css('display', 'none'); }; $scope.numbercheck = function(val) { if (val == undefined) { $('#invalidNumber').css('display', 'block'); } else { $('#alreadyExist').css('display', 'block'); } }; // $scope.$on('city', function (event, value) { $scope.data.city = localStorage.getItem("city"); $scope.data.country = localStorage.getItem("country"); // }); var data = { "amount": $scope.payingAmnt, "currency": "INR", "status": "pending", "paymentType": $scope.data.country } var handleFileSelect = function(evt) { var files = evt.target.files; var file = files[0]; if (files && file) { var reader = new FileReader(); reader.onload = function(readerEvt) { var binaryString = readerEvt.target.result; $scope.base64textString = btoa(binaryString); //console.log("base64textarea",$scope.base64textString) //$scope.data.uploadFile = file.name; $scope.fileSelect = false; if($scope.data.uploadFile == null){ $scope.fileSelect = true; }else{ $scope.fileSelect = false; }; } reader.readAsBinaryString(file); } }; if (window.File && window.FileReader && window.FileList && window.Blob) { document.getElementById('filePicker').addEventListener('change', handleFileSelect, false); } $scope.ngShowhide = false; $scope.GetValue = function(){ if($scope.data.sector == "Other"){ $scope.ngShowhide = true; }else{ $scope.ngShowhide = false; } } $scope.ngShow = false; $scope.getValue = function(){ if($scope.data.hear == "Other"){ $scope.ngShow = true; }else{ $scope.ngShow = false; } } $scope.payingAmnt = 1180; $rootScope.tokenCall = function(val) { if (val == undefined) { $('#invalidToken').css('display', 'block'); } else { val = val.toUpperCase(); if(((val == "IITH99" || val == "IITH90") && $scope.data.city != "Hyderabad") || ((val == "OASIS" || val == "JALSA22") && $scope.data.city != "Jaipur") || (val == "IITM99" && $scope.data.city != "Chennai") || (val == "IITD99" && $scope.data.city != "Delhi") || (val == "IITB99" && $scope.data.city != "Mumbai") || (val == "IITK99" && $scope.data.city != "Kanpur") || (val == "IIMC99" && $scope.data.city != "Kolkata") || (val == "IIMB99" && $scope.data.city != "Bengaluru") || (val == "IIMA99" && $scope.data.city != "Ahmedabad")){ $scope.tokencheck = false; return; } $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "' + val + '"}}') .then(function(searchResult) { if (searchResult.data.length == 0) { $scope.tokencheck = false; $scope.discountAmount = 0; } else { $scope.discountpercentage = searchResult.data[0].discount; $scope.tokencheck = true; } $scope.ticketAmnt = 1180; var amount = $scope.ticketAmnt * 100 if($scope.tokencheck == true){ var amount = $scope.ticketAmnt if($scope.discountpercentage == "100") { $scope.discountpercentage = "99.9"; } $scope.percDiscount = $scope.discountpercentage/100; $scope.discountAmount = amount * $scope.percDiscount; } var taxAmount = $scope.ticketAmnt - $scope.discountAmount $scope.payingAmnt = taxAmount; $scope.payingAmnt = $scope.payingAmnt.toFixed() },function(err){ console.log(err) }); } }; // if($scope.data.country == "INDIA"){ // $scope.submit = function() { // Analytics.trackEvent('register', 'click', 'Registration'); // $scope.loading = true; // $scope.data.uploadFile = $scope.base64textString; // console.log($scope.data.uploadFile) // // if($scope.tokencheck == false){ // // $scope.data.referalToken = null; // // } // // if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { // // var x = document.getElementById("snackbar") // // 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; // $scope.ticketAmnt = 1180; // $scope.detail = {}; // $scope.data.phone = "+91"+$scope.data.number; // if($scope.data.referalToken == null){ // $scope.data.referalToken = "NA" // } // var file =document.getElementById('filePicker').files[0]; // var image = BASE_URL+'/containers/images/download/' // var imagePath = file.name; // $scope.data.uploadFile = image + imagePath; // var fd = new FormData() // fd.append('filePicker',file); // var deferred = $q.defer(); // $http({ // method:'POST', // url: BASE_URL+'/containers/images/upload', // data:fd, // transformRequest:angular.identity, // headers:{'Content-Type':undefined} // }) // .success(function(result){ // deferred.resolve(result); // $http({ // method: 'POST', // url: BASE_URL+'/applicants', // data: $scope.data, // headers: {} // }).then(function mySuccess(result) { // $scope.detail = result; // data.applicantId = result.data.id; // $scope.userId = result.data.id; // var amount = $scope.ticketAmnt * 100 // if($scope.tokencheck == true){ // var amount = $scope.ticketAmnt // console.log("resultcity===",$scope.data.city) // if($scope.discountpercentage == "100") { // $scope.discountpercentage = "99.9"; // } // $scope.percDiscount = $scope.discountpercentage/100; // $scope.discountAmount = amount * $scope.percDiscount; // } // var taxAmount = $scope.ticketAmnt - $scope.discountAmount // $scope.payingAmnt = taxAmount; // $scope.payingAmnt = $scope.payingAmnt.toFixed() // data.amount = $scope.payingAmnt; // if($scope.detail != null){ // $http({ // method: 'POST', // url: BASE_URL+'/payments', // data: data, // headers: {} // }).then(function mySuccess(paymentResult) { // $scope.loading = false; // //$("p").html(paymentResult.data.data) // }, function myError(error) { // }); // } // var i = 0; // $scope.payingAmnt = $scope.payingAmnt * 100; // var options = { // "key": "rzp_test_YwHsVFiDIQ2WUQ", // //"key": "rzp_live_mkmCb4FkstuWaS", // "amount": $scope.payingAmnt, // "name": "Startup Jalsa", // "description":"amount", // "currency": "INR", // "status": "done", // "prefill": { // "email": $scope.detail.email, // "contact": $scope.detail.phone // }, // "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){ // $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; // $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; // $scope.paymentResponse.amount = data.amount; // $scope.paymentResponse.currency = "INR"; // $scope.paymentResponse.status = $scope.paymentResult.data.status; // $http({ // method: 'PUT', // url: BASE_URL+'/payments/'+$scope.paymentResult.data.id, // data: $scope.paymentResponse, // headers: {} // }).then(function mySuccess(searchResult) { // Analytics.trackEvent('register', 'click', 'Registration'); // $location.path("/confirm") // }, function myError(error) { // }); // } // //} // }, function myError(error) { // }); // }) // // }) // //} // } // }else{ // $scope.ticketAmnt = 1180; // var amount = $scope.ticketAmnt * 100 // console.log("amount",amount) // console.log("amount",$scope.tokencheck) // if($scope.tokencheck == true){ // var amount = $scope.ticketAmnt // console.log("amount",amount) // if($scope.discountpercentage == "100") { // $scope.discountpercentage = "99.9"; // } // $scope.percDiscount = $scope.discountpercentage/100; // console.log("$scope.percDiscount",$scope.percDiscount) // $scope.discountAmount = amount * $scope.percDiscount; // } // console.log("$scope.discountAmount",$scope.discountAmount) // var taxAmount = $scope.ticketAmnt - $scope.discountAmount // console.log("taxAmount",taxAmount) // $scope.payingAmnt = taxAmount; // $scope.payingAmnt = $scope.payingAmnt.toFixed() $scope.submit = function() { Analytics.trackEvent('register', 'click', 'Registration'); $scope.loading = true; $scope.data.uploadFile = $scope.base64textString; // if($scope.tokencheck == false){ // $scope.data.referalToken = null; // } // if ($scope.data.name == undefined || $scope.data.email == undefined || $scope.data.number == undefined) { // var x = document.getElementById("snackbar") // 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; $scope.ticketAmnt = 1180; $scope.detail = {}; $scope.paymentResultt = {}; $rootScope.applicantResult = {}; $scope.data.phone = "+91"+$scope.data.number; if($scope.data.referalToken == null){ $scope.data.referalToken = "NA" } var file =document.getElementById('filePicker').files[0]; //console.log("file",filePicker) var image = BASE_URL+'/containers/images/download/' var imagePath = file.name; $scope.data.uploadFile = image + imagePath; //console.log($scope.data.uploadFile) var fd = new FormData() fd.append('filePicker',file); var deferred = $q.defer(); $http({ method:'POST', url: BASE_URL+'/containers/images/upload', data:fd, transformRequest:angular.identity, headers:{'Content-Type':undefined} }) .success(function(result){ deferred.resolve(result); $http({ method: 'POST', url: BASE_URL+'/applicants', data: $scope.data, headers: {} }).then(function mySuccess(result) { $scope.detail = result; data.applicantId = result.data.id; $scope.userId = result.data.id; var amount = $scope.ticketAmnt * 100 if($scope.tokencheck == true){ var amount = $scope.ticketAmnt if($scope.discountpercentage == "100") { $scope.discountpercentage = "99.9"; } $scope.percDiscount = $scope.discountpercentage/100; $scope.discountAmount = amount * $scope.percDiscount; } var taxAmount = $scope.ticketAmnt - $scope.discountAmount $scope.payingAmnt = taxAmount; $scope.payingAmnt = $scope.payingAmnt.toFixed() data.amount = $scope.payingAmnt; if($scope.detail != null){ $http({ method: 'POST', url: BASE_URL+'/payments', data: data, headers: {} }).then(function mySuccess(paymentResult) { $scope.loading = false; $scope.paymentResult = paymentResult; //$("p").html(paymentResult.data.data) }, function myError(error) { }); } var i = 0; $scope.payingAmntt = $scope.payingAmnt * 100; var options = { //"key": "rzp_test_YwHsVFiDIQ2WUQ", "key": "rzp_live_mkmCb4FkstuWaS", "amount": $scope.payingAmntt, "name": "Startup Jalsa", "description":"amount", "currency": "INR", "status": "done", "prefill": { "email": $scope.detail.email, "contact": $scope.detail.phone }, "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){ $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; $scope.paymentResponse.amount = data.amount; $scope.paymentResponse.currency = "INR"; $scope.paymentResponse.status = $scope.paymentResult.data.status; $http({ method: 'PUT', url: BASE_URL+'/payments/'+$scope.paymentResult.data.id, data: $scope.paymentResponse, headers: {} }).then(function mySuccess(searchResult) { console.log("searchResult",searchResult) //$location.path("/confirm") $rootScope.paymentResultt = searchResult.data; $http({ method: 'GET', url: BASE_URL+'/applicants/'+$rootScope.paymentResultt.applicantId, data: $scope.data, headers: {} }).then(function mySuccess(result) { //console.log("result2323324434",result) $rootScope.applicantResult = result.data; if (result.data.city == "Chennai") { $rootScope.applicantResult.location= "Auditorium, IITM Research Park, Kanagam Road, 32, Kanagam, Tharamani, Chennai, Tamil Nadu 600113", $rootScope.applicantResult.date= "October 1st, 2019", $rootScope.applicantResult.time= "3 PM" } else if (result.data.city == "Hyderabad") { $rootScope.applicantResult.location= "Academic block A, Room no. 220, IIT Hyderabad Kandi, Sangareddy 502285", $rootScope.applicantResult.date= "September 14th, 2019", $rootScope.applicantResult.time= "3 PM" } else if (result.data.city == "Mumbai") { $rootScope.applicantResult.location= "LC 101, Lecture Hall Complex, Academic Area, IIT Bombay, Powai, Maharashtra - 40076", $rootScope.applicantResult.date= "September 4th, 2019", $rootScope.applicantResult.time= "3 PM" } else if (result.data.city == "Ahmedabad") { $rootScope.applicantResult.location= "Sunil Mehta Conference Hall, First Floor, CIIE Building, IIM New Campus, Vastrapur Road, Ahmedabad 380015", $rootScope.applicantResult.date= "September 11th, 2019", $rootScope.applicantResult.time= "3 PM" } else if (result.data.city == "Jaipur") { $rootScope.applicantResult.location= "Startup Oasis, M8, RIICO Software Complex, EPIP, Sitapura Industrial Area, Jaipur", $rootScope.applicantResult.date= "September 24th, 2019", $rootScope.applicantResult.time= "3 PM" } else if (result.data.city == "Kolkata") { $rootScope.applicantResult.location= "New Academic Block, IIM Calcutta, Diamond Harbour Rd., Joka, Kolkata (700104)", $rootScope.applicantResult.time= "3 PM", $rootScope.applicantResult.date= "September 17th, 2019" } else if (result.data.city == "Bengaluru") { $rootScope.applicantResult.location= "NSRCEL, Indian Institute of Management Bangalore, Bannerghatta Main Road, Bengaluru 560076", $rootScope.applicantResult.time= "3 PM", $rootScope.applicantResult.date= "September 7th, 2019" } else if (result.data.city == "Delhi") { $rootScope.applicantResult.location= "Vishwakarma Bhavan Auditorium(Ground Floor), Vishwakarma Bhavan, IIT Delhi, Saheed Jeet Singh Marg, Hauz Khas, New Delhi, Delhi 110016", $rootScope.applicantResult.time= "12 PM", $rootScope.applicantResult.date= "October 16th, 2019" } else if (result.data.city == "Kanpur"){ $rootScope.applicantResult.location= "L14, Academic Area IIT Kanpur, Kanpur - 208016", $rootScope.applicantResult.time= "3 PM", $rootScope.applicantResult.date= "September 28th, 2019" }else if (result.data.city == "Colombo") { $rootScope.applicantResult.location= "Likuid Spcaes, Ground Floor, 5 Charles Place, Colpetty, Colombo, 00300, Sri Lanka", $rootScope.applicantResult.time= "3 PM", $rootScope.applicantResult.date= "October 5th, 2019" } else if (result.data.city == "Dhaka") { $rootScope.applicantResult.location= "The Business Center, The Inspiration Hall Level 2, Lift number-2, Celebration Point, Plot: 3 & 5 (Beside Shahabuddin Medical College) Road: 113/A, Gulshan-2, Dhaka-1212", $rootScope.applicantResult.date= "September 21st, 2019", $rootScope.applicantResult.time= "3 PM" } else { $rootScope.applicantResult.location= "Innovative Hive, 1st Floor, M&S Tower, Pulchowk, lalitpur Nepal, POB No 24445", $rootScope.applicantResult.time= "3 PM", $rootScope.applicantResult.date= "October 12th, 2019" } Analytics.trackEvent('success', 'click', 'Registration'); $location.path("/confirm") }) }, function myError(error) { }); } //} }, function myError(error) { }); }) // }) //} } //} }); scotchApp.controller('confirmationController', function($scope, $http, $location, $route, BASE_URL) { $scope.approvedMsg = false; $scope.disApprovedMsg = false; var myParam = window.location.href.split('status=').splice(1).join('').split('&')[0] // if(myParam){ if(myParam == "approved"){ $scope.approvedMsg = true; $scope.disApprovedMsg = false; }else{ $scope.approvedMsg = false; $scope.disApprovedMsg = true; } // }else{ // $scope.disApprovedMsg = true; // } }); scotchApp.controller('paytmController', function($q, $scope, $http, $location, $rootScope,$route,BASE_URL,Analytics) { $scope.data = {}; $scope.data.city = localStorage.getItem("city"); $scope.data.country = localStorage.getItem("country");; var data = { //"amount": $scope.payingAmnt, //"currency": "INR", "status": "captured", "paymentType": "Manual_Paytm" } var handleFileSelect = function(evt) { var files = evt.target.files; var file = files[0]; if (files && file) { var reader = new FileReader(); reader.onload = function(readerEvt) { var binaryString = readerEvt.target.result; $scope.base64textString = btoa(binaryString); //console.log("base64textarea",$scope.base64textString) //$scope.data.uploadFile = file.name; $scope.fileSelect = false; if($scope.data.uploadFile == null){ $scope.fileSelect = true; }else{ $scope.fileSelect = false; }; } reader.readAsBinaryString(file); } }; if (window.File && window.FileReader && window.FileList && window.Blob) { document.getElementById('filePicker').addEventListener('change', handleFileSelect, false); } $scope.ngShowhide = false; $scope.GetValue = function(){ if($scope.data.sector == "Other"){ $scope.ngShowhide = true; }else{ $scope.ngShowhide = false; } } $scope.ngShow = false; $scope.getValue = function(){ if($scope.data.hear == "Other"){ $scope.ngShow = true; }else{ $scope.ngShow = false; } } $scope.register = function() { Analytics.trackEvent('register', 'click', 'Registration'); $scope.loading = true; $scope.data.uploadFile = $scope.base64textString; $scope.infoForm = true; //$scope.ticketAmnt = 1180; $scope.detail = {}; $scope.data.phone = "+91"+$scope.data.number; var file =document.getElementById('filePicker').files[0]; var image = BASE_URL+'/containers/images/download/' var imagePath = file.name; $scope.data.uploadFile = image + imagePath; var fd = new FormData() fd.append('filePicker',file); var deferred = $q.defer(); $http({ method:'POST', url: BASE_URL+'/containers/images/upload', data:fd, transformRequest:angular.identity, headers:{'Content-Type':undefined} }) .success(function(result){ deferred.resolve(result); $http({ method: 'POST', url: BASE_URL+'/applicantIns', data: $scope.data, headers: {} }).then(function mySuccess(result) { $scope.detail = result; data.applicantInId = result.data.id; $scope.userId = result.data.id; // var amount = $scope.ticketAmnt * 100 // if($scope.tokencheck == true){ // var amount = $scope.ticketAmnt // console.log("resultcity===",$scope.data.city) // if($scope.discountpercentage == "100") { // $scope.discountpercentage = "99.9"; // } // $scope.percDiscount = $scope.discountpercentage/100; // $scope.discountAmount = amount * $scope.percDiscount; // } // var taxAmount = $scope.ticketAmnt - $scope.discountAmount // $scope.payingAmnt = taxAmount; // $scope.payingAmnt = $scope.payingAmnt.toFixed() // data.amount = $scope.payingAmnt; if($scope.detail != null){ $http({ method: 'POST', url: BASE_URL+'/paymentsIns', data: data, headers: {} }).then(function mySuccess(paymentResult) { $scope.loading = false; $scope.paymentResult = paymentResult; $location.path("/paytm/confirm") }, function myError(error) { }); } }, function myError(error) { }); }) } }); scotchApp.controller('registrationFormController', function($q, $scope, $http, $location, $rootScope,$route,BASE_URL,Analytics) { $scope.data = {}; $scope.data.city = localStorage.getItem("city"); var data = { "amount": $scope.payingAmnt, "currency": "INR", "status": "pending" } //$scope.payingAmnt = 590; $rootScope.tokenCall = function(val) { if (val == undefined) { $('#invalidToken').css('display', 'block'); } else { val = val.toUpperCase(); // if(((val == "IITH99" || val == "IITH90") && $scope.data.city != "Hyderabad") || ((val == "OASIS" || val == "JALSA22") && $scope.data.city != "Jaipur") || (val == "IITM99" && $scope.data.city != "Chennai") || (val == "IITD99" && $scope.data.city != "Delhi") || (val == "IITB99" && $scope.data.city != "Mumbai") || (val == "IITK99" && $scope.data.city != "Kanpur") || (val == "IIMC99" && $scope.data.city != "Kolkata") || (val == "IIMB99" && $scope.data.city != "Bengaluru") || (val == "IIMA99" && $scope.data.city != "Ahmedabad")){ // $scope.tokencheck = false; // return; // } $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "' + val + '"}}') .then(function(searchResult) { if (searchResult.data.length == 0) { $scope.tokencheck = false; $scope.discountAmount = 0; } else { $scope.discountpercentage = searchResult.data[0].discount; $scope.tokencheck = true; } $scope.ticketAmnt = 590; var amount = $scope.ticketAmnt * 100 if($scope.tokencheck == true){ var amount = $scope.ticketAmnt if($scope.discountpercentage == "100") { $scope.discountpercentage = "99.9"; } //console.log($scope.ticketAmnt) $scope.percDiscount = $scope.discountpercentage/100; //console.log($scope.percDiscount) $scope.discountAmount = amount * $scope.percDiscount; //console.log($scope.discountAmount) } var taxAmount = $scope.ticketAmnt - $scope.discountAmount //console.log(taxAmount) $scope.payingAmnt = taxAmount; $scope.payingAmnt = $scope.payingAmnt.toFixed() //console.log($scope.payingAmnt) },function(err){ console.log(err) }); } }; $scope.formRegister = function() { //Analytics.trackEvent('register', 'click', 'Registration'); $scope.loading = true; $scope.detail = {}; $scope.data.phone = "+91"+$scope.data.number; console.log($scope.data.register) if($scope.data.referalToken == null){ $scope.data.referalToken = "NA" } if($scope.data.register == "Pitch"){ $scope.ticketAmnt = 590; }else { $scope.ticketAmnt = 118; } $http({ method: 'POST', url: BASE_URL+'/applicantIndia', data: $scope.data, headers: {} }).then(function mySuccess(result) { $scope.detail = result; data.applicantIndiaId = result.data.id; var amount = $scope.ticketAmnt * 100 if($scope.tokencheck == true){ //console.log("test") var amount = $scope.ticketAmnt //console.log("test",$scope.ticketAmnt) if($scope.discountpercentage == "100") { $scope.discountpercentage = "99.9"; } $scope.percDiscount = $scope.discountpercentage/100; //console.log($scope.percDiscount) $scope.discountAmount = amount * $scope.percDiscount; //console.log($scope.discountAmount) } var taxAmount = $scope.ticketAmnt - $scope.discountAmount $scope.payingAmnt = taxAmount; $scope.payingAmnt = $scope.payingAmnt.toFixed() //console.log($scope.payingAmnt) data.amount = $scope.payingAmnt; //var amount = $scope.ticketAmnt * 100 if($scope.detail != null){ $http({ method: 'POST', url: BASE_URL+'/paymentsIndia', data: data, headers: {} }).then(function mySuccess(paymentResult) { console.log(paymentResult) $scope.loading = false; //$scope.ambassadorId = paymentResult.data.ambassadorId $scope.paymentResult = paymentResult; //$location.path("/paytm/confirm") }, function myError(error) { }); } var i = 0; $scope.payingAmntt = $scope.payingAmnt * 100; //console.log($scope.payingAmntt) var options = { //"key": "rzp_test_YwHsVFiDIQ2WUQ", "key": "rzp_live_mkmCb4FkstuWaS", "amount": $scope.payingAmntt, "name": "Startup Jalsa", "description":"amount", "currency": "INR", "status": "done", "prefill": { "email": $scope.detail.email, "contact": $scope.detail.phone }, "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){ console.log("response",response) console.log($scope.paymentResult) $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; $scope.paymentResponse.amount = data.amount; $scope.paymentResponse.currency = "INR"; $scope.paymentResponse.status = $scope.paymentResult.data.status; $http({ method: 'PUT', url: BASE_URL+'/paymentsIndia/'+$scope.paymentResult.data.id, data: $scope.paymentResponse, headers: {} }).then(function mySuccess(searchResult) { console.log("searchResult",searchResult) $location.path("/confirm") }, function myError(error) { }); } //} }, function myError(error) { }); //}) } }); scotchApp.controller('campusAmbassadorController', function($q, $scope, $http, $location, $rootScope,$route,BASE_URL,Analytics) { $scope.data = {}; var data = { "amount": $scope.ticketAmnt, "currency": "INR", "status": "pending" } $scope.formRegister = function() { //Analytics.trackEvent('register', 'click', 'Registration'); $scope.loading = true; $scope.ticketAmnt = 500; $scope.detail = {}; $scope.data.phone = "+91"+$scope.data.number; var randomNumber = ""+Math.random(); var nameSpliced = $scope.data.name.slice(0,3); var numberSpliced = randomNumber.slice(2,4); //var numberSpliced = "90"; $scope.data.referalToken = nameSpliced+numberSpliced; //$scope.data.referalToken = nameSpliced; $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); var ambassDorpayload = {"name":$scope.data.name,"email":$scope.data.email,"mobile":$scope.data.phone,"discount":10,"referalToken":$scope.data.referalToken} $http({ method: 'POST', url: BASE_URL+'/campusAmbassadors', data: $scope.data, headers: {} }).then(function mySuccess(result) { $scope.detail = result; data.campusAmbassadorId = result.data.id; $scope.userId = result.data.id; var amount = $scope.ticketAmnt * 100 $scope.ambassCall(ambassDorpayload); if($scope.detail != null){ $http({ method: 'POST', url: BASE_URL+'/ambassadorPayments', data: data, headers: {} }).then(function mySuccess(paymentResult) { console.log(paymentResult) $scope.loading = false; //$scope.ambassadorId = paymentResult.data.ambassadorId $scope.paymentResult = paymentResult; //$location.path("/paytm/confirm") }, function myError(error) { }); } var i = 0; $scope.payingAmntt = $scope.ticketAmnt * 100; data.amount = $scope.ticketAmnt; var options = { //"key": "rzp_test_YwHsVFiDIQ2WUQ", "key": "rzp_live_mkmCb4FkstuWaS", "amount": $scope.payingAmntt, "name": "Startup Jalsa", "description":"amount", "currency": "INR", "status": "done", "prefill": { "email": $scope.detail.email, "contact": $scope.detail.phone }, "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){ console.log("response",response) console.log($scope.paymentResult) $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; $scope.paymentResponse.amount = data.amount; $scope.paymentResponse.currency = "INR"; $scope.paymentResponse.status = $scope.paymentResult.data.status; $http({ method: 'PUT', url: BASE_URL+'/ambassadorPayments/'+$scope.paymentResult.data.id, data: $scope.paymentResponse, headers: {} }).then(function mySuccess(searchResult) { console.log("searchResult",searchResult) $location.path("/confirmation") //$scope.paymentResultt = searchResult.data; // $http({ // method: 'GET', // url: BASE_URL+'/campusAmbassadors/'+$rootScope.paymentResultt.campusAmbassadorId, // data: $scope.data, // headers: {} // }).then(function mySuccess(result) { // //console.log("result2323324434",result) // //Analytics.trackEvent('success', 'click', 'Registration'); // $location.path("/confirm") // }) }, function myError(error) { }); } //} }, function myError(error) { }); $scope.ambassCall = function(data){ $http({ method: 'POST', url: BASE_URL+'/ambassadors', data: data, headers: {} }).then(function mySuccess(result) { console.log(result) }); } //}) } }); scotchApp.controller('ambassadorController', function($scope, $http, $location, $route, BASE_URL) { $scope.data = {}; $scope.check = false; $scope.numberCheck = false; $scope.submit = function() { //var randomNumber = ""+Math.random(); var nameSpliced = $scope.data.name.slice(0,5); //var numberSpliced = randomNumber.slice(2,4); //var numberSpliced = "22"; //$scope.data.referalToken = nameSpliced+numberSpliced; $scope.data.referalToken = nameSpliced; $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); //$scope.data.referalToken = $scope.data.referalToken.toString(); $http({ method: 'POST', url: BASE_URL + '/ambassadors', data: $scope.data, headers: {} }).then(function mySuccess(result) { $scope.detail = result; $('#myModal').modal('show'); $scope.data.name = ''; $scope.data.email = ''; $scope.data.mobile = ''; //$scope.data.discount = ''; }, function myError(error) { console.log(error) console.log(error.data.error.message) }); } });