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 @@ -->
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 @@ -= htmlspecialchars($guide->guide_name) ?>
-= htmlspecialchars($guide->languages) ?>
-= htmlspecialchars($guide->places) ?>
- - - += htmlspecialchars($guide->guide_name) ?>
+= htmlspecialchars($guide->languages) ?>
+= htmlspecialchars($guide->places) ?>
+ + + +