<?php 
session_start();
include('constant/connect.php');
?>

<?php include('./constant/layout/head.php');?>
<?php include('./constant/layout/header.php');?>
<?php include('./constant/layout/sidebar.php');?>  

<div class="page-wrapper">

<div class="row page-titles">
    <div class="col-md-5">
        <h3 class="text-primary">Manage Doctors</h3>
    </div>
</div>

<div class="container-fluid">

<div class="card shadow-lg border-0">
<div class="card-body">

<div class="d-flex justify-content-between align-items-center mb-4">
    <h4 class="fw-bold text-dark">Doctor List</h4>

    <a href="add_doctor.php" class="btn btn-primary">
        + Add Doctor
    </a>
</div>

<div class="table-responsive">

<table class="table align-middle table-hover">

<thead style="background:#111827; color:white;">
<tr>
    <th>#</th>
    <th>Image</th>
    <th>Name</th>
    <th>Department</th>
    <th>Action</th>
</tr>
</thead>

<tbody>

<?php
$res = $connect->query("SELECT * FROM doctors");

$i=1;
while($row = $res->fetch_assoc()){
?>

<tr>
<td class="fw-semibold"><?= $i++ ?></td>

<td>
<img src="assets/uploadImage/<?= $row['image'] ?>" 
     style="width:60px; height:60px; object-fit:cover; border-radius:50%;">
</td>

<td class="fw-bold text-dark">
    <?= $row['name'] ?>
</td>

<td style="color:#4b5563;">
    <?= $row['department'] ?>
</td>

<td>
<a href="delete_doctor.php?id=<?= $row['id'] ?>" 
   onclick="return confirm('Delete this doctor?')" 
   class="btn btn-danger btn-sm">
   🗑 Delete
</a>
</td>
</tr>

<?php } ?>

</tbody>
</table>

</div>

</div>
</div>
</div>
<style>
    .table-hover tbody tr:hover{
    background:#f9fafb;
    transition:0.3s;
}

.table td, .table th{
    vertical-align:middle;
    font-size:14px;
}

.card{
    border-radius:12px;
}

.btn{
    border-radius:20px;
    font-weight:500;
}

h4{
    letter-spacing:0.5px;
}
</style>

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