diff --git a/index.html b/index.html
index ebae358..56a1aba 100644
--- a/index.html
+++ b/index.html
@@ -14,6 +14,7 @@
+
@@ -65,6 +66,12 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
+
diff --git a/script.js b/script.js
index 821911b..7a8e048 100644
--- a/script.js
+++ b/script.js
@@ -54,10 +54,10 @@
})
// route for the paytm page
- // .when('/paytm', {
- // templateUrl: 'pages/paytm.html',
- // controller: 'paytmController'
- // })
+ .when('/paytm', {
+ templateUrl: 'pages/paytm.html',
+ controller: 'paytmController'
+ })
.otherwise({
redirectTo: '/'
@@ -1041,149 +1041,149 @@ scotchApp.controller('confirmationController', function($scope, $http, $location
});
-// scotchApp.controller('paytmController', function($q, $scope, $http, $location, $rootScope,$route,BASE_URL) {
-// $scope.data = {};
-// $scope.data.city = localStorage.getItem("city");
-// $scope.data.country = localStorage.getItem("country");;
-// var data = {
-// "amount": $scope.payingAmnt,
-// "currency": "INR",
-// "status": "pending",
-// "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;
-// }
-// }
-
-// $rootScope.tokenCall = function(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 == "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;
-// }
-// },function(err){
-// console.log(err)
-// });
+scotchApp.controller('paytmController', function($q, $scope, $http, $location, $rootScope,$route,BASE_URL) {
+ $scope.data = {};
+ $scope.data.city = localStorage.getItem("city");
+ $scope.data.country = localStorage.getItem("country");;
+ var data = {
+ "amount": $scope.payingAmnt,
+ "currency": "INR",
+ "status": "pending",
+ "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;
+ }
+ }
+
+ $rootScope.tokenCall = function(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 == "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;
+ }
+ },function(err){
+ console.log(err)
+ });
-// }
-// };
-
-// $scope.submit = 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;
-// 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;
-// $scope.paymentResult = paymentResult;
-// }, function myError(error) {
-// });
-// }
-
-// }, function myError(error) {
-
-// });
-
-// })
+ }
+ };
+
+ $scope.submit = 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;
+ 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;
+ $scope.paymentResult = paymentResult;
+ }, function myError(error) {
+ });
+ }
+
+ }, function myError(error) {
+
+ });
+
+ })
-// }
+ }
-// });
+});
scotchApp.controller('ambassadorController', function($scope, $http, $location, $route, BASE_URL) {