<?php 
    include 'header.php'; 
    $kdc=$_SESSION['kdc'];
    $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-8">
       <?php 
        if(isset($_GET['alert'])){
          if($_GET['alert'] == "berhasil"){
            ?>
            <div class="alert alert-success">
              Pilihan Warna Background, 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 Warna Background</span>
      <button type="button" class="btn btn-primary btn-sm align-self-end" data-bs-toggle="modal" data-bs-target="#exampleModal">
        <a href="index.php" class="btn btn-primary btn-sm"><i class="bi bi-reply-all"></i> &nbsp Kembali</a>
      </button>
    </div>
    <div class="card-body">



      <div class="table-responsive">
<table class="table table-bordered table-striped" id="table-datatable">
    <thead>
        <tr>
            <th width="5%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">No</th>
            <th width="10%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Kode</th>
            <th width="25%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Nama</th>
            <th width="20%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Kode RGB</th>
            <th width="25%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Tampilan Warna</th>
            <th width="5%" class="text-center" style="text-align:left; font-size: 10pt; font-weight:normal;">Pilih</th>
        </tr>
    </thead>
    <tbody>
        <?php
        $no = 1;
        $id_warna_defauld=47 ;
        $war = mysqli_query($koneksi, "SELECT * FROM kdwarna ORDER BY id ASC ");
        while ($w = mysqli_fetch_array($war)) {
        ?>
            <tr>
                <td><?php echo $no++; ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $w['warna'] ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $w['nama'] ?></td>
                <td style="text-align:left; font-size: 10pt; font-weight:normal;"><?php echo $w['rgb'] ?></td>
                <td style="background-color: <?php echo $w['warna']; ?>; width: 50px; height: 20px;"></td>
                <td>
                  <a data-toggle='tooltip' data-placement='top' title='Mengganti warna baground aplikasi menjadi warna : <?php echo $w['warna'] ?>' class="btn btn-primary btn-sm" href="00_ganti_warna_background.php?id=<?php echo $w['id'] ?>&warna=<?php echo $w['warna'] ?>&kdc=<?php echo $kdc ?>"><i class="bi bi-arrow-left-right"></i></a>                                    
                </td>
            </tr>
        <?php } ?>    
    </tbody>
    <div>
      <buton>
        <a href="00_foto_kop.php" class="btn btn-success btn-sm"><i class="bi bi-emoji-smile"></i> &nbsp Lihat Contoh</a> 
        <a href="00_ganti_warna_background.php?id=<?php echo $id_warna_defauld ?>&warna=<?php echo $w['warna'] ?>&kdc=<?php echo $kdc ?>" class="btn btn-dark btn-sm"><i class="bi bi-reply-all"></i> &nbsp Kembalikan ke warna Defauld</a> 
      </buton>
    </div>  
</table>
      </div>
    </div>

  </div>
</div>
<?php include 'footer.php'; ?>