<?php
    session_start();
    if(!isset($_SESSION["judge_admin"]))
    {
        header("location:./index.php");
    }

    include "../backend/connection.php";
    $configure = new DefaultDatabase();
    $conf = $configure->connect();

    //fetch school detailss
    $details = mysqli_query($conf,"SELECT * FROM adjudicator WHERE username = '".$_SESSION["judge_admin"]."'");
    $det = mysqli_fetch_array($details);

    $materials = mysqli_query($conf,"SELECT * FROM reports WHERE category = '".$det["category"]."'");
    $pupils = mysqli_query($conf,"SELECT * FROM participants WHERE category = '".$det["category"]."'");
    


?>
<div class="school-container">
    <h2>PARTICIPANT REPORTS UPLOAD</h2>

    <table id="schoolsTable">
        <thead>
            <tr>
                <th>Pupils Name</th>
                <th>Category</th>
                <th>Level</th>
                <th>Document</th>
            </tr>
        </thead>
        <tbody>
            <!-- Dummy data -->
            <?php
                while($reports = mysqli_fetch_array($materials))
                {
            ?>
            <tr>
                <td><?php echo $reports["full_name"] ?></td>
                <td><?php echo $reports["category"] ?></td>
                <td><?php echo $reports["section_name"] ?></td>
                <td><a href="<?php echo $reports["location"] ?>" style="text-decoration: none; color:black; text-align:center;"><img src="../images/icon.PNG" width="50"> <br> Read Document</a></td>
            </tr>
            <?php
                }
            ?>
        </tbody>
    </table>
</div>
