From 22bcadef02b42fdefd89f8e6f15307e18717451e Mon Sep 17 00:00:00 2001 From: SandaliGunawardena Date: Tue, 31 Oct 2023 12:00:15 +0530 Subject: [PATCH] Dashboard controller --- app/controllers/Dashboard.php | 26 +++++ app/controllers/Profile.php | 2 +- app/views/components/navbar.php | 106 +++++++++--------- ...GuideBlog..view.php => GuideBlog.view.php} | 0 ...oard..view.php => GuideDashboard.view.php} | 0 ...king..view.php => GuideMyBooking.view.php} | 0 .../{moreBlog..view.php => moreBlog.view.php} | 0 7 files changed, 79 insertions(+), 55 deletions(-) create mode 100644 app/controllers/Dashboard.php rename app/views/guide/{GuideBlog..view.php => GuideBlog.view.php} (100%) rename app/views/guide/{GuideDashboard..view.php => GuideDashboard.view.php} (100%) rename app/views/guide/{GuideMyBooking..view.php => GuideMyBooking.view.php} (100%) rename app/views/guide/{moreBlog..view.php => moreBlog.view.php} (100%) diff --git a/app/controllers/Dashboard.php b/app/controllers/Dashboard.php new file mode 100644 index 00000000..201504a2 --- /dev/null +++ b/app/controllers/Dashboard.php @@ -0,0 +1,26 @@ +role; + + if ($user->role == 'guide') { + //echo "Welcome"; + $this->view('guide/GuideDashboard'); + } else if ($user->role == 'rentalservice') { + $this->view('rental/RentalDashboard'); + } + + // else { + // $this->view('profile'); + // } + + // $this->view('profile'); + } +} diff --git a/app/controllers/Profile.php b/app/controllers/Profile.php index 2641d419..a861a7bd 100755 --- a/app/controllers/Profile.php +++ b/app/controllers/Profile.php @@ -12,7 +12,7 @@ public function index(string $a = '', string $b = '', string $c = ''):void { $this->view('customer/profile'); } else if ($user->role == 'guide') { $this->view('guide/profile'); - } else if ($user->role == 'admin') { + } else if ($user->role == 'rentalservice') { $this->view('rental-service/profile'); } diff --git a/app/views/components/navbar.php b/app/views/components/navbar.php index 7ab6a62d..3d6d95c5 100755 --- a/app/views/components/navbar.php +++ b/app/views/components/navbar.php @@ -12,78 +12,76 @@ - role != 'admin' ){ $user = $_SESSION['USER']; ?> + role != 'admin') { + $user = $_SESSION['USER']; ?> -
- profile picture - - role == 'admin' ){ $admin = $_SESSION['USER']; ?> + role == 'admin') { + $admin = $_SESSION['USER']; ?>
- profile picture - -
- + - + \ No newline at end of file + // Get the profile avatar element and the dropdown menu + var profileAvatar = document.querySelector('.profile-avatar'); + var dropdownMenu = document.getElementById('nav-dropdown'); + + // Toggle the dropdown menu when clicking on the profile avatar + profileAvatar.addEventListener('click', function(event) { + // Prevent the default behavior of the anchor tags + event.preventDefault(); + + // Toggle the display style of the dropdown menu + if (dropdownMenu.style.display === 'block') { + dropdownMenu.style.display = 'none'; + } else { + dropdownMenu.style.display = 'block'; + } + }); + + // Close the dropdown menu if the user clicks outside of it + document.addEventListener('click', function(event) { + if (!profileAvatar.contains(event.target) && !dropdownMenu.contains(event.target)) { + dropdownMenu.style.display = 'none'; + } + }); + + // Prevent event propagation when clicking on dropdown links + dropdownMenu.addEventListener('click', function(event) { + event.stopPropagation(); + }); + \ No newline at end of file diff --git a/app/views/guide/GuideBlog..view.php b/app/views/guide/GuideBlog.view.php similarity index 100% rename from app/views/guide/GuideBlog..view.php rename to app/views/guide/GuideBlog.view.php diff --git a/app/views/guide/GuideDashboard..view.php b/app/views/guide/GuideDashboard.view.php similarity index 100% rename from app/views/guide/GuideDashboard..view.php rename to app/views/guide/GuideDashboard.view.php diff --git a/app/views/guide/GuideMyBooking..view.php b/app/views/guide/GuideMyBooking.view.php similarity index 100% rename from app/views/guide/GuideMyBooking..view.php rename to app/views/guide/GuideMyBooking.view.php diff --git a/app/views/guide/moreBlog..view.php b/app/views/guide/moreBlog.view.php similarity index 100% rename from app/views/guide/moreBlog..view.php rename to app/views/guide/moreBlog.view.php