<?php include('includes/header.php'); ?>

<div class="row">
    <div class="col-md-12">
        <div class="card">
            <div class="card-header">
                <h4>
                    Projects Lists
                    <!-- <a href="projects-create.php" class="btn btn-primary float-end">Add Project</a> -->
                </h4>
            </div>
            <div class="card-body">
                <?= alertMessage(); ?>
                <table class="table table-bordered table-striped">
                    <thead>
                        <tr class="align-middle text-center">
                            <th>S.No.</th>
                            <th>Client Name</th>
                            <th>Project Name</th>
                            <th>Milestone Action</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php
                        $no = 1;
                        $projects = linkALL('projects');
                        if (mysqli_num_rows($projects) > 0) {
                            foreach ($projects as $projectItem) {
                                ?>
                                <tr class="align-middle text-center text-sm">
                                    <td><?= $no; ?></td>
                                    <td><?= $projectItem['clientName']; ?></td>
                                    <td><?= $projectItem['projectName']; ?></td>
                                    <td>
                                        <a href="milestones-view.php?projectID=<?= $projectItem['projectID']; ?>" class="btn btn-success btn-sm">View</a>
                                    </td>
                                </tr>

                                <?php
                                $no++;
                            }

                        } else {
                            ?>
                        <tr>
                            <td colspan="7">No record Found</td>
                        </tr>

                        <?php
                        }
                        ?>

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



<?php include('includes/footer.php'); ?>