283 lines
9.4 KiB
PHTML
283 lines
9.4 KiB
PHTML
<?php
|
|
|
|
/**
|
|
* @var int $tenantCount
|
|
* @var int $departmentCount
|
|
* @var int $roleCount
|
|
* @var int $userCount
|
|
* @var int $permissionCount
|
|
* @var int $activeUserCount
|
|
* @var int $inactiveUserCount
|
|
* @var array $tenantBreakdown
|
|
* @var int $mailLogTotalCount
|
|
* @var int $mailLogSentCount
|
|
* @var int $mailLogFailedCount
|
|
* @var int $mailLogQueuedCount
|
|
* @var int $mailLogTotal24hCount
|
|
* @var int $mailLogSent24hCount
|
|
* @var int $mailLogFailed24hCount
|
|
* @var int $mailLogQueued24hCount
|
|
*/
|
|
|
|
?>
|
|
<div class="app-breadcrumb">
|
|
<a href="/admin"><?php e(t('Home')); ?></a><i class="bi bi-chevron-right"></i><?php e(t('Statistics')); ?>
|
|
</div>
|
|
<div class="app-dashboard-titlebar">
|
|
<h1><?php e(t('Statistics')); ?></h1>
|
|
<div class="app-dashboard-titlebar-actions">
|
|
<!-- Optional actions -->
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="app-dashboard">
|
|
<div class="app-tabs" data-tabs id="stats-tabs">
|
|
<!-- Tab Navigation -->
|
|
<div class="app-tabs-nav">
|
|
<button data-tab="organization" data-tab-default class="transparent tab-button">
|
|
<?php e(t('Organization')); ?>
|
|
</button>
|
|
<button data-tab="users-roles" class="transparent tab-button">
|
|
<?php e(t('Users & roles')); ?>
|
|
</button>
|
|
<?php if (can('mail_log.view')): ?>
|
|
<button data-tab="system" class="transparent tab-button">
|
|
<?php e(t('System')); ?>
|
|
</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Tab Panel: Organization -->
|
|
<div data-tab-panel="organization">
|
|
<div class="app-tiles">
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/tenants',
|
|
'label' => t('Tenants'),
|
|
'count' => (string) $tenantCount,
|
|
'icon' => 'bi bi-building',
|
|
'iconBg' => '#e9f0ff',
|
|
'iconColor' => '#264db3',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/departments',
|
|
'label' => t('Departments'),
|
|
'count' => (string) $departmentCount,
|
|
'icon' => 'bi bi-diagram-3-fill',
|
|
'iconBg' => '#fff2d9',
|
|
'iconColor' => '#9a5a00',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/users',
|
|
'label' => t('Users'),
|
|
'count' => (string) $userCount,
|
|
'icon' => 'bi bi-people-fill',
|
|
'iconBg' => '#d9f2e6',
|
|
'iconColor' => '#1f6a3a',
|
|
]);
|
|
?>
|
|
</div>
|
|
<?php if (!empty($tenantBreakdown)): ?>
|
|
<div class="app-stats-table">
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>
|
|
<?php e(t('Tenant')); ?>
|
|
</th>
|
|
<th>
|
|
<?php e(t('Departments')); ?>
|
|
</th>
|
|
<th>
|
|
<?php e(t('Assigned users (Active/Inactive)')); ?>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($tenantBreakdown as $item): ?>
|
|
<tr>
|
|
<td>
|
|
<?php if (can('tenants.view') && !empty($item['uuid'])): ?>
|
|
<a href="admin/tenants/edit/<?php e($item['uuid']); ?>">
|
|
<?php e($item['description']); ?>
|
|
</a>
|
|
<?php else: ?>
|
|
<?php e($item['description']); ?>
|
|
<?php endif; ?>
|
|
</td>
|
|
<td>
|
|
<?php e($item['departments']); ?>
|
|
</td>
|
|
<td>
|
|
<?php e($item['total_users']); ?> <small>(
|
|
<?php e($item['active_users']); ?> /
|
|
<?php e($item['inactive_users']); ?>)
|
|
</small>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<!-- Tab Panel: Users & Roles -->
|
|
<div data-tab-panel="users-roles">
|
|
<div class="grid">
|
|
<div>
|
|
<div class="app-tiles">
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/users',
|
|
'label' => t('Active users'),
|
|
'count' => (string) $activeUserCount,
|
|
'icon' => 'bi bi-person-check-fill',
|
|
'iconBg' => '#d9f2e6',
|
|
'iconColor' => '#1f6a3a',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/users',
|
|
'label' => t('Inactive users'),
|
|
'count' => (string) $inactiveUserCount,
|
|
'icon' => 'bi bi-person-x-fill',
|
|
'iconBg' => '#ffe9e9',
|
|
'iconColor' => '#a32e2e',
|
|
]);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="app-tiles">
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/roles',
|
|
'label' => t('Roles'),
|
|
'count' => (string) $roleCount,
|
|
'icon' => 'bi bi-shield-lock-fill',
|
|
'iconBg' => '#f3e9ff',
|
|
'iconColor' => '#5b2c83',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/permissions',
|
|
'label' => t('Permissions'),
|
|
'count' => (string) $permissionCount,
|
|
'icon' => 'bi bi-key-fill',
|
|
'iconBg' => '#fff2d9',
|
|
'iconColor' => '#9a5a00',
|
|
]);
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tab Panel: System -->
|
|
<?php if (can('mail_log.view')): ?>
|
|
<div data-tab-panel="system">
|
|
<div class="grid">
|
|
<div>
|
|
<h4><?php e(t('Mail logs')); ?></h4>
|
|
<div class="app-tiles">
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/mail-log',
|
|
'label' => t('Total emails'),
|
|
'count' => (string) $mailLogTotalCount,
|
|
'icon' => 'bi bi-envelope-fill',
|
|
'iconBg' => '#e9f0ff',
|
|
'iconColor' => '#264db3',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/mail-log?status=sent',
|
|
'label' => t('Sent emails'),
|
|
'count' => (string) $mailLogSentCount,
|
|
'icon' => 'bi bi-envelope-check-fill',
|
|
'iconBg' => '#d9f2e6',
|
|
'iconColor' => '#1f6a3a',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/mail-log?status=failed',
|
|
'label' => t('Failed emails'),
|
|
'count' => (string) $mailLogFailedCount,
|
|
'icon' => 'bi bi-envelope-x-fill',
|
|
'iconBg' => '#ffe9e9',
|
|
'iconColor' => '#a32e2e',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/mail-log',
|
|
'label' => t('Queued emails'),
|
|
'count' => (string) $mailLogQueuedCount,
|
|
'icon' => 'bi bi-envelope-paper-fill',
|
|
'iconBg' => '#fff2d9',
|
|
'iconColor' => '#9a5a00',
|
|
]);
|
|
?>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<h4>
|
|
<?php e(t('Last 24 hours')); ?>
|
|
</h4>
|
|
<div class="app-tiles">
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/mail-log?created_from=' . urlencode($date24hAgo ?? '') . '&created_to=' . urlencode($dateToday ?? ''),
|
|
'label' => t('Total (24h)'),
|
|
'count' => (string) $mailLogTotal24hCount,
|
|
'icon' => 'bi bi-envelope-fill',
|
|
'iconBg' => '#e9f0ff',
|
|
'iconColor' => '#264db3',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/mail-log?status=sent&created_from=' . urlencode($date24hAgo ?? '') . '&created_to=' . urlencode($dateToday ?? ''),
|
|
'label' => t('Sent (24h)'),
|
|
'count' => (string) $mailLogSent24hCount,
|
|
'icon' => 'bi bi-envelope-check-fill',
|
|
'iconBg' => '#d9f2e6',
|
|
'iconColor' => '#1f6a3a',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/mail-log?status=failed&created_from=' . urlencode($date24hAgo ?? '') . '&created_to=' . urlencode($dateToday ?? ''),
|
|
'label' => t('Failed (24h)'),
|
|
'count' => (string) $mailLogFailed24hCount,
|
|
'icon' => 'bi bi-envelope-x-fill',
|
|
'iconBg' => '#ffe9e9',
|
|
'iconColor' => '#a32e2e',
|
|
]);
|
|
?>
|
|
<?php
|
|
MintyPHP\Support\Tile::render([
|
|
'href' => 'admin/mail-log?status=queued&created_from=' . urlencode($date24hAgo ?? '') . '&created_to=' . urlencode($dateToday ?? ''),
|
|
'label' => t('Queued (24h)'),
|
|
'count' => (string) $mailLogQueued24hCount,
|
|
'icon' => 'bi bi-envelope-paper-fill',
|
|
'iconBg' => '#fff2d9',
|
|
'iconColor' => '#9a5a00',
|
|
]);
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|