Skip to content

Commit

Permalink
Merge pull request #264 from wanderlust-group-project-1/admin-fix
Browse files Browse the repository at this point in the history
Admin fix
  • Loading branch information
nsavinda authored Apr 30, 2024
2 parents 1279afb + cab7ebc commit c6240b2
Show file tree
Hide file tree
Showing 15 changed files with 7,006 additions and 38 deletions.
1 change: 1 addition & 0 deletions app/controllers/FindGuide.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class FindGuide{
use Controller;
public function index(string $a = '', string $b = '', string $c = ''): void {
AuthorizationMiddleware::authorize(['customer']);
$this->view('customer/findGuide');
}

Expand Down
1 change: 1 addition & 0 deletions app/controllers/GuideAvailability.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class GuideAvailability{
use Controller;
public function index(string $a = '', string $b = '', string $c = ''): void {
AuthorizationMiddleware::authorize(['guide']);
$this->view('guide/guideAvailability');
}

Expand Down
1 change: 1 addition & 0 deletions app/controllers/GuideBookings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class GuideBookings{
use Controller;
public function index(string $a = '', string $b = '', string $c = ''): void {
AuthorizationMiddleware::authorize(['guide']);
$this->view('guide/guidebooking');
}
}
1 change: 1 addition & 0 deletions app/controllers/Guideprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Guideprofile {
public function index(string $a = '', string $b = '', string $c = ''): void {
$user = $_SESSION['USER'];

AuthorizationMiddleware::authorize(['guide']);
if ($user->role == 'guide') {
$guideProfileModel = new GuideProfileModel();
$guideProfile = $guideProfileModel->getGuideProfileByUserId($user->id); // Assuming you have a method to fetch guide profile by user ID
Expand Down
1 change: 1 addition & 0 deletions app/controllers/Guidestatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Guidestatistics {
use Controller;

public function index(string $a = '', string $b = '', string $c = ''): void {
AuthorizationMiddleware::authorize(['guide']);
$this->view('guide/guideStatistics');
}

Expand Down
1 change: 1 addition & 0 deletions app/controllers/MyBookings.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
class MyBookings{
use Controller;
public function index(string $a = '', string $b = '', string $c = ''): void {
AuthorizationMiddleware::authorize(['customer']);
$this->view('customer/myBookings');
}
}
20 changes: 12 additions & 8 deletions app/controllers/MyOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@ class MyOrders {
use Controller;


public function index(string $a = '', string $b = '', string $c = ''):void {


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']);

if (empty($data['tips'])) {
// Handle the case where no tips are found
$data['tip'] = '';
} else {
// Randomly select 1 tip if the array is not empty
$data['tip'] = $data['tips'][array_rand($data['tips'])];
}

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


public function list(string $a = '', string $b = '', string $c = ''):void {
AuthorizationMiddleware::authorize(['customer']);
Expand Down
46 changes: 24 additions & 22 deletions app/views/customer/checkout.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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">
<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 ">

Expand Down Expand Up @@ -81,23 +81,23 @@
<!-- select pay fully or patial -->


<table class="payment-table">

<table class="payment-table">

<!-- <h4> Total: Rs. <?php echo $total; ?> </h4>

<!-- <h4> Total: Rs. <?php echo $total; ?> </h4>
<h4> Booking Fee: Rs. <?php echo $total * 0.2 ?> </h4> -->
<tr>
<td> Total: </td>
<td> Rs. <?php echo $total; ?> </td>
</tr>
<tr>
<td> Booking Fee: </td>
<td> Rs. <?php echo $total * 0.2 ?> </td>
</tr>

</table>

<tr>
<td> Total: </td>
<td> Rs. <?php echo $total; ?> </td>
</tr>
<tr>
<td> Booking Fee: </td>
<td> Rs. <?php echo $total * 0.2 ?> </td>
</tr>


</table>

</div>
<div class="row gap-2 ">
Expand All @@ -116,6 +116,8 @@

</div>

</div>

<script>
$(document).ready(function() {
// Event listener for the button click
Expand Down Expand Up @@ -219,11 +221,11 @@ function paymentGateWay(data) {
alertmsg("Payment dismissed", "error");

setTimeout(() => {
window.location.href = "<?php echo ROOT_DIR ?>/myOrders";
window.location.href = "<?php echo ROOT_DIR ?>/myOrders";

hideLoader();
hideLoader();

}, 1000);
}, 1000);

};

Expand All @@ -233,11 +235,11 @@ function paymentGateWay(data) {
console.log("Error:" + error);
alertmsg("Error occured", "error");
setTimeout(() => {
window.location.href = "<?php echo ROOT_DIR ?>/myOrders";
window.location.href = "<?php echo ROOT_DIR ?>/myOrders";

hideLoader();
hideLoader();

}, 1000);
}, 1000);
};

// Put the payment variables here
Expand Down
4 changes: 2 additions & 2 deletions app/views/customer/components/complaintlist.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<button class="btn btn-primary" 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>
<button class="btn-text-red" id="cancel-complaint"><i class="fa fa-times" aria-hidden="true"></i> Cancel</button>
<!-- <button class="btn-text-orange" id="accept-complaint"><i class="fa fa-check" aria-hidden="true"></i> Accept</button>
<button class="btn-text-red" id="cancel-complaint"><i class="fa fa-times" aria-hidden="true"></i> Cancel</button> -->
<?php }
?>

Expand Down
17 changes: 13 additions & 4 deletions app/views/customer/orders.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@

<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>
<?php if (isset($tip) && !empty($tip)): ?>
<div class="tips">
<h3><i class="fa fa-lightbulb-on"></i> <?php echo htmlspecialchars($tip->title); ?></h3>
<p><?php echo htmlspecialchars($tip->description); ?></p>
</div>
<?php else: ?>
<div class="tips">
<h3><i class="fa fa-lightbulb-on"></i> No Tips Available</h3>
<p>Check back later for more tips!</p>
</div>
<?php endif; ?>



</div>
<div class="card card-normal-glass ">
Expand Down
4 changes: 2 additions & 2 deletions app/views/rental/components/orderlist.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@
<button class="btn-text-orange" id="mark-as-returned"><i class="fa fa-check" aria-hidden="true"></i>Mark as Returned</button>
<?php }
elseif ($order->status == 'pending') { ?>
<button class="btn-text-orange" id="accept-request"><i class="fa fa-check" aria-hidden="true"></i> Accept</button>
<button class="btn-text-red" id="cancel-request"><i class="fa fa-times" aria-hidden="true"></i> Cancel</button>
<button class="btn-text-orange" id="accept-request"><i class="fa fa-check" aria-hidden="true"></i> Mark As Viewed</button>
<!-- <button class="btn-text-red" id="cancel-request"><i class="fa fa-times" aria-hidden="true"></i> Cancel</button> -->
<?php }
?>

Expand Down
Loading

0 comments on commit c6240b2

Please sign in to comment.