<?php

/* Safety check so header works on every page */

$village_name = $village['village_name'] ?? 'Panchayat';
$slug = $slug ?? ($_GET['village'] ?? '');

?>
<!DOCTYPE html>
<html>

<head>

<title><?php echo $village_name; ?> Panchayat</title>

<link rel="stylesheet" href="css/style.css">

<!-- Lightbox Gallery CSS -->
<link href="https://cdn.jsdelivr.net/npm/lightbox2@2.11.4/dist/css/lightbox.min.css" rel="stylesheet">

<meta name="viewport" content="width=device-width, initial-scale=1">

</head>

<body>

<!-- HEADER -->

<header class="header">
<h1><?php echo $village_name; ?> Panchayat</h1>
</header>


<!-- MENU -->

<nav class="menu">

<div class="menu-container">

<!-- LOGO -->

<div class="logo">
<a href="?village=<?php echo $slug ?>">
<?php echo $village_name; ?>
</a>
</div>


<!-- HAMBURGER -->

<div class="hamburger" onclick="toggleMenu()">
<span></span>
<span></span>
<span></span>
</div>


<!-- MENU LINKS -->

<ul class="menu-links" id="mobileMenu">

<li><a href="?village=<?php echo $slug ?>">Home</a></li>

<li><a href="#">Members</a></li>

<li><a href="#">Development</a></li>

<!-- BUILDINGS DROPDOWN -->

<li class="dropdown">

<a href="#">Buildings </a>

<ul class="submenu">

<li>
<a href="buildings.php?type=chaupals&village=<?php echo $slug ?>">
🏛 Chaupals
</a>
</li>

<li>
<a href="buildings.php?type=govt_buildings&village=<?php echo $slug ?>">
🏢 Govt Buildings
</a>
</li>

<li>
<a href="buildings.php?type=anganwadi&village=<?php echo $slug ?>">
👶 Anganwadi
</a>
</li>

<li>
<a href="buildings.php?type=temples&village=<?php echo $slug ?>">
🛕 Temples
</a>
</li>

</ul>

</li>
<!-- DONATIONS DROPDOWN -->

<li class="dropdown">

<a href="#">Donations</a>

<ul class="submenu">

<?php

$donations = mysqli_query($conn,"
SELECT id, work_name
FROM donation_categories
WHERE village_id='$village_id'
AND status='in_progress'
ORDER BY work_name
");

while($d=mysqli_fetch_assoc($donations)){
?>

<li>
<a href="donations.php?work=<?php echo $d['id']; ?>&village=<?php echo $slug ?>">
💰 <?php echo $d['work_name']; ?>
</a>
</li>

<?php } ?>

</ul>

</li>

<li>
<a href="schemes.php?village=<?php echo $slug ?>">Schemes</a>
</li>

<li>
<a href="gallery.php?village=<?php echo $slug ?>">Gallery</a>
</li>

<li><a href="#">Contact</a></li>

</ul>

</div>

</nav>