Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customer#profile #244

Merged
merged 8 commits into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion app/controllers/Complaints.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ 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 {
public function rentComplaints(string $a = '', string $b = '', string $c = ''):void {
$rentcomplaint = new RentComplaintModel;
$data = ['customer_id' => UserMiddleware::getUser()['id']];
$data['complaints'] = $rentcomplaint->getComplaintsByCustomer($data);
Expand All @@ -115,5 +115,21 @@ public function rentCompaints(string $a = '', string $b = '', string $c = ''):vo
$this->view('customer/components/customercomplaintlist', $data);
}

public function rentComplaint(string $a = '', string $b = '', string $c = ''):void {
$rentcomplaint = new RentComplaintModel;
$data['complaint'] = $rentcomplaint->getRentComplaint($a)[0];
// show($data['complaint']->rent_id);

$rent = new RentModel;
$data['rentitems'] = $rent->getItemListbyRentId($data['complaint']->rent_id);
show($data);

$this->view('customer/components/customercomplaints', $data);
}






}
13 changes: 13 additions & 0 deletions app/models/RentComplaint.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ public function getComplaintsByCustomer(array $data) {

return $this->query($q->getQuery(), $q->getData());
}

public function getRentComplaint($id) {
$q = new QueryBuilder;
$q->setTable('rent_complaint');
$q->select('rent_complaint.complaint_no as complaint_no, rent.id as rent_id,rent.created_at as rent_date, rent.customer_id as customer_id, rent.paid_amount as paid_amount, rent.created_at as paid_date, rent.start_date as start_date, rent.end_date as end_date,
rent.status as rent_status, rent.total as total_amount,rental_services.id as rental_id, rental_services.name as rental_name, rental_services.mobile as rental_mobile,
rent_complaint.title as title, rent_complaint.description as description, rent_complaint.created_at as created_at, rent_complaint.status as status')
->join('rent','rent_complaint.rent_id', 'rent.id')
->join('rental_services', 'rent.rentalservice_id','rental_services.id')
->where('rent_complaint.complaint_no', $id);

return $this->query($q->getQuery(), $q->getData());
}



Expand Down
13 changes: 8 additions & 5 deletions app/views/customer/checkout.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
// }
?>

<div class="container flex-d flex-md-c justify-content-center mt-7">
<div class="container flex-d flex-md-c justify-content-center mt-9 ml-8 p-6">
<div class="customer-bg-image">
<img src="<?php echo ROOT_DIR?>/assets/images/customerbg.jpg" alt="customer-bg-image" class="customer-bg-image">
</div>
<div class=" col-lg-8 col-md-12 flex-d-c gap-2 ">

<div class="card card-normal justify-content-center">
<div class="card card-normal-glass justify-content-center">

<h2 class="justify-content-center flex-d "> Cart </h2>
<div class="row gap-2 ">
Expand All @@ -36,8 +39,8 @@
foreach ($items as $item) : ?>
<div class="card" id='cart-item' data-id="<?= htmlspecialchars($item->id) ?>">
<div class="row gap-2">
<div class="cart-item-image col-lg-4">
<img src="<?= OSURL ?>images/equipment/<?php echo htmlspecialchars($item->e_image); ?>" alt="Image" class="img-fluid">
<div class="cart-item-image col-lg-4 mb-6">
<img src="<?= OSURL ?>images/equipment/<?php echo htmlspecialchars($item->e_image); ?>" alt="Image" class="img-fluid rounded-8">
</div>
<div class="cart-item-details col-lg-5">
<h3 class="cart-item-name"><?php echo htmlspecialchars($item->e_name); ?></h3>
Expand All @@ -64,7 +67,7 @@
</div>

<div class=" col-lg-3 col-md-12 flex-d gap-2 ">
<div class="card card-normal col-md-11 flex-d-c">
<div class="card card-normal-glass col-md-11 flex-d-c">

<div class="flex-d-c gap-2 justify-content-between h-100">
<h2 class="justify-content-center flex-d"> Checkout </h2>
Expand Down
23 changes: 21 additions & 2 deletions app/views/customer/complaints.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<h2 class="justufy-content-ceneter flex-d"> Complaints </h2>

<div class="section-switch flex-d gap-3 flex-wrap">
<button class="btn-selected" id="rentCompaints">My complaints</button>
<button class="btn-selected" id="rentComplaints">My complaints</button>
<button class="btn-selected" id="returnComplaintsbyCustomer">Recieved complaints</button>
</div>

Expand Down Expand Up @@ -106,6 +106,7 @@ function getComplaints(status) {

</script>

<!-- View modal -->
<div class="modal" id="complaint-view-modal">
<div class="modal-content">
<span class="close">&times;</span>
Expand All @@ -118,4 +119,22 @@ function getComplaints(status) {

<?php
require_once('../app/views/layout/footer.php');
?>
?>

<!-- mycom-view-button -->
<script>
$(document).on('click', '#mycom-view-button', function() {
var complaintId = $(this).closest('.complaint').attr('data-id');
$.ajax({
headers:{
'Authorization' : 'Bearer' + getCookie('jwt_auth_token')
},
url: '<?= ROOT_DIR ?>/complaints/rentComplaint/' + complaintId,
type: 'GET',
success: function(response) {
$('#complaint-data').html(response);
$('#complaint-view-modal').css('display', 'block');
}
});
});
</script>
18 changes: 2 additions & 16 deletions app/views/customer/components/customercomplaintlist.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
?>

<div class = "row flex-d col-lg-12 complaint-card-item row-content" id="complaint-card">
<div class="complaint card card-normal3 col-lg-12 flex-md-c miw-200px" data-id="<?= $complaint->id ?>">
<div class="complaint card card-normal3 col-lg-12 flex-md-c miw-200px" data-id="<?= $complaint->complaint_no ?>">
<div class="complaint-header">
<div class="complaint-id">Complaint ID: <?= $complaint->complaint_no ?></div>
<div class="complaint-status">Status: <?= $complaint->status ?></div>
Expand All @@ -22,7 +22,7 @@
</div>

<div class="complaint-actions flex-d gap-3">
<button class="btn-text-green" id="view-button"><i class="fa fa-list" aria-hidden="true"></i> View</button>
<button class="btn-text-green" id="mycom-view-button"><i class="fa fa-list" aria-hidden="true"></i> View</button>
<button class="btn-text-red" id="cancel-complaint"><i class="fa fa-times" aria-hidden="true"></i> Cancel</button>
<!-- if status pending set show -->
<!-- <?php if ($complaint->status == 'myComplaints') {
Expand Down Expand Up @@ -65,20 +65,6 @@




<!-- View modal -->

<div class="modal" id="complaint-view-modal">
<div class="modal-content">
<span class="close">&times;</span>


<div id="complaint-data"> </div>
</div>
</div>



<!-- Complaint Modals -->

<div id="report-complaint-modal" class="modal">
Expand Down
164 changes: 164 additions & 0 deletions app/views/customer/components/customercomplaints.view.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
<div id="order-item-content">

<?php
// [complaint] => stdClass Object
// (
// [complaint_no] => CC000003
// [rent_id] => 65
// [rent_date] => 2024-02-25 10:24:39
// [customer_id] => 32
// [paid_amount] => 0.00
// [paid_date] => 2024-02-25 10:24:39
// [start_date] => 2024-02-25
// [end_date] => 2024-02-28
// [rent_status] => accepted
// [total_amount] => 1400.00
// [rental_id] => 56
// [rental_name] => nirmal
// [rental_mobile] => 0713458323
// [title] => kjbaekr
// [description] => lkjbk dflnfdl kjbdf
// [created_at] => 2024-04-23 09:54:10
// [status] => pending
// )



?>

<div class="order-item">

<div class="row card-grid m-2">
<!-- Complain details -->

<div class="col-lg-5 col-md-12">
<table class="order-details">
<tr>
<td>Complain No:</td>
<td><?= $complaint->complaint_no ?></td>
</tr>
<tr>
<td>Complaint Date:</td>
<td><?= date('Y-m-d', strtotime($complaint->created_at)) ?></td>
</tr>
<tr>
<td class="status-view">Complaint Status:</td>
<td class="status-view"><?= $complaint->status ?></td>
</tr>
</table>

</div>
<div class="col-lg-5 col-md-12">
<table class="order-details">
<tr>
<td>Total:</td>
<td><?= $complaint->total_amount ?></td>
</tr>
<tr>
<td>Paid:</td>
<td><?= $complaint->paid_amount ?></td>
</tr>
<tr>
<td>Payment Date:</td>
<td><?= date('Y-m-d', strtotime($complaint->created_at)) ?></td>
</tr>
</table>

</div>

</div>

<div class="row card-grid m-2">
<div class="col-lg-5 col-md-12">

<table class="order-details">
<tr >
<td>Order ID:</td>
<td><?= $complaint->rent_id ?></td>
</tr>
<tr>
<td>Order Date:</td>
<td><?= date('Y-m-d', strtotime($complaint->rent_date)) ?></td>
</tr>
<tr>
<td class="status-view">Order Status:</td>
<td class="status-view"><?= $complaint->rent_status ?></td>
</tr>
</table>


</div>
<div class="col-lg-6 col-md-12 mr-0">
<!-- <h3>Customer: <span id="customer-name"><?= $order->customer_name ?></span></h3>
<h3>Email: <span id="customer-email"><?= $order->customer_email ?></span></h3> -->
<table class="order-details">
<tr>
<td>Rental ID:</td>
<td><?= $complaint->rental_id ?></td>
</tr>
<tr>
<td>Rental name:</td>
<td><?= $complaint->rental_name ?></td>
</tr>
<tr>
<td>Rental Mobile:</td>
<td><?= $complaint->rental_mobile ?></td>
</tr>
</table>

</div>

</div>

<div class="row card-grid-last m-2">

<!-- item list -->

<div class="col-lg-12 col-md-12">
<!-- [equipment_id] => 53
[equipment_name] => BBQ Grill
[item_number] => I000539029
[equipment_cost] => 5600.00 -->

<h3>Equipment List</h3>
<div class="table-container">
<table class="table-custom">
<thead>
<tr>
<th>Item_number</th>
<th>Item Name</th>
<!-- <th>Complaint</th> -->
<th>Equipment cost</th>
</tr>
</thead>
<?php foreach ($rentitems as $rentitem) : ?>
<tbody>
<tr>
<td><?= $rentitem->item_number ?></td>
<td><?= $rentitem->equipment_name?></td>
<!-- <td><?= $rentitem->complaint ? $rentitem->complaint->complaint_description : 'No Complain' ?></td> -->
<td><?= $rentitem->equipment_cost ?></td>
</tr>
</tbody>
<?php endforeach; ?>
</table>
</div>

</div>







</div>




</div>



</div>
Loading
Loading