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

Nirmal #60

Merged
merged 2 commits into from
Nov 1, 2023
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
15 changes: 15 additions & 0 deletions app/controllers/Admin/Blogs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

class Blogs {
use Controller;

public function index(string $a = '', string $b = '', string $c = ''):void {
$this->view('admin/item');
}

public function item(string $a = '', string $b = '', string $c = ''):void {
$this->view('admin/item');
}}


?>
7 changes: 6 additions & 1 deletion app/controllers/Admin/RentalServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ class RentalServices {
use Controller;

public function index(string $a = '', string $b = '', string $c = ''):void {
$this->view('admin/rentalServices');

$rentalServices = new RentalServiceModel();
$data['rentalServices'] = $rentalServices->findAll();
// show($data);

$this->view('admin/rentalServices', $data);
}

public function item(string $a = '', string $b = '', string $c = ''):void {
Expand Down
1 change: 1 addition & 0 deletions app/models/RentalService.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,5 @@ public function updateRentalservice(array $data)

return $this->update($_SESSION['USER']->id, $data, 'id');
}

}
2 changes: 2 additions & 0 deletions app/views/admin/chart.view.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
require_once('../app/views/admin/layout/header.php');
require_once('../app/views/admin/components/navbar.php');

require_once('../app/views/admin/layout/sidebar.php');
?>

Expand Down
98 changes: 84 additions & 14 deletions app/views/admin/components/navbar.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,87 @@
<nav class="sidebar">
<div class="nav-container">
<nav class="navbar">
<div class="nav-logo">

<div class="logo">
<img src="<?= ROOT_DIR ?>/assets/images/logo.png" alt="logo">
</div>
<ul class="nav-menu">
<li class="nav-menu-item"><a href="#">Home</a></li>
<li class="nav-menu-item"><a href="#">About</a></li>
<li class="nav-menu-item"><a href="#">Guides</a></li>
<li class="nav-menu-item"><a href="#">Rental Services</a></li>
<li class="nav-menu-item"><a href="#">Blogs</a></li>
<li class="nav-menu-item"><a href="#">Tips & Knowhows</a></li>
<li class="nav-menu-item"><a href="#">Complaints</a></li>
</ul>

<div class="login-button"><a href="<?= ROOT_DIR ?>/login">Login</a></div>

</nav>

</div>

<!-- check role avalable or not -->
<?php if (isset($_SESSION['USER']) && is_object($_SESSION['USER']) && $_SESSION['USER']->role != 'admin') {
$user = $_SESSION['USER']; ?>


<!-- profile avatar with dropdown -->

<div class="profile-avatar">
<img src="<?php echo ROOT_DIR ?>/assets/images/1.png" alt="profile picture">
<div class="dropdown-menu" id="nav-dropdown">
<ul>
<li><a href="<?= ROOT_DIR . ($user->role == 'guide' || $user->role == 'rentalservice' ? '/Dashboard' : '/profile') ?>">Profile</a></li>
<li><a href="<?= ROOT_DIR ?>/settings">Settings</a></li>
<li><a href="<?= ROOT_DIR ?>/logout">Logout</a></li>
</ul>
</div>
</div>



<?php } else if (isset($_SESSION['USER']) && is_object($_SESSION['USER']) && $_SESSION['USER']->role == 'admin') {
$admin = $_SESSION['USER']; ?>

<!-- profile avatar with dropdown -->
<div class="profile-avatar">
<img src="<?php echo ROOT_DIR ?>/assets/images/1.png" alt="profile picture">
<div class="dropdown-menu" id="nav-dropdown">
<ul>
<li><a href="<?= ROOT_DIR ?>/admin/dashboard">Dashboard</a></li>
<!-- <li><a href="<?= ROOT_DIR ?>/settings">Settings</a></li> -->
<li><a href="<?= ROOT_DIR ?>/logout">Logout</a></li>
</ul>
</div>
</div>


<?php } else { ?>



<div class="login-button"><a href="<?= ROOT_DIR ?>/login">Login</a></div>

<?php } ?>
</nav>

</div>

<script>
// Get the profile avatar element and the dropdown menu
var profileAvatar = document.querySelector('.profile-avatar');
var dropdownMenu = document.getElementById('nav-dropdown');

// Toggle the dropdown menu when clicking on the profile avatar
profileAvatar.addEventListener('click', function(event) {
// Prevent the default behavior of the anchor tags
event.preventDefault();

// Toggle the display style of the dropdown menu
if (dropdownMenu.style.display === 'block') {
dropdownMenu.style.display = 'none';
} else {
dropdownMenu.style.display = 'block';
}
});

// Close the dropdown menu if the user clicks outside of it
document.addEventListener('click', function(event) {
if (!profileAvatar.contains(event.target) && !dropdownMenu.contains(event.target)) {
dropdownMenu.style.display = 'none';
}
});

// Prevent event propagation when clicking on dropdown links
dropdownMenu.addEventListener('click', function(event) {
event.stopPropagation();
});
</script>
8 changes: 5 additions & 3 deletions app/views/admin/customer.view.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
require_once('../app/views/admin/layout/header.php');
require_once('../app/views/admin/components/navbar.php');

require_once('../app/views/admin/layout/sidebar.php');

