<?php

include "../../config/master.php";
allowRoles([1]);

include "../layout/header.php";
include "../layout/sidebar.php";


$query = mysqli_query($conn,"
SELECT 
v.id,
v.village_name,
d.district_name,
b.block_name,
v.pincode
FROM villages v
LEFT JOIN districts d ON v.district_id=d.id
LEFT JOIN blocks b ON v.block_id=b.id
WHERE v.status=0
ORDER BY v.village_name
");

?>

<div class="main">

<h2>Inactive Villages</h2>

<table border="1" width="100%" cellpadding="8">

<tr style="background:#eee">

<th>ID</th>
<th>Village</th>
<th>District</th>
<th>Block</th>
<th>Pincode</th>
<th>Action</th>

</tr>

<?php while($row=mysqli_fetch_assoc($query)){ ?>

<tr>

<td><?php echo $row['id']; ?></td>
<td><?php echo $row['village_name']; ?></td>
<td><?php echo $row['district_name']; ?></td>
<td><?php echo $row['block_name']; ?></td>
<td><?php echo $row['pincode']; ?></td>

<td>

<a href="reactivate_village.php?id=<?php echo $row['id']; ?>"
onclick="return confirm('Reactivate this village?')">

Reactivate

</a>

</td>

</tr>

<?php } ?>

</table>

</div>

<?php include "../layout/footer.php"; ?>