<?php include ('../controller/config/config.php'); ?>
<?php
	
	@$langold = $_GET['lang'];

	if($langold == '' || $langold == NULL || $langold == 'undefined' || $langold == 'null')
	{
		$lang = 'english';
	}
	else{
		$lang = $_GET['lang'];
	}

	include ('../lang/'.$lang.'.php'); 

?>



<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<meta name="author" content="EduMESS"/>	
	<meta name="description" content="EduMESS (Education Management and E-Learning Software Solution) is a leading school management, automation and elearning solution. Since its launch, EduMESS has grown to become a leader. Our clients say that the simplicity of our interface, ease of use, cost effectiveness and excellent customer care is the reason they prefare EduMESS. We have watched schools move from softwares they are using to EduMESS."/>
	<meta name="keywords" content="Best, School, Management, Best School, Best School Management, Best School Management Software, Free School Management Software, Portal, School Owner, Group of School Owner, Consultants, Brand Promoters | School Portal Generator ">	
	<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
      <!-- SITE TITLE -->
    <title>EduMESS | <?php echo $website_forgetpassword_pagetitle; ?></title>
	<link rel="shortcut icon" href="../assets/images/website_images/favicon.png" type="image/x-icon">
	<link rel="icon" href="../assets/images/website_images/favicon.png" type="image/x-icon">
	<link rel="apple-touch-icon" sizes="152x152" href="../assets/images/website_images/favicon.png">
	<link rel="apple-touch-icon" sizes="120x120" href="../assets/images/website_images/favicon.png">
	<link rel="apple-touch-icon" sizes="76x76" href="../assets/images/website_images/favicon.png">
	<link rel="apple-touch-icon" href="./assets/images/website_images/favicon.png">
	<link rel="icon" href="../assets/images/website_images/favicon.png" type="image/x-icon">

	<link href="../assets/plugins/bootstrap5/css/bootstrap.min.css" rel="stylesheet">	

	
	<link href="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.3/css/intlTelInput.min.css" rel="stylesheet"/>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.3/js/intlTelInput.min.js"></script>


	<!-- font awesome cn -->
	<link rel="stylesheet"  href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> 
	<!-- font awesome cn -->
	<link href="../css/website_css/resgistrationnew.css" rel="stylesheet">	
	
		<!-css notify--->
	     <link href="../../assets/plugins/notify/wnoty.css" rel="stylesheet">
	    <!-css notify--->
	
 </head>
  <body >
        <!--======================== HTML CONTENT===================== -->	
        <section id="wrapper" >
                 <div class="container">
                      <!-- Stack the columns on mobile by making one full-width and the other half-width -->
                      <div align="center" class="row">
                        <div class="col-md-12">
                           
                          <img id="edumessblue" class="img-fluid" src="../assets/images/website_images/edumes-blue.png" >

                          <div  id="contentlogin" class="" style="box-shadow:0 2px 5px 0 #D3D3D3; 0 3px 11px 0 #D3D3D3;border-radius:10px;margin-top:2%;">
                              
                              
                              <!--PROS VERIFY FIRST PAGE CONTENT-->
                                 <div class="prosfirsttabcontent" >
                                   <center><h4 style="padding-top:40px;color:#0047AB;" id="verificatitle"><?php echo $website_forgetpassword_title; ?></h4></center>
                            
                                    <p style="color:#5A5A5A;font-family: Arial, Helvetica, sans-serif;padding-top:18px;" id="otpsent"> Enter username. OTP sent to your phone via WhatsApp. Students' sent to parent's WhatsApp</p>
                                    <div id="displayerrmessage"></div>
                                 
                                    <div class="centerlogin prosdisplayerror" >
                                          <input type="text"  autocomplete="off" class="generalinput prosgetuserforchangepwd" id="resemail" placeholder="Enter Your Username">
                                        <i class="fa fa-envelope fa-lg  icon" style=""></i>
                                    </div>
                                
                                   <div class="username"></div>
                                
                                   <p style="margin-top:36px;"></p>
                            
                                   <button type="button" id="signinbtn"   style="background-color:#007bff;" class="btn btn-block btn-lg text-light prosgeneralchangepwdbtn"><?php echo $website_forgetpassword_buttontitle; ?></button>
                                    <p style="color:#92929D;font-size:15px;font-family: Arial, Helvetica, sans-serif;padding-top:40px;"></p>
                               </div>
                               <!--PROS VERIFY FIRST PAGE CONTENT-->
                               
                               
                               <!--PROS VERIFY Second PAGE CONTENT-->
                                 <div class="prossecondtabcontent" style="display:none;">
                                   <center><h4 style="padding-top:40px;color:#0047AB;" id="verificatitle"><?php echo $website_forgetpassword_title; ?></h4></center>
                            
                                    <p style="color:#5A5A5A;font-family: Arial, Helvetica, sans-serif;padding-top:18px;" id="otpsent"> Enter OTP sent to proceed</p>
                                    <div id="displayerrmessage"></div>
                                 
                                    <div class="centerlogin prosverifycontenterr" >
                                          <input type="text"  autocomplete="off" class="generalinput prosverifycontentinput" id="resemail" placeholder="Enter Your OTP">
                                        <i class="fa  fa-key fa-lg  icon" style=""></i>
                                    </div>
                                
                                   <div class="usernameverify"></div>
                                
                                
                               
                                   <p style="margin-top:36px;"></p>
                            
                                   <button type="button" id="signinbtn"   style="background-color:#007bff;" class="btn btn-block btn-lg text-light prosverifypagebtn">Verify Now</button>
                                    <p style="color:#92929D;font-size:15px;font-family: Arial, Helvetica, sans-serif;padding-top:40px;"></p>
                               </div>
                               <!--PROS VERIFY Second PAGE CONTENT-->
                               
                             
                               
                                <!--PROS VERIFY Third PAGE CONTENT-->
                                 <div class="prosthirdtabcontent" style="display:none;">
                                   <center><h4 style="padding-top:40px;color:#0047AB;" id="verificatitle"><?php echo $website_forgetpassword_title; ?></h4></center>
                            
                                    <p style="color:#5A5A5A;font-family: Arial, Helvetica, sans-serif;padding-top:18px;" id="otpsent"> Enter password of Your Choice Below</p>
                                 
                                 
                                    <div class="centerlogin mainpasserror" >
                                          <input type="password"  autocomplete="off" class="generalinput prosmainpwd" id="resemail" placeholder="Password">
                                        <i class="fa  fa-lock fa-lg  icon" style=""></i>
                                    </div>
                                    
                                    <div class="errmessagemainpwd"></div>
                                    
                                     <div class="centerlogin mainpasserrorconfirm" >
                                          <input type="password"  autocomplete="off" class="generalinput prosconfirmpwd" id="resemail" placeholder="Confirm Password">
                                        <i class="fa  fa-lock fa-lg  icon" style=""></i>
                                    </div>
                                
                                   <div class="errmessageconfirmpwd"></div>
                                
                                   <p style="margin-top:36px;"></p>
                            
                                   <button type="button" id="signinbtn"   style="background-color:#007bff;" class="btn btn-block btn-lg text-light proschangepwdbtn">Change Now</button>
                                    <p style="color:#92929D;font-size:15px;font-family: Arial, Helvetica, sans-serif;padding-top:40px;"></p>
                               </div>
                               <!--PROS VERIFY Third PAGE CONTENT-->
                             
                               
                          </div>    
                          <p style="padding-top:20px;color:#92929D;font-size:14px;" id="signin"> <?php echo $website_forgetpassword_haveaccount; ?> <a href="../sign-in?lang=<?php echo $lang; ?>"><?php echo $website_forgetpassword_haveaccountlink; ?></a></p>
                        
                        </div>
                       
                      </div>
                 </div>
            </section>
            
            <input type="hidden"  value="<?php echo $GroupOfSchoolID ; ?>" id="prosloadinstitutionhere">
                
             <div id="prosloadusertypecontent"></div>
           
        
      <!--======================== HTML CONTENT===================== -->	
    
       <!-- EXTERNAL SCRIPTS============================================= -->	
       <script src="../assets/plugins/jquery/jquery.min.js"></script>
        <!-- Bootstrap tether Core JavaScript -->
        <script src="../assets/plugins/bootstrap5/js/popper.min.js"></script>
        <script src="../assets/plugins/bootstrap5/js/bootstrap.min.js"></script>
        
        	<?php include("../controller/js/website/registrationcall.php"); ?>
        
           <script src="../../assets/plugins/notify/wnoty.js"></script>
           <script src="../../js/current_page.php"></script>
           
           
           
           
         <script>
         
            //  SEND WITH USERNAME CONTENT HERE
             $('body').on('click','.prosgeneralchangepwdbtn',function(){

                    var username = $('.prosgetuserforchangepwd').val();
                     var InstutionID = $('#prosloadinstitutionhere').val();
                     
                    
                    
                    
                    
                     
                   if(username == '')
                    {
                        
                        $(".prosdisplayerror").css("outline", "1px solid red");
                        $(".username").html('<p class="small text-danger text-left"> Please Input   Username</p>');
                        $(".prosdisplayerror").focus();
                        
                        
                    }else
                    {
                        
                            $(".username").html('');

                                $('.prosgeneralchangepwdbtn').prop("disabled", true);
                                $('.prosgeneralchangepwdbtn').html('processing... <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>');
                        
                                 $(".prosdisplayerror").css("outline", "1px solid green");
                                 $(".prosdisplayerror").focus();
                        
                                $.ajax({           
                                        type : 'POST',
                                        url : '../controller/portal_login/proscesschangepasscontenthere.php', 
                                        data :  {username:username,InstutionID:InstutionID}, //Pass $id
                                        success : function(data)
                                        {
                                            
                                            
                                           $('.prosgeneralchangepwdbtn').prop("disabled", false);
                                           $('.prosgeneralchangepwdbtn').html("Reset");
                                           
                                           var prosloaddate = data.trim();
                                           
                                           if(prosloaddate == 'nonumber')
                                           {
                                               
                                                $.wnoty({
                                                    type: 'warning',
                                                    message: "No number found to send OTP. please contact the school administrator .",
                                                    autohideDelay: 2000
                            
                                                });
                                                
                                                
                                           }else if(prosloaddate == 'noparent')
                                           {
                                               
                                               
                                                $.wnoty({
                                                    type: 'warning',
                                                    message: "No parent found for this student.please contact the school administrator",
                                                    autohideDelay: 2000
                            
                                                });
                                                
                                           }else if(prosloaddate == 'notexist')
                                           {
                                               
                                                        $.wnoty({
                                                            type: 'warning',
                                                            message: "User does not exist. please contact the school administrator",
                                                            autohideDelay: 2000
                                    
                                                        });
                                               
                                           }else
                                           {
                                               
                                                 $('#prosloadusertypecontent').html(prosloaddate);
                                                 
                                                 $('.prosfirsttabcontent').fadeOut();
                                                 $('.prossecondtabcontent').fadeIn();
                                                 
                                                 
                                                    
                                           }
                                           
                                             
                                           
                                          
                                           
                                         
                                            
                                            // alert(UserID);
                                        }

                                });                      
                       
                    }
                    
             });
            //  SEND WITH USERNAME CONTENT HERE
            
            
            //  VERIFY CODE HERE
            
                  $('body').on('click','.prosverifypagebtn',function(){
                      
                            var prosotp = $('.prosverifycontentinput').val();
                            var InstutionID = $('#prosloadinstitutionhere').val(); 
                            var usertype = $('#prosloaduserttype').val(); 
                            var UserID = $('#prosloaduserid').val(); 
                            
                            
                            
                              
                            if(prosotp == '')
                            {
                                
                                    $(".prosverifycontenterr").css("outline", "1px solid red");
                                    $(".usernameverify").html('<p class="small text-danger text-left"> Please Input   Username</p>');
                                    $(".prosverifycontenterr").focus();
                                
                            }else
                            {
                                
                                
                                
                                         $(".usernameverify").html('');
        
                                        $('.prosverifypagebtn').prop("disabled", true);
                                        $('.prosverifypagebtn').html('verifying... <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>');
                                
                                         $(".prosverifycontenterr").css("outline", "1px solid green");
                                         $(".prosverifycontenterr").focus();
                                
                                        $.ajax({  
                                            
                                                type : 'POST',
                                                url : '../controller/portal_login/prosverifyotpforcahngepwd.php', 
                                                data :  {
                                                    
                                                    prosotp:prosotp,
                                                    InstutionID:InstutionID,
                                                    usertype:usertype,
                                                    UserID:UserID
                                                    
                                                }, //Pass $id
                                                success : function(data)
                                                {
                                                                                                        
                                                   $('.prosverifypagebtn').prop("disabled", false);
                                                   $('.prosverifypagebtn').html("Verify Now");
                                                   
                                                   
                                                   
                                                   if(data.trim() == 'great')
                                                   {
                                                      
                                                      
                                                      $('.prossecondtabcontent').fadeOut();
                                                      $('.prosthirdtabcontent').fadeIn(); 
                                                      
                                                      
                                                   }else
                                                   {
                                                     
                                                      $.wnoty({
                                                            type: 'warning',
                                                            message: "Token does not match!!",
                                                            autohideDelay: 2000
                            
                                                        });  
                                                   }
                                                   
                                                   
                                                }
                                                
                                        });
                                        
                                        
                                        
                            }
                        
                             
                  });
            
           //  VERIFY CODE HERE
           
           
           
            //  pros change pwd here
            
             $('body').on('click','.proschangepwdbtn',function(){
                 
                 
                            var InstutionID = $('#prosloadinstitutionhere').val(); 
                            var usertype = $('#prosloaduserttype').val(); 
                            var UserID = $('#prosloaduserid').val(); 
                            
                            
                            var mainpwd = $('.prosmainpwd').val(); 
                            var confirmpwd = $('.prosconfirmpwd').val(); 
                            
                          
                            
                              
                            
                            
                            
                              
                            if(mainpwd == '')
                            {
                              
                              
                                            $.wnoty({
                                                    type: 'warning',
                                                    message: "Password should not be left empty.",
                                                    autohideDelay: 2000
                            
                                              });  
                                              
                                              
                                               $('.proschangepwdbtn').html('Change Now');
                                   
                                
                            }else if(confirmpwd == '')
                            {
                                
                                              $.wnoty({
                                                    type: 'warning',
                                                    message: " Confirm password should not be left empty.",
                                                    autohideDelay: 2000
                            
                                              }); 
                                             $('.proschangepwdbtn').html('Change Now');
                                
                            }else if(mainpwd != confirmpwd)
                            {
                                
                                 $.wnoty({
                                        type: 'warning',
                                        message: "Password does not match.",
                                        autohideDelay: 2000
                
                                  }); 
                                  
                                  $('.proschangepwdbtn').html('Change Now');
                                  
                                
                            }else
                            {
                                
                                        $('.proschangepwdbtn').prop("disabled", true);
                                        $('.proschangepwdbtn').html('processing... <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>');
                                
                                        
                                        
                                        $.ajax({  
                                            
                                                type : 'POST',
                                                url : '../controller/portal_login/prosproceedtochangepwdhere.php', 
                                                data :  {
                                                    
                                                      mainpwd:mainpwd,
                                                    confirmpwd:confirmpwd,
                                                    InstutionID:InstutionID,
                                                    usertype:usertype,
                                                    UserID:UserID
                                                    
                                                }, //Pass $id
                                                success : function(data)
                                                {
                                                                                                        
                                                   $('.proschangepwdbtn').prop("disabled", false);
                                                   $('.proschangepwdbtn').html("Verify Now");
                                                   
                                                   
                                                   
                                                   if(data.trim() == 'success')
                                                   {
                                                       
                                                        $.wnoty({
                                                            type: 'success',
                                                            message: "Great password changed successfully.",
                                                            autohideDelay: 2000
                                    
                                                       }); 
                                                      
                                                      window.location.href = "../sign-in?lang=english";
                                                      
                                                      
                                                      
                                                   }else
                                                   {
                                                     
                                                      $.wnoty({
                                                            type: 'warning',
                                                            message: "Please check your password and try again!!",
                                                            autohideDelay: 2000
                            
                                                        });  
                                                   }
                                                   
                                                   
                                                }
                                                
                                        });
                                
                                
                            }
                 
             });
            
           //  pros change pwd here
           
           
            
                               
                               
            
	    </script>

  </body>
</html>