<?php
  include VIEWPATH.'includes/new_header.php';
  ?>
  
<body class="hold-transition sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
  <?php
  include VIEWPATH.'includes/new_top_menu.php';
  include VIEWPATH.'includes/new_menu_principal.php';
  ?>

  

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <?php 
    include 'includes/menu_employe.php';
    ?>

    <!-- Main content -->
    <section class="content">

      <!-- Default box -->
      <div class="card">
      
      <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Enregistrement d'un Employé</h3>
              </div>
              <!-- /.card-header -->
              <!-- form start -->
              <form id="FormData" action="<?php echo base_url()?>rh/Employe/add" method="POST" enctype="multipart/form-data">
                <div class="card-body row">
                <div class="col-lg-12">
                <h5 >Employ&eacute;</h5>
                </div>
                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">Nom <spam class="text-danger">*</spam></label>
                    <input type="text" class="form-control" id="NOM" name="NOM" placeholder="Nom" value="<?=set_value('NOM')?>">
                    <?php echo form_error('NOM', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">Pr&eacute;nom <spam class="text-danger">*</spam></label>
                    <input type="text" class="form-control" id="PRENOM" name="PRENOM" placeholder="Pr&eacute;nom" value="<?=set_value('PRENOM')?>">
                    <?php echo form_error('PRENOM', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">Sexe <spam class="text-danger">*</spam></label><br>
                    <div class="icheck-primary d-inline">
                        <input type="radio" name="ID_SEXE" value="1" id="radioSuccess1">
                        <label for="radioSuccess1">
                          Homme
                        </label>
                      </div>
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <div class="icheck-primary d-inline">
                        <input type="radio" name="ID_SEXE" value="2" id="radioSuccess2">
                        <label for="radioSuccess2">
                          Femme
                        </label>
                      </div>
                    <?php echo form_error('ID_SEXE', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  <div class="form-group col-lg-6">
                    <label for="exampleInputPassword1">Date d'entrée en service <spam class="text-danger">*</spam></label>
                    <div class="input-group date" id="DATE_ENTRE_SERVICE" data-target-input="nearest">
                        <input type="text" class="form-control datetimepicker-input" data-target="#DATE_ENTRE_SERVICE" name="DATE_ENTRE_SERVICE" value="<?=set_value('DATE_ENTRE_SERVICE')?>"/>
                        <div class="input-group-append" data-target="#DATE_ENTRE_SERVICE" data-toggle="datetimepicker">
                            <div class="input-group-text"><i class="fa fa-calendar"></i></div>
                        </div>
                    </div>
                    <?php echo form_error('DATE_ENTRE_SERVICE', '<div class="text-danger">', '</div>'); ?>
                  </div>

                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">E-mail <spam class="text-danger">*</spam></label>
                    <input type="email" class="form-control" id="EMAIL" name="EMAIL" placeholder="mail@mail.com" value="<?=set_value('EMAIL')?>">
                    <?php echo form_error('EMAIL', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">T&eacute;l&eacute;phone <spam class="text-danger">*</spam></label>

                    <div class="input-group mb-3">
                  <div class="input-group-prepend">
                    <span class="input-group-text">+257</span>
                  </div>
                  <input type="number" class="form-control" id="TEL" name="TEL"  placeholder="79000000" value="<?=set_value('TEL')?>">
                </div>
                    <?php echo form_error('TEL', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">Profile <spam class="text-danger">*</spam> </label>
                    <select class="custom-select" name="PROFIL_ID" id="PROFIL_ID">
                          <option>-- Select --</option>
                          <?php
                          foreach ($profil as $profils) {
                           echo"<option value='".$profils['PROFIL_ID']."'>".$profils['DESCRIPTION']."</option>";
                          }
                          ?>
                        </select>
                    
                    <?php echo form_error('PROFIL_ID', '<div class="text-danger">', '</div>'); ?>
                  </div>



                  <div class="form-group col-lg-6">
                    <label for="exampleInputEmail1">Signature <spam class="text-danger">*</spam> </label>
                  <input type="file" name="SIGNATURE" class="form-control" accept="image/*">
                    
                    <?php echo form_error('SIGNATURE', '<div class="text-danger">', '</div>'); ?>
                  </div>






                  <!-- <h5 class="mt-4 mb-2"></h5> -->
                  <div class="col-lg-12">
                <h5>Affectation de l'employ&eacute;</h5>
                </div>

                <div class="form-group col-lg-3">
                    <label for="exampleInputEmail1">Responsabilite <spam class="text-danger">*</spam></label>
                    <select class="custom-select" name="ID_RESPONSABILITE" id="ID_RESPONSABILITE">
                         <!--  <option>-- Select --</option> -->
                          <?php
                          foreach ($responsabilite as $responsabilites) {
                           echo"<option value='".$responsabilites['ID_RESPONSABILITE']."'>".$responsabilites['DESCRIPTION']."</option>";
                          }
                          ?>
                        </select>
                    
                    <?php echo form_error('ID_RESPONSABILITE', '<div class="text-danger">', '</div>'); ?>
                  </div>
                    
                  <div class="form-group col-lg-3">
                    <label for="exampleInputEmail1">Direction <spam class="text-danger">*</spam></label>
                    <select class="custom-select" name="ID_DIRECTION" id="ID_DIRECTION" onchange="get_departement(this)">
                          <option>-- Select --</option>
                          <?php
                          foreach ($direction as $directions) {
                           echo"<option value='".$directions['ID_DIRECTION']."'>".$directions['DESCRIPTION']."</option>";
                          }
                          ?>
                        </select>
                    
                    <?php echo form_error('ID_DIRECTION', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  <div class="form-group col-lg-3">
                    <label for="exampleInputEmail1">Service</label>
                    <select class="custom-select" name="ID_SERVICE" id="ID_SERVICE" onchange="get_service(this)">
                          
                        </select>
                    
                    <?php echo form_error('ID_SERVICE', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  <div class="form-group col-lg-3">
                    <label for="exampleInputEmail1">Section</label>
                    <select class="custom-select" name="ID_SECTION" id="ID_SECTION">
                          
                        </select>
                    
                    <?php echo form_error('ID_SECTION', '<div class="text-danger">', '</div>'); ?>
                  </div> 

                  
                  
                   
                  
                  
                       
                 
                  
                </div>
                <!-- /.card-body -->

                <div class="card-footer">
                  <button type="submit" class="btn btn-primary btn-block">Enregistrer</button>
                </div>
              </form>
            </div>
        
        
        <!-- /.card-body -->
        <!-- <div class="card-footer">
          Footer
        </div> -->
        <!-- /.card-footer-->
      </div>
      <!-- /.card -->

    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->

  <?php
 include VIEWPATH.'includes/new_copy_footer.php';  
  ?>
  <!-- /.control-sidebar -->
</div>
<!-- ./wrapper -->
<?php
  include VIEWPATH.'includes/new_script.php';
  ?>
<script>

function get_departement(va){
 var ID_DIRECTION= $(va).val();
 $.post('<?php echo base_url('rh/Employe/get_departement')?>',
     {ID_DIRECTION:ID_DIRECTION},
     function(data){
       $('#ID_SERVICE').html(data);
     });
}
</script>

<script>

function get_service(va){
 var ID_SERVICE= $(va).val();
 $.post('<?php echo base_url('rh/Employe/get_service')?>',
     {ID_SERVICE:ID_SERVICE},
     function(data){
       $('#ID_SECTION').html(data);
     });
}
</script>
<script>
  $(function () {
   
    //Date picker
    $('#DATE_ENTRE_SERVICE').datetimepicker({
        format: 'L'
    });   

  })
 


</script>
</body>
</html>
