Skip to content

Commit

Permalink
Merge pull request #227 from wanderlust-group-project-1/adminstyles
Browse files Browse the repository at this point in the history
admin-numbers
  • Loading branch information
Sandali-Upekha authored Apr 25, 2024
2 parents 6e87b11 + 897be65 commit 52abb82
Show file tree
Hide file tree
Showing 17 changed files with 408 additions and 215 deletions.
8 changes: 7 additions & 1 deletion app/controllers/Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

echo "This is the index page";

Class Admin{
use Controller;

// public function getRentalCount

}

?>

?>
36 changes: 30 additions & 6 deletions app/controllers/Admin/Charts.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
<?php

class Charts {
class Charts
{
use Controller;

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

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

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

$stats = new AdminStatsModel;
$data['rentalServices'] = $stats->getRentalServiceCount();

$stats = new AdminStatsModel;
$data['customers'] = $stats->getCustomerCount();

$stats = new AdminStatsModel;
$data['guides'] = $stats->getGuideCount();

?>
$stats = new AdminStatsModel;
$data['tips'] = $stats->getTipsCount();

$stats = new AdminStatsModel;
$data['rentComplaints'] = $stats->getRentComplainsCount();

$stats = new AdminStatsModel;
$data['orders'] = $stats->getOrdersCount();

$this->view('admin/chart', $data);
}
}
30 changes: 24 additions & 6 deletions app/controllers/Admin/Dashboard.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
<?php

class Dashboard {
class Dashboard
{
use Controller;

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

$stats = new AdminStatsModel;
$data['rentalServices'] = $stats->getRentalServiceCount();

$stats = new AdminStatsModel;
$data['customers'] = $stats->getCustomerCount();

$stats = new AdminStatsModel;
$data['guides'] = $stats->getGuideCount();

$stats = new AdminStatsModel;
$data['tips'] = $stats->getTipsCount();

?>
$stats = new AdminStatsModel;
$data['rentComplaints'] = $stats->getRentComplainsCount();

$stats = new AdminStatsModel;
$data['orders'] = $stats->getOrdersCount();

$this->view('admin/dashboard', $data);
}
}
2 changes: 1 addition & 1 deletion app/controllers/Admin/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public function index(string $a = '', string $b = '', string $c = ''): void
$data['items'] = $item->findAll();
//show($data);

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

public function item(string $a = '', string $b = '', string $c = ''): void
Expand Down
79 changes: 79 additions & 0 deletions app/models/AdminStats.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php


class AdminStatsModel
{
use Model;

public function getRentalServiceCount()
{

$q = new QueryBuilder();

$q->setTable('rental_services');
$q->count()->where("status", "accepted");


return $this->query($q->getQuery(), $q->getData());
}

public function getCustomerCount()
{

$q = new QueryBuilder();

$q->setTable('customers');
$q->count();


return $this->query($q->getQuery(), $q->getData());
}

public function getGuideCount()
{

$q = new QueryBuilder();

$q->setTable('guides');
$q->count();


return $this->query($q->getQuery(), $q->getData());
}

public function getTipsCount()
{

$q = new QueryBuilder();

$q->setTable('tips');
$q->count();


return $this->query($q->getQuery(), $q->getData());
}

public function getRentComplainsCount()
{

$q = new QueryBuilder();

$q->setTable('rent_return_complaints');
$q->count();


return $this->query($q->getQuery(), $q->getData());
}

public function getOrdersCount()
{

$q = new QueryBuilder();

$q->setTable('rent');
$q->count();


return $this->query($q->getQuery(), $q->getData());
}
}
25 changes: 23 additions & 2 deletions app/views/admin/chart.view.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once('../app/views/layout/header.php');
require_once('../app/views/admin/components/navbar.php');
// require_once('../app/views/admin/components/navbar.php');

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

Expand Down Expand Up @@ -34,8 +34,29 @@
</div>

<script>
var guides = <?php if ($guides && $guides[0] && $guides[0]->count > 0) : ?>
<?php echo $guides[0]->count; ?>
<?php else : ?>
0
<?php endif; ?>


var customers = <?php if ($customers && $customers[0] && $customers[0]->count > 0) : ?>
<?php echo $customers[0]->count; ?>
<?php else : ?>
0
<?php endif; ?>

var rentals = <?php if ($rentalServices && $rentalServices[0] && $rentalServices[0]->count > 0) : ?>
<?php echo $rentalServices[0]->count; ?>
<?php else : ?>
0
<?php endif; ?>



var xValues = ["Rental Services", "Guides", "Customers"];
var yValues = [15, 27, 32];
var yValues = [rentals, guides, customers];
var barColors = ["#8D9E6F", "#526534", "#8D9E6F"];

new Chart("myChart", {
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/complains.view.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once('../app/views/layout/header.php');
require_once('../app/views/admin/components/navbar.php');
// require_once('../app/views/admin/components/navbar.php');

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

Expand Down
45 changes: 0 additions & 45 deletions app/views/admin/components/complainlist.view.php
Original file line number Diff line number Diff line change
@@ -1,53 +1,13 @@
<div id="complaint-list-content" class=" col-lg-12">


<!-- Filter Complaint -->

<!-- Filter by Date Duration -->
<!-- <div class="filter-complaint">
<div class="filter-complaint-header">
</div>
<div class="filter-complaint-body flex-d">
<div class="filter-complaint-date">
<label for="start-date">Start Date</label>
<input type="date" id="start-date" name="start-date">
</div>
<div class="filter-complaint-date">
<label for="end-date">End Date</label>
<input type="date" id="end-date" name="end-date">
</div>


<div class="filter-complaint-button">
<button class="btn btn-primary" id="filter-complaint-button">Filter</button>
</div>


</div>
</div> -->





<?php

// show($complaints);

// [0] => stdClass Object
// (
// [id] => 13
// [customer_id] => 32
// [rentalservice_id] => 25
// [start_date] => 2024-02-22
// [end_date] => 2024-04-29
// [status] => pending
// [total] => 1206.00
// [paid_amount] => 0.00
// [update_at] => 2024-02-23 15:01:21
// [payment_status] => completed
// )


// oreders list
($complaints) ?: show('<div class="col-lg-12"><h1>No Complaints</h1></div>');
Expand All @@ -72,11 +32,6 @@
<button class="btn-text-green" id="view-button"><i class="fa fa-list" aria-hidden="true"></i> View</button>
<!-- if status pending set show -->
<?php if ($complaint->status == 'pending') {





?>
<div class="flex-d-c">
<button class="btn-text-red" id="cancel-complaint"><i class="fa fa-check" aria-hidden="true"></i> Resolve</button>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/customer.view.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once('../app/views/layout/header.php');
require_once('../app/views/admin/components/navbar.php');
// require_once('../app/views/admin/components/navbar.php');

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

Expand Down
Loading

0 comments on commit 52abb82

Please sign in to comment.