?>
Expand All @@ -10,21 +12,21 @@
<tr>
<th>Name</th>
<th>Email</th>
<th>Status</th>
<!-- <th>Status</th> -->
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sandaruwan</td>
<td>[email protected]</td>
<td><span class="status accepted">Accepted</span></td>
<!-- <td><span class="status accepted">Accepted</span></td> -->
<td><button class="view-button">View</button></td>
</tr>
<tr>
<td>Sarani</td>
<td>[email protected]</td>
<td><span class="status not-accepted">Not Accepted</span></td>
<!-- <td><span class="status not-accepted">Not Accepted</span></td> -->
<td><button class="view-button">View</button></td>
</tr>

Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/dashboard.view.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
require_once('../app/views/admin/layout/header.php');
require_once('../app/views/admin/components/navbar.php');

require_once('../app/views/admin/layout/sidebar.php');

?>
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/guides.view.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
require_once('../app/views/admin/layout/header.php');
require_once('../app/views/admin/components/navbar.php');

require_once('../app/views/admin/layout/sidebar.php');

?>
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/item.view.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
require_once('../app/views/admin/layout/header.php');
require_once('../app/views/admin/components/navbar.php');

require_once('../app/views/admin/layout/sidebar.php');
?>

Expand Down
12 changes: 6 additions & 6 deletions app/views/admin/layout/sidebar.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<nav class="sidebar sidebar-offcanvas" id="sidebar">
<ul class="nav">
<li class="nav-item">
<a class="nav-link" href="index.html">
<a class="nav-link" href="<?php echo ROOT_DIR ?>/admin/rentalServices">
<i class="ti-shield menu-icon"></i>
<span class="menu-title">Dashboard</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="rentalServices" aria-expanded="false" aria-controls="ui-basic">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/admin/rentalServices" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Rental Services</span>
<i class="menu-arrow"></i>
Expand All @@ -21,7 +21,7 @@
</li>

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

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

<li class="nav-item">
<a class="nav-link" href="index.html">
<a class="nav-link" href="<?php echo ROOT_DIR ?>/admin/blogs">
<i class="ti-shield menu-icon"></i>
<span class="menu-title">Blogs</span>
</a>
Expand All @@ -63,7 +63,7 @@
</li>

<li class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="item" aria-expanded="false" aria-controls="ui-basic">
<a class="nav-link" data-bs-toggle="collapse" href="<?php echo ROOT_DIR ?>/admin/rentalServices/item" aria-expanded="false" aria-controls="ui-basic">
<i class="ti-palette menu-icon"></i>
<span class="menu-title">Items</span>
<i class="menu-arrow"></i>
Expand Down
38 changes: 35 additions & 3 deletions app/views/admin/rentalServices.view.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
<?php
require_once('../app/views/admin/layout/header.php');
require_once('../app/views/admin/components/navbar.php');

require_once('../app/views/admin/layout/sidebar.php');

?>

<div class="table-container">
<table class="data-table">

<table class="data-table">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>

<?php
// Assuming rentalServices is an array of data
foreach ($rentalServices as $service) {
?>
<tr>
<td><?php echo $service->name; ?></td>
<td><?php echo $service->mobile; ?></td>
<td><span class="status <?php echo $service->status; ?>"><?php echo $service->status; ?></span></td>
<td><button class="view-button">View</button></td>
</tr>
<?php
}
?>
</tbody>

</table>


<!-- <table class="data-table">
<thead>
<tr>
<th>Name</th>
Expand Down Expand Up @@ -33,9 +65,9 @@
<td><span class="status waiting">Waiting</span></td>
<td><button class="view-button">View</button></td>
</tr>
<!-- Add more rows as needed -->
</tbody>
</table>
</table> -->

</div>

<!-- Modal -->
Expand Down
2 changes: 2 additions & 0 deletions app/views/admin/tips.view.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php
require_once('../app/views/admin/layout/header.php');
require_once('../app/views/admin/components/navbar.php');

require_once('../app/views/admin/layout/sidebar.php');

?>
Expand Down
4 changes: 2 additions & 2 deletions app/views/signup.view.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div class="login-form">
<div id="select" class="col ">
<div class="header">
<h1>
<h1 class="signup-text">
Who are you?
</h1>
</div>
Expand Down Expand Up @@ -54,7 +54,7 @@
<label for="email">Email</label>
<input type="text" name="email" id="email" required>

<label for="number">Number</label>
<label for="number">Mobile Number</label>
<input type="text" name="number" id="number" required>

<label for="nic">NIC Number</label>
Expand Down
24 changes: 23 additions & 1 deletion public/assets/css/admin-style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
/* Navbar */

.nav-container {
display: flex;
justify-content: flex-end;
}
.navbar {
width:80%;
background-color: #fff; /* Theme color */
color: #4C5039; /* Text color */
padding: 10px 20px;
display: flex;
justify-content: space-between;
/* align-items: flex-end; */
}

.nav-logo {
display: flex;
align-items: flex-end;
margin-bottom: 20px;
}

/* Sidebar styles */
.sidebar {
width: 250px;
Expand Down Expand Up @@ -140,7 +162,7 @@
color: #fff;
}

.not-accepted {
.rejected {
background-color: #FF5733;
color: #fff;
}
Expand Down
8 changes: 8 additions & 0 deletions public/assets/css/signUp.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
color: #6c7058;
}

.signup-text {
text-align: center;
margin-top: 10px;
margin-bottom: 10px;
font-size: 20px;
color: #6c7058;
}

/* .login-container .login-form p{
font-family:'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-style:inherit;
Expand Down