diff --git a/app/controllers/Admin/Complains.php b/app/controllers/Admin/Complains.php new file mode 100644 index 0000000..d0b7fa8 --- /dev/null +++ b/app/controllers/Admin/Complains.php @@ -0,0 +1,50 @@ +view('admin/complains'); + } + + public function listComplains(string $a = '', string $b = '', string $c = ''): void + { + $complain = new RentReturnComplaintModel; + $data['complaints'] = $complain->getAdminRentalComplaints($b); + + $this->view('admin/components/complainlist', $data); + } + + + + public function viewComplaint(string $a = '', string $b = '', string $c = ''): void + { + $rentreturncomplaint = new RentReturnComplaintModel; + $complaint = $rentreturncomplaint->getComplaint($a); + // show($complaint); + $rent = new RentModel; + $order = $rent->getRental($complaint->rent_id); + $items = $rent->getItemListbyRentId($complaint->rent_id); + + // add complaint details to items + foreach ($items as $item) { + $item->complaint = null; + $item->charge = 0; + // show(json_decode($complaint->complains)); + foreach (json_decode($complaint->complains) as $complain) { + if ($item->equipment_id == $complain->equipment_id) { + $item->complaint = $complain; + $item->charge = $complain->charge; + } + } + } + + + + // show(['complaint' => $complaint, 'order' => $order, 'items' => $items]); + + $this->view('admin/components/complaint', ['complaint' => $complaint, 'order' => $order, 'items' => $items]); + } +} diff --git a/app/models/RentReturnComplaint.php b/app/models/RentReturnComplaint.php index 4270056..f40edd0 100644 --- a/app/models/RentReturnComplaint.php +++ b/app/models/RentReturnComplaint.php @@ -1,7 +1,8 @@ allowedColumns); }, ARRAY_FILTER_USE_KEY); $this->insert($data); - - - - - - - - - - } public function getComplaintsByRentalId($rental_id, $status='pending') { @@ -61,20 +53,22 @@ public function getComplaintsByRentalId($rental_id, $status='pending') { ->where('rent_return_complaints.status', $status); // echo $q->getQuery(); - return $this->query($q->getQuery(),$q->getData()); + return $this->query($q->getQuery(), $q->getData()); } - public function getComplaint($id) { + public function getComplaint($id) + { $q = new QueryBuilder; $q->setTable('rent_return_complaints'); $q->select('rent_return_complaints.*,rent.id as rent_id') ->join('rent', 'rent_return_complaints.rent_id', 'rent.id') ->where('rent_return_complaints.id', $id); - return $this->query($q->getQuery(),$q->getData())[0]; + return $this->query($q->getQuery(), $q->getData())[0]; } - public function cancelComplaint($id) { + public function cancelComplaint($id) + { $q = new QueryBuilder; $q->setTable('rent_return_complaints'); @@ -98,4 +92,22 @@ public function getComplaintsByCustomerId($id) { } -} \ No newline at end of file + + + + + public function getAdminRentalComplaints($status = "pending"){ + + $q = new QueryBuilder; + // join rent table to get rental + $q->setTable('rent_return_complaints'); + $q->select('rent_return_complaints.*,rent.id as rent_id') + ->setTable('rent_return_complaints') + ->join('rent', 'rent_return_complaints.rent_id', 'rent.id') + ->where('rent_return_complaints.status', $status); + + // echo $q->getQuery(); + return $this->query($q->getQuery(), $q->getData()); + } + +} diff --git a/app/views/admin/chart.view.php b/app/views/admin/chart.view.php index 973a9c5..2c56110 100755 --- a/app/views/admin/chart.view.php +++ b/app/views/admin/chart.view.php @@ -12,174 +12,280 @@ -
+

Statistics

+ +
-
-
-
-

Wanderlust Users

-
-
- -
+
+
+
+

Wanderlust Users

+
- + options: { + legend: { + display: false + }, + // title: { + // display: true, + // text: "Wanderlust Users" + // } + } + }); + +
-
- - -
-
-
-

Rental Services Bookings

- - + - - + + - - var chart2 = new ApexCharts(document.querySelector("#chart2"), options); - chart2.render(); - } - }); + + + +
+
+
+

Guide Bookings

+ +
+
+
+
+
+
+ + + + + + - + var chart1 = new ApexCharts(document.querySelector("#chart1"), options); + chart1.render(); + + - - - -
-
-
-

Guide Bookings

- - - - - - - - - - - - -
-
-
-

Complaints from Users

-
- -
- -
+
+ +
- - + + }); + -
-
\ No newline at end of file +
+
\ No newline at end of file diff --git a/app/views/admin/complains.view.php b/app/views/admin/complains.view.php index e69de29..6bbc0cb 100644 --- a/app/views/admin/complains.view.php +++ b/app/views/admin/complains.view.php @@ -0,0 +1,214 @@ + + +
+ + + + + + + +
+

