v2
This commit is contained in:
@@ -110,26 +110,28 @@
|
||||
</div>
|
||||
|
||||
<!-- Some content -->
|
||||
<div style="margin-top:80px; padding:15px;">
|
||||
<!-- Dashboard Content -->
|
||||
</div>
|
||||
<div style="margin-top:20px; padding:15px;"></div>
|
||||
|
||||
<!-- Bottom Navigation -->
|
||||
<?php if(isset($_SESSION) && !empty($_SESSION['user_id'])){ ?>
|
||||
<div class="agent-bottom-nav">
|
||||
<a href="/Agent/Dashboard" class="agent-bottom-link active">
|
||||
<a href="/Agent/Dashboard" class="agent-bottom-link <?php echo ($current_page == 'Dashboard' || $current_page == 'Agent') ? 'active' : ''; ?>" data-page="Dashboard">
|
||||
<i class="fa-solid fa-house"></i>
|
||||
Home
|
||||
</a>
|
||||
<a href="/Agent/report" class="agent-bottom-link">
|
||||
<a href="/Agent/report" class="agent-bottom-link <?php echo ($current_page == 'report') ? 'active' : ''; ?>" data-page="report">
|
||||
<i class="fa-solid fa-chart-line"></i>
|
||||
Reports
|
||||
</a>
|
||||
<a href="/Agent/Receive" class="agent-bottom-link">
|
||||
<a href="/Agent/Receive" class="agent-bottom-link <?php echo ($current_page == 'Receive') ? 'active' : ''; ?>" data-page="Receive">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
Payment
|
||||
</a>
|
||||
<a href="/Agent/transaction" class="agent-bottom-link">
|
||||
<!-- <a href="/Agent/commission" class="agent-bottom-link">
|
||||
<i class="fa-solid fa-plus"></i>
|
||||
Commission
|
||||
</a> -->
|
||||
<a href="/Agent/transaction" class="agent-bottom-link <?php echo ($current_page == 'transaction') ? 'active' : ''; ?>" data-page="transaction">
|
||||
<i class="fa-solid fa-money-check-dollar"></i>
|
||||
Transaction
|
||||
</a>
|
||||
@@ -137,3 +139,37 @@
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
// Function to set active state based on current page
|
||||
function setActiveNavLink() {
|
||||
// Get all navigation links
|
||||
const navLinks = document.querySelectorAll('.agent-bottom-link');
|
||||
|
||||
// Get current page from URL
|
||||
const currentPage = window.location.pathname.split('/').pop() || 'Dashboard';
|
||||
|
||||
// Remove active class from all links
|
||||
navLinks.forEach(link => {
|
||||
link.classList.remove('active');
|
||||
|
||||
// Get the page identifier from data attribute or href
|
||||
const linkPage = link.getAttribute('data-page') || link.getAttribute('href').split('/').pop();
|
||||
|
||||
// Add active class if matches current page
|
||||
if (linkPage === currentPage) {
|
||||
link.classList.add('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Set active nav link on page load
|
||||
document.addEventListener('DOMContentLoaded', setActiveNavLink);
|
||||
|
||||
// Also set active state when navigating (optional)
|
||||
document.querySelectorAll('.agent-bottom-link').forEach(link => {
|
||||
link.addEventListener('click', function() {
|
||||
document.querySelectorAll('.agent-bottom-link').forEach(l => l.classList.remove('active'));
|
||||
this.classList.add('active');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user