<?php
                  $mode		= $this->uri->segment(4);

                  if ($mode == "edt" || $mode == "act_edt") {
                    
                    $act			= "act_edt";
                    $idp			        = $datpil->id_umkm;
                    $nama_usaha			  = $datpil->nama_usaha;
                    $nama_pemilik			= $datpil->nama_pemilik;
                    $telp			        = $datpil->telp;
                    $jenis_produk			= $datpil->jenis_produk;
                    $nama_produk			= $datpil->nama_produk;
                    $linsek			      = $datpil->linsek;

                    
                    
                    
                    
                    
                  } else {
                    $act			          = "act_add";
                    $idp			          = "";
                    $id_proses			    = $this->uri->segment(3);
                    $step			          = "";
                    $kendala			      = "";
                    $ket			          = "";
                    $file_progres                    = "";
                    $verif			        = "";
                    $ket_verif			        = "";
                    $tgl			        = "";

                    

                  }
                  ?>
<html>
<head>
<script>
		function hanyaAngka(evt) {
		  var charCode = (evt.which) ? evt.which : event.keyCode
		   if (charCode > 31 && (charCode < 48 || charCode > 57))
 
		    return false;
		  return true;
		}
  
</script>



 
 <script>
  function validateFormProgres() {
    
 
    var id_proses = document.forms["formprogres"]["id_proses"].value;
    var step = document.forms["formprogres"]["step"].value;
    var kendala = document.forms["formprogres"]["kendala"].value;
    var ket = document.forms["formprogres"]["ket"].value;
    var file_progres = document.forms["formprogres"]["file_progres"].value;
    if (id_proses == "") {
      alert("url Jangan Diubah/Dihapus");
      return false;
    }
    else if (step == "") {
      alert("Progres Harus Dipilih");
      return false;
    }
    else if (kendala == "") {
      alert("Kendala Harus Dipilih");
      return false;
    }
    else if (ket == "") {
      alert("Keterangan Harus Diisi");
      return false;
    }
    else if (file_progres == "") {
      alert("File Harus diupload");
      return false;
    }
    
    $('.auto-save').savy('destroy',function(){
    console.log("All data from savy are Destroyed");
    window.location.reload();
  });
  }
  
  </script>
<script>
function clearcontent() {
    document.getElementById("formumkm").reset();
}
</script>

</head>
<body>
<section class="content">
      <div class="container-fluid">
        <div class="row">
          <!-- left column -->
          <div class="col-md-12">
            <!-- jquery validation -->
            <div class="card card-primary">
              <div class="card-header">
                <h3 class="card-title">Form <small>Progres</small></h3>
              </div>
              
              <!-- /.card-header -->
              <!-- form start -->
              <form name="formprogres" onsubmit="return validateFormProgres()" action="<?=base_URL()?>sistem/progres_detail/<?php echo decrypt_url ($this->uri->segment(3))?>/<?php echo $act; ?>" onsubmit="dstry()"  method="post" accept-charset="utf-8" enctype="multipart/form-data" id="quickForm" class="form-horizontal">
              <input type="hidden" name="idp" value="<?php echo $idp; ?>">   
              <input type="hidden" name="tgl" value="<?php echo $tgl; ?>">   
              <input type="hidden"   name="id_proses" value="<?php echo decrypt_url ($id_proses) ; ?>">                                              
              <div class="card-body">
                                     
                                       
                                         
    <section class="content">
      


 <div class="container-fluid">
        <!-- SELECT2 EXAMPLE -->
        <div class="card card-default">
          <div class="card-header">
            <h3 class="card-title">Masukkan Progres Pendampingan</h3>

            <div class="card-tools">
              <button type="button" class="btn btn-tool" data-card-widget="collapse">
                <i class="fas fa-minus"></i>
              </button>
             
            </div>
          </div>
          <!-- /.card-header -->
          <div class="card-body">
            <div class="row">
              <div class="col-md-6">
             
              <div class="form-group">
                  <label>Progres</label>
                  <select  name="step" id="step"  class="form-control auto-save" ><option value=""> - Pilih - </option>
                  <option  value="1">Step 1 - Pembuatan NIB dan KBLI yang sesuai</option>
                  <option  value="2">Step 2 - Pembuatan Dokumen SOP dan Panduan Mutu</option>
                  <option  value="3">Step 3 - Persetujuan Denah dan Alur Produksi</option>
                  <option  value="4">Step 4 - Input permohonan melalui OSS RBA</option>
                  <option  value="5">Step 5 - Sertifikasi Sarana Produksi</option>
                  <option  value="6">Step 6 - Pengujian Produk</option>
                  <option  value="7">Step 7 - Pendaftaran Nomor Izin Edar</option>
                  </select>       
              </div>
              <br>
              <br>
             
                <div class="form-group">
                  <label>Apakah Ada Kendala?</label>
                  <select  name="kendala" id="kendala"  class="form-control auto-save" ><option value=""> - Pilih - </option>
                        <?php
                          $l_kendala	= array('Ada Kendala','Tidak Ada Kendala',);
                          for ($i = 0; $i < sizeof($l_kendala); $i++) {
                            if ($l_kendala[$i] == $kendala) {
                              echo "<option selected value='".$l_kendala[$i]."'>".$l_kendala[$i]."</option>";
                                } else {
                                  echo "<option value='".$l_kendala[$i]."'>".$l_kendala[$i]."</option>";
                                    }				
                                      }			
                        ?>			
                  </select>           
                </div>
                
               
              
               
              </div>

              <!-- /.col KANAN -->
              <div class="col-md-6">
              
              <div class="form-group">
                  <label>Keterangan:</label>
                  <textarea name="ket"  style="width: 593px; height: 85px" id="ket"   class="form-control auto-save"><?php echo $ket; ?></textarea>
                </div>
               
                <label>Upload File</label>                                   
                <div class="custom-file">
                <input autocomplete ='off' type="file" name="file_progres"   oninvalid="this.setCustomValidity('data tidak boleh kosong')" oninput="setCustomValidity('')" class="form-control">
                 
                </div> 
                
                
                
              </div>
            
              <!-- /.col -->
            </div>
            <!-- /.row -->
            
          
            <!-- /.row -->
          </div>
          <!-- /.card-body -->
          
        </div>
        <!-- /.card -->

        <!-- SELECT2 EXAMPLE -->
       
        <!-- /.card -->

        
        <!-- /.card -->

       
        <!-- /.row -->
        
        <!-- /.row -->
        
        <!-- /.row -->
      </div>

      
      <!-- /.container-fluid -->
    </section>
                                           
                                            
                                          </div>
                                          <!-- /.card-body -->
                                          <div class="card-footer">
                                              <button type="submit"  class="form-control btn btn-primary"  >Kirim</button>
                                             
                                          </div>
                                          
                                        </form>
                                        
            </div>
         
            <!-- /.card -->
            </div>
          <!--/.col (left) -->
          <!-- right column -->
          <div class="col-md-3">
            
              <button type="submit" onclick="clearcontent()"  id="hapus"   class="btn btn-secondary" >Bersihkan Form</button>
           
          </div>
          
          <!--/.col (right) -->
        </div>
        <!-- /.row -->
      </div><!-- /.container-fluid -->
    </section>


    

















    
