<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4">
    <div
        class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
        <h2 class="text-center mt-4 mb-3">Parents</h2>
        <a href="/administrator/parent/create" class="btn btn-primary">Add New Parent</a>
    </div>
    <table class="table table-striped mt-3">
        <thead>
            <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Email</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tbody>
            <?php if (!empty($parents)): ?>
            <?php foreach ($parents as $parent): ?>
            <tr>
                <td><?php echo $parent['id']; ?></td>
                <td><?php echo $parent['firstname'] . ' ' . $parent['lastname']; ?></td>
                <td><?php echo $parent['email']; ?></td>
                <td>
                    <a href="/administrator/parent/edit/<?php echo $parent['id']; ?>" class="btn btn-warning">Edit</a>
                    <a href="/administrator/parent/delete/<?php echo $parent['id']; ?>" class="btn btn-danger"
                        onclick="return confirm('Are you sure you want to delete this parent?');">Delete</a>
                </td>
            </tr>
            <?php endforeach; ?>
            <?php else: ?>
            <tr>
                <td colspan="4">No parents found.</td>
            </tr>
            <?php endif; ?>
        </tbody>
    </table>
</main>