update admin dashboard, adding last 5 user to user statistics

This commit is contained in:
Dario Rekowski on RockPI 2020-02-20 09:06:41 +00:00
parent 46e8d1d08e
commit a49a33766d
4 changed files with 60 additions and 9 deletions

View File

@ -62,8 +62,14 @@ class UsersController extends AppController
$newAccountsTree[$created->year][$created->month]['count'] += intval($entry['count']);
}
// last 5 new users
$lastUsers = $this->Users->find('all')->order(['created DESC'])->limit(5);
$timeUsed = microtime(true) - $startTime;
$this->set(compact('users', 'newUsersThisMonth', 'newUsersLastMonth', 'timeUsed', 'newAccountsTree'));
$this->set(compact(
'users', 'newUsersThisMonth', 'newUsersLastMonth',
'timeUsed', 'newAccountsTree', 'lastUsers'));
}
/**

View File

@ -33,9 +33,12 @@ $this->assign('title', __('Willkommen') . ' ' . $user['first_name'] . '&nbs
<h3>Account ...</h3>
<a class="grd-nav-bn" href="./account/user_delete"><?= __("löschen"); ?></a>
</fieldset>-->
<?php if($serverUser != null || $user['role'] == 'admin') : ?>
<h2 class="admin-border"><?= __('Adminbereich'); ?></h2>
<?php endif; ?>
<?php if($serverUser != null) : ?>
<fieldset class="grd-margin-top-10">
<h3>Server Admin Gradido ...</h3>
<fieldset class="grd-margin-top-10 admin-border">
<h3>Gradido ...</h3>
<?= $this->Html->link(
__('einzeln schöpfen'),
['controller' => 'TransactionCreations', 'action' => 'create'],
@ -47,21 +50,29 @@ $this->assign('title', __('Willkommen') . '&nbsp;' . $user['first_name'] . '&nbs
['class' => 'grd-nav-bn grd-nav-bn-large']
);?>
</fieldset>
<fieldset class="grd-margin-top-10 admin-border">
<legend>Statistik</legend>
<?= $this->Html->link(
__('Anmeldungen'),
['controller' => 'Users', 'action' => 'statistics'],
['class' => 'grd-nav-bn grd-nav-bn-large']
);?>
</fieldset>
<?= $this->Html->link(
__('Fehler') . ' (' . $adminErrorCount . ')',
['controller' => 'AdminErrors'], ['class' => 'grd-nav-bn']);
?>
<?php endif; ?>
<?php if($user['role'] == 'admin') : ?>
<fieldset class="grd-margin-top-10">
<h3>Adminbereich</h3>
<fieldset class="grd-margin-top-10 admin-border">
<h3>Benutzer ...</h3>
<?= $this->Html->link(
__('Benutzer suchen'),
__('suchen'),
['controller' => 'StateUsers', 'action' => 'search'],
['class' => 'grd-nav-bn grd-nav-bn-large']
); ?>
<a href="<?= Router::url('./', true) ?>account/adminRegister" class="grd-nav-bn grd-nav-bn-large">
<?= __("Benutzer hinzufügen") ?>
<?= __("hinzufügen") ?>
</a>
</fieldset>
<?php endif; ?>

View File

@ -56,6 +56,36 @@ if($users->count() > 0 && $newUsersLastMonth->count()) {
</div>
</div>
</div>
<div class="row">
<div class="col-md-10 equel-grid">
<div class="grid">
<div class="grid-body py-3">
<p class="card-title ml-n1"><?= __('Letzte Anmeldungen'); ?></p>
</div>
<div class="table-responsive">
<table class="table table-hover table-sm">
<thead>
<tr class="solid-header">
<th class="pl-4"><?= __('Name')?></th>
<th><?= __('E-Mail') ?></th>
<th><?= __('Erstellt') ?></th>
</tr>
</thead>
<tbody>
<?php foreach($lastUsers as $user) : ?>
<tr>
<td><?= $user->first_name . ' ' . $user->last_name ?></td>
<td><?= $user->email ?></td>
<td><?= $user->created ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php //var_dump($lastUsers->toArray()); ?>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8 equel-grid">
<div class="grid">
@ -87,5 +117,6 @@ if($users->count() > 0 && $newUsersLastMonth->count()) {
</div>
</div>
</div>
</div>
</div>
<?= $this->Html->script(['core', 'vendor.addons']); ?>
<?= $this->Html->script('userSearch') ?>

View File

@ -349,3 +349,6 @@ p.grd_small {
.grd-negative-currency {
color: red;
}
.admin-border {
border-color: #ffa600;
}