<?php include 'header.php';
include 'admin/config.php';
?>
<!-- breadcrumb -->
<div class="site-breadcrumb" style="background: url(assets/img/home/s0.png)">
    <div class="container">
        <h2 class="breadcrumb-title">Planning</h2>
        <ul class="breadcrumb-menu">
            <li><a href="index.php">Home</a></li>
            <li class="active">Action Plans</li>
        </ul>
    </div>
</div>
<!-- breadcrumb end -->


<!-- course-area -->
<div class="course-area py-80">
    <div class="container">
        <div class=" text-center mt-5 mb-4">
            <h2 class="mb-3">
                Action Plan
            </h2>

        </div>
        <div class="table-responsive">
            <table class="table annual-report text-center table-bordered">
                <thead>

                    <tr class="table-primary ">
                        <th scope="col">Year</th>
                        <th scope="col">District</th>
                        <th scope="col">Description</th>
                        <th scope="col">Constituency</th>
                        <th scope="col">Status </th>
                        <th scope="col">View / Download</th>
                    </tr>
                </thead>
                <tbody class="">
                    <?php
                    $sql = "SELECT * FROM `action_plan` ORDER BY year DESC"; // Order by year (latest first)
                    $query = mysqli_query($con, $sql);
                    if ($query) {
                        while ($row = mysqli_fetch_assoc($query)) {
                            $year = $row['year'];
                            $district = $row['district'];
                            $description = $row['description'];
                            $constituency = $row['constituency'];
                            $status = $row['status'];

                            $pdf = $row['document'];
                            $pdf_path = "admin/image/" . $pdf;
                    ?>
                            <tr>
                                <td ><?php echo $year; ?></td>
                                <td><?php echo $district; ?></td>
                                <td><?php echo $description; ?></td>
                                <td><?php echo $constituency; ?></td>
                                <td><?php echo $status; ?></td>

                                <td> <a href="<?php echo $pdf_path; ?>" target="_blank"><i
                                            class="fa-solid fa-file-arrow-down"></i></a> </td>
                            </tr>
                    <?php
                        }
                    }
                    ?>



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


    </div>
</div>
<!-- course-area -->

<?php include 'footer.php' ?>