<?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_demande_doc.php';
  ?> -->

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

    <!-- Default box -->
    <div class="card">
    
    <div class="card card-primary">
           <!--  <div class="card-header">
              <h3 class="card-title">Demande d'un document</h3>
            </div> -->
            <!-- /.card-header -->
            <!-- form start -->

   <form id="FormData" action="https://documents.jagsolutions.bi/gestion_document/Demande_Document/add" method="POST" accept-charset="utf-8" enctype="multipart/form-data">
    <div class="card-body">
<div class="form-row">
    <div class="form-group col-md-4">
                  <label for="type">Type de document <spam class="text-danger">*</spam></label>
                  <select class="custom-select" name="DOC_TYPE_ID" id="DOC_TYPE_ID">
                        <option>-- Selectionner --</option>
                        <?php
                        foreach ($doc_type as $doc_type) {
                         echo"<option value='".$doc_type['DOC_TYPE_ID']."'>".$doc_type['DESC_TYPE']."</option>";
                        }
                        ?>
                      </select>
                  <?php echo form_error('DOC_TYPE_ID', '<div class="text-danger">', '</div>'); ?>
    </div>
    <div class="form-group col-md-4">
     <label for="doc">Document Scanné<spam class="text-danger">*</spam></label>
                  <input type="file" class="form-control" id="PATH_DOC" name="PATH_DOC" placeholder="" value="<?=set_value('PATH_DOC')?>" >
                  <?php echo form_error('PATH_DOC', '<div class="text-danger">', '</div>'); ?>
    </div>
    <div class="form-group col-md-4">
                  <label for="numerp">Numéro police<spam class="text-danger">*</spam></label>
                  <input type="number" class="form-control" id="NUM_POLICE" name="NUM_POLICE" placeholder="" value="<?=set_value('NUM_POLICE')?>">
                  <?php echo form_error('NUM_POLICE', '<div class="text-danger">', '</div>'); ?>
    </div>
  </div>


  <div class="form-row">
    <div class="form-group col-md-4">
                  <label for="nom">Nom requérant<spam class="text-danger">*</spam></label>
                  <input type="text" class="form-control" id="NOM" name="NOM" placeholder="" value="<?=set_value('NOM')?>">
                  <?php echo form_error('NOM', '<div class="text-danger">', '</div>'); ?>
    </div>
    <div class="form-group col-md-4">
                  <label for="prenom">Prénom requérant<spam class="text-danger">*</spam></label>
                  <input type="text" class="form-control" id="PRENOM" name="PRENOM" placeholder="" value="<?=set_value('PRENOM')?>">
                  <?php echo form_error('PRENOM', '<div class="text-danger">', '</div>'); ?>
    </div>
    <div class="form-group col-md-4">
                 <label for="tel">Téléphone requérant<spam class="text-danger">*</spam></label>

                    <div class="input-group" data-target-input="nearest">

                   <div class="input-group-prepend">
                       <div class="input-group-text">+257
                    </div>
                  </div>

                   <input type="number" class="form-control" id="TEL" name="TEL" placeholder="" value="<?=set_value('TEL')?>">

             </div>
              
            <?php echo form_error('TEL', '<div class="text-danger">', '</div>'); ?>
    </div>
  </div>

  <div class="form-row">


  	    <div class="form-group col-md-4">
                  <label for="numerp">Matricule<spam class="text-danger">*</spam></label>
                  <input type="text" class="form-control" id="MATRICULE" name="MATRICULE" placeholder="" value="<?=set_value('MATRICULE')?>">
                  <?php echo form_error('MATRICULE', '<div class="text-danger">', '</div>'); ?>
    </div>

    <div class="form-group col-md-4">
                  <label for="numeroa">Numéro adhérant<spam class="text-danger">*</spam></label>
                  <input type="text" class="form-control" id="NUMERO_ADHERANT" name="NUMERO_ADHERANT" placeholder="" value="<?=set_value('NUMERO_ADHERANT')?>">
                  <?php echo form_error('NUMERO_ADHERANT', '<div class="text-danger">', '</div>'); ?>
    </div>

    <div class="form-group col-md-4">
                  <label for="numerp">Numéro intermédiaire<spam class="text-danger">*</spam></label>
                  <input type="text" class="form-control" id="NUM_INTERMEDIAIRE" name="NUM_INTERMEDIAIRE" placeholder="" value="<?=set_value('NUM_INTERMEDIAIRE')?>">
                  <?php echo form_error('NUM_INTERMEDIAIRE', '<div class="text-danger">', '</div>'); ?>
    </div>



  </div>
  <!--   <div class="form-group col-md-4"> -->




    <div class="form-row">



    <div class="form-group col-md-4">
                  <label for="prenom">Email</label>
                  <input type="email" class="form-control" id="EMAIL" name="EMAIL" placeholder="" value="<?=set_value('EMAIL')?>">
                  <?php echo form_error('EMAIL', '<div class="text-danger">', '</div>'); ?>
    </div>

       <div class="form-group col-md-4">
                  <label for="datedem">Date de demande <spam class="text-danger">*</spam></label>
                  <div class="input-group date"  data-target-input="nearest">
                      <input type="text" class="form-control datetimepicker-input" data-target="#DATE_DEMANDE" name="DATE_DEMANDE" id="DATE_DEMANDE" value="<?=set_value('DATE_DEMANDE')?>"/>
                      <div class="input-group-append" data-target="#DATE_DEMANDE" data-toggle="datetimepicker">
                          <div class="input-group-text"><i class="fa fa-calendar"></i></div>
                      </div>
                  </div>
                  <?php echo form_error('DATE_DEMANDE', '<div class="text-danger">', '</div>'); ?>
    </div>


      <div class="form-group col-md-4">
                  <label for="prenom">Commentaire<spam class="text-danger">*</spam></label>
                  <textarea class="form-control" id="COMMENTAIRE" name="COMMENTAIRE" placeholder=""><?=set_value('COMMENTAIRE')?> </textarea>
                  <?php echo form_error('COMMENTAIRE', '<div class="text-danger">', '</div>'); ?>
    </div>


  <div class="form-group col-md-4">
                          <label for="USER">
                           Voulez-vous faire une affectation manuelle ?
                             
                          </label>
                         <div class="custom-control custom-switch">
                        <input type="checkbox" class="custom-control-input" id="switch1" onclick="showprofil()" <?php echo (!empty($ID_NIVEAUX_ORGANIGRAMME))? 'checked':'' ?>>
                        <label class="custom-control-label" for="switch1"></label>
                         </div>