Complaints

+ + + +
+ +
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+ + +
+
+
+
+ + + + + + +
+ +
+ +
+

Complaints

+ + + +
+ + + + + + + + + +
+ + + + + + + + +
+ + +
+ + + + + + +
+ +
+ +
+
+ + +
+ + + + + + + + + + \ No newline at end of file diff --git a/app/views/admin/components/complainlist.view.php b/app/views/admin/components/complainlist.view.php new file mode 100644 index 0000000..0508090 --- /dev/null +++ b/app/views/admin/components/complainlist.view.php @@ -0,0 +1,155 @@ +
+ + + + + + + + + + + + stdClass Object + // ( + // [id] => 13 + // [customer_id] => 32 + // [rentalservice_id] => 25 + // [start_date] => 2024-02-22 + // [end_date] => 2024-04-29 + // [status] => pending + // [total] => 1206.00 + // [paid_amount] => 0.00 + // [update_at] => 2024-02-23 15:01:21 + // [payment_status] => completed + // ) + + + // oreders list + ($complaints) ?: show('

No Complaints

'); + + + + foreach ($complaints as $complaint) { + ?> + +
+
+
+
Complaint ID: id ?>
+
Status: status ?>
+
+ +
+
description ?>
+
+ +
+ + + status == 'pending') { + + + + + + ?> +
+ + + + +
+ status == 'rented') { ?> + + status == 'pending') { ?> + + + + + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/views/admin/components/complaint.view.php b/app/views/admin/components/complaint.view.php new file mode 100644 index 0000000..9b52eb0 --- /dev/null +++ b/app/views/admin/components/complaint.view.php @@ -0,0 +1,131 @@ +
+ + + +
+ +
+ + +
+ + + + + + + + + + + + + +
Complain ID:id ?>
Complain Date:created_at)) ?>
Complain Status:status ?>
+
+
+ + + + + + + + + + + +
Rental Serivece Name: rental_service_name ?>
Rental Serivece ID:rental_service_id ?>
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + +
Order ID:id ?>
Order Date:created_at)) ?>
Order Status:status ?>
+ + +
+
+ + + + + + + + + + + + + +
Customer:customer_name ?>
Email:customer_email ?>
Mobile:customer_number ?>
+ +
+ +
+ +
+ + + +
+

Equipment List

+ + + + + + + + + + + + + + + +
Item_number NameComplainCharge
item_number ?>equipment_name ?>complaint ? $item->complaint->complaint_description : 'No Complain' ?>charge ?>
+ +
+ + + + + + + +
+ + + + +
+ + + +
\ No newline at end of file diff --git a/app/views/admin/customer.view.php b/app/views/admin/customer.view.php index bc9e2cd..10af512 100755 --- a/app/views/admin/customer.view.php +++ b/app/views/admin/customer.view.php @@ -12,108 +12,119 @@ -
- - - - - - - - - - - - - - - - - - + + +
+

Customers

+ + + +
+
NameNumberAddressAction
name; ?>number; ?>address; ?>
+ + + + + + - - - - -
NameNumberAddressAction
-
- - - \ No newline at end of file + ?> +
\ No newline at end of file diff --git a/app/views/admin/dashboard.view.php b/app/views/admin/dashboard.view.php index b912f11..72b8d6f 100755 --- a/app/views/admin/dashboard.view.php +++ b/app/views/admin/dashboard.view.php @@ -141,7 +141,7 @@
-
+ - fwfw +
+
+ + -
+ +
+ -
- -
- - @@ -290,7 +291,7 @@ + + +

Guide Booking

+
+ +
+ + + - -
\ No newline at end of file + ?> +
\ No newline at end of file diff --git a/app/views/admin/item.view.php b/app/views/admin/item.view.php index 767c2b9..3bdf51b 100755 --- a/app/views/admin/item.view.php +++ b/app/views/admin/item.view.php @@ -11,116 +11,124 @@ ?> - -
- - - - - - - - - - - - - - - - - +
+

Items

+ + + +
+
NameTypeQuantityPriceAction
type; ?>count; ?>status; ?>
+ + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeQuantityPriceAction
Item 1Type A5$10.00
Item 2Type B10$15.50
Item 3Type C3$8.75
-
- - - \ No newline at end of file +
\ No newline at end of file diff --git a/app/views/admin/layout/sidebar.php b/app/views/admin/layout/sidebar.php index 1c998dd..fd5a845 100755 --- a/app/views/admin/layout/sidebar.php +++ b/app/views/admin/layout/sidebar.php @@ -92,7 +92,7 @@