-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from wanderlust-group-project-1/sandali
tipsStarted
- Loading branch information
Showing
5 changed files
with
252 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
class Tips | ||
{ | ||
use Controller; | ||
|
||
public function index(string $a = '', string $b = '', string $c = ''): void | ||
{ | ||
$this->view('admin/tips'); | ||
} | ||
|
||
public function update(string $a = '', string $b = '', string $c = ''): void | ||
{ | ||
|
||
$tips = new TipsModel(); | ||
$tips->updateTips($_POST); | ||
|
||
redirect('profile'); //methana mokadda? | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
class TipsModel | ||
{ | ||
use Model; | ||
|
||
protected string $table = 'tips'; | ||
protected array $allowedColumns = [ | ||
//'id', | ||
'title', | ||
'description', | ||
]; | ||
|
||
public function validateCustomerSignup(array $data) | ||
{ | ||
$this->errors = []; | ||
|
||
if (empty($data['title'])) { | ||
$this->errors['title'] = "Title is required"; | ||
} | ||
|
||
if (empty($data['description'])) { | ||
$this->errors['description'] = "Description is required"; | ||
} | ||
return empty($this->errors); | ||
} | ||
|
||
public function updateTips(array $data) | ||
{ | ||
|
||
// $user = new UserModel; | ||
|
||
$data['id'] = $_SESSION['USER']->id; | ||
|
||
// alowed column | ||
$data = array_filter($data, function ($key) { | ||
return in_array($key, $this->allowedColumns); | ||
}, ARRAY_FILTER_USE_KEY); | ||
|
||
return $this->update($_SESSION['USER']->id, $data, 'id'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,93 @@ | ||
<nav class="sidebar sidebar-offcanvas" id="sidebar"> | ||
<ul class="nav"> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="index.html"> | ||
<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"> | ||
<i class="ti-palette menu-icon"></i> | ||
<span class="menu-title">Rental Services</span> | ||
<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> | ||
<ul class="nav"> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="index.html"> | ||
<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"> | ||
<i class="ti-palette menu-icon"></i> | ||
<span class="menu-title">Rental Services</span> | ||
<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 class="nav-item"> | ||
<a class="nav-link" data-bs-toggle="collapse" href="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> | ||
</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 class="nav-item"> | ||
<a class="nav-link" data-bs-toggle="collapse" href="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> | ||
</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 class="nav-item"> | ||
<a class="nav-link" data-bs-toggle="collapse" href="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> | ||
</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 class="nav-item"> | ||
<a class="nav-link" data-bs-toggle="collapse" href="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> | ||
</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 class="nav-item"> | ||
<a class="nav-link" href="index.html"> | ||
<i class="ti-shield menu-icon"></i> | ||
<span class="menu-title">Blogs</span> | ||
</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" href="index.html"> | ||
<i class="ti-shield menu-icon"></i> | ||
<span class="menu-title">Tips and Know-hows</span> | ||
</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link" data-bs-toggle="collapse" href="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> | ||
</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 class="nav-item"> | ||
<a class="nav-link" data-bs-toggle="collapse" href="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> | ||
</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 class="nav-item"> | ||
<a class="nav-link" data-bs-toggle="collapse" href="charts" aria-expanded="false" aria-controls="ui-basic"> | ||
<i class="ti-palette menu-icon"></i> | ||
<span class="menu-title">Charts</span> | ||
<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 class="nav-item"> | ||
<a class="nav-link" data-bs-toggle="collapse" href="charts" aria-expanded="false" aria-controls="ui-basic"> | ||
<i class="ti-palette menu-icon"></i> | ||
<span class="menu-title">Charts</span> | ||
<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> | ||
</nav> | ||
</div> | ||
</li> | ||
</ul> | ||
</nav> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
require_once('../app/views/admin/layout/header.php'); | ||
require_once('../app/views/admin/layout/sidebar.php'); | ||
|
||
?> | ||
|
||
<div class="table-container"> | ||
<table class="data-table"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Email</th> | ||
<th>Status</th> | ||
<th>Action</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>Lahiru Sandaruwan</td> | ||
<td>lahiru@example.com</td> | ||
<td><span class="status accepted">Accepted</span></td> | ||
<td><button class="view-button">View</button></td> | ||
</tr> | ||
<tr> | ||
<td>Dasun Thathsara</td> | ||
<td>dasun@example.com</td> | ||
<td><span class="status not-accepted">Not Accepted</span></td> | ||
<td><button class="view-button">View</button></td> | ||
</tr> | ||
|
||
<!-- Add more rows as needed --> | ||
</tbody> | ||
</table> | ||
</div> | ||
|
||
<!-- Modal --> | ||
<div class="rental-services-modal" id="rental-services-modal"> | ||
<div class="modal-content"> | ||
<span class="close">×</span> | ||
<div class="profile-info"> | ||
<img src="<?php echo ROOT_DIR ?>/assets/images/dp.jpg" alt="Profile Image" class="profile-image"> | ||
<h2 id="profile-name">Lahiru Sandaruwan </h2> | ||
<p id="profile-email">lahiru@example.com</p> | ||
<p id="profile-address">Kandy</p> | ||
<p id="profile-status" class="accepted">Accepted</p> | ||
<div class="profile-links"> | ||
<a href="#" id="link-1">Link 1</a> | ||
<a href="#" id="link-2">Link 2</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
<script> | ||
// Get the modal | ||
var modal = document.getElementById("rental-services-modal"); | ||
|
||
// Get the <span> element that closes the modal | ||
var span = document.getElementsByClassName("close")[0]; | ||
|
||
// Get all view buttons | ||
var viewButtons = document.querySelectorAll('.view-button'); | ||
|
||
// Function to handle modal display | ||
function openModal(content) { | ||
// document.getElementById("modal-content").innerHTML = content; | ||
modal.style.display = "block"; | ||
} | ||
|
||
// Add click event listener to view buttons | ||
viewButtons.forEach(function(button) { | ||
button.addEventListener('click', function() { | ||
|
||
var name = this.parentElement.parentElement.querySelector('td:first-child').textContent; | ||
var email = this.parentElement.parentElement.querySelector('td:nth-child(2)').textContent; | ||
openModal("Name: " + name + "<br>Email: " + email); | ||
}); | ||
}); | ||
|
||
// Close the modal when the close button is clicked | ||
span.onclick = function() { | ||
modal.style.display = "none"; | ||
} | ||
|
||
// Close the modal if the user clicks outside of it | ||
window.onclick = function(event) { | ||
if (event.target == modal) { | ||
modal.style.display = "none"; | ||
} | ||
} | ||
</script> | ||
|
||
|
||
|
||
|
||
<?php | ||
require_once('../app/views/admin/layout/footer.php'); | ||
|
||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters