<main id="main" class="main">
   <div class="pagetitle">
      <h1>Atur Situs</h1>
      <nav>
         <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="index.php">Home</a></li>
            <li class="breadcrumb-item">Atur Situs</li>
         </ol>
      </nav>
   </div>
   <!-- End Page Title -->
   <section class="section dashboard">
      <div class="card recent-sales overflow-auto">
         <div class="filter">
            <!-- Modal Dialog Scrollable -->
         </div>
         <div class="card-body">
            <h5 class="card-title">Atur Situs</h5>
            <?php
            if (isset($_GET['notif'])) {
               if ($_GET['notif'] == "berhasil_tambah_data") {
                  echo '
                       <div class="alert alert-success" role="alert">
                           Berhasil menambahkan data.
                       </div>
                   ';
               } else if ($_GET['notif'] == "berhasil_ubah_data") {
                  echo '
                       <div class="alert alert-success" role="alert">
                           Berhasil mengubah data.
                       </div>
                   ';
               } else if ($_GET['notif'] == "berhasil_hapus_data") {
                  echo '
                       <div class="alert alert-success" role="alert">
                           Berhasil menghapus data.
                       </div>
                   ';
               }
            }
            ?>
            <?php
            include "koneksi.php";

            // Ambil data dari database
            $qry_hadiah = mysqli_query($koneksi, "SELECT * FROM atur_situs WHERE id='1'") or die("Query Error: " . mysqli_error($koneksi));
            $dt_bank = mysqli_fetch_array($qry_hadiah);

            $nama_situs = $dt_bank['nama_situs'] ?? '';
            $title_situs = $dt_bank['title_situs'] ?? '';
            $meta_deskripsi = $dt_bank['meta_deskripsi'] ?? '';
            $logo = $dt_bank['logo'] ?? '';
            $favicon = $dt_bank['favicon'] ?? '';
            $background_situs = $dt_bank['background_situs'] ?? '';
            $slider_banner = $dt_bank['slider_banner'] ?? '';
            $link_daftar = $dt_bank['link_daftar'] ?? '';
            $link_login = $dt_bank['link_login'] ?? '';
            $link_klaim = $dt_bank['link_klaim'] ?? '';
            $link_apk = $dt_bank['link_apk'] ?? '';
            $link_telegram = $dt_bank['link_telegram'] ?? '';
            $link_whatsapp = $dt_bank['link_whatsapp'] ?? '';
            $link_livechat = $dt_bank['link_livechat'] ?? '';
            $link_rtp = $dt_bank['link_rtp'] ?? '';
            $link_buktijp = $dt_bank['link_buktijp'] ?? '';
            $link_promosi = $dt_bank['link_promosi'] ?? '';
            $link_keluhan = $dt_bank['link_keluhan'] ?? '';
            $theme_color = $dt_bank['theme_color'] ?? '';
            ?>

            <form action="prs_ubah_web.php" method="post" enctype="multipart/form-data">
               <!-- Nama Situs -->
               <div class="form-group row mb-3">
                  <label for="nama_situs" class="col-4 col-form-label">Nama Situs</label>
                  <div class="col-8">
                     <input id="nama_situs" name="nama_situs" value="<?php echo $nama_situs; ?>" type="text"
                        class="form-control">
                  </div>
               </div>
               <!-- Title Situs -->
               <div class="form-group row mb-3">
                  <label for="title_situs" class="col-4 col-form-label">Title Situs</label>
                  <div class="col-8">
                     <input id="title_situs" name="title_situs" value="<?php echo $title_situs; ?>" type="text"
                        class="form-control">
                  </div>
               </div>
               <!-- Meta Deskripsi -->
               <div class="form-group row mb-3">
                  <label for="meta_deskripsi" class="col-4 col-form-label">Meta Deskripsi</label>
                  <div class="col-8">
                     <textarea id="meta_deskripsi" name="meta_deskripsi" cols="40" rows="5"
                        class="form-control"><?php echo $meta_deskripsi; ?></textarea>
                  </div>
               </div>
               <!-- Logo -->
               <div class="form-group row">
                  <label for="logo" class="col-4 col-form-label">Logo</label>
                  <div class="col-8">
                     <input id="logo" name="logo" type="file" class="form-control">
                     <?php if ($logo): ?>
                        <br>
                        <small>File saat ini: <?php echo $logo; ?></small><br>
                        <img src="../images/<?php echo $logo; ?>" alt="Logo" style="max-width:150px;">
                     <?php endif; ?>
                  </div>
               </div>
               <!-- Favicon -->
               <div class="form-group row">
                  <label for="favicon" class="col-4 col-form-label">Favicon</label>
                  <div class="col-8">
                     <input id="favicon" name="favicon" type="file" class="form-control">
                     <?php if ($favicon): ?>
                        <br>
                        <small>File saat ini: <?php echo $favicon; ?></small><br>
                        <img src="../images/<?php echo $favicon; ?>" alt="Favicon" style="max-width:50px;">
                     <?php endif; ?>
                  </div>
               </div>
               <div class="form-group row mb-3">
                  <label for="link_daftar" class="col-4 col-form-label">Link Daftar</label>
                  <div class="col-8">
                     <input id="link_daftar" name="link_daftar" type="url" class="form-control"
                        value="<?php echo $link_daftar; ?>">
                  </div>
               </div>
               <!-- Link Login -->
               <div class="form-group row mb-3">
                  <label for="link_login" class="col-4 col-form-label">Link Login</label>
                  <div class="col-8">
                     <input id="link_login" name="link_login" type="url" class="form-control"
                        value="<?php echo $link_login; ?>">
                  </div>
               </div>
               <!-- Link Tambahan -->
               <div class="form-group row mb-3">
                  <label for="link_apk" class="col-4 col-form-label">Link APK</label>
                  <div class="col-8">
                     <input id="link_apk" name="link_apk" type="url" class="form-control"
                        value="<?php echo $link_apk; ?>">
                  </div>
               </div>
               <div class="form-group row mb-3">
                  <label for="link_telegram" class="col-4 col-form-label">Link Telegram</label>
                  <div class="col-8">
                     <input id="link_telegram" name="link_telegram" type="url" class="form-control"
                        value="<?php echo $link_telegram; ?>">
                  </div>
               </div>
               <div class="form-group row mb-3">
                  <label for="link_whatsapp" class="col-4 col-form-label">Link WhatsApp</label>
                  <div class="col-8">
                     <input id="link_whatsapp" name="link_whatsapp" type="url" class="form-control"
                        value="<?php echo $link_whatsapp; ?>">
                  </div>
               </div>
               <div class="form-group row mb-3">
                  <label for="link_livechat" class="col-4 col-form-label">Link Live Chat</label>
                  <div class="col-8">
                     <input id="link_livechat" name="link_livechat" type="url" class="form-control"
                        value="<?php echo $link_livechat; ?>">
                  </div>
               </div>
               <div class="form-group row mb-3">
                  <label for="link_rtp" class="col-4 col-form-label">Link RTP</label>
                  <div class="col-8">
                     <input id="link_rtp" name="link_rtp" type="url" class="form-control"
                        value="<?php echo $link_rtp; ?>">
                  </div>
               </div>
               <div class="form-group row mb-3">
                  <label for="link_buktijp" class="col-4 col-form-label">Link Bukti JP</label>
                  <div class="col-8">
                     <input id="link_buktijp" name="link_buktijp" type="url" class="form-control"
                        value="<?php echo $link_buktijp; ?>">
                  </div>
               </div>
               <div class="form-group row mb-3">
                  <label for="link_promosi" class="col-4 col-form-label">Link Promosi</label>
                  <div class="col-8">
                     <input id="link_promosi" name="link_promosi" type="url" class="form-control"
                        value="<?php echo $link_promosi; ?>">
                  </div>
               </div>
               <div class="form-group row mb-3">
                  <label for="link_keluhan" class="col-4 col-form-label">Link Keluhan</label>
                  <div class="col-8">
                     <input id="link_keluhan" name="link_keluhan" type="url" class="form-control"
                        value="<?php echo $link_keluhan; ?>">
                  </div>
               </div>
               <!-- Link Klaim -->
               <div class="form-group row mb-3">
                  <div class="offset-4 col-8">
                     <button name="submit" type="submit" class="btn btn-primary">Submit</button>
                  </div>
               </div>
            </form>

         </div>
      </div>
   </section>
</main>
<!-- End #main -->