<div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
           
          </div><!-- /.col -->
         
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            
            <!-- /.card -->

            <div class="card">
              <div class="card-header">
                <h3 class="card-title"><?php echo $this->session->flashdata("k");?></h3>
                <h3 class="card-title"><?php echo $this->session->flashdata("kk");?></h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
              <table  id="example1" class="table table-bordered table-striped">
                  <thead>
                  <tr>
                    <th>No</th>
                    <th>Nama Usaha</th>
                    <th>Nama Pemilik</th>
                    <th>Progres</th>
                    <th>Kendala</th>
                    <th>Keterangan</th>
              
                    <th>Aksi</th>
                  </tr>
                           
                  </thead>
                  <tbody >
                  <tr>
                  <?php 
                  if (empty($data)) {
                    echo "<tr></tr>";
                  } else {
                    $no 	= ($this->uri->segment(4) + 1);
                    foreach ($data as $b) {
                  ?>
                  <td> 
                <?=$no?>
                 
                </td>
                 <td> 
                <?=$b->nama_usaha?>
                 
                </td>
                  
                  <td>
                  <?=$b->nama_pemilik?>
                  </td>
                    
                  <td>
                
                    <?php  
                     if ($b->step == '1' ){echo "1. Pembuatan NIB dan KBLI yang sesuai";}
                     else if ($b->step == '2' ){echo "2. Pembuatan Dokumen SOP dan Panduan Mutu";}
                     else if ($b->step == '3' ){echo "3. Persetujuan Denah dan Alur Produksi";}
                     else if ($b->step == '4' ){echo "4. Input permohonan melalui OSS RBA yang terintegrasi e-sertifikasi BPOM";}
                     else if ($b->step == '5' ){echo "5. Sertifikasi Sarana Produksi (oleh TIM BBPOM Palangka Raya) untuk mendapatkan Sertifikat CPPOB";}
                     else if ($b->step == '6' ){echo "6. Pengujian Produk (khusus untuk produk dengan resiko sedang-tinggi)";}
                    
                    
                     else {echo "7. Pendaftaran Nomor Izin Edar produk melalui OSS yang terintegrasi e-Registrasi BPOM";}
                    ?>
                  <br>
                  <small>
                       
                  <?php  
                     if ($b->verif == '0' ){echo "Belum Verifikasi";}
                     else if ($b->verif == '1' ){echo "Terverifikasi";}
                    
                    
                     else {echo "Selesai";}
                    ?>
                    <br>
                    <br>
                    <b>File Progres           :  </b> <a  <?php echo "<a href='".base_URL()."upload/bukti/".$b->file_progres."' " ?>  rel="noopener" target="_blank" class="btn btn-default"><i class="fas fa-download"></i></a><br>
                       </small>
                  
                  </td>

                  <td>
                     <?=$b->kendala?>
                    </td>
                    <td>
                   
                    <?=$b->ket?><br><br>
                    <small>
                    <blockquote>
                    <p><?=$b->ket_verif?></p>
                    
                    </blockquote> 
                    </small>
                   </td>
                  
                   
                    <td class="text-center py-0 align-middle">
                      <div class="btn-group btn-group-sm">
                     
                      <?php if ($b->verif == 1  || $b->verif == 2 || $b->verif == 100) { ?> <!-- Acton Operator -->
                        <a onclick="return confirm('Anda Yakin..?')" href="<?=base_URL()?>sistem/progres_detail/<?php echo $this->uri->segment(3)?>/del/<?php echo encrypt_url ($b->id_progres)?>" class="btn btn-danger disabled"><i class="fas fa-trash"></i></a>
								 
											 <?php } ?>
                       <?php if ($b->verif == 0 ) { ?> <!-- Acton Operator -->
                        <a onclick="return confirm('Anda Yakin..?')" href="<?=base_URL()?>sistem/progres_detail/<?php echo $this->uri->segment(3)?>/del/<?php echo encrypt_url ($b->id_progres)?>" class="btn btn-danger"><i class="fas fa-trash"></i></a>
								 
											 <?php } ?>
                       
                      </div>
                    </td>
                       
                </tr>
                  
                  <?php 
			$no++;
			}
		}
		?> 
                  </tbody>
                 
                </table>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
  
    	
