Skip to content

Commit

Permalink
Merge pull request #258 from wanderlust-group-project-1/admin-fix
Browse files Browse the repository at this point in the history
feat:Tips
  • Loading branch information
nsavinda authored Apr 29, 2024
2 parents a8a8069 + ac8d851 commit 506354c
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 9 deletions.
3 changes: 3 additions & 0 deletions app/controllers/Admin/Tips.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ public function delete(string $a = '', string $b = '', string $c = ''): void
// show($b);
// show($c);
$tips = new TipsModel();
// show($tips->first(['id' => $a]));

$tips->delete($a, 'id');


redirect('admin/tips');
}
Expand Down
9 changes: 8 additions & 1 deletion app/controllers/MyOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ public function index(string $a = '', string $b = '', string $c = ''):void {


AuthorizationMiddleware::authorize(['customer']);

$tips = new TipsModel();
$data['tips'] = $tips->findAll();

// randomly select 1 tip
$data['tip'] = $data['tips'][array_rand($data['tips'])];
// show($data['tip']);

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

public function list(string $a = '', string $b = '', string $c = ''):void {
Expand Down
16 changes: 13 additions & 3 deletions app/views/admin/tips.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<div class="modal-content">
<span class="close">&times;</span>
<h2>Tips Update Form</h2>
<form id="update-form" action="<?php echo ROOT_DIR ?>/admin/tips/update" method="post">
<form id="update-form" class="flex-d gap-3" action="<?php echo ROOT_DIR ?>/admin/tips/update" method="post">
<input name="id" id="tip-id" type="hidden" value="">

<label for="updated-title">Title:</label>
Expand All @@ -101,7 +101,7 @@


<button class="btn-text-green border center">Update</button>
<a class="text-center mt-2" id="delete-tip" href="<?php echo ROOT_DIR ?>/admin/tips/delete/ "> <button class="btn-text-red border center"> Delete </button> </a>
<button key="" id="delete-tip" class="btn-text-red border center"> Delete </button>
</form>
</div>
</div>
Expand All @@ -128,10 +128,20 @@ function openUpdateModal(name, email, id) {
document.getElementById("updated-title").value = name;
document.getElementById("updated-description").value = email;
document.getElementById("tip-id").value = id;
document.getElementById("delete-tip").href = "<?php echo ROOT_DIR ?>/admin/tips/delete/" + id;
document.getElementById("delete-tip").setAttribute('key', id);
updateModal.style.display = "block";
}

$(document).on('click','#delete-tip',function(e){
e.preventDefault();
var id = $(this).attr('key');
console.log(id);
// goto the delete route
window.location.href = "<?php echo ROOT_DIR ?>/admin/tips/delete/" + id;
});



// Event listener for add button click
addButton.addEventListener('click', function() {
openAddModal();
Expand Down
12 changes: 11 additions & 1 deletion app/views/customer/orders.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@
<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 flex-d-c gap-2 mt-9 ">
<div class="col-lg-8 col-md-12 flex-d-c gap-2 mt-9 ">


<div class="card card-normal-glass mw-600px align-self-center bg-transparent">
<!-- Tip -->
<div class="tips">
<h3><i class="fa fa-lightbulb-on"></i> <?php echo $tip->title; ?> </h3>
<p> <?php echo $tip->description; ?> </p>
</div>

</div>
<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" >
Expand Down
6 changes: 3 additions & 3 deletions app/views/rental/components/complainlist.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
<?php
}
elseif ($complaint->status == 'rented') { ?>
<button class="btn btn-primary" id="mark-as-returned">Mark as Returned</button>
<button class="btn-text-orange" id="mark-as-returned">Mark as Returned</button>
<?php }
elseif ($complaint->status == 'pending') { ?>
<button class="btn-text-orange" id="accept-complaint"><i class="fa fa-check" aria-hidden="true"></i> Accept</button>
Expand Down Expand Up @@ -149,8 +149,8 @@
<h2>Cancel Complaint</h2>
<p>Are you sure you want to cancel this complaint?</p>
<div class="flex-d gap-3 mt-3">
<button class="btn btn-primary" id="cancel-complaint-confirm">Yes</button>
<button class="btn btn-danger modal-close" id="cancel-complaint-cancel">No</button>
<button class="btn-text-green border" id="cancel-complaint-confirm">Yes</button>
<button class="btn-text-red border modal-close" id="cancel-complaint-cancel">No</button>
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion public/assets/scss/wl/dashboard/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@
}
}

// disabled state
&.center {
align-self: center;
}


&:hover{
Expand Down
5 changes: 5 additions & 0 deletions public/assets/scss/wl/dashboard/common/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@

.bg-transparent {
background-color: transparent !important;
}

.bg-none {
background-color: none !important;

}
8 changes: 8 additions & 0 deletions public/assets/scss/wl/dashboard/common/_width.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@

// max width

.mw-600px {
max-width:600px !important;
}

.mw-400px {
max-width: 400px !important;
}

.mw-300px {
max-width: 300px !important;
}
Expand Down

0 comments on commit 506354c

Please sign in to comment.