authentication.controller.js 2.4 KB
(function(){
	'use strict';

		angular.module('sbAdminApp')
			.controller('LoginCtrl', ['$scope', '$rootScope', '$state','$mdDialog','$log', 'AUTH_EVENTS', 'LoginService', 'toaster', loginCtrl]);

		function loginCtrl($scope, $rootScope, $state, $mdDialog,$log, AUTH_EVENTS, LoginService ,toaster) {
			$scope.data={}
			var checkData=0;
			$scope.create = function() {
				LoginService.createForm().save($scope.data).$promise.then(function(result) {
					if(result != null){
						toaster.success("Registration done successfully");
					}

						if(checkData != 0){
							$mdToast.show(
							$mdToast.simple()
							.textContent('Please verify your form again')
							.position($scope.getToastPosition())
							.hideDelay(3000)
							);
							checkData++;
						}else{
							
							var i = 0;
							var applicationFees = 100;
							$scope.applicationFees = applicationFees*100;
							var options = {
					           "key": "rzp_test_TxoEstU3hr7Ltw",
					           "amount": $scope.applicationFees,
					           "currency": "INR",
					           "status": "done",
					         
  
					           "theme": {
					               "color": "#2196f3 ",
					               "image_padding":"NO"
					           },
					           "modal": {
					               "ondismiss": function(){
					                 console.log("===ondismiss====");
					               }
					           },
					           "handler": function (response){
					             console.log("response===",response)
					             createPayment(response)
					           }
					       };
					       var rzp1 = new Razorpay(options);
					       rzp1.open();
							
							function createPayment(response){
								// var date= new Date();
								// $scope.registration.paymentId = response.razorpay_payment_id;
								// $scope.registration.paymentDate = date.toISOString();
								// $scope.registration.amount = $scope.registrationFees/100;
								// $scope.registration.paymentType = "registration fees";
								// var setDate = $scope.registrationDate.setMonth($scope.registrationDate.getMonth());
								// var registrationDate = new Date(setDate).getMonth() + 1;
								// $scope.registration.dob = $scope.registrationDate.getFullYear() +"-"+ registrationDate +"-"+$scope.registrationDate.getDate();
								
								console.log("$scope.registration",$scope.registration);
								
								
							}
						}














					// }
				})		
			}	
			
	}

})();