<div class="row">
        <div class="col-md-12">
                <div class="card border border-danger">
                    <form method="POST" action="config/uploadturnamen.php" enctype="multipart/form-data" class="form-horizontal">
                        <div class="card-body">
                            <h4 class="card-title"><i class="mdi mdi-upload"></i> Upload Data Turnamen</h4>
                            <div class="form-group row">
                                <div class="col-sm-12">
                                <p>* File yang harus di Upload tidak boleh selain dari Dokumen EXCEL.</p>
                                <ol>
                                    <li>Kolom A (Pertama): Di isi username member.</li>
                                    <li>Kolom B (Kedua): Di isi Turnover member [Cukup isi angka saja].</li>
                                    <li>Kolom C (Ketiga): Di isi Permainan yang akan ditampilkan di depan web.</li>
                                    <li>Kolom D (Keempat): Di isi Hadiah Pemenang [Cukup isi angka saja].</li>
                                </ol>
                                <p class="font-weight-bold text-danger">* Nama User dan Nama Game harus huruf kecil agar lebih optimal.</p>
                                    <img src="assets/images/info-turnamen.png" width="300" class="rounded img-fluid" />
                                    <hr />
                                </div>

                                <label class="col-sm-3 mt-4 text-right control-label col-form-label">Upload Turnamen:</label>
                                <div class="col-sm-9 mt-4">
                                        <input type="file" name="turnamen" class="form-control">  
                                </div>

                            </div>
                            
                            <div class="card-body my-3">
                                <button type="submit" name="upload" class="btn float-right btn-primary"><i class="mdi mdi-upload"></i> Upload Turnamen</button>
                            </div>
                    </form>
                </div>
        </div>

        <div class="col-xl-12">
        <div class="card border border-info">
            <form method="POST" action="config/update-turnamentxt.php" class="form-horizontal">
                <div class="card-body">
                        <h4 class="card-title"><i class="fas fa-pencil-alt"></i> Turnamen Text</h4>
                        <small><?php echo $uploadgambar; ?></small>
                        <textarea name="turnamen-text" class="editor"><?php ftab("turnamen_text", "change_text", "turnamen_text"); ?></textarea>

                        <button type="submit" class="btn mt-3 btn-block btn-primary">Submit</button>
                    
                            </div>
                        </form>
                 </div>
         </div>


        <div class="col-xl-12">
        <div class="card border border-info">
        <div class="card-body m-b-0">
            <h5 class="card-title m-b-0"><i class="mdi mdi-minus-circle"></i> Set Mulai & Akhir Turnover</h5>
            <p>Terakhir Ubah : <?php echo ftab("tgl_mulaito", "mulai_to", "tgl_mulaito") ?></p>

            <form action="config/update-jamto.php" method="POST">
                       <input type="text" class="mydatepicker" name="mulaitgl" placeholder="Mulai : <?php echo ftab("mulai_tglto", "mulai_to", "mulai_tglto") ?>" required>
                       <input type="text" class="mydatepicker" name="akhirtgl" placeholder="Akhir : <?php echo ftab("akhir_tglto", "mulai_to", "akhir_tglto") ?>" required> <br>
                       
                   <button type="submit" style="margin-top: 10px;" class="btn btn-primary"><i class="fas fa-check"></i> Submit</button>
            </form>

        </div>
            

        <div class="card-body">
            <div class="d-flex justify-content-between">
            <h5 class="card-title m-b-0"><i class="mdi mdi-trophy-variant"></i> Semua Turnamen</h5>
            <button type="button" onclick="hapusSemuato()" class="btn btn-danger"><i class="fas fa-times"></i> Hapus Semua</button>
            </div>
                            </div>
                            <table id="pesertato" class="table font-weight-bold">
                                  <thead>
                                    <tr>
                                      <th scope="col">#</th>
                                      <th scope="col">Nama User</th>
                                      <th scope="col">Turnover</th>
                                      <th scope="col">Hadiah</th>
                                      <th scope="col">Game</th>
                                      <th scope="col">Update Tanggal</th>
                                      <th scope="col">Action</th>
                                    </tr>
                                  </thead>
                                  <tbody>

                                  <?php
                                    $sturn = "SELECT * FROM peserta_to";
                                    $qturn = mysqli_query($data, $sturn);

                                        if(mysqli_num_rows($qturn) > 0) {
                                            $n = 1;
                                            while($fturn = mysqli_fetch_assoc($qturn)) {
                                                $namato = $fturn['nama_user'];
                                                $touser = $fturn['to_user'];
                                                $hadiah = $fturn['hadiah_user'];
                                                $game = $fturn['game_user'];
                                                $tglturn = $fturn['tanggal_to'];
                                                $idto = $fturn['id'];

                                                echo '<tr>
                                                <th scope="row">'.$n++.'</th>
                                                <form method="POST" action="config/update-to.php?row='.$idto.'">
                                                <td><input class="form-control" type="text" name="namauser" value="'.$namato.'" /></td>
                                                <td><input class="form-control" type="text" name="touser" value="'.$touser.'" /></td>
                                                <td><input class="form-control" type="text" name="hadiahuser" value="'.$hadiah.'" /></td>
                                                <td><input class="form-control" type="text" name="gameuser" value="'.$game.'" /></td>
                                                <td> '.date("d M Y | H:i:s", strtotime($tglturn)).'</td>
                                                <td><button type="submit" class="btn btn-primary"><i class="fas fa-check"></i> Edit</button> <a href="config/delto.php?row='.$idto.'" class="btn btn-danger"><i class="fas fa-times"></i> Hapus</a></td>
                                                </tr>
                                                ';

                                            }

                                        } else {

                                        }

                                    ?>


                                    

                                  </tbody>
                            </table>
         </div>
         </div>
<div></div>


         
</div>

<?php
        if(!isset($_SESSION['nama_pengguna'])) {
        echo '<script>
        window.location.replace("/");
        </script>';
        }
    ?>