<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Manage Students</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/css/administrator.css">
</head>
<body>
<div class="content-wrapper">
    <div class="container">
    <?php include('partials/header.php'); ?>
        <h1>Teachers</h1>
        <a href="teacher/create" class="btn btn-primary">Add New Teacher</a>
        <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 foreach ($teachers as $teacher): ?>
                    <tr>
                        <td><?php echo $teacher['id']; ?></td>
                        <td><?php echo $teacher['firstname'] . ' ' . $teacher['lastname']; ?></td>
                        <td><?php echo $teacher['email']; ?></td>
                        <td>
                            <a href="teacher/edit/<?php echo $teacher['id']; ?>" class="btn btn-warning">Edit</a>
                            <a href="teacher/delete/<?php echo $teacher['id']; ?>" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this teacher?');">Delete</a>
                        </td>
                    </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>

