diff --git a/app/controllers/Complaints.php b/app/controllers/Complaints.php index 964bf72..ce832fc 100644 --- a/app/controllers/Complaints.php +++ b/app/controllers/Complaints.php @@ -67,11 +67,6 @@ public function returnComplaintsbyCustomer(string $a = '', string $b = '', strin $this->view('customer/components/complaintlist', $data); - - - - - } public function returnComplaintbyCustomer(string $a = '', string $b = '', string $c = ''):void { @@ -108,4 +103,14 @@ public function returnComplaintbyCustomer(string $a = '', string $b = '', string $this->view('customer/components/complaint', ['complaint' => $complaint, 'order' => $order, 'items' => $items]); } + public function rentCompaints(string $a = '', string $b = '', string $c = ''):void { + $rentcomplaint = new RentComplaintModel; + $data = ['customer_id' => UserMiddleware::getUser()['id']]; + $data['complaints'] = $rentcomplaint->getComplaintsByCustomer($data); + show ($data['complaints']); + + $this->view('customer/components/customercomplaintlist', $data); + } + + } \ No newline at end of file diff --git a/app/models/RentComplaint.php b/app/models/RentComplaint.php index 89a1bd4..65a0b37 100644 --- a/app/models/RentComplaint.php +++ b/app/models/RentComplaint.php @@ -22,6 +22,16 @@ public function createComplaint($data) { public function getComplaints(array $data) { return $this->where($data); } + + public function getComplaintsByCustomer(array $data) { + $q = new QueryBuilder; + $q->setTable('rent_complaint'); + $q->select('rent.customer_id as customer_id, rent.id as rent_id, complaint_no as complaint_no, rent_complaint.status as status, rent_complaint.description as description, rent_complaint.created_at as created_at') + ->join('rent', 'rent_complaint.rent_id','rent.id') + ->where('rent.customer_id', $data['customer_id']); + + return $this->query($q->getQuery(), $q->getData()); + } } diff --git a/app/views/customer/complaints.view.php b/app/views/customer/complaints.view.php index caa037c..1aa4539 100644 --- a/app/views/customer/complaints.view.php +++ b/app/views/customer/complaints.view.php @@ -3,16 +3,15 @@ require_once('../app/views/navbar/customer-navbar.php'); ?> -
echo isset($cart) ? "Selected Date: " . $cart->start_date . " - " . $cart->end_date : "Select Date"; ?>
+