(function() {
  'use strict';

  angular.module('Monitour.pages.password')
    .controller('confirmCtrl', confirmCtrl);

  /** @ngInject */
  function confirmCtrl($scope, $location, ForgotpasswordService, $translate, SweetAlert, $stateParam) {
        
		var vm = this; 
        vm.password = password;
	
	vm.sentence = {static: 'Your total platrom needs for'};
    
    // should be resolved by the router, and injected in this controller
    // that way, words are ready when the controller is instantiated
    // and when the link function of the directive is triggered
   vm.sentence.options = ['security', 'workforce', 'cleaning', 'mining', 'complete']; 
		
 
       
			
		  function password() {
            vm.dataLoading = true;
			
			var password =  { password: vm.confirm_password, email: vm.email, uuid: vm.uuid};
			console.log(password);
            ForgotpasswordService.Password(password)
                .then(function (response) {
					console.log(response.data.status);
                    if (response.data.status == 1) {
						  SweetAlert.swal({
            title: 'Success your Pin  details were correct!',
			
            text: '<span style="text-align:left; padding-bottom:15px; font-size:10px;">Please enter a new<span style="color:#08c"> password</span> for your account.</span>',
            html: true
        });
                        vm.passworddiv = true;
                        vm.pindiv = false;
						vm.emaildiv = false;
                    } else {
						 vm.pindiv  = false;
						 vm.emaildiv  = false;
                        SweetAlert.swal({
            title: 'Your Email details were incorrect!',
            text: '<span style="text-align:left; padding-bottom:15px; font-size:10px;">Please try again,<span style="color:#08c">with the correct </span> email address and password.</span>',
            html: true
        });
                        vm.dataLoading = 2;
                    }
                });
        }
    }

})();