</div>
</div>


<div class="form-row" id="affectation" <?php echo (!empty($AFFECTATION))? "style='display: block'":"style='display: none'" ?>>


<div class="form-group col-md-4">
<label for="service">Niveau de Service concerné <spam class="text-danger">*</spam></label>
                  <select class="custom-select" name="ID_NIVEAUX_ORGANIGRAMME" id="ID_NIVEAUX_ORGANIGRAMME" onchange="get_services(this)">
                        <option value="">-- Selectionner --</option>
                        <?php
                        foreach ($nivea as $niveaus) {
                         echo"<option value='".$niveaus['ID_NIVEAUX_ORGANIGRAMME']."'>".$niveaus['DESCRIPTION']."</option>";
                        }
                        ?>
                      </select>
                  <?php echo form_error('ID_NIVEAUX_ORGANIGRAMME', '<div class="text-danger">', '</div>'); ?>
 <!--    </div> -->
  </div>
 

    <div class="form-group col-md-4">
                  <label for="service">Service concerné <spam class="text-danger">*</spam></label>
                  <select class="custom-select" name="SERVICE" id="SERVICE">
      
                    </select>
                  <?php echo form_error('SERVICE', '<div class="text-danger">', '</div>'); ?>
    </div>
<div class="form-group col-md-4">
                  <label for="service">Etape<spam class="text-danger">*</spam></label>
                  <select class="custom-select" name="STATUT_DOC_ID" id="STATUT_DOC_ID">
                        <option>-- Selectionner --</option>
                        <?php
                        foreach ($doc_statut as $doc_statut) {
                         echo"<option value='".$doc_statut['STATUT_DOC_ID']."'>".$doc_statut['DESC_STATUT']."</option>";
                        }
                        ?>
                      </select>
                  <?php echo form_error('STATUT_DOC_ID', '<div class="text-danger">', '</div>'); ?>
    </div>

</div>



     <div class="card-footer">
        <button type="submit" class="btn btn-primary btn-block">Enregistrer</button>
      </div>

 </div>

</form>


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


    
          </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_services(va){
var ID_NIVEAUX_ORGANIGRAMME= $(va).val();
$.post('<?php echo base_url('gestion_document/Demande_Document/get_services')?>',
   {ID_NIVEAUX_ORGANIGRAMME:ID_NIVEAUX_ORGANIGRAMME},
   function(data){
     $('#SERVICE').html(data);
   });

}
</script>

<script>
$(function () {
 
  //Date picker
  $('#DATE_ENTRE_SERVICE').datetimepicker({
      format: 'L'
  });   

})



</script>
<script>
$(function () {
  //Initialize Select2 Elements
  $('.select2').select2()

  //Initialize Select2 Elements
  $('.select2bs4').select2({
    theme: 'bootstrap4'
  })
})
</script>

<script>
$(function () {
  //Date picker
  $('#DATE_DEMANDE').datetimepicker({
      format: 'L',
        locale: "ru",
        step: 1,
      // minDate : 0,
      maxDate:new Date()
  });   
})
</script>

  <script>

      function showprofil()
      {

        if($('input[type=checkbox]').prop('checked'))
         {

         $("#affectation").show();
         }
         else
         {
         $("#affectation").hide();
         $("#ID_NIVEAUX_ORGANIGRAMME").val('');
         }
         
      }


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