38458-vm/includes/sidebar.php
2026-02-15 19:49:48 +00:00

61 lines
2.7 KiB
PHP

<?php
$activeElectionId = get_active_election_id();
$allElections = get_all_elections();
$currentElection = get_active_election();
$currentPage = basename($_SERVER['PHP_SELF']);
?>
<aside class="sidebar">
<div class="sidebar-header">
<div class="sidebar-brand">CLICK TO VOTE</div>
<div class="sidebar-subtitle">Administrator Portal</div>
</div>
<div class="election-selector-container" style="padding: 0 20px; margin-bottom: 20px;">
<label style="font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; margin-bottom: 8px; display: block;">ACTIVE ELECTION</label>
<select onchange="window.location.href='?set_election_id=' + this.value" style="width: 100%; padding: 8px; border-radius: 6px; border: 1px solid #e2e8f0; background: #f8fafc; font-size: 12px; font-weight: 500; color: #1e293b; cursor: pointer;">
<?php foreach ($allElections as $e): ?>
<option value="<?= $e['id'] ?>" <?= $activeElectionId === $e['id'] ? 'selected' : '' ?>>
<?= htmlspecialchars($e['title']) ?>
</option>
<?php endforeach; ?>
<?php if (empty($allElections)): ?>
<option disabled>No elections found</option>
<?php endif; ?>
</select>
</div>
<nav class="sidebar-nav">
<a href="dashboard.php" class="nav-item <?= $currentPage === 'dashboard.php' ? 'active' : '' ?>">
<i data-lucide="layout-dashboard"></i>
Election Dashboard
</a>
<a href="election_history.php" class="nav-item <?= $currentPage === 'election_history.php' ? 'active' : '' ?>">
<i data-lucide="history"></i>
Election History
</a>
<a href="voter_management.php" class="nav-item <?= $currentPage === 'voter_management.php' ? 'active' : '' ?>">
<i data-lucide="users"></i>
Voter Management
</a>
<a href="candidate_management.php" class="nav-item <?= $currentPage === 'candidate_management.php' ? 'active' : '' ?>">
<i data-lucide="user-square-2"></i>
Candidate Management
</a>
<a href="officers_management.php" class="nav-item <?= $currentPage === 'officers_management.php' ? 'active' : '' ?>">
<i data-lucide="shield-check"></i>
Officers Management
</a>
<a href="reports_audit.php" class="nav-item <?= $currentPage === 'reports_audit.php' ? 'active' : '' ?>">
<i data-lucide="file-text"></i>
Reports & Audit
</a>
</nav>
<div class="sidebar-footer">
<a href="logout.php" class="nav-item" style="color: #ef4444;">
<i data-lucide="log-out"></i>
Logout
</a>
</div>
</aside>