// create the module and name it scotchApp var scotchApp = angular.module('scotchApp', ['ngRoute']); // configure our routes scotchApp.config(function($routeProvider) { $routeProvider // route for the home page .when('/', { templateUrl : 'pages/home.html', controller : 'mainController' }) // route for the about page .when('/verification/=:id', { templateUrl : 'pages/verify.html', controller : 'verifyController' }) }); // create the controller and inject Angular's $scope scotchApp.controller('mainController', function($scope, $http, $location,$route) { $scope.data = { show: true, hide: false }; $scope.infoForm = false; /*THIS CODE FOR HIDE STEP 2 FORM*/ $scope.max = 100; $scope.current = 0; $scope.payingAmnt = 0; if ($scope.data.stage == 'select') { console.log("sdsaasd"); } $scope.author = 'Swarn Singh'; $scope.data = {}; //$scope.data.stage = 'idea'; //$scope.data.email = ''; $scope.check = false; $scope.numberCheck = false; $scope.paymentResult = {}; var BASE_URL = "http://139.59.68.74:4001/api"; var data ={ "amount":$scope.payingAmnt, "currency": "INR", "status": "pending" } $scope.removeError = function(){ $('#invalidEmail').css('display', 'none'); $('#alreadyExist').css('display', 'none'); }; $scope.emailcheck = function(val){ //console.log('val', val); if (val == undefined) { $('#invalidEmail').css('display', 'block'); }else{ $http({ method: 'GET', url: BASE_URL+'/applicants?filter={"where": {"email": {"like":"%25' + $scope.data.email + '%25"}}}', //data: email, 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; }else{ $scope.numberCheck = true; $('#noExist').css('display', 'block'); } }, function myError(error) { }); }; /*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); } }); }); /*****THIS IS FOR STEP ONE FORM ******/ $scope.next = function() { $scope.data.status = null if ($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.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) { console.log("result",result) $scope.detail = result; data.applicantId = result.data.id; $scope.userId = result.data.id; }, function myError(error) { }); } } /*****THIS IS FOR STEP THREE FORM ******/ $scope.create = function() { console.log("$scope.data.identity",$scope.data.identity) if($scope.data.stage == "Idea"){ console.log("$scope.data",$scope.data) if($scope.data.identity == "student"){ $scope.payingAmnt = 50000; }else{ $scope.payingAmnt = 100000; } } if($scope.data.stage == "Product"){ if($scope.data.identity == "student"){ $scope.payingAmnt = 100000; }else{ $scope.payingAmnt = 200000; } } if($scope.data.stage == "Growth"){ if($scope.data.identity == "student"){ $scope.payingAmnt = 250000; }else{ $scope.payingAmnt = 500000; } } 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) { if($scope.data.identity == "student"){ var image = BASE_URL+'/container1s/proof/download/' console.log("image",image) var image = document.getElementById('picture').files[0]; var imagePath = image.name; $scope.NewIamge = image + imagePath; $scope.data.pic = $scope.NewIamge; var fd = new FormData() fd.append('file',image); $http({ method:'POST', url: BASE_URL+'/container1s/proof/upload', data:fd, transformRequest:angular.identity, headers:{'Content-Type':undefined} }).then(function mySuccess(sucessResponse) { }, function myError(error) { }); } $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) data.amount = $scope.payingAmnt /100; 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; var options = { "key": "rzp_test_YwHsVFiDIQ2WUQ", "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){ $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"; $scope.paymentResponse.status = "captured"; $http({ method: 'PUT', url: BASE_URL+'/payments/'+$scope.paymentResult.data.id, data: $scope.paymentResponse, headers: {} }).then(function mySuccess(searchResult) { console.log("searchResult",searchResult) $scope.showToastr() //toaster.success("Registration done successfully"); }, function myError(error) { }); } }, function myError(error) { }); } } $scope.showToastr = function(){ console.log("called toast") var x = document.getElementById("snacsskbar") x.className = "show"; setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000); } // $scope.lastpage = function(){ // console.log("sdasd"); // $('.sectors-card').css('display', 'inherit'); // $('.form-all').css('display', 'inherit'); // $('.submit-button').css('display', 'inherit'); // } /*kk***This code for change data when click to chooses stages***/ $scope.businessmodel = true; $scope.Idea =true; $scope.current = true; $scope.stage = function(stage){ // $('.sectors-card').css('display', 'block'); // $('.form-all').css('display', 'block'); // $('.identity-shadow').css('display', 'block'); // $('.step-two-form').css('display', 'block'); // $('.step-three-form').css('display', 'block'); if (stage == 'Idea') { $scope.current = 10; $scope.prototyp = false; $scope.market = false; $scope.risks = false; $scope.team = false; $scope.pitch = false; $scope.financials = false; $scope.businessmodel = true; // for right content $scope.Idea =true; $scope.Product =false; $scope.Growth =false; }else if(stage == 'Product') { $scope.current = 10; $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 =true; $scope.Growth =false; }else if(stage == 'Growth') { $scope.current = 10; $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.sector = function(sector){ // if (sector == 'retail') { // $scope.current = true; // }else if(sector == 'b2b commerce') { // $scope.current = true; // }else if(sector == 'agritech') { // $scope.current = true; // }else if(sector == 'travel') { // $scope.current = true; // }else if(sector == 'fintech') { // $scope.current = true; // }else if(sector == 'hyperlocal services') { // $scope.current = true; // }else if(sector == 'education') { // $scope.current = true; // }else if(sector == 'rural') { // $scope.current = true; // } // } // $scope.sector = function(sector){ // if (sector == 'retail') { // $scope.current = true; // }else if(sector == 'b2b commerce') { // $scope.current = true; // }else if(sector == 'agritech') { // $scope.current = true; // }else if(sector == 'travel') { // $scope.current = true; // }else if(sector == 'fintech') { // $scope.current = true; // }else if(sector == 'hyperlocal services') { // $scope.current = true; // }else if(sector == 'education') { // $scope.current = true; // }else if(sector == 'rural') { // $scope.current = true; // } // } // $scope.entername = function(name){ // if (name == undefined) { // $scope.current = false; // }else if (name != undefined){ // $scope.current = true; // } // } // $scope.enteremail = function(email){ // if (email == undefined) { // $scope.current = false; // }else if (email != undefined){ // $scope.current = true; // } // } // $scope.enternumber = function(number){ // if (name == undefined) { // $scope.current = false; // }else if (name != undefined){ // $scope.current = true; // } // } // $scope.selectcity = function(city){ // console.log("city",city); // if (name == undefined) { // $scope.current = false; // }else if (name != undefined){ // $scope.current = true; // } // } // $scope.entertechnology = function(technology){ // console.log("technology",technology); // if (name == undefined) { // $scope.current = false; // }else if (name != undefined){ // $scope.current = true; // } // } // $scope.enterproblem = function(problem){ // console.log("problem",problem); // if (name == undefined) { // $scope.current = false; // }else if (name != undefined){ // $scope.current = true; // } // } // $scope.entersolution = function(solution){ // console.log("solution",solution); // if (name == undefined) { // $scope.current = false; // }else if (name != undefined){ // $scope.current = true; // } // } $scope.enterbusiness = function(business){ console.log("business",business); if (name == undefined) { $scope.current = false; }else if (name != undefined){ $scope.current = true; } } /*******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)'); } $scope.namekeyPress = function(name){ console.log("name",name); if (name == undefined) { $('.icon-circle-c').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-c').css('background-color', 'rgb(66, 181, 73)'); } } $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)'); } } $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)'); } } $scope.questionkeyPress = function(q){ if (q == undefined) { $('.icon-circle-x').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-x').css('background-color', 'rgb(66, 181, 73)'); } } $scope.technologykeyPress = function(technology){ if (technology == undefined) { $('.icon-circle-h').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-h').css('background-color', 'rgb(66, 181, 73)'); } } $scope.problemkeyPress = function(problem){ if (problem == undefined) { $('.icon-circle-i').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-i').css('background-color', 'rgb(66, 181, 73)'); } } $scope.solutionkeyPress = function(solution){ 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)'); } $scope.prototypekeyPress = function(prototype){ if (prototype == undefined) { $('.icon-circle-k').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-k').css('background-color', 'rgb(66, 181, 73)'); } } $scope.marketkeyPress = function(market){ if (market == undefined) { $('.icon-circle-l').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-l').css('background-color', 'rgb(66, 181, 73)'); } } $scope.riskkeyPress = function(risk){ if (risk == undefined) { $('.icon-circle-m').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-m').css('background-color', 'rgb(66, 181, 73)'); } } $scope.teamkeyPress = function(team){ if (team == undefined) { $('.icon-circle-n').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-n').css('background-color', 'rgb(66, 181, 73)'); } } $scope.pitchkeyPress = function(pitch){ if (pitch == undefined) { $('.icon-circle-z').css('background-color', 'rgb(102, 102, 102)'); }else{ $('.icon-circle-z').css('background-color', 'rgb(66, 181, 73)'); } } $scope.financialskeyPress = 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(66, 181, 73)'); } } // create a message to display in our view // $scope.message = 'Everyone come and see how good I look!'; }); scotchApp.controller('verifyController', function($scope, $http, $location) { $scope.pendingPaymentId = $location.absUrl().split('=')[1] var BASE_URL = "http://139.59.68.74:4001/api"; $http({ method : "GET", url : BASE_URL+'/applicants/'+$scope.pendingPaymentId, }).then(function mySuccess(response) { $scope.data = response.data; console.log("response-1",response); $scope.pendingPaymentId = $location.absUrl().split('=')[1] $http({ method : "GET", url : BASE_URL+'/payments?filter={"where":{"applicantId":'+$scope.pendingPaymentId+'}}', }).then(function mySuccess(response) { $scope.paymentRecord = response.data; }, function myError(response) { // $scope.paymentRecord = response.data; }); }, function myError(response) { $scope.myWelcome = response.statusText; }); $scope.checkView = false; $scope.verifyView = false; $scope.pendingPaymentId = ''; var BASE_URL = "http://139.59.68.74:4001/api"; $scope.update = function(){ $http({ method: 'GET', url: BASE_URL+'/payments?filter={"where":{"applicantId": '+$scope.pendingPaymentId+'}}', //data: email, headers: {} }).then(function mySuccess(searchResult) { if(searchResult.data[0].status == "pending"){ $scope.checkView = true; $scope.verifyView = false; $scope.amount = searchResult.data[0].amount * 100; console.log('pending data', searchResult); var i = 0; var options = { "key": "rzp_test_YwHsVFiDIQ2WUQ", "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 = {}; function createPayment(response){ $scope.paymentResponse.razorPaymentId = response.razorpay_payment_id; $scope.paymentResponse.razorOrderId = $scope.paymentResult.data.razorOrderId; $scope.paymentResponse.amount = $scope.amount; $scope.paymentResponse.currency = "INR"; $scope.paymentResponse.status = "captured"; $scope.paymentResponse.applicantId = $scope.userId; console.log("$scope.paymentResponse",$scope.paymentResponse) $http({ method: 'PUT', url: BASE_URL+'/payments/'+$scope.paymentResult.data.id, data: $scope.paymentResponse, headers: {} }).then(function mySuccess(searchResult) { }, function myError(error) { }); } }else{ } }, function myError(error) { }); } }); // scotchApp.controller('contactController', function($scope) { // $scope.message = 'Contact us! JK. This is just a demo.'; // });