<?php 
    session_start();
    include 'header.php'; 
    $kdc=$_SESSION['kdc'];
    echo $_SESSION['lokasi_gambar']; ;
    $kdkanca = mysqli_query($koneksi,"select * from kdkanca where kd='$kdc'");
    $k = mysqli_fetch_assoc($kdkanca);
?>

<div class="container">

 <div class="my-4 border-bottom">
   <h2 class="fw-semibold fs-3"></h2>
 </div>

  <div class="row justify-content-center">
    <div class="col-lg-12">
       <?php 
        if(isset($_GET['alert'])){
          if($_GET['alert'] == "berhasil"){
            ?>
            <div class="alert alert-success">
              Identitas Dan Alamat Koperasi, telah diupdate!
            </div>
            <?php
          }
        }
        ?>
       <div class="card">
    <div class="card-header d-flex justify-content-between">
      <span class="card-title fw-semibold align-self-start mb">Data Masjid Pengguna Aplikasi</span>
      <button type="button" class="btn btn-primary btn-sm align-self-end" data-bs-toggle="modal" data-bs-target="#exampleModal">
        <i class="bi bi-subtract"></i> Ganti/Edit
        <a href="javascript:history.go(-1)" class="btn btn-info btn-sm"><i class="bi bi-reply-all"></i> &nbsp Kembali</a>
      </button>
    </div>
    <div class="card-body">


      <!-- Modal -->
      <form action="00_ganti_nama_kop_act.php" method="post">
        <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <h1 class="modal-title fs-5" id="exampleModalLabel">Ganti / Edit</h1>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
              </div>
              <div class="modal-body">
<div style="background-color: <?php echo$_SESSION['warna_bag']; ?>; padding: 15px; border-radius: 15px; box-shadow: 0 0 15px <?php echo$_SESSION['warna_bag']; ?>;">                  
        	<div class="form-group">
                <label class="form-label">Nama Masjid</label>
                <input type="text" name="nama_kop" required="required" class="form-control" placeholder="..." value="<?php echo $k['kanca']; ?>" style="width:100%">
        	</div>                    
        	<div class="form-group">
                <label class="form-label">Nama Singkat (Misal : Masjid Candi) </label>
                <input type="text" name="nama_singkat" required="required" class="form-control" placeholder="..." value="<?php echo $k['nama_singkat']; ?>" style="width:100%">
        	</div> 
        	<div class="form-group">
                <label class="form-label">Alamat (Dk, JL, RT / RW) </label>
                <input type="text" name="alamat_kop" required="required" class="form-control" placeholder="..." value="<?php echo $k['alamat']; ?>" style="width:100%">
        	</div>           
        	<div class="form-group">
                <label class="form-label">Kelurahan </label>
                <input type="text" name="kelurahan_kop" required="required" class="form-control" placeholder="..." value="<?php echo $k['kelurahan']; ?>" style="width:100%">
        	</div>         	
        	<div class="form-group">
                <label class="form-label">Kecamatan </label>
                <input type="text" name="kecamatan_kop" required="required" class="form-control" placeholder="..." value="<?php echo $k['kecamatan']; ?>" style="width:100%">
        	</div> 
        	<div class="form-group">
                <label class="form-label">Kota/Kabupaten </label>
                <input type="text" name="kota_kop" required="required" class="form-control" placeholder="..." value="<?php echo $k['kota']; ?>" style="width:100%">
        	</div> 
<!--        	
        	<div class="form-group">
                <label class="form-label">Nomor Badan Hukum </label>
                <input type="text" name="no_bh" required="required" class="form-control" placeholder="..." value="<?php echo $k['no_bh']; ?>" style="width:100%">
        	</div> 
        	<div class="form-group">
                <label class="form-label">Nomor Induk Koperasi (NIK) </label>
                <input type="text" name="no_nik" required="required" class="form-control" placeholder="..." value="<?php echo $k['no_nik']; ?>" style="width:100%">
        	</div>      
        	<div class="form-group">
                <label class="form-label">Nomor Ijin Berusaha (NIB) </label>
                <input type="text" name="no_nib" required="required" class="form-control" placeholder="..." value="<?php echo $k['no_nib']; ?>" style="width:100%">
        	</div>  
        	<div class="form-group">
                <label class="form-label">Nomor Wajib Pajak (NPWP) </label>
                <input type="text" name="npwp" required="required" class="form-control" placeholder="..." value="<?php echo $k['npwp']; ?>" style="width:100%">
        	</div>          	
        	<div class="form-group">
                <label class="form-label">Ketentuan Simpanan Pokok </label>
                <input type="text" name="simp_pkk" required="required" class="form-control" placeholder="..." value="<?php echo $k['sp']; ?>" style="width:100%">
        	</div>  
        	<div class="form-group">
                <label class="form-label">Ketentuan Simpanan Wajib </label>
                <input type="text" name="simp_wjb" required="required" class="form-control" placeholder="..." value="<?php echo $k['sw']; ?>" style="width:100%">
        	</div>    
-->        	
        	</div>  
              <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Tutup</button>
                <button type="submit" class="btn btn-primary">Simpan</button>
              </div>
            </div>
          </div>
        </div>
</div>        
      </form>
      <div class="table-responsive">
        <table class="table table-bordered table-striped" id="table-datatable1">
          <thead>
            <tr>
              <th width="1%" class="text-center">Kd</th>    
              <th width="20%" class="text-center">Nama</th>
              <th width="10%" class="text-center">Alamat</th>
              <th width="1%" class="text-center">Kelurahan</th>
              <th width="1%" class="text-center">Kecamatan</th>
              <th width="1%" class="text-center">Kab/Kota</th>
            </tr>
          </thead>
          <tbody>
            <?php 
            $no=1;
            $data = mysqli_query($koneksi,"SELECT * FROM kdkanca ORDER BY id ASC");
            while($d = mysqli_fetch_array($data)){
                         
              ?>
              <tr>
                <td><?php echo $d['kd']; ?></td>
                <td><?php echo $d['kanca']; ?> - <?php echo $d['nama_singkat']; ?></td>
                <td><?php echo $d['alamat']; ?></td>
                <td><?php echo $d['kelurahan']; ?></td>
                <td><?php echo $d['kecamatan']; ?></td>
                <td><?php echo $d['kota']; ?></td>
                      <center>
                        <?php if($d['gambar'] == ""){ ?>
                          <img src="../gambar/user.png" style="width: 90px;height: auto">  
                        <?php }else{ ?>
                            <a href="00_foto_kop.php?id=<?php echo $d['gambar'] ?>&id=<?php echo $k['kd'] ?>" data-placement='top' title='Ganti Gambar KOP SURAT <?php echo $k['kd'] ?>' >								    
                               <img width="80" height="80" 
                            src="../gambar/<?php echo $d['gambar'] ?>" style="width: 500px;height: auto">
                            </a>             
                        <?php } ?>
                      </center>      
              </tr>
              <?php 
            }
            ?>                      
          </tbody>
        </table>
      </div>
    </div>
    
  </div>
    </div>
  </div>
</div>
<?php include 'footer.php'; ?>