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'); ?> -
-
+
+

Complaints

- - - + +
@@ -33,7 +32,7 @@ function getComplaints(status) { headers:{ 'Authorization': 'Bearer' + getCookie('jwt_auth_token') }, - url: '/complaints/returnComplaintsbyCustomer/' + status, + url: '/complaints/' + status, type: 'GET', success: function(response) { //if complain-list-content in document remove it @@ -46,7 +45,7 @@ function getComplaints(status) { } $(document).ready(function(){ - getComplaints('myComplaints'); + getComplaints('returnComplaintsbyCustomer'); $('.section-switch button').click(function() { $('.section-switch button').removeClass('active'); $(this).addClass('active'); diff --git a/app/views/customer/components/customercomplaintlist.view.php b/app/views/customer/components/customercomplaintlist.view.php new file mode 100644 index 0000000..16a3a4f --- /dev/null +++ b/app/views/customer/components/customercomplaintlist.view.php @@ -0,0 +1,111 @@ + +
+ + +

No Complaints

'); + + foreach ($complaints as $complaint) { + ?> + +
+
+
+
Complaint ID: complaint_no ?>
+
Status: status ?>
+
+ +
+
description ?>
+
+ +
+ + + + + + +
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/views/customer/orders.view.php b/app/views/customer/orders.view.php index 21bb5e5..1211653 100644 --- a/app/views/customer/orders.view.php +++ b/app/views/customer/orders.view.php @@ -5,8 +5,8 @@ ?> -
-
+
+
diff --git a/app/views/customer/rent.view.php b/app/views/customer/rent.view.php index 4bab071..f3df616 100644 --- a/app/views/customer/rent.view.php +++ b/app/views/customer/rent.view.php @@ -8,7 +8,7 @@ -
+
@@ -23,41 +23,57 @@
-
- - - +
+ + + + + +
+
+
+ +
+

start_date . " - " . $cart->end_date : "Select Date"; ?>

+
+
+ +
+
+
-
-
+
+
+
+
+
+
+
+ + + + + + -
- -
- - - - - - - - + +
+ +
- +
-
+
+ +
@@ -69,10 +85,11 @@