Files
MoneyFlix/crm/Views/components/notification-bell.php
1sonhador 9d43854277 feat: Initial MoneyFlix project setup
- Created separate MoneyFlix project directory
- Copied Node.js redirector from production server
- Added CRM PHP code (Redirects module, Core classes, Config, Routes, Views)
- Created comprehensive documentation (README_MONEYFLIX.md)
- Added sync script to keep CRM code updated (sync-from-crm.sh)
- Configured .gitignore for Node.js and PHP
- Set up proper project structure for multi-client isolation

This separates MoneyFlix from the main CRM to avoid confusion
between different client systems and provides a dedicated
environment for MoneyFlix-specific development and maintenance.
2025-10-03 12:09:41 +01:00

119 lines
7.7 KiB
PHP

<?php
declare(strict_types=1);
use App\Core\View;
// Contadores de alertas do sistema
$systemAlertsCount = $alertStats['total'] ?? 0;
$monitoringIssuesCount = ($alertStats['by_category']['security'] ?? 0) + ($alertStats['by_category']['errors'] ?? 0);
// Contagens para os itens específicos na aba de monitorização
$activeSystemAlerts = $alertStats['total'] ?? 0;
$recentErrors = $alertStats['by_category']['errors'] ?? 0;
?>
<!-- Notification Bell Component -->
<div class="dropdown topbar-head-dropdown ms-1 header-item">
<button type="button" class="btn btn-icon btn-topbar btn-ghost-secondary rounded-circle" id="page-header-notifications-dropdown" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-haspopup="true" aria-expanded="false">
<i class='bx bx-bell fs-22'></i>
<?php if($systemAlertsCount > 0): ?>
<span class="position-absolute topbar-badge fs-10 translate-middle badge rounded-pill bg-danger">
<?php echo $systemAlertsCount > 9 ? '9+' : $systemAlertsCount ?>
<span class="visually-hidden">notificações não lidas</span>
</span>
<?php endif; ?>
</button>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-end p-0" aria-labelledby="page-header-notifications-dropdown">
<div class="dropdown-head bg-primary bg-pattern rounded-top">
<div class="p-3">
<div class="row align-items-center">
<div class="col">
<h6 class="m-0 fs-16 fw-semibold text-white"> Notificações</h6>
</div>
<div class="col-auto dropdown-tabs">
<span class="badge bg-light-subtle text-light fs-13" id="top-notification-unread-count-text">
<?php echo $systemAlertsCount ?> Alertas por Rever
</span>
</div>
</div>
</div>
<div class="px-2 pt-2">
<ul class="nav nav-tabs dropdown-tabs nav-tabs-custom" data-dropdown-tabs="true" id="notificationItemsTab" role="tablist">
<li class="nav-item waves-effect waves-light"><a class="nav-link" data-bs-toggle="tab" href="#all-notifications-tab" role="tab">Todas (<span id="all-notifications-count">0</span>)</a></li>
<li class="nav-item waves-effect waves-light"><a class="nav-link" data-bs-toggle="tab" href="#alerts-tab" role="tab">Alertas (<span id="alerts-count"><?php echo $systemAlertsCount ?></span>)</a></li>
<li class="nav-item waves-effect waves-light"><a class="nav-link" data-bs-toggle="tab" href="#reminders-tab" role="tab">Lembretes (<span id="reminders-count">0</span>)</a></li>
<li class="nav-item waves-effect waves-light"><a class="nav-link active" data-bs-toggle="tab" href="#monitoring-tab" role="tab">
Monitorização
<?php if($monitoringIssuesCount > 0): ?>
<span class="badge bg-danger rounded-pill ms-1"><?php echo $monitoringIssuesCount ?></span>
<?php endif; ?>
</a></li>
</ul>
</div>
</div>
<div class="tab-content position-relative" id="notificationItemsTabContent">
<div class="tab-pane fade py-2 ps-2" id="all-notifications-tab" role="tabpanel">
<div data-simplebar style="max-height: 300px;" class="pe-2" id="all-notifications-list">
<!-- Conteúdo preenchido por notification-bell.js -->
</div>
</div>
<div class="tab-pane fade py-2 ps-2" id="alerts-tab" role="tabpanel">
<div data-simplebar style="max-height: 300px;" class="pe-2" id="alerts-list">
<div class="text-center p-3">
<h6 class="mt-2">Resumo dos Alertas</h6>
<p class="text-muted">Veja a aba de monitorização para detalhes.</p>
</div>
</div>
</div>
<div class="tab-pane fade py-2 ps-2" id="reminders-tab" role="tabpanel">
<div data-simplebar style="max-height: 300px;" class="pe-2" id="reminders-list">
<!-- Conteúdo preenchido por JS se necessário -->
</div>
</div>
<div class="tab-pane fade show active p-2" id="monitoring-tab" role="tabpanel">
<div class="p-2">
<div class="text-reset notification-item d-block dropdown-item position-relative">
<div class="d-flex">
<div class="avatar-xs me-3"><span class="avatar-title bg-soft-danger text-danger rounded-circle fs-16"><i class="bx bx-error"></i></span></div>
<div class="flex-grow-1">
<a href="/alerts" class="stretched-link"><h6 class="mt-0 mb-1 fs-13 fw-semibold">Alertas do Sistema</h6></a>
<p class="mb-0 fs-11 text-muted"><span><i class="mdi mdi-clock-outline"></i> <?php echo $activeSystemAlerts ?> alertas ativos</span></p>
</div>
</div>
</div>
<div class="text-reset notification-item d-block dropdown-item position-relative">
<div class="d-flex">
<div class="avatar-xs me-3"><span class="avatar-title bg-soft-info text-info rounded-circle fs-16"><i class="bx bx-file"></i></span></div>
<div class="flex-grow-1">
<a href="/logs" class="stretched-link"><h6 class="mt-0 mb-1 fs-13 fw-semibold">Logs do Sistema</h6></a>
<p class="mb-0 fs-11 text-muted"><span><i class="mdi mdi-clock-outline"></i> Visualizar logs</span></p>
</div>
</div>
</div>
<div class="text-reset notification-item d-block dropdown-item position-relative">
<div class="d-flex">
<div class="avatar-xs me-3"><span class="avatar-title bg-soft-warning text-warning rounded-circle fs-16"><i class="bx bx-error-circle"></i></span></div>
<div class="flex-grow-1">
<a href="/apps/logs/view/error" class="stretched-link"><h6 class="mt-0 mb-1 fs-13 fw-semibold">Erros Recentes</h6></a>
<p class="mb-0 fs-11 text-muted"><span><i class="mdi mdi-clock-outline"></i> <?php echo $recentErrors ?> erros hoje</span></p>
</div>
</div>
</div>
<?php if($systemAlertsCount > 0): ?>
<div class="my-2 text-center">
<a href="/alerts" class="btn btn-soft-warning btn-sm waves-effect waves-light">Ver Todos os Alertas <i class="ri-arrow-right-line align-middle"></i></a>
</div>
<?php endif; ?>
</div>
</div>
<div class="my-3 text-center view-all">
<?php if (\App\Core\ModuleConfig::getInstance()->isModuleActive('Crm', \App\Core\Branding::getClientId())): ?>
<a href="/apps/crm/notifications" type="button" class="btn btn-soft-success waves-effect waves-light">Ver Todas as Notificações <i class="ri-arrow-right-line align-middle"></i></a>
<?php else: ?>
<a href="/error-monitoring/dashboard" type="button" class="btn btn-soft-success waves-effect waves-light">Ver Todas as Notificações <i class="ri-arrow-right-line align-middle"></i></a>
<?php endif; ?>
</div>
</div>
</div>
</div>