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
+
+
+
+
+
+
+
+
+
+
+
+ Rental Services
+
+
+
+
+
+
+ Guides
+
+
+
+
+
+
+ Customers
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Complaints
+
+
+
+
+ Pending
+ Accepted
+ Rejected
+ Resolved
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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->description ?>
+
+
+
+
View
+
+ status == 'pending') {
+
+
+
+
+
+ ?>
+
+ Resolve
+
+
+
+
+ status == 'rented') { ?>
+
Mark as Returned
+ status == 'pending') { ?>
+
Accept
+
Cancel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
×
+
Cancel Complaint
+
Are you sure you want to cancel this complaint?
+
+ Yes
+ No
+
+
+
+
+
\ 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:
+ = $complaint->id ?>
+
+
+ Complain Date:
+ = date('Y-m-d', strtotime($complaint->created_at)) ?>
+
+
+ Complain Status:
+ = $complaint->status ?>
+
+
+
+
+
+
+ Rental Serivece Name:
+ = $order->rental_service_name ?>
+
+
+ Rental Serivece ID:
+ = $order->rental_service_id ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Order ID:
+ = $order->id ?>
+
+
+ Order Date:
+ = date('Y-m-d', strtotime($order->created_at)) ?>
+
+
+ Order Status:
+ = $order->status ?>
+
+
+
+
+
+
+
+
+
+ Customer:
+ = $order->customer_name ?>
+
+
+ Email:
+ = $order->customer_email ?>
+
+
+ Mobile:
+ = $order->customer_number ?>
+
+
+
+
+
+
+
+
+
+
+
+
Equipment List
+
+
+ Item_number
+ Name
+ Complain
+ Charge
+
+
+
+ = $item->item_number ?>
+ = $item->equipment_name ?>
+ = $item->complaint ? $item->complaint->complaint_description : 'No Complain' ?>
+ = $item->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 @@
-
-
-
-
- Name
- Number
- Address
- Action
-
-
-
-
-
- name; ?>
- number; ?>
- address; ?>
-
-
- View
+
+
+
+
Customers
+
+
+
+
+
+
+
+ Name
+ Number
+ Address
+ Action
-
-
-
-
-
-
-
-
-
-
-
×
-
+
+
+
+
+ name; ?>
+ number; ?>
+ address; ?>
+
+
+ View
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
\ 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 @@
-
+
+
+
-
-
-
-
-
@@ -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 @@
?>
-
-
-
-
-
- Name
- Type
- Quantity
- Price
- Action
-
-
-
-
-
- type; ?>
- count; ?>
- status; ?>
- View
+
+
Items
+
+
+
+
+
+
+
+ Name
+ Type
+ Quantity
+ Price
+ Action
-
-
-
-
- Item 1
- Type A
- 5
- $10.00
- View
-
-
- Item 2
- Type B
- 10
- $15.50
- View
-
-
- Item 3
- Type C
- 3
- $8.75
- View
-
-
-
-
-
-
-
-
-
-
×
-
-
Item Name
-
Type: Type A
-
Quantity: 5
-
Price: $10.00
+
+
+
+
+ type; ?>
+ count; ?>
+ status; ?>
+ View
+
+
+
+
+
+ Item 1
+ Type A
+ 5
+ $10.00
+ View
+
+
+ Item 2
+ Type B
+ 10
+ $15.50
+ View
+
+
+ Item 3
+ Type C
+ 3
+ $8.75
+ View
+
+
+
+
+
+
+
+
+
+
×
+
+
Item Name
+
Type: Type A
+
Quantity: 5
+
Price: $10.00
+
-
-
-
-
+ // Close the modal if the user clicks outside of it
+ window.onclick = function(event) {
+ if (event.target == modal) {
+ modal.style.display = "none";
+ }
+ }
+
+
+
-
\ 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 @@
-
+
diff --git a/app/views/admin/rentalServices.view.php b/app/views/admin/rentalServices.view.php
index 0ed4843..88ea402 100755
--- a/app/views/admin/rentalServices.view.php
+++ b/app/views/admin/rentalServices.view.php
@@ -12,44 +12,53 @@
-
-
-
-
-
- Name
- Mobile
- Status
- Action
-
-
-
-
-
-
- name; ?>
- mobile; ?>
- status; ?>
- View
+
+
Rental Services
+
+
+
+
+
+
+
+
+ Name
+ Mobile
+ Status
+ Action
-
-
-
-
+
+
+
+
+
+ name; ?>
+ mobile; ?>
+ status; ?>
+ View
+
+
+
+
+
-
-
-