// 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 paymentVerify page .when('/pendingPayment/:id', { templateUrl: 'pages/verify.html', controller: 'verifyController' }) // route for the registration page .when('/registration', { templateUrl: 'pages/registration.html', controller: 'registrationController' }) //route for the ambassador page // .when('/startupJalsaPromocode', { // templateUrl: 'pages/ambassador.html', // controller: 'ambassadorController' // }) // route for the confirmation page .when('/confirmation', { templateUrl: 'pages/confirmation.html', controller: 'registrationController' }) .otherwise({ redirectTo: '/' }); }); scotchApp.config(['AnalyticsProvider', function (AnalyticsProvider) { // Add configuration code as desired AnalyticsProvider.setAccount('UA-106416759-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", "http://35.154.24.158:4001/v1") //scotchApp.constant("BASE_URL", "http://0.0.0.0:4001/v1") // 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 }; window.onload = function(){ var element = document.getElementById("defaultcountry"); element.classList.add("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; $scope.isShowHide = function (value) { console.log(value) var element = document.getElementById("defaultcountry"); element.classList.remove("btn-active"); 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() { // //Analytics.trackEvent('register', 'click', 'Registration'); // $location.path("/caricatures") // } // $scope.data.city = ''; $scope.watch = function(){ //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.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) { $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.data.quantity = "1"; $scope.check = false; $scope.numberCheck = false; $scope.paymentResult = {}; var data = { "amount": $scope.payingAmnt, "currency": "INR", "status": "pending" } $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"); // console.log("HERE===",$scope.data.city ); // }); 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) }; 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(){ console.log("====$scope.value===",$scope.data.sector) if($scope.data.sector == "Other"){ $scope.ngShowhide = true; }else{ $scope.ngShowhide = false; } } $rootScope.tokenCall = function(val) { console.log('val-------->', val); if (val == undefined) { $('#invalidToken').css('display', 'block'); } else { val = val.toUpperCase(); if((val == "IITH99" && $scope.data.city != "Hyderabad") || (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 == "IIMA99" && $scope.data.city != "Ahmedabad") || (val == "JAI40" && $scope.data.city != "Jaipur")){ $scope.tokencheck = false; return; } $http.get(BASE_URL + '/ambassadors?filter={"where": {"referalToken": "' + val + '"}}') .then(function(searchResult) { console.log("searchResult",searchResult) if (searchResult.data.length == 0) { $scope.tokencheck = false; $scope.discountAmount = 0; } else { console.log("===searchResult.data[0].discount===",searchResult.data[0].discount); $scope.discountpercentage = searchResult.data[0].discount; console.log("===searchResultdiscountpercentage===",$scope.discountpercentage); $scope.tokencheck = true; } },function(err){ console.log(err) }); } }; $scope.submit = function() { //$scope.data.uploadFile = $scope.base64textString; $scope.ticketAmnt = 500; 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.detail = {}; $scope.data.phone = "+91"+$scope.data.number; if($scope.data.referalToken == null){ $scope.data.referalToken = "N.A." } var file =document.getElementById('filePicker').files[0]; console.log("file",filePicker) var image = BASE_URL+'/containers/applicants/download/' console.log("file",image) var imagePath = filePicker.name; $scope.data.uploadFile = image + imagePath; var fd = new FormData() fd.append('filePicker',data); var deferred = $q.defer(); $http({ method:'POST', url: BASE_URL+'/containers/applicants/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) { console.log("=====result=====",result) $scope.detail = result; data.applicantId = result.data.id; $scope.userId = result.data.id; console.log("=====data=====",data) var amount = $scope.ticketAmnt * 100 if($scope.tokencheck == true){ var amount = $scope.ticketAmnt console.log("====$scope.discountpercentage====",$scope.discountpercentage); console.log("resultcity===",$scope.data.city) if($scope.discountpercentage == "100") { $scope.discountpercentage = "99.8"; console.log("$scope.discountpercentage====",$scope.discountpercentage) } console.log("====$scope.discountpercentage====",$scope.discountpercentage); $scope.percDiscount = $scope.discountpercentage/100; console.log("====$scope.percDiscount====",$scope.percDiscount); console.log("====amount=====",amount); $scope.discountAmount = amount * $scope.percDiscount; console.log("finalAmount====>",$scope.discountAmount) } var taxAmount = $scope.ticketAmnt - $scope.discountAmount console.log("$scope.taxTotal----",taxAmount) $scope.payingAmnt = taxAmount; console.log("====$scope.payingAmnt====",$scope.payingAmnt) $scope.payingAmnt = $scope.payingAmnt.toFixed() data.amount = $scope.payingAmnt; console.log("data.amount==",data.amount) if($scope.detail != null){ $http({ method: 'POST', url: BASE_URL+'/payments', data: data, headers: {} }).then(function mySuccess(paymentResult) { $scope.paymentResult = paymentResult; }, 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){ console.log("response12333333",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; console.log("$scope.paymentResponse.amount=====",$scope.paymentResponse.amount) $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("/confirmation") }, function myError(error) { }); } //} }, function myError(error) { }); //} } }); scotchApp.controller('ambassadorController', function($scope, $http, $location, $route,BASE_URL) { $scope.data = {}; $scope.check = false; $scope.numberCheck = false; $scope.submit = function() { console.log($scope.data.name) var randomNumber = ""+Math.random(); var nameSpliced = $scope.data.name.slice(0,5); var numberSpliced = randomNumber.slice(2,4);; $scope.data.referalToken = nameSpliced+numberSpliced; $scope.data.referalToken = $scope.data.referalToken.toUpperCase(); console.log("dsdfs",numberSpliced); $http({ method: 'POST', url: BASE_URL + '/ambassadors', data: $scope.data, headers: {} }).then(function mySuccess(result) { console.log("result", 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) }); } });