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

Admin fix #252

Merged
merged 5 commits into from
Apr 28, 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
5 changes: 4 additions & 1 deletion app/controllers/API/MyOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function cancelOrder(string $a = '', string $b = '', string $c = ''):void
$response = new JSONResponse();

$data = [
'customer_req' => NULL,
'customer_req' => 'cancelled',
];

$rentReq = new RentRequestModel;
Expand All @@ -50,4 +50,7 @@ public function reportOrder(string $a = '', string $b = '', string $c = ''):void

$response->statusCode(200)->message('Complaint added successfully')->send();
}



}
3 changes: 3 additions & 0 deletions app/controllers/MyOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public function fullPay(string $a = '', string $b = '', string $c = ''):void {






}


Expand Down
4 changes: 3 additions & 1 deletion app/models/Equipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public function updateEquipment(array $data, array $files, int $id) {
if (isset($files['image']) && $files['image']['name'] != '') {
$data['image'] = upload($files['image'], 'images/equipment');

}
} else {
unset($data['image']);
}

// show($data);
// filter data
Expand Down
36 changes: 24 additions & 12 deletions app/views/customer/orders.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,27 @@
<div class="card card-normal-glass ">
<h2 class="justify-content-center flex-d ml-3"> Orders </h2>
<div class="section-switch flex-d gap-3 flex-wrap" >
<button class="btn-selected" id="all">All</button>
<button class="btn-selected" id="unpaid">Unpaid</button>
<button class="btn-selected" id="pending">Pending</button>
<button class="btn-selected" id="upcoming">Upcoming</button>
<button class="btn-selected" id="rented">Rented</button>
<button class="btn-selected" id="completed">Completed</button>
<button class="btn-selected" id="cancelled">Cancelled</button>
<!-- not rented yet -->
</div>


<button class="btn-selected active" id="pending">Pending</button>



<button class="btn-selected" id="upcoming">Upcoming</button>
<button class="btn-selected" id="rented">Rented</button>
<button class="btn-selected" id="completed">Completed</button>
<button class="btn-selected" id="unpaid">Unpaid</button>

<button class="btn-selected" id="cancelled">Cancelled</button>
<button class="btn-selected" id="all">All</button>



<!-- not rented yet -->

</div>


<div class="row gap-2 ">
<!-- scrollable cart items -->
<!-- <div class="col-lg-12 " id="cart-items"> -->
Expand Down Expand Up @@ -78,7 +90,7 @@
<script>
$(document).ready(function() {
// loadOrders();
loadOrders('all');
loadOrders('pending');
$('.section-switch button').click(function() {
$('.section-switch button').removeClass('active');
$(this).addClass('active');
Expand Down Expand Up @@ -159,14 +171,14 @@ function loadOrders(status = 'all') {
var orderId = $(this).attr('data-id');
console.log(orderId);
$.ajax({
url: '<?= ROOT_DIR ?>/myOrders/cancelOrder/' + orderId,
url: '<?= ROOT_DIR ?>/api/myOrders/cancelOrder/' + orderId,
headers: {
'Authorization': 'Bearer ' + getCookie('jwt_auth_token')
},
type: 'GET',
success: function(data) {
$('#confirm-cancel-modal').hide();
loadOrders();
loadOrders(window.currentStatus);
hideLoader();
},
error: function(data) {
Expand Down
22 changes: 15 additions & 7 deletions app/views/guide/layout/guide-sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,21 +115,29 @@
<i class="menu-arrow"></i>
</a>
<div class="collapse" id="ui-basic">
<ul class="nav flex-column sub-menu">
<li class="nav-item"> <a class="nav-link" href="pages/ui-features/buttons.html">Buttons</a></li>
<li class="nav-item"> <a class="nav-link" href="pages/ui-features/typography.html">Typography</a></li>
</ul>

</div>
</li>


<li data-id="settings" class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/settings" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Settings</span>
<i class="menu-arrow"></i>
</a>

</li>



<div class="guide-dash-prof">
<div class="">
<a href="<?php echo ROOT_DIR ?>/settings" class="ml-7 mr-2">
<i class="fas fa-cog" aria-hidden="true"></i>
</a>

<a href="<?php echo ROOT_DIR ?>/logout"> <button type="submit" class="btn-edit edit-profile">
Logout
</button>
</a>
</div>
</div>
</ul>
Expand Down
42 changes: 1 addition & 41 deletions app/views/navbar/customer-navbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,47 +44,7 @@

<li><a href="<?php echo ROOT_DIR ?>/myOrders" class="nav__link">My Orders</a></li>

<!-- <li class="dropdown__item">
<div class="nav__link">
Blogs <i class="ri-arrow-down-s-line dropdown__arrow"></i>
</div>

<ul class="dropdown__menu">
<li>
<a href="#" class="dropdown__link">
Add Blog
</a>
</li>

<li>
<a href="#" class="dropdown__link">
My Blogs
</a>
</li>
</ul>
</li> -->
<!-- <li><a href="#" class="nav__link">Tips and Knowhows</a></li> -->

<!--=============== DROPDOWN 2 ===============-->
<!-- <li class="dropdown__item">
<div class="nav__link">
Complains
</div>

<ul class="dropdown__menu">
<li>
<a href="#" class="dropdown__link">
Add Complain
</a>
</li>

<li>
<a href="#" class="dropdown__link">
My Complains
</a>
</li>
</ul>
</li> -->


<li><a href="<?php echo ROOT_DIR ?>/complaints" class="nav__link">Complaints</a></li>

Expand Down
17 changes: 11 additions & 6 deletions app/views/navbar/logout-navbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@
<!-- <div class="nav__menu" id="nav-menu"> -->
<div class="nav__menu" id="nav-menu" >
<ul class="nav__list">
<li><a href="<?= ROOT_DIR ?>/login" class="nav__link">Home</a></li>
<li><a href="<?= ROOT_DIR ?>/" class="nav__link">Home</a></li>

<!--=============== DROPDOWN 1 ===============-->

<li><a href="<?= ROOT_DIR ?>/login" class="nav__link">Guides</a></li>
<li><a href="<?= ROOT_DIR ?>/login" class="nav__link">Rental Services</a></li>
<li><a href="<?= ROOT_DIR ?>/login" class="nav__link">Blogs</a></li>
<li><a a href="<?= ROOT_DIR ?>/login" class="nav__link">Tips and Knowhows</a></li>
<li><a a href="<?= ROOT_DIR ?>/login" class="nav__link">Complains</a></li>
<li><a href="<?php echo ROOT_DIR ?>/findGuide" class="nav__link">Guides</a></li>

<li><a href="<?php echo ROOT_DIR ?>/myBookings" class="nav__link">My Bookings</a></li>

<li><a href="<?php echo ROOT_DIR ?>/rent" class="nav__link">Rent</a></li>

<li><a href="<?php echo ROOT_DIR ?>/myOrders" class="nav__link">My Orders</a></li>



<li><a href="<?php echo ROOT_DIR ?>/complaints" class="nav__link">Complaints</a></li>

<!-- check role avalable or not -->
<?php if (isset($_SESSION['USER']) && is_object($_SESSION['USER']) && $_SESSION['USER']->role != 'admin') {
Expand Down
13 changes: 10 additions & 3 deletions app/views/rental/components/reportReturnIssue.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

<h2> Report Complaint </h2>

<div>

<table class="table" id="report-complaint-table" data-order-id="<?= $order->id ?>">
<thead>
<tr>
Expand All @@ -30,15 +32,15 @@
</thead>
<tbody>
<?php foreach($items as $item) { ?>
<tr data-id="<?= $item->equipment_id ?>">
<tr data-id="<?= $item->equipment_id ?>" >
<td><?= $item->item_number ?></td>
<td><?= $item->equipment_name ?></td>
<td>
<input id="report-item-checkbox" class="report-item-checkbox" type="checkbox" name="complaint[]" value="<?= $item->equipment_id ?>">
</td>
<td>
<!-- <input type="text" name="complaint_description[]" class="form-control"> -->
<textarea name="complaint_description[]" class="form-control-lg" disabled></textarea>
<textarea rows="3" name="complaint_description[]" class="form-control-lg " disabled></textarea>
</td>
<td>
<!-- <input type="text" name="charge[]" class="form-control-lg" disabled> -->
Expand Down Expand Up @@ -76,4 +78,9 @@


</table>
<button class="btn btn-primary" id="report-complaint-submit">Report Complaint</button>
</div>

<div class="flex-d align-items-center justify-content-center">

<button class="btn-text-green border center" id="report-complaint-submit">Report Complaint</button>
</div>
43 changes: 39 additions & 4 deletions app/views/rental/equipments.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@
<label for="equipment-image1">Equipment Image</label>
<input type="file" id="equipment-image" class="form-control-lg" name="equipment_image" hidden>
<button type="button" class="btn-text-green border" id="equipment-image-upload-button">Upload Image</button>


</div>
</div>
Expand Down Expand Up @@ -218,9 +219,14 @@
<h2>Upload Equipment Images</h2>
<!-- Equipment image upload form -->
<form method="post" class="flex-d-c text-center justify-content-center align-items-center" enctype="multipart/form-data">
<input type="file" name="equipment_images[]" id="equipment-image-input" class="form-control-lg" accept="image/png, image/jpg, image/gif, image/jpeg , image/webp" required>
<div class="equipment-image-preview-container flex-d mt-2 align-items-center" id="equipment-image-preview"></div>
<input type="submit" class="btn-text-green border mt-4" name="submit" value="Select Images" id="equipment-image-submit">
<div class="flex-d mt-3 ">
<label for="equipment-image-input" class="btn-text-green border"> <i class="fa fa-file"></i> Select Images</label>
<input type="file" name="equipment_images[]" id="equipment-image-input" class="form-control-lg hidden" accept="image/png, image/jpg, image/gif, image/jpeg , image/webp" required >
</div>
<div class="equipment-image-preview-container flex-d mt-2 align-items-center" id="equipment-image-preview">

</div>
<input type="submit" class="btn-text-green border mt-4" name="submit" value="Upload" id="equipment-image-submit">
</form>

</div>
Expand Down Expand Up @@ -284,6 +290,8 @@
// equipment-image-input to equipment-image
$('#equipment-image').prop('files', $('#equipment-image-input').prop('files'));




});

Expand Down Expand Up @@ -475,9 +483,32 @@ function openModal() {
alertmsg('Equipment added successfully', 'success');

$("#add-equipment-form").trigger('reset');
// another way to reset form
// document.getElementById("add-equipment-form").reset();
// not working
// $("#add-equipment-form").reset();
// reset not a function


// reset
$("#equipment-name").val('');
$("#cost").val('');
$("#standard-fee").val('');
$("#rental-fee").val('');
$("#description").val('');
$("#quantity").val('');







// close

setTimeout(() => {
addEquipmentModal.style.display = "none";
}, 1000);
Comment on lines +486 to +511
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The form reset logic after successful equipment addition is redundant and can be simplified. Use only one method to reset the form to avoid confusion and potential errors.

- // another way to reset form
- // document.getElementById("add-equipment-form").reset();
- // not working 
- // $("#add-equipment-form").reset();
- // reset not a function
- 
- // reset 
- $("#equipment-name").val('');
- $("#cost").val('');
- $("#standard-fee").val('');
- $("#rental-fee").val('');
- $("#description").val('');
- $("#quantity").val('');
+ $("#add-equipment-form").trigger('reset');

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
// another way to reset form
// document.getElementById("add-equipment-form").reset();
// not working
// $("#add-equipment-form").reset();
// reset not a function
// reset
$("#equipment-name").val('');
$("#cost").val('');
$("#standard-fee").val('');
$("#rental-fee").val('');
$("#description").val('');
$("#quantity").val('');
// close
setTimeout(() => {
addEquipmentModal.style.display = "none";
}, 1000);
// reset
$("#add-equipment-form").trigger('reset');
// close
setTimeout(() => {
addEquipmentModal.style.display = "none";
}, 1000);


// refresh equipment list
getEquipments();
Expand Down Expand Up @@ -824,7 +855,11 @@ function filterEquipment() {



if (formData.get('equipment_image') != '') {
if (formData.get('equipment_image').name != '') {

console.log(formData.get('equipment_image'));

console.log(formData.get('equipment_image').name);
var image = formData.get('equipment_image');

// validate file type
Expand Down
9 changes: 5 additions & 4 deletions app/views/rental/layout/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,24 @@

</li>
<!-- Settings -->
<!-- <li data-id="settings" class="nav-item">
<li data-id="settings" class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/settings" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Settings</span>
<i class="menu-arrow"></i>
</a>

</li> -->
</li>

<div class="guide-dash-prof">
<div class="">
<a href="<?php echo ROOT_DIR ?>/settings" class="ml-7 mr-2">
<!-- <a href="<?php echo ROOT_DIR ?>/settings" class="ml-7 mr-2">
<i class="fas fa-cog" aria-hidden="true"></i>
</a>
</a> -->
<a href="<?php echo ROOT_DIR ?>/logout"> <button type="submit" class="btn-edit edit-profile">
Logout
</button>
</a>
</div>
</div>

Expand Down
2 changes: 2 additions & 0 deletions app/views/rental/orders.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ function getOrders(status) {
success: function(response) {
console.log(response);
$('#report-complaint-modal').hide();

alertmsg('Complaint Submitted Successfully', 'success');
},
error: function(err) {
console.log(err);
Expand Down
6 changes: 6 additions & 0 deletions public/assets/scss/wl/dashboard/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,10 @@ $breakpoint-lg: 992px;
}



.hidden {
display: none !important;
}


@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
Loading