<?php if ($this->session->userdata('admin_level') == "Admin"){ ?>
<?php
                  $mode		= $this->uri->segment(3);

                  if ($mode == "edt" || $mode == "act_edt") {
                    
                    $act			= "act_edt";
                 
                    
                    
                    
                    
                  } else {
                    $act			            = "act_add";
                    $idp			            = "";
                    $id_umkm			          = "";
                    $id_user			      = "";


                  }
?>
<body>
  <br>
  <script>
  function validateGabung() {
    
    var id_umkm = document.forms["formjoin"]["id_umkm"].value;
    var id_user = document.forms["formjoin"]["id_user"].value;

    if (id_umkm == "") {
      alert("Pilih UMKM Terlebih Dahulu");
      return false;
    }
    else if (id_user == "") {
      alert("Pilih Fasiltator Terlebih Dahulu");
     
      return false;
    };
  
  }
  
  </script>
<section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-md-6">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">Data UMKM</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
              <table id="tabelkiri" class="table table-bordered table-hover">
                  <thead>
                  <tr>
                    <th>No</th>
                    <th>Nama Usaha</th>
                    <th>Nama Pemilik</th>
                    
                  </tr>
                           
                  </thead>
                  <tbody >
                  <tr>
                  <?php 
                  if (empty($data_umkm)) {
                    echo "<tr></tr>";
                  } else {
                    $no 	= ($this->uri->segment(4) + 1);
                    foreach ($data_umkm as $b) {
                  ?>
                  <td> 
                <?=$no?>
                 
                </td>
                 <td> 
                <?=$b->nama_usaha?>
                 
                </td>
                  
                  <td>
                  <?=$b->nama_pemilik?>
                  </td>
                    
                 
                   
                   
                       
                </tr>
                  
                  <?php 
			$no++;
			}
		}
		?> 
                  </tbody>
                 
                </table>
              </div>
              <!-- /.card-body -->
              
            </div>
            <!-- /.card -->

            
            <!-- /.card -->
          </div>
          <!-- /.BATAS KIRI -->
          <!-- /.col -->
          <div class="col-md-6">
          <div class="card">
              <div class="card-header">
                <h3 class="card-title">Data Fasilitator</h3>
              </div>
              <!-- /.card-header -->
              <div class="card-body">
              <table id="tabelkanan" class="table table-bordered table-hover">
                  <thead>
                  <tr>
                    <th>No</th>
                    <th>Nama Lengkap</th>
                    <th>WA Aktif</th>
                    
                  </tr>
                           
                  </thead>
                  <tbody >
                  <tr>
                  <?php 
                  if (empty($data_fasilitator)) {
                    echo "<tr></tr>";
                  } else {
                    $no 	= ($this->uri->segment(4) + 1);
                    foreach ($data_fasilitator as $b) {
                  ?>
                  <td> 
                <?=$no?>
                 
                </td>
                 <td> 
                <?=$b->nama_lengkap?>
                 
                </td>
                  
                  <td>
                  <?=$b->no_wa?>
                  </td>
                    
                 
                   
                   
                       
                </tr>
                  
                  <?php 
			$no++;
			}
		}
		?> 
                  </tbody>
                 
                </table>

            
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
        
        <!-- /.row -->
        
        <!-- /.row -->
        
        <!-- /.row -->
        
        <!-- /.row -->
      </div><!-- /.container-fluid -->
  </section>


  <section class="content">
      <div class="container-fluid">
        <!-- SELECT2 EXAMPLE -->
        <div class="card card-default">
          <div class="card-header">
            <h3 class="card-title">Pilih UMKM dan Fasilitator</h3>

            <div class="card-tools">
              <button type="button" class="btn btn-tool" data-card-widget="collapse">
                <i class="fas fa-minus"></i>
              </button>
              <button type="button" class="btn btn-tool" data-card-widget="remove">
                <i class="fas fa-times"></i>
              </button>
            </div>
          </div>
          <!-- /.card-header -->
          <form name="formjoin" onsubmit="return validateGabung()"  action="<?=base_URL()?>sistem/proses/<?php echo $act; ?>"  method="post" accept-charset="utf-8" enctype="multipart/form-data" id="quickForm" class="form-horizontal">
               
          <div class="card-body">
            <div class="row">
              <div class="col-md-6">
                <div class="form-group">
                  <label>Pilih UMKM</label>
                  
                  <select value="<?php echo $id_umkm; ?>" name="id_umkm" id="id_umkm" class="form-control select2" style="height :100%;   width: 100%;">
                           <option value="">-- Pilih UMKM --</option>
                            <?php  $data_b  = $data_umkm;						  
                                  foreach ($data_b as $row) {  
                                    echo "<option select value='".$row->id_umkm."'>".$row->nama_usaha."</option>";
                                      }
                                        echo"
                                        </select>"
                                  ?>
                         </div>               
                <!-- /.form-group -->
              </div>
              <!-- /.col -->
              <div class="col-md-6">
              <div class="form-group">
                  <label>Pilih Fasilitator</label>
                  <select value="<?php echo $id_user; ?>" name="id_user" id="id_user" class="form-control select2" style="height :100%;   width: 100%;">
                           <option value="">-- Pilih Fasilitator --</option>
                           <?php  $data_b  = $data_fasilitator;								  
                                  foreach ($data_b as $row) {  
                                    echo "<option select value='".$row->id_user."'>".$row->nama_lengkap."</option>";
                                      }
                                        echo"
                                        </select>"
                                  ?>
                         </div>   
                <!-- /.form-group -->
               
                <!-- /.form-group -->
              </div>
              <!-- /.col -->
              
            </div>
            <!-- /.row -->
            
        </div>
        <!-- /.card -->

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

       
          <!-- /.card-header -->
          
        
        <!-- /.card -->

        
        <!-- /.row -->
        
        <!-- /.row -->
        <div class="card-footer">
         <button type="submit"   class="form-control btn btn-primary" >Proses</button>
         </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>Jenis Produk</th>
                    <th>Nama Produk</th>
                    <th>Lintas Sektor</th>
                    <th>Fasilitator</th>
                 
                    <th>Progres</th>
                    <th>Status</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?><br>
                  <?=$b->telp?> 
                  </td>
                    
              

                  <td>
                     <?=$b->jenis_produk?>
                    </td>
                    <td>
                    <?=$b->nama_produk?>
                   </td>
                    <td>
                    <?=$b->linsek?>
                   </td>
                   <td>
                    <?=$b->nama_lengkap?>
                   </td>
                   
                   </td>
                   
                   <td class="project_progress">
                          <div class="progress progress-sm">
                              <div class="progress-bar bg-green" role="progressbar" aria-valuenow="47" aria-valuemin="0" aria-valuemax="100" style="width:  <?=round(($b->hitung/7)*100)?>%">
                              </div>
                          </div>
                          <small>
                       
                          <?=round(($b->hitung/7)*100)?>%
                          <br>
                          <br>
                          
                          </small>
                          
                      </td>
                      <td class="project-state">
                      Sertifikasi CPPOB
                      <?php  
                     if ($b->hitung == 0 ){echo '<span class="badge badge-danger">' ."Belum Ada Progres". '</span>';;}
                     else if ($b->hitung < 5 ){echo '<span class="badge badge-warning">' ."On Proses". '</span>';;}
                     else if ($b->hitung >= 5 ){echo '<span class="badge badge-success">' ."Telah Selesai". '</span>';;}
                     else {echo '<span class="badge badge-success">' ."Selesai". '</span>';;}
                    ?>
                    <br>
                    <br>

                      Nomor Izin Edar <br>
                      <?php  
                     if ($b->hitung == 0 ){echo '<span class="badge badge-danger">' ."Belum Ada Progres". '</span>';;}
                     else if ($b->hitung < 7 ){echo '<span class="badge badge-warning">' ."On Proses". '</span>';;}
                     else if ($b->hitung == 7 ){echo '<span class="badge badge-success">' ."Telah Terbit". '</span>';;}
                     else {echo '<span class="badge badge-success">' ."Selesai". '</span>';;}
                    ?>
                         
                      </td>
                      
                    <td class="text-center py-0 align-middle">
                      <div class="btn-group btn-group-sm">
                     
                     
                        <a onclick="return confirm('Anda Yakin..?')" href="<?=base_URL()?>sistem/proses/del/<?php echo encrypt_url ($b->id_proses)?>" class="btn btn-danger"><i class="fas fa-trash"></i></a>
                      </div>
                    </td>
                 
                </tr>
                  
                  <?php 
			$no++;
			}
		}
		?> 
    
                  </tbody>
                 
                </table>
              </div>
              <!-- /.card-body -->
            </div>
            <!-- /.card -->
          </div>
          <!-- /.col -->
        </div>
        <!-- /.row -->
      </div>
      <!-- /.container-fluid -->
    </section>
  </body>
    	
  <?php } ?> <!-- Acton Admin-->
    <?php if ($this->session->userdata('admin_level') == "User"){ ?>
      <h1>Page Not Found</h1>
    <p>Sorry, but the page you requested has not been found</p>
      <?php } ?> <!-- Acton Admin-->