<?php

include_once '../config/database.php';
include_once '../template/lang.php';
include_once 'auth.php';

$result = mysqli_query(
    $conn,
    "SELECT * FROM participants
     WHERE payment_status='verified'
     ORDER BY bib_number ASC"
);

?>

<!-- HEADER -->
<div class="page-header">

    <h1 class="page-title">
        <?php echo tr(
            'Verified Participants',
            'Peserta Terverifikasi'
        ); ?>
    </h1>

    <a href="export_verified.php"
       class="admin-btn admin-btn--primary">

        <svg viewBox="0 0 24 24" width="16" height="16"
             fill="none" stroke="currentColor"
             stroke-width="2" stroke-linecap="round"
             stroke-linejoin="round">
            <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
            <polyline points="7 10 12 15 17 10"/>
            <line x1="12" y1="15" x2="12" y2="3"/>
        </svg>

        Export Excel

    </a>

</div>

<!-- TABLE -->
<div class="admin-table-wrap">

    <table class="admin-table">

        <thead>

            <tr>

                <th>BIB</th>
                <th>Name</th>
                <th>Gender</th>
                <th>Blood</th>
                <th>Distance</th>
                <th>Category</th>
                <th>WhatsApp</th>
                <th>Email</th>

            </tr>

        </thead>

        <tbody>

            <?php while($row = mysqli_fetch_assoc($result)){ ?>

            <tr>

                <td data-label="BIB">
                    <?php echo $row['bib_number']; ?>
                </td>

                <td data-label="Name">
                    <?php echo $row['full_name']; ?>
                </td>

                <td data-label="Gender">
                    <?php echo $row['gender']; ?>
                </td>

                <td data-label="Blood">
                    <?php echo $row['blood_type']; ?>
                </td>

                <td data-label="Distance">
                    <?php echo $row['distance_category']; ?>
                </td>

                <td data-label="Category">
                    <?php echo $row['participant_category']; ?>
                </td>

                <td data-label="WhatsApp">
                    <?php echo $row['whatsapp']; ?>
                </td>

                <td data-label="Email">
                    <?php echo $row['email']; ?>
                </td>

            </tr>

            <?php } ?>

        </tbody>

    </table>

</div>
