<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php"); ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Edit User | EduPortal</title>
    <!-- Bootstrap -->
    <link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- bootstrap-daterangepicker -->
    <link href="../vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="../build/css/custom.min.css" rel="stylesheet">
    <link href="<?php echo DOMAIN;?>Production/css/style1.css" rel="stylesheet">
   
  </head>
  

  <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
     
            <?php include('RootMe/sidebar.php');?>

              <?php include('RootMe/header.php');?>
     
        <!-- page content -->
          <div class="right_col" role="main">
          <div class="row" style="background-color: white;padding:2%;">
           
  <section class="">
  <div class="container">
  <div class="inner_banner_bg">
    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">

  <h3> Update User Profile </h3>   


    </div>
    <ul class="inner_menu">
   
     <div class="clearfix"></div>
    </ul>
    <div class="clearfix"></div>
    </div>
  </div>
</section>
<section class="add_sub_agent" id="table_sub_agent">
  <div class="container">
   <div class="box_visa_form">
    <div class="" style="min-height:320px;">
      

<form class="form-style-7" id="add_emp" action="<?php echo DOMAIN.AgentDirectory;?>parent/InsertMe.php" method="post" onSubmit="return student_check11();" enctype="multipart/form-data">


  <input type="hidden" name="action"  value="EditUser">

  <input type="hidden" name="user"  value="<?php echo $_SESSION['user_id']; ?>" />



<input type="hidden" value="" class="form-control"  id="validate_status" />

        


<div class="row">

       <div class="col-md-10"> 

<?php 

   if(isset($_SESSION['user_id'])){

     $m->where("status", '0');
     $m->where("user_id", $_SESSION['user_id']);
     $m->where("branch_id", $_SESSION['branch']);
     $user = $m->get("edu_user_config");
     //print_r($user);
   }


?>

          
          <?php  if(isset($_SESSION['User_Updated'])){?>


            <div class="alert alert-success" id="msg">
             <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
              <strong>Success!</strong> User record is updated successfully...
            </div>


          <?php  unset($_SESSION['User_Updated']); }?>

      
        <div class="row">
                       
                       
                      <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  First Name * </label>
                              <input type="text" value="<?php echo $user[0]['user_fname']; ?>" class="form-control" name="fname" id="fname"  />
                          </div>
                      </div>

                  
                      <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  Last Name * </label>
                              <input type="text"  value="<?php echo $user[0]['user_lname']; ?>"  class="form-control" name="lname" id="lname"/>
                          </div>
                      </div>

                    <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  Religion </label>
                              
                       <select id="religion" name="religion" class="dropdown" style="width: 100%;height: 34px;">
                      <option <?php if($user[0]['user_religion']=="Muslim"){echo "Selected";} ?> value="Muslim">Muslim</option>
                      <option <?php if($user[0]['user_religion']=="Hinduism"){echo "Selected";} ?> value="Hinduism">Hindu</option>                    
                      <option <?php if($user[0]['user_religion']=="Sikhism"){echo "Selected";} ?> value="Sikhism">Sikh</option>
                      <option <?php if($user[0]['user_religion']=="Christian"){echo "Selected";} ?> value="Christian">Christian</option>                                        
                                            
                    </select>

                          </div>
                      </div>


                  <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  Gender  </label>
                              <br>
                                      
                          <input <?php if($user[0]['user_gender']=="Male"){echo "checked";} ?> type="radio" name="gender" value="Male"  /> 
                  Male
                          
                                                                          
                          <input <?php if($user[0]['user_gender']=="Female"){echo "checked";} ?> type="radio" name="gender" value="Female"  /> 
                  Female
                          
                          </div>
                      </div>
  


    
                   </div>  <!-- ending row-->




        <div class="row">
                       
                       
                      <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  Blood Group  </label>
                               <select name="blood" class="form-control" >
                        
                          <option value="">Select </option>                 
                          <option <?php if($user[0]['user_blood']=="A-"){echo "Selected";} ?> value="A-"> A-</option>
                          <option <?php if($user[0]['user_blood']=="A+"){echo "Selected";} ?> value="A+"> A+</option>
                          <option <?php if($user[0]['user_blood']=="B-"){echo "Selected";} ?> value="B-"> B-</option>
                          <option <?php if($user[0]['user_blood']=="B+"){echo "Selected";} ?> value="B+"> B+</option>
                          <option <?php if($user[0]['user_blood']=="O-"){echo "Selected";} ?> value="O-"> O-</option>
                          <option <?php if($user[0]['user_blood']=="O+"){echo "Selected";} ?> value="O+"> O+</option>                                        
                          <option  <?php if($user[0]['user_blood']=="AB-"){echo "Selected";} ?> value="AB-"> AB-</option>
                          <option <?php if($user[0]['user_blood']=="AB+"){echo "Selected";} ?>value="AB+"> AB+</option>                                        

                                                                    
                        </select>

                          </div>
                      </div>

                  
                      <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  CNIC  </label>
                              <input type="text"  value="<?php echo $user[0]['user_cnic']; ?>" class="form-control" name="cnic"  />
                          </div>
                      </div>


                   <div class="col-md-3" >
                       
                        <label>  Upload Picture  </label>
                              
                        <input type="file" class="form-control" onchange="readURL(this);" name="img_file" />

             
                      </div>


                    <div class="col-md-3" >
                          <div class="form-group" >
                            
                           <!---remove qualification field-->
                          </div>
                      </div>



    
                   </div>  <!-- ending row-->


                    

    </div>   <!--  ending 10 column-->



   <div class="col-md-2" > 

   <?php if($user[0]['attach_image']!=NULL){ ?>
      
      <img src="<?php echo DOMAIN.AgentDirectory;?>staff_pics/<?php echo $user[0]['attach_image'];?>" id="preview" class="img-thumbnail" style="width:180px;height:180px;"   />

   <?php }else { ?>   

       <img src="<?php echo DOMAIN.AgentDirectory;?>/images/upload.png" id="preview" height="180px" id="preview"  class="img-thumbnail" width="180px"  />


   <?php } ?>   

   </div>


</div>

        <div class="row">
                       
                     
                      <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  Cell No * </label>
                              <input type="text" class="form-control" value="<?php echo $user[0]['cell_no']; ?>" name="cell_no" onBlur="check_std_duplication1();"   />
                          </div>
                      </div>

                  
                      <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  Postal Code </label>
                              <input type="text" class="form-control" value="<?php echo $user[0]['user_postalcode']; ?>" name="postal"  />
                          </div>
                      </div>

                    <div class="col-md-3" >
                          <div class="form-group" >
                            
                            <label>  Email (Software Login)*</label>
                              <input type="email" class="form-control"  value="<?php echo $user[0]['user_email']; ?>"  name="user_email"  />

                          </div>
                      </div>

        <div class="col-md-12" >
                          <div class="form-group"  >
                            
                            <label>  Address  </label>
                              <br>
                                      
                          <input type="text" value="<?php echo $user[0]['user_address']; ?>" class="form-control" name="address" style="height:50px;" />
                          
                          </div>
                </div>


<?php 

       if(!isset($_REQUEST['emp'])){
?>


<!-- 
                    <div class="col-md-3" >
                          <div class="form-group" >
                            
                             <label>  Password  </label>
                              <input type="password" class="form-control" name="password" id="password"  />

                          </div>
                      </div>
   -->

<?php 
    }
?>


    
                   </div>  <!-- ending row-->



      <div class="col-md-12 pull-right">

          <input type="submit" value=" Save Record " class="pull-right btn btn-primary" >

      </div>




    </form>






      <div class="clearfix"></div>


     </div>   <!--  main row -->








  </div>
  <div class="clearfix"></div>
</section>          
    

           
          </div>
        </div>

            </div>
          </div>
        </div>
        <!-- /page content -->
  

    <!-- jQuery -->
    <script src="../vendors/jquery/dist/jquery.min.js"></script>
    <!-- Bootstrap -->
    <script src="../vendors/bootstrap/dist/js/bootstrap.min.js"></script>    
    <!-- Custom Theme Scripts -->
    <script src="../build/js/custom.min.js"></script>

    <!-- morris.js -->
    <script src="../vendors/raphael/raphael.min.js"></script>
    <script src="../vendors/morris.js/morris.min.js"></script>
  

<script type="text/javascript">


// function to set image on thumbnail

function readURL(input) {
  if (input.files && input.files[0]) {
      var reader = new FileReader();

      reader.onload = function (e) {
          $('#preview')
              .attr('src', e.target.result)
              .width(170)
              .height(180);
      };

      reader.readAsDataURL(input.files[0]);
  }
}


function ConvertCnic(value)
{
  
cnic.value = value.substring(0,5) + '-' + value.substring(5,12) + '-' + value.substring(12);  

}





// validations for form




$(function(){
  
  $("#add_emp").validate({
    rules: {
      fname: {
        
        required: true,
        minlength: 3,
        maxlength: 50,
      },
      lname: {
        
        minlength: 3,
        minlength: 3,
        maxlength: 50,
      },
      gender: {        
        required: true,
      },
      cnic: {
         minlength: 13,
         minlength: 15,
      },
      
      cellno: {
        required: true,
        number: true,
        minlength:11,
        maxlength:13,
      },
      joining: {
        required: true,
      },
      jobtype: {
        required: true,
      },
      designation: {
        required: true,
      },
          
      email: {
        
//        required: true,
        email:true,
        
      },



      gemail: {
        
  
        email:true,
        minlength: 12,
        maxlength: 25,
        
      },
  
      
      city: {
        required: true,
      //  number: true,
      //  minlength: 6
      },

    
      gender: {
        required: true,
      //  number: true,
      //  minlength: 6
      },

      gcellno: {
        required: true,
        number: true,
        minlength: 11,
        maxlength:18, 
      },
      
      dob: {
        required: true,
      },


    },
    messages: {
      
      fname: {
        required: 'This field is required.',
        number:'Number not allowed'
      },
      
      cellno: {
        required: 'This field is required.',
        number:'Number not allowed',
        minlength:'Minimum length 11',
        maxlength:'Maximum length 18',        
      },
      
      
      dob: {
        required: 'This field is required.',
      },
      
      gender: {
        required: 'This field is required.',

      },
      
      
      
      postal: {
        required: 'This field is required.',
        number:'Only number allowed',
        maxlength: 'Maximum 15 allowed',
        
        
      },
        
      
    
      
      cellno: {
        number:'Only number allowed',
        required: 'This field is required.',
        maxlength: 'Maximum 15 allowed',
        minlength: 'Minimum length 8',
      },
      
        
      
      
      cnic: {
        required: 'This field is required',
        minlength: 'Minimum length: 13',
        maxlength: 'Maximum length: 13',
        
      },
      
      email: {
//        required: 'This field is required',
        minlength: 'Minimum length: 12',
        maxlength: 'Maximum length: 25',
        email: 'Enter a valid email',
        
      },
      
      gemai: {
//        required: 'This field is required',
        minlength: 'Minimum length: 12',
        maxlength: 'Maximum length: 25',
        email:'Enter a valid email',
        
      },
      
      
      
      
      fname: {
        required: 'This field is required.'
        
      }},
      gname: {
        required: 'This field is required.',
        minlength: 'Minimum length: 3'
      },
      cellno: {
        required: 'This field is required.',
        minlength: 'Minimum length: 8'
      },
      city: {
        required: 'This field is required.',
        minlength: 'Minimum length: 3'
      },
      
      postal: {
        required: 'This field is required.',
        
      },
      
      
      houseNo: {
        required: 'This field is required.',
        
      },
      province: {
        required: 'This field is required.',
        
      },
      streetNo: {
        required: 'This field is required.',
        
      },
      country: {
        required: 'This field is required.',
        
      },
      
      religion: {
        required: 'This field is required.',
        
      },
    
  });
  });
  





</script>

  </body>
</html>
