<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
    <title>Halaman User</title>
</head>
<?php
ob_start();
session_start();

if ($_SESSION['nama_peserta'] == "") {
    header("location:../loginpageuser.php?pesan=gagal");
}
$koneksi = mysqli_connect("localhost", "root", "", "membership");
$cekdata = mysqli_query($koneksi, "SELECT * FROM peserta WHERE nama_peserta='$_SESSION[nama_peserta]'");
$data = mysqli_fetch_array($cekdata);
$cektingkatan = mysqli_query($koneksi, "SELECT * FROM latihan WHERE tingkatan = '$data[tingkatan]'");
$tingkatan = mysqli_fetch_array($cektingkatan);
$ceknama = mysqli_query($koneksi, "SELECT * FROM raport WHERE nama_peserta = '$data[nama_peserta]'");
$nilai = mysqli_fetch_array($ceknama);
?>

<style>
    body {
        background-image: url("../img/Logo.svg");
        background-repeat: no-repeat;
        background-color: #EBEBEB;
    }
</style>

<body>
    <div class="container mt-2">
        <h4 class="mb-3">Halaman Orang Tua</h4>
        <ul class="nav nav-tabs">
            <li class="nav-item">
                <a class="nav-link active" data-bs-toggle="tab" href="#beranda"> Beranda </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-bs-toggle="tab" href="#data"> Data Diri</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-bs-toggle="tab" href="#latihan"> Latihan </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-bs-toggle="tab" href="#lomba"> Lomba </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-bs-toggle="tab" href="#raport"> Raport </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" data-bs-toggle="tab" href="#prestasi"> Prestasi </a>
            </li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane active" id="beranda">
                <div class="col p-4">
                    <h3>Beranda</h3>
                    <p>
                    <p>Halo, Anda telah login sebagai orang tua dari<b>
                            <?php echo $_SESSION['nama_peserta']; ?>
                        </b>.</p>
                        <a class="btn btn-danger" href="../logoutuser.php" role="button">LOGOUT</a>
                    <br />
                    </p>
                </div>
            </div>
            <div class="tab-pane" id="data">
                <div class="col p-4">
                    <h3>Data Diri</h3>
                    <p>

                    <table class="table table-bordered table-sm w-50 bg-white text-dark" style="text-align:left">
                        <tbody style="border-color:black; border-width:3px;">
                            <tr>
                                <td class ="w-50">Nama Peserta</td>
                                <td>
                                    <b>
                                        <?= $data['nama_peserta'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>NIS</td>
                                <td>
                                    <b>
                                        <?= $data['nis'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Anak Ke</td>
                                <td>
                                    <b>
                                        <?= $data['anakke'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Jumlah Saudara Kandung</td>
                                <td>
                                    <b>
                                        <?= $data['jmlhsdr'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Jenjang</td>
                                <td>
                                    <b>
                                        <?= $data['jenjang'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Jenis Kelamin</td>
                                <td>
                                    <b>
                                        <?= $data['jenis_kelamin'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Agama</td>
                                <td>
                                    <b>
                                        <?= $data['agama'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Tanggal Lahir</td>
                                <td>
                                    <b>
                                        <?= $data['tgl_lahir'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Tempat Lahir</td>
                                <td>
                                    <b>
                                        <?= $data['tmpt_lahir'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Nomor HP Peserta</td>
                                <td>
                                    <b>
                                        <?= $data['nomorpeserta'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Nomor HP Ortu/wali</td>
                                <td>
                                    <b>
                                        <?= $data['nomorortu'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Alamat</td>
                                <td>
                                    <b>
                                        <?= $data['alamat'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Tingkatan</td>
                                <td>
                                    <b>
                                        <?= $data['tingkatan'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Asal Sekolah/Instansi</td>
                                <td>
                                    <b>
                                        <?= $data['asalsekolah'] ?>
                                    </b>
                                </td>
                            </tr>
                            <tr>
                                <td>Nomor Virtual Account</td>
                                <td>
                                    <b>
                                        <h5 class="fw-bold">
                                            <img src="../img/logobni.svg" width="25%">
                                            <?= $data['virtualacc'] ?>
                                        </h5>
                                    </b>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <h6>
                        <p class="text-danger">*PEMBAYARAN PERTAMA DAPAT DILAKUKAN <b>H+2 HARI KERJA GUNA PENGAKTIFAN
                                NOMOR VA </b><br>
                            *PEMBAYARAN SELANJUTNYA MOHON DAPAT DILAKUKAN <b>SAAT HARI KERJA</b></p>
                    </h6>
                    </p>
                </div>
            </div>
            <div class="tab-pane" id="latihan">
                <div class="col p-4">
                    <h2>Jadwal Latihan</h2>
                    <h6> Tingkatan : <b>
                            <?= $data['tingkatan'] ?>
                        </b> <br></h6>
                    <p>
                    <table class="table table-bordered table-sm w-25 bg-white text-dark" style="text-align:center">
                        <thead style="border-color:black; border-width:3px;">
                            <tr>
                                <th class="w-25">Latihan</th>
                                <th class="w-25">Hari</th>
                                <th class="w-25">Waktu</th>
                            </tr>
                        </thead>
                        <tbody style="border-color:black; border-width:3px;">
                            <tr>
                                <td>Latihan 1</td>
                                <td>
                                    <?= $tingkatan['harilat1'] ?>
                                </td>
                                <td>
                                    <?= $tingkatan['jamlat1'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td>Latihan 2</td>
                                <td>
                                    <?= $tingkatan['harilat2'] ?>
                                </td>
                                <td>
                                    <?= $tingkatan['jamlat2'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td>Latihan 3</td>
                                <td>
                                    <?= $tingkatan['harilat3'] ?>
                                </td>
                                <td>
                                    <?= $tingkatan['jamlat3'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td>Latihan 4</td>
                                <td>
                                    <?= $tingkatan['harilat4'] ?>
                                </td>
                                <td>
                                    <?= $tingkatan['jamlat4'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td>Latihan 5</td>
                                <td>
                                    <?= $tingkatan['harilat5'] ?>
                                </td>
                                <td>
                                    <?= $tingkatan['jamlat5'] ?>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    </p>

                </div>
            </div>
            <div class="tab-pane" id="lomba">
                <div class="col p-4">
                    <h2>Daftar Lomba</h2>


                    <div class="container"><br>
                        <table class="table bg-white text-dark" style="text-align:center">
                            <thead style="border-color:black; border-width:3px;">
                                <tr>
                                    <th>Nomor</th>
                                    <th>Kode</th>
                                    <th>Nama Lomba</th>
                                    <th>Tanggal Lomba</th>
                                    <th>Lokasi Lomba</th>
                                    <th>Peserta</th>
                                </tr>
                            </thead>
                            <tbody style="border-color:black; border-width:3px;">
                                <?php
                                $servername = "localhost";
                                $username = "root";
                                $password = "";
                                $database = "membership";

                                $connection = new mysqli($servername, $username, $password, $database);

                                if ($connection->connect_error) {
                                    die("Gagal Koneksi" . $connection->connect_error);
                                }

                                $sql = "SELECT * FROM lomba";
                                $result = $connection->query($sql);

                                if (!$result) {
                                    die("Invalid query: " . $connection->error);
                                }

                                while ($row = $result->fetch_assoc()) {
                                    echo "
                        <tr>
                        <td>$row[id]</td>
                        <td>$row[kode]</td>
                        <td>$row[nama_lomba]</td>
                        <td>$row[tanggal_lomba]</td>
                        <td>$row[lokasi_lomba]</td>
                        <td>$row[peserta]</td>
                    </tr>
                        ";
                                }
                                ?>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="tab-pane" id="raport">
                <div class="col p-4">
                    <h2>Hasil Nilai</h2>
                    <p>
                    <h3><b>HARD SKILL</b></h3>

                    <table class="table table-bordered table-sm w-25 bg-white text-dark" style="text-align:center">
                        <thead style="border-color:black; border-width:3px;">
                            <tr>
                                <th class="w-50">INDIKATOR</th>
                                <th class="w-50">NILAI</th>
                            </tr>
                        </thead>
                        <tbody style="border-color:black; border-width:3px;">
                            <tr>
                                <td><b>Dribbling</b></td>
                                <td>
                                    <?= $nilai['dribbling'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Passing</b></td>
                                <td>
                                    <?= $nilai['passing'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Shooting</b></td>
                                <td>
                                    <?= $nilai['shooting'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Rebounding</b></td>
                                <td>
                                    <?= $nilai['rebounding'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Defense</b></td>
                                <td>
                                    <?= $nilai['defense'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Pivot</b></td>
                                <td>
                                    <?= $nilai['pivot'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Blocking</b></td>
                                <td>
                                    <?= $nilai['blocking'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Lay Up</b></td>
                                <td>
                                    <?= $nilai['layup'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Crossover</b></td>
                                <td>
                                    <?= $nilai['crossover'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Triple Threat</b></td>
                                <td>
                                    <?= $nilai['tripleth'] ?>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <h3><b>SOFT SKILL</b></h3>

                    <table class="table table-bordered table-sm w-25 bg-white text-dark" style="text-align:center">
                        <thead style="border-color:black; border-width:3px;">
                            <tr>
                                <th class="w-50">INDIKATOR</th>
                                <th class="w-50">NILAI</th>
                            </tr>
                        </thead>
                        <tbody style="border-color:black; border-width:3px;">
                            <tr>
                                <td><b>Leadership</b></td>
                                <td>
                                    <?= $nilai['leadership'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Kerjasama</b></td>
                                <td>
                                    <?= $nilai['kerjasama'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Kejujuran</b></td>
                                <td>
                                    <?= $nilai['kejujuran'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Disiplin</b></td>
                                <td>
                                    <?= $nilai['disiplin'] ?>
                                </td>
                            </tr>
                            <tr>
                                <td><b>Sportivitas</b></td>
                                <td>
                                    <?= $nilai['sportivitas'] ?>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <b>Catatan :</b>
                    <?= $nilai['catatan'] ?><br>
                    </p>
                </div>
            </div>
            <div class="tab-pane" id="prestasi">
                <div class="col p-4">
                    <h3>Prestasi</h3>
                </div>
            </div>
        </div>
        </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js"
        integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW"
        crossorigin="anonymous"></script>
</body>
</html>