From a2987c0e04421c1eb1aaa51219c089337edabdb0 Mon Sep 17 00:00:00 2001 From: Gayandee <2021cs153@stu.ucsc.cmb.ac.lk> Date: Mon, 29 Apr 2024 16:42:59 +0530 Subject: [PATCH] Guide Dashboard --- app/controllers/API/GuideBookings.php | 30 +++ app/models/GuideBookings.php | 19 +- app/views/customer/OneGuide.view.php | 2 +- .../customer/components/AllGuides.view.php | 25 +- app/views/customer/myBookings.view.php | 58 ++++- app/views/guide/GuideDashboard.view.php | 218 +++++++++++------- app/views/guide/guideAvailability.view.php | 18 +- app/views/guide/guidebooking.view.php | 26 +-- app/views/guide/package.view.php | 4 +- app/views/guide/packages.view.php | 4 +- public/assets/scss/wl/dashboard/_guide.scss | 2 +- .../reports/income_report_662f18a265d22.pdf | Bin 0 -> 2457 bytes .../reports/income_report_662f18a6c7ab1.pdf | Bin 0 -> 2454 bytes .../reports/income_report_662f18a851353.pdf | Bin 0 -> 2455 bytes .../reports/income_report_662f18a9bf5f4.pdf | Bin 0 -> 2455 bytes .../reports/income_report_662f18aa34d3f.pdf | Bin 0 -> 2452 bytes .../reports/income_report_662f18aa5f2a8.pdf | Bin 0 -> 2453 bytes .../reports/income_report_662f18aae78a8.pdf | Bin 0 -> 2455 bytes .../reports/income_report_662f18ab213fe.pdf | Bin 0 -> 2453 bytes .../reports/income_report_662f18af04935.pdf | Bin 0 -> 2452 bytes 20 files changed, 284 insertions(+), 122 deletions(-) create mode 100644 public/reports/income_report_662f18a265d22.pdf create mode 100644 public/reports/income_report_662f18a6c7ab1.pdf create mode 100644 public/reports/income_report_662f18a851353.pdf create mode 100644 public/reports/income_report_662f18a9bf5f4.pdf create mode 100644 public/reports/income_report_662f18aa34d3f.pdf create mode 100644 public/reports/income_report_662f18aa5f2a8.pdf create mode 100644 public/reports/income_report_662f18aae78a8.pdf create mode 100644 public/reports/income_report_662f18ab213fe.pdf create mode 100644 public/reports/income_report_662f18af04935.pdf diff --git a/app/controllers/API/GuideBookings.php b/app/controllers/API/GuideBookings.php index 6b1f60b..3436ee8 100644 --- a/app/controllers/API/GuideBookings.php +++ b/app/controllers/API/GuideBookings.php @@ -170,4 +170,34 @@ public function completeBooking($date): void ->statusCode(200) ->send(); } + + public function GetUserBookingDetails(string $a = '', string $b = '', string $c = ''): void{ + + $response = new JSONResponse; + + $GuideBookingsModel = new GuideBookingsModel; + $userId = UserMiddleware::getUser()['id']; + $bookingDetails = $GuideBookingsModel->GetUserBookingDetails($userId); + + $response->success(true) + ->data($bookingDetails) + ->message('Booking details fetched successfully') + ->statusCode(200) + ->send(); + } + + public function GetMonthlyCompletedBookings(string $a = '', string $b = '', string $c = ''): void{ + + $response = new JSONResponse; + + $GuideBookingsModel = new GuideBookingsModel; + $userId = UserMiddleware::getUser()['id']; + $bookingDetails = $GuideBookingsModel->GetMonthlyCompletedBookings($userId); + + $response->success(true) + ->data($bookingDetails) + ->message('Booking details fetched successfully') + ->statusCode(200) + ->send(); + } } diff --git a/app/models/GuideBookings.php b/app/models/GuideBookings.php index 4c1a27a..c029f9f 100644 --- a/app/models/GuideBookings.php +++ b/app/models/GuideBookings.php @@ -137,7 +137,6 @@ public function deleteBooking(int $guideId, string $date): mixed { $q->setTable($this->table); $q->delete()->where('guide_id', $guideId)->where('date', $date); return $this->query($q->getQuery(), $q->getData()); - } @@ -147,4 +146,22 @@ public function completeBooking(int $guideId, string $date): mixed { $q->update(['status' => 'completed'])->where('guide_id', $guideId)->where('date', $date); return $this->query($q->getQuery(), $q->getData()); } + + public function GetUserBookingDetails(int $userId): mixed { + $q = 'CALL GetUserBookingDetails(:userId)'; + $params = [ + 'userId' => $userId + ]; + + return $this->query($q, $params); + } + + public function GetMonthlyCompletedBookings(int $userId): mixed { + $q = 'CALL GetMonthlyCompletedBookings(:userId)'; + $params = [ + 'userId' => $userId + ]; + + return $this->query($q, $params); + } } \ No newline at end of file diff --git a/app/views/customer/OneGuide.view.php b/app/views/customer/OneGuide.view.php index c8c1e7a..6dceb22 100644 --- a/app/views/customer/OneGuide.view.php +++ b/app/views/customer/OneGuide.view.php @@ -23,7 +23,7 @@ -->
- Availability + Availability
diff --git a/app/views/customer/components/AllGuides.view.php b/app/views/customer/components/AllGuides.view.php index 19bf561..c9298f0 100644 --- a/app/views/customer/components/AllGuides.view.php +++ b/app/views/customer/components/AllGuides.view.php @@ -1,16 +1,17 @@ -
-
- guide -
-
-

guide_id) ?>

-

guide_name) ?>

-

languages) ?>

-

places) ?>

- - - +
+
+
+ guide +
+
+

guide_name) ?>

+

languages) ?>

+

places) ?>

+ + + +
diff --git a/app/views/customer/myBookings.view.php b/app/views/customer/myBookings.view.php index e6bca22..589b80a 100644 --- a/app/views/customer/myBookings.view.php +++ b/app/views/customer/myBookings.view.php @@ -38,7 +38,7 @@
- +
@@ -107,7 +107,7 @@ function bookingHTML(userDetails, bookingDetails) { $(document).ready(function() { // Get the modal var modal = document.getElementById("report-modal"); - var viewModal = document.getElementById("view-modal") + var viewModal = document.getElementById("view-booking-modal") // When the user clicks the "Complain" button, open the modal $(document).on('click', '.order-report-button', function() { @@ -133,5 +133,57 @@ function bookingHTML(userDetails, bookingDetails) { } }); }); + + + $(document).on('click', '#report-submit', function(e) { + e.preventDefault(); + var title = $('#report-title').val(); + var description = $('#report-description').val(); + var orderId = $(this).attr('data-id'); + var data = { + title: title, + description: description, + orderId: orderId + }; + + $.ajax({ + headers: { + 'Authorization': 'Bearer ' + getCookie('jwt_auth_token') + }, + url: '/complaints/addComplaint', + method: 'POST', + data: JSON.stringify(data), + success: function(response) { + alert('Complaint submitted successfully'); + $('#report-modal').css('display', 'none'); + } + }); + }); - \ No newline at end of file + + + + + + \ No newline at end of file diff --git a/app/views/guide/GuideDashboard.view.php b/app/views/guide/GuideDashboard.view.php index ffd93bc..1c8fc78 100644 --- a/app/views/guide/GuideDashboard.view.php +++ b/app/views/guide/GuideDashboard.view.php @@ -25,125 +25,185 @@
No of Tours
-

30

+

Income
-

Rs.139000

+

Upcoming Booking
-

Micheal Julius

+

Recent Booking
-

Micheal Julius

+

-
-
-
-

Monthly Bookings

- -
-
-
+
+
+
+

Monthly Bookings

+
+
+
+
+
- - - - - + + + + + + + + // Update the series name and data + options.series[0].name = 'All bookings'; + options.series[0].data = numBookingsData; + options.series[1].name = 'Completed bookings'; + options.series[1].data = completedBookingData; + xaxisCategories = data.data.map(entry => entry.month); + + + + + // Rendering the chart + var chart = new ApexCharts(document.querySelector("#chart"), options); + chart.render(); + + }, + error: function(xhr, status, error) { + console.error(xhr.responseText); + } + }); + }); + diff --git a/app/views/guide/guideAvailability.view.php b/app/views/guide/guideAvailability.view.php index d91d23c..449f94d 100644 --- a/app/views/guide/guideAvailability.view.php +++ b/app/views/guide/guideAvailability.view.php @@ -202,20 +202,22 @@ function nextMonth() {
diff --git a/app/views/guide/guidebooking.view.php b/app/views/guide/guidebooking.view.php index f11efa0..20b52ad 100644 --- a/app/views/guide/guidebooking.view.php +++ b/app/views/guide/guidebooking.view.php @@ -275,7 +275,7 @@ function nextMonth() {