<?php require_once('../auth/auth.php');?>
<?php
$get_em_id=$_GET['get_em_id'];
$accounts_query= mysqli_query($conn,"SELECT * FROM em_employee WHERE em_id='$get_em_id' ") or die (mysqli_error($conn));
$row_em= mysqli_fetch_assoc ($accounts_query);
$em_acid = $row_em['em_acid'];
?>
<section class="content">
   <div class="container-fluid">
      <div class="row">
         <div class="col-md-12">
            <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
               <div class="card-header" style="padding: 5px 8px;"><h3 class="card-title"> <?php echo language(25);?>  </h3> <div class="card-tools"> <button type="button" class="btn btn-tool" data-card-widget="remove"> <i class="fas fa-times"></i>  </button> </div>
            </div>
            <form id="em_update_form" action="#" method="post" autocomplete="off">
               <input type="hidden" name="update_emfrom" required="true">
               <input type="hidden" name="em_id" value="<?php echo $get_em_id ;?>" required="true">
                <div class="card-body">
                     <div class="col-md-12">
                        <div class="row mt-2">
                           <div class="col-md-4">
                              <div class="form-group">
                                 <label> <?php echo language(247); ?> <b class="text-danger"> *</b></label>
                                 <input type="text" name="em_acname" value="<?php echo @$row_em['em_acname'];?>" class="form-control form-control-sm inputselect" required="true">
                              </div>
                           </div>
                           <div class="col-md-2">
                              <div class="form-group">
                                 <label> <?php echo language(110);?> <b class="text-danger"> *</b></label>
                                 <input type="text" name="em_alias" value="<?php echo @$row_em['em_alias'];?>" class="form-control form-control-sm inputselect" required="true">
                              </div>
                           </div>
                           <div class="col-md-3">
                              <div class="form-group">
                                 <label><?php echo language(111);?> <b class="text-danger"> *</b></label>
                                 <input type="number" name="em_phone" value="<?php echo @$row_em['em_phone'];?>" id="checknumber"  onkeyup="checknumber();" class="form-control form-control-sm inputselect" required="true">
                              </div>
                           </div>
                           <div class="col-md-3">
                              <div class="form-group">
                                 <label><?php echo language(112);?> <b class="text-danger"> *</b></label>
                                 <input type="text" value="<?php echo @$row_em['em_email'];?>" name="em_email"  class="form-control form-control-sm inputselect" required="true">
                              </div>
                           </div>
                           
                           
                           <div class="col-md-5">
                              <div class="form-group">
                                 <label> <?php echo language(248);?> <b class="text-danger"> *</b></label>
                                 <input name="em_pres_address" value="<?php echo @$row_em['em_pres_address'];?>" class="form-control form-control-sm inputselect" rows="2">
                              </div>
                           </div>
                           <div class="col-md-3">
                              <div class="form-group">
                                 <label><?php echo language(117);?> <b class="text-danger"> *</b></label>
                                 <input type="number" name="em_nid" value="<?php echo @$row_em['em_nid'];?>" class="form-control form-control-sm inputselect">
                              </div>
                           </div>
                     
                           <div class="col-md-3">
                              <div class="form-group">
                                 <label><?php echo language(118);?> </label>
                                 <input type="text" name="id_card" value="<?php echo @$row_em['id_card'];?>"  class="form-control form-control-sm inputselect">
                              </div>
                           </div>
                          
                          
                  
                        </div>
                     </div>
                  </div>
               <center>
               <div class="card-footer" style="padding: 8px 5px;">
                  <button type="submit" id="save" class="btn btn-success btn-xs"><?php echo language(25);?></button>
               </div>
               </center>
            </form>
         </div>
      </div>
   </div>
</div>
</section>
<script>
$(document).ready(function() {
      $("select").select2();
      $('#em_update_form').on('submit', function(e){
      $('#save').prop('disabled', true);
      $('#save').html('<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> '+'Loading...');
      e.preventDefault();
      $.post("../hr_manage/employee_db.php",$(this).serialize(),function(data){
      $('#em_update_form')[0].reset();
      $('#save').prop('disabled', false);
      $.post('../hr_manage/em_profile_update.php?get_em_id=<?php echo $get_em_id ?>',{},function(res){
      $('#pview<?php echo $em_acid?>').html(res);
      });
        toastr.success(Showing, yourdata);
     });
  });
});
</script>