<?php
$actUrl = 'admin/verify/'.$verifyToken;	 
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
<title> Change Password | ACP - <?php echo site_name(); ?></title>
<?php $this->load->view('admin/login_top'); ?>

<script type="text/javascript">
 $(document).ready(function(){
	$(document).on('click', "#goto_forgot", function() {
 		 $('#login_panel').hide();
		 reloadCaptcha('captchaForgotImg');
		 $('#forgot_panel').fadeIn();
 		 return false;	 
 	});
	$(document).on('click', "#goto_login", function() {
 		 $('#forgot_panel').hide();
		 reloadCaptcha('captchaImg');
		 $('#login_panel').fadeIn();
 		 return false;	 
 	});
	$(document).on('click', ".changeCaptcha", function() {
 		reloadCaptcha($(this).attr('id').replace('id_',''));
		 return false;	 
 	}); 
	 
}); 
function reloadCaptcha(captcha_id){
	$('#'+captcha_id).fadeOut();
		$.ajax({ url :"<?php echo base_url(); ?>admin/ajax/loadCaptchaImg",
			success : function (resData) { 
// 			console.log(captcha_id);
 				$('#'+captcha_id).html(resData);
				$('#'+captcha_id).append('<a style="margin:10px 2px; position:absolute;" href="#" class="changeCaptcha" id="'+captcha_id+'" ><?php echo img('assets/ap_assets/img/reload_captcha.png', TRUE);?> </a>');
				// console.log(resData);
				$('#'+captcha_id).fadeIn("slow");
			}
		 });	
}
function validateForm(){
	clrErr();
	$errStaus = false; 
   	if(validateFormFields('adminLoginPass','Please enter your password.',''))$errStaus=true;
	if(validateFormFields('adminLoginConfPass',' Please enter confirm password.',''))$errStaus=true;
   
    if(($('#adminLoginPass').val() != "" && $('#adminLoginConfPass').val() != "") && ($('#adminLoginPass').val() !=  $('#adminLoginConfPass').val()) ){
		setMsg('adminLoginConfPass','Password mismatching! Please try again.');$errStaus=true;
	}
	if(validateFormFields('adminLoginCode','Please enter the verify code.',''))$errStaus=true;
    if($errStaus) {
		return false;
	} else {
		return true;		
	}	
 }
 
 
</script>
</head>

<body>


<div class="limiter">
		<div class="container-login100" >
		    <!--style="background-image:url(login_assets/images/bg.jpg)"-->
			<div class="wrap-login100  pr-5 pl-5 pt-5 pb-4" >
				<!--<form class="login100-form validate-form" action="server.php" method="POST">-->
				    <?php
         		        echo form_open($actUrl,array('name' => 'loginFrm','class'=>'login100-form validate-form', 'id' => 'loginFrm' ,'onsubmit'=>'return validateForm();'));
        			?>
			
					<span class="login100-form-title pb-4" style="font-size:24px;color:#212529;">
					    <!--<img src="login_assets/header_logo.jpg" heigth="70px" width="200px">-->
					    <?php echo site_name(); ?>
					</span>
					
					<!--<span class="login100-form-title pb-3" style="font-size:22px;color:#212529;" >-->
					<!--	     Admin Panel -->
					<!--</span>-->
					
					<span class="login100-form-title pb-4" style="font-size:19px;color:#d33f8d;" >
						     Update Password
					</span>
					     <div class="wrap-input100 mb-3">
        			       <div class="" id="messageRow">
                              <?php 
                          		$errMsg = validation_errors('* ');
                        		if(empty($errMsg)){ $errMsg = $this->session->flashdata('errMsg');  }
                        		$warningMsg = $this->session->flashdata('warningMsg');
                        		$successMsg = $this->session->flashdata('successMsg');
                        		if(isset($errMsg) && !empty($errMsg)){ echo showMessage($errMsg,'error',true); }  
                        		if(isset($warningMsg) && !empty($warningMsg)){ echo showMessage($warningMsg,'warning',true); }
                        		if(isset($successMsg) && !empty($successMsg)){ echo showMessage($successMsg,'success',true); }
                         	    ?>
                            </div>
    			        </div>

					
					<div class="wrap-input100 validate-input" id="div_adminLoginPass" >
						<?php   echo form_input(array( 'type'=>"password" , 'name' => 'adminLoginPass', 'minlength'=> '6',  'id' => 'adminLoginPass',  'placeholder'=> 'Password', 'class' => 'input100', ));  ?>
						<span class="focus-input100"></span>
						<span class="symbol-input100">
							<span class="lnr lnr-lock"></span>
						</span>
					</div>
					<p class="text-danger err_msg" id="err_adminLoginPass"></p>
					
					<div class="wrap-input100 validate-input mt-3" id="div_adminLoginConfPass" >
						<?php   echo form_input(array( 'type'=>"password" , 'name' => 'adminLoginConfPass', 'minlength'=> '6', 'id' => 'adminLoginConfPass',  'placeholder'=>'Confirm Password', 'class' => 'input100', ));  ?>
						<span class="focus-input100"></span>
						<span class="symbol-input100">
							<span class="lnr lnr-lock"></span>
						</span>
					</div>
					<p class="text-danger err_msg" id="err_adminLoginConfPass"></p>
					

                    <div class="wrap-input100 validate-input mt-3" >
                        <div class="row">
                          <div class="col-md-5 ">
                            <div class="cap-img" id="captchaImg" style="width:100% !important" >
                              <?php   $this->session->unset_userdata('S4A_CAPTCHA');
            							$captcha = create_captcha(captcha_config());
            							$this->session->set_userdata('S4A_CAPTCHA', $captcha['word']);
            							echo  $captcha['image']; ?>
            							
                              <a style="margin:10px 2px; position:absolute" href="#" class="changeCaptcha" id="id_captchaImg" ><?php echo img('assets/ap_assets/img/reload_captcha.png', TRUE);?> </a> </div>
                          </div>
                          <div class="col-md-7 " id="div_adminLoginCode">
                            <?php  echo form_input(array( 'type'=>"text" , 'name' => 'adminLoginCode', 'style'=>'padding: 0 30px 0 20px;', 'id' => 'adminLoginCode',    'class' => 'input100',   )); ?>
                            <p class="text-danger err_msg" id="err_adminLoginCode"></p>
                          </div>
                        </div>
                  </div>
				
					<div class="container-login100-form-btn pt-4">
					    <?php   echo form_button(array( 'name' => 'loginBtn','value' => 'true', 'id' => 'loginBtn',  'type' => 'submit','content' => 'Submit', 'class' => 'login100-form-btn', )); ?>
					</div>
                        
				<!--</form>-->
				<?php echo form_close();?> 
			</div>
			
		</div>
	</div>

</body>
</html>