<?php
session_start();
include '../includes/db.php';
include 'header.php';
$team = $conn->query("SELECT * FROM team_members ORDER BY id DESC");
?>
<!DOCTYPE html>
<html>
<head>
<title>Manage Team</title>
<style>
table { width: 90%; margin: auto; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid #ccc; padding: 10px; text-align: center; }
a.button { padding: 8px 15px; background: #0078d7; color:white; border-radius: 6px; text-decoration:none; }
</style>
</head>
<body>

<h2 style="text-align:center;">Team Members</h2>

<div style="text-align:center; margin-bottom:20px;">
    <a href="add_member.php" class="button">Add New Member</a>
</div>

<table>
<tr>
    <th>ID</th>
    <th>Photo</th>
    <th>Name</th>
    <th>Position</th>
    <th>Actions</th>
</tr>

<?php while($row = $team->fetch_assoc()): ?>
<tr>
    <td><?= $row['id'] ?></td>
    <td><img src="../<?= $row['photo'] ?>" width="60"></td>
    <td><?= $row['name'] ?></td>
    <td><?= $row['position'] ?></td>
    <td>
        <a href="edit_member.php?id=<?= $row['id'] ?>" class="button">Edit</a>
        <a href="delete_member.php?id=<?= $row['id'] ?>" class="button" style="background:red;">Delete</a>
    </td>
</tr>
<?php endwhile; ?>
</table>

</body>
</html>
