Commit a03e3d0d authored by Mahmoud Aglan's avatar Mahmoud Aglan

kkookkokoko

parent 01cb0797
<?php <?php
/** /**
* Alerts component — reads flash alerts from session and displays them. * Flash alert messages component.
* Bulletproof: will never crash, never kill the page.
*/ */
$__alertList = []; $session = \App\Core\App::getInstance()->session();
try { $alerts = $session->getAlerts();
if (isset($_SESSION['_flash']['_alerts']) && is_array($_SESSION['_flash']['_alerts'])) {
$__alertList = $_SESSION['_flash']['_alerts'];
unset($_SESSION['_flash']['_alerts']);
} elseif (isset($_SESSION['_alerts']) && is_array($_SESSION['_alerts'])) {
$__alertList = $_SESSION['_alerts'];
unset($_SESSION['_alerts']);
}
} catch (\Throwable $__e) {
$__alertList = [];
}
foreach ($__alertList as $__a): if (empty($alerts)) {
$__type = $__a['type'] ?? 'info'; return;
$__msg = $__a['message'] ?? ''; }
if ($__msg === '') continue;
?> ?>
<div class="alert alert-<?= e($__type) ?>"><?= e($__msg) ?></div> <?php foreach ($alerts as $alert): ?>
<?php
$type = $alert['type'] ?? 'info';
$message = $alert['message'] ?? '';
$bgColor = match($type) {
'success' => '#F0FDF4',
'error' => '#FEF2F2',
'warning' => '#FFF7ED',
'info' => '#EFF6FF',
default => '#F9FAFB',
};
$textColor = match($type) {
'success' => '#059669',
'error' => '#DC2626',
'warning' => '#D97706',
'info' => '#0284C7',
default => '#6B7280',
};
$borderColor = match($type) {
'success' => '#BBF7D0',
'error' => '#FECACA',
'warning' => '#FED7AA',
'info' => '#BFDBFE',
default => '#E5E7EB',
};
$icon = match($type) {
'success' => '✓',
'error' => '✗',
'warning' => '⚠',
'info' => 'ℹ',
default => '',
};
?>
<div class="alert alert-<?= $type ?>" style="background:<?= $bgColor ?>;color:<?= $textColor ?>;border:1px solid <?= $borderColor ?>;padding:12px 20px;border-radius:8px;margin:0 25px 15px;font-size:14px;display:flex;justify-content:space-between;align-items:center;">
<span><?= $icon ?> <?= e($message) ?></span>
<button onclick="this.parentElement.remove()" style="background:none;border:none;cursor:pointer;font-size:18px;color:<?= $textColor ?>;opacity:0.6;padding:0 5px;">&times;</button>
</div>
<?php endforeach; ?> <?php endforeach; ?>
\ No newline at end of file
This diff is collapsed.
<?php
use App\Core\CSRF;
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ar" dir="rtl"> <html lang="ar" dir="rtl">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php $__template->yield('title', 'تسجيل الدخول'); ?> — نادي النادي</title> <meta name="csrf-token" content="<?= e(CSRF::token()) ?>">
<link rel="preconnect" href="https://fonts.googleapis.com"> <title><?= $__template->yield('title', 'تسجيل الدخول') ?> — نادي النادي شيراتون</title>
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="<?= url('assets/css/main.css') ?>"> <link rel="stylesheet" href="<?= url('assets/css/main.css') ?>">
<style> <style>
body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0D7377 0%, #1A1A2E 100%); padding: 20px; } body {
.auth-card { background: #fff; border-radius: 12px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); } display: flex;
.auth-logo { text-align: center; margin-bottom: 30px; } justify-content: center;
.auth-logo h1 { font-size: 24px; color: #0D7377; margin: 0; } align-items: center;
.auth-logo p { color: #6B7280; font-size: 13px; margin-top: 5px; } min-height: 100vh;
@media (max-width: 480px) { margin: 0;
.auth-card { padding: 25px 20px; } background: linear-gradient(135deg, #1A1A2E 0%, #0D7377 100%);
.auth-logo h1 { font-size: 20px; } font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
direction: rtl;
}
.auth-card {
background: #fff;
border-radius: 12px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
padding: 40px;
width: 100%;
max-width: 420px;
}
.auth-header {
text-align: center;
margin-bottom: 30px;
}
.auth-header h1 {
color: #0D7377;
font-size: 24px;
margin: 0 0 5px;
}
.auth-header p {
color: #6B7280;
font-size: 14px;
margin: 0;
} }
</style> </style>
</head> </head>
<body> <body>
<div class="auth-card"> <div class="auth-card">
<div class="auth-logo"> <div class="auth-header">
<h1>🏛️ THE CLUB</h1> <h1>نادي النادي شيراتون</h1>
<p>نادي النادي شيراتون — Sports City</p> <p>THE CLUB Sheraton</p>
</div> </div>
<?php <?php
// Inline alert reading — no includes, no method calls that can crash $session = \App\Core\App::getInstance()->session();
$__alertList = []; $alerts = $session->getAlerts();
try { if (!empty($alerts)):
if (isset($_SESSION['_flash']['_alerts']) && is_array($_SESSION['_flash']['_alerts'])) { foreach ($alerts as $alert):
$__alertList = $_SESSION['_flash']['_alerts']; ?>
unset($_SESSION['_flash']['_alerts']); <div style="padding:10px 15px;border-radius:6px;margin-bottom:15px;font-size:13px;
} elseif (isset($_SESSION['_alerts']) && is_array($_SESSION['_alerts'])) { background:<?= ($alert['type'] ?? '') === 'error' ? '#FEF2F2' : '#F0FDF4' ?>;
$__alertList = $_SESSION['_alerts']; color:<?= ($alert['type'] ?? '') === 'error' ? '#DC2626' : '#059669' ?>;
unset($_SESSION['_alerts']); border:1px solid <?= ($alert['type'] ?? '') === 'error' ? '#FECACA' : '#BBF7D0' ?>;">
} <?= e($alert['message'] ?? '') ?>
} catch (\Throwable $__e) {} </div>
foreach ($__alertList as $__a): <?php
$__type = $__a['type'] ?? 'info'; endforeach;
$__msg = $__a['message'] ?? ''; endif;
if ($__msg === '') continue;
?> ?>
<div class="alert alert-<?= e($__type) ?>" style="margin-bottom:15px;"><?= e($__msg) ?></div>
<?php endforeach; ?>
<?php $__template->yield('content'); ?> <?= $__template->yield('content', '') ?>
</div> </div>
</body> </body>
</html> </html>
\ No newline at end of file
<?php
/**
* Main application layout — RTL Arabic-first.
* All authenticated pages use this layout.
*/
use App\Core\App;
use App\Core\CSRF;
$app = App::getInstance();
$employee = $app->currentEmployee();
$employeeName = $employee ? ($employee->full_name_ar ?? 'مستخدم') : 'زائر';
$currentPath = parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH);
?>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ar" dir="rtl"> <html lang="ar" dir="rtl">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php $__template->yield('title', 'النظام'); ?> — نادي النادي</title> <meta name="csrf-token" content="<?= e(CSRF::token()) ?>">
<link rel="preconnect" href="https://fonts.googleapis.com"> <title><?= $__template->yield('title', 'لوحة التحكم') ?> — نادي النادي شيراتون</title>
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap" rel="stylesheet"> <link rel="stylesheet" href="<?= url('assets/css/main.css') ?>">
<link rel="stylesheet" href="<?= url('assets/css/main.css') ?>?v=<?= @filemtime(App\Core\App::getInstance()->basePath() . '/public/assets/css/main.css') ?>"> <?= $__template->yield('styles', '') ?>
</head> </head>
<body> <body>
<div class="app-layout"> <!-- Sidebar -->
<div class="sidebar-overlay" id="sidebarOverlay"></div> <aside class="sidebar" id="sidebar">
<?php $__template->include('Shared.Components.sidebar'); ?> <?php $__template->include('Shared.Components.sidebar'); ?>
</aside>
<div class="main-wrapper"> <!-- Main Wrapper -->
<header class="main-header"> <div class="main-wrapper" id="main-wrapper">
<div style="display:flex;align-items:center;gap:12px;">
<button class="hamburger-btn" id="hamburgerBtn" aria-label="القائمة"></button> <!-- Top Header -->
<h1 class="page-title"><?php $__template->yield('title', 'لوحة التحكم'); ?></h1> <header class="top-header">
<div class="header-right">
<button class="sidebar-toggle-btn" onclick="toggleSidebar()"></button>
<div class="header-title">
<h1><?= $__template->yield('title', 'لوحة التحكم') ?></h1>
</div>
</div> </div>
<div class="page-actions"> <div class="header-left">
<?php $__template->yield('page_actions', ''); ?> <?= $__template->yield('page_actions', '') ?>
<div class="user-info"> <div class="header-user">
<?php <span class="header-user-name"><?= e($employeeName) ?></span>
$__employee = \App\Core\App::getInstance()->currentEmployee(); <a href="/logout" class="header-logout" title="تسجيل الخروج">🚪</a>
if ($__employee):
?>
<span class="user-name-text"><?= e($__employee->full_name_ar ?? '') ?></span>
<a href="/logout" class="btn btn-sm btn-outline" style="color:var(--red);border-color:var(--red);">خروج</a>
<?php endif; ?>
</div> </div>
</div> </div>
</header> </header>
<?php <!-- Alerts -->
// Inline alert reading — direct $_SESSION access, zero method calls <?php $__template->include('Shared.Components.alerts'); ?>
$__alertList = [];
try {
if (isset($_SESSION['_flash']['_alerts']) && is_array($_SESSION['_flash']['_alerts'])) {
$__alertList = $_SESSION['_flash']['_alerts'];
unset($_SESSION['_flash']['_alerts']);
} elseif (isset($_SESSION['_alerts']) && is_array($_SESSION['_alerts'])) {
$__alertList = $_SESSION['_alerts'];
unset($_SESSION['_alerts']);
}
} catch (\Throwable $__e) {}
if (!empty($__alertList)):
?>
<div style="padding:15px 25px 0;">
<?php foreach ($__alertList as $__a):
$__type = $__a['type'] ?? 'info';
$__msg = $__a['message'] ?? '';
if ($__msg === '') continue;
?>
<div class="alert alert-<?= e($__type) ?>"><?= e($__msg) ?></div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<main class="main-content"> <!-- Page Content -->
<?php $__template->yield('content'); ?> <main class="page-content">
<?= $__template->yield('content', '') ?>
</main> </main>
</div>
<!-- Footer -->
<footer class="page-footer">
<span>نادي النادي شيراتون &copy; <?= date('Y') ?></span>
<span>الإصدار 1.0.0</span>
<span><?= arabic_date(date('Y-m-d')) ?></span>
</footer>
</div> </div>
<script src="<?= url('assets/js/app.js') ?>"></script> <script src="<?= url('assets/js/app.js') ?>"></script>
<script> <script>
(function() { function toggleSidebar() {
var sidebar = document.querySelector('.sidebar'); var sb = document.getElementById('sidebar');
var overlay = document.getElementById('sidebarOverlay'); var mw = document.getElementById('main-wrapper');
var hamburger = document.getElementById('hamburgerBtn'); sb.classList.toggle('collapsed');
mw.classList.toggle('sidebar-collapsed');
function openSidebar() { }
sidebar.classList.add('open'); function toggleSubmenu(el) {
overlay.classList.add('active'); var parent = el.parentElement;
document.body.style.overflow = 'hidden'; var submenu = parent.querySelector('.sidebar-submenu');
} if (submenu) {
function closeSidebar() { var isOpen = submenu.style.display === 'block';
sidebar.classList.remove('open'); submenu.style.display = isOpen ? 'none' : 'block';
overlay.classList.remove('active'); parent.classList.toggle('open', !isOpen);
document.body.style.overflow = '';
}
if (hamburger) {
hamburger.addEventListener('click', function(e) {
e.stopPropagation();
if (sidebar.classList.contains('open')) {
closeSidebar();
} else {
openSidebar();
}
});
}
if (overlay) {
overlay.addEventListener('click', closeSidebar);
}
var sidebarLinks = sidebar ? sidebar.querySelectorAll('.sidebar-link') : [];
sidebarLinks.forEach(function(link) {
link.addEventListener('click', function() {
if (window.innerWidth <= 768) {
closeSidebar();
}
});
});
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') closeSidebar();
});
window.addEventListener('resize', function() {
if (window.innerWidth > 768) {
closeSidebar();
} }
}); }
})();
</script> </script>
<?php $__template->yield('scripts', ''); ?> <?= $__template->yield('scripts', '') ?>
</body> </body>
</html> </html>
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment