Skip to content

Commit

Permalink
Merge pull request #220 from wanderlust-group-project-1/payment-manag…
Browse files Browse the repository at this point in the history
…ement

Payment management
  • Loading branch information
nsavinda authored Apr 24, 2024
2 parents 332b9eb + 28503a7 commit c729a40
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 16 deletions.
1 change: 1 addition & 0 deletions app/controllers/API/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public function submitReturnComplaint(string $a = '', string $b = '', string $c



$response->statusCode(200)->data(['order_id' => $a])->send();


// $rent->updateRentStatus($data);
Expand Down
12 changes: 10 additions & 2 deletions app/middlewares/AuthMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ public static function run_middleware(string $controller, string $method): mixed
'Customer' => ['index', 'edit', 'update'],
'Profile' => ['index', 'edit', 'update'],
'Dashboard' => ['index', 'edit', 'update'],
'Complaints' => 'ALL',
'Equipments' => 'ALL',
'Orders' => 'ALL',
'Statistics' => 'ALL',
'Settings' => 'ALL',




// 'Profile' => ['index', 'edit', 'update'],
];
Expand All @@ -45,8 +53,8 @@ public static function run_middleware(string $controller, string $method): mixed

$currentController = ucfirst($controller);

if (isset($authRequired[$currentController]) &&
in_array($method, $authRequired[$currentController])) {
if (isset($authRequired[$currentController]) && ($authRequired[$currentController] == 'ALL' || in_array($method, $authRequired[$currentController]))) {
// in_array($method, $authRequired[$currentController])) {
Self::is_authenticated();
}
if (isset($unauthRequired[$currentController]) && ($unauthRequired[$currentController] == 'ALL' || in_array($method, $unauthRequired[$currentController]))) {
Expand Down
37 changes: 31 additions & 6 deletions app/views/rental/layout/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@

<ul class="nav">

<li class="nav-item">
<li data-id="dashboard" class="nav-item">
<a class="nav-link" href="<?php echo ROOT_DIR ?>/dashboard">
<i class="ti-shield menu-icon"></i>
<span class="menu-title">Dashboard</span>
</a>
</li>

<li class="nav-item">
<li data-id="equipments" class="nav-item">

<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/equipments" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Equipments</span>
Expand All @@ -46,7 +47,7 @@

</li>

<li class="nav-item">
<li data-id="orders" class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/orders" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Orders</span>
Expand All @@ -57,7 +58,7 @@



<li class="nav-item">
<li data-id="complaints" class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/complaints" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Complaints</span>
Expand Down Expand Up @@ -110,7 +111,7 @@
</a>
</li> -->

<li class="nav-item">
<li data-id="statistics" class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="statistics" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Statistics</span>
Expand All @@ -119,7 +120,7 @@

</li>
<!-- Settings -->
<li 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>
Expand Down Expand Up @@ -363,4 +364,28 @@ function openModal() {
modal.style.display = "none";
}
}
</script>


<script>
// sidebar selected nav item

// get current url and split it

$(document).ready(function() {
var url = window.location.href;
var urlSplit = url.split('/');
var page = urlSplit[urlSplit.length - 1];
console.log(page);
var navItems = document.querySelectorAll('.nav-item');

navItems.forEach(function(item) {
if (item.getAttribute('data-id') == page) {
item.classList.add('active');
}
});
});



</script>
54 changes: 50 additions & 4 deletions public/assets/js/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ function initialize() {
mapTypeId: google.maps.MapTypeId.ROADMAP
}

$('#latitude').val(7.873053999999999);
$('#longitude').val(80.77179699999999);

console.log(document.getElementById('map-canvas'));

var map = new google.maps.Map(document.getElementById('map-canvas'), myOptions);
var geocoder = new google.maps.Geocoder();


// Create the search box and link it to the UI element.
var input = document.getElementById('pac-input');
Expand All @@ -22,16 +27,57 @@ function initialize() {
map: map
});



function updatePosition(latlng) {
geocoder.geocode({ 'location': latlng }, function (results, status) {
if (status === 'OK') {
if (results[0]) {
var foundCountry = false;
results[0].address_components.forEach(function(component) {
if (component.types.includes('country')) {
console.log('Country:', component.long_name);
foundCountry = component.long_name === 'Sri Lanka'; // Check for a specific country
$('#country').val(component.long_name); // Update country input field
}
});
if (!foundCountry) {
alertmsg('Location is outside of Sri Lanka. Please select a location within Sri Lanka.','error');
// reset the marker to the previous location
marker.setPosition(new google.maps.LatLng(7.873053999999999,80.77179699999999));
map.panTo(new google.maps.LatLng(7.873053999999999,80.77179699999999));
console.log("change back");

return;
}
}
} else {
console.log('Geocoder failed due to: ' + status);
}
});
console.log(latlng.lat());
$('#latitude').val(latlng.lat());
$('#longitude').val(latlng.lng());
}






// Bias the SearchBox results towards current map's viewport.
map.addListener('bounds_changed', function() {
searchBox.setBounds(map.getBounds());
});

google.maps.event.addListener(marker, 'dragend', function (event) {
var poiLat = this.getPosition().lat();
var poiLon = this.getPosition().lng();
$('#latitude').val(poiLat);
$('#longitude').val(poiLon);
// var poiLat = this.getPosition().lat();
// var poiLon = this.getPosition().lng();
// $('#latitude').val(poiLat);
// $('#longitude').val(poiLon);
updatePosition(this.getPosition());
console.log("dragend");

});

var markers = [];
Expand Down
13 changes: 9 additions & 4 deletions public/assets/scss/wl/dashboard/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,18 @@ $sidebar-top: 60px;
color: $color-primary;
}

&.active{
background-position: left bottom;
color: $color-primary;
}

&.active {
background-color: $theme-color;
color: #fff;
// color: #fff;

.sub-menu {
display: block;
}
// .sub-menu {
// display: block;
// }

.menu-arrow {
transform: rotate(90deg);
Expand Down

0 comments on commit c729a40

Please sign in to comment.