update 2221
This commit is contained in:
parent
c5ac8e3c6e
commit
dcb1aa0c6b
@ -171,7 +171,7 @@ $page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int)$_GET['page'] :
|
||||
if ($page < 1) $page = 1;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$where_clauses = ["m.type = 'inbound'"];
|
||||
$where_clauses = ["1=1"];
|
||||
$params = [];
|
||||
|
||||
if ($search) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php if (isLoggedIn()): ?>
|
||||
</div><!-- Close main-content -->
|
||||
</main><!-- Close main-content -->
|
||||
<?php endif; ?>
|
||||
|
||||
<footer class="footer mt-auto py-4 bg-white border-top">
|
||||
@ -46,28 +46,6 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
||||
<!-- Main App JS -->
|
||||
<script src="assets/js/main.js?v=<?= time() ?>"></script>
|
||||
<script>
|
||||
// Sidebar Toggle for Mobile
|
||||
document.getElementById('sidebarToggle')?.addEventListener('click', function() {
|
||||
document.getElementById('sidebar').classList.toggle('show');
|
||||
});
|
||||
|
||||
// Theme Switcher
|
||||
const checkbox = document.getElementById('checkbox');
|
||||
if (checkbox) {
|
||||
checkbox.addEventListener('change', () => {
|
||||
const theme = checkbox.checked ? 'dark' : 'light';
|
||||
document.documentElement.setAttribute('data-bs-theme', theme);
|
||||
|
||||
// Save preference to database
|
||||
fetch('api/update_theme.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ theme: theme })
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
ob_start();
|
||||
ob_start(); error_reporting(E_ALL); ini_set("display_errors", 1);
|
||||
session_start();
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
|
||||
@ -99,10 +99,14 @@ if (isLoggedIn()) {
|
||||
'view' => (bool)$p['can_view'],
|
||||
'add' => (bool)$p['can_add'],
|
||||
'edit' => (bool)$p['can_edit'],
|
||||
'delete' => (bool)$p['can_delete']
|
||||
'delete' => (bool)$p['can_delete'],
|
||||
];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// User not found in DB but session exists - clean up
|
||||
session_destroy();
|
||||
redirect('login.php');
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,6 +175,7 @@ if (!isLoggedIn() && basename($_SERVER['PHP_SELF']) !== 'login.php' && basename(
|
||||
.sidebar .nav-link.active {
|
||||
border-right: 4px solid #0d6efd;
|
||||
}
|
||||
.logo-link:hover { opacity: 0.8; }
|
||||
.sidebar-heading {
|
||||
padding: 20px 20px 10px;
|
||||
font-size: 0.75rem;
|
||||
@ -213,11 +218,9 @@ if (!isLoggedIn() && basename($_SERVER['PHP_SELF']) !== 'login.php' && basename(
|
||||
display: inline-block;
|
||||
height: 24px;
|
||||
position: relative;
|
||||
width: 50px;
|
||||
}
|
||||
.theme-switch input {
|
||||
display:none;
|
||||
width: 48px;
|
||||
}
|
||||
.theme-switch input { display: none; }
|
||||
.slider {
|
||||
background-color: #ccc;
|
||||
bottom: 0;
|
||||
@ -240,13 +243,49 @@ if (!isLoggedIn() && basename($_SERVER['PHP_SELF']) !== 'login.php' && basename(
|
||||
width: 16px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
input:checked + .slider {
|
||||
background-color: #0d6efd;
|
||||
input:checked + .slider { background-color: #0d6efd; }
|
||||
input:checked + .slider:before { transform: translateX(24px); }
|
||||
.slider .fa-sun {
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 4px;
|
||||
font-size: 12px;
|
||||
color: #ffc107;
|
||||
opacity: 1;
|
||||
transition: .4s;
|
||||
}
|
||||
input:checked + .slider:before {
|
||||
transform: translateX(26px);
|
||||
.slider .fa-moon {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 4px;
|
||||
font-size: 12px;
|
||||
color: #f8f9fa;
|
||||
opacity: 0;
|
||||
transition: .4s;
|
||||
}
|
||||
input:checked + .slider .fa-sun { opacity: 0; }
|
||||
input:checked + .slider .fa-moon { opacity: 1; }
|
||||
|
||||
/* RTL specific tweaks */
|
||||
[dir="rtl"] .dropdown-menu { text-align: right; }
|
||||
[dir="rtl"] .ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
|
||||
[dir="rtl"] .me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
|
||||
[dir="rtl"] .me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
|
||||
</style>
|
||||
<script>
|
||||
function toggleSidebar() {
|
||||
document.getElementById('sidebar').classList.toggle('show');
|
||||
}
|
||||
function toggleTheme(checkbox) {
|
||||
const theme = checkbox.checked ? 'dark' : 'light';
|
||||
document.documentElement.setAttribute('data-bs-theme', theme);
|
||||
fetch('api/update_theme.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ theme: theme })
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -254,10 +293,12 @@ if (!isLoggedIn() && basename($_SERVER['PHP_SELF']) !== 'login.php' && basename(
|
||||
<!-- Sidebar -->
|
||||
<div class="sidebar d-flex flex-column" id="sidebar">
|
||||
<div class="p-3 text-center border-bottom border-secondary">
|
||||
<?php if ($sys_settings['site_logo']): ?>
|
||||
<a href="index.php" class="text-decoration-none text-white d-block logo-link">
|
||||
<?php if (!empty($sys_settings['site_logo'])): ?>
|
||||
<img src="<?= $sys_settings['site_logo'] ?>" alt="Logo" class="img-fluid mb-2" style="max-height: 50px;">
|
||||
<?php endif; ?>
|
||||
<h5 class="mb-0 fw-bold"><?= htmlspecialchars($sys_settings['site_name']) ?></h5>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<ul class="nav flex-column mt-3 mb-4">
|
||||
@ -301,23 +342,15 @@ if (!isLoggedIn() && basename($_SERVER['PHP_SELF']) !== 'login.php' && basename(
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="sidebar-heading">التقارير</div>
|
||||
<?php if (canView('reports')): ?>
|
||||
<div class="sidebar-heading">التقارير</div>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'overdue_report.php' ? 'active' : '' ?>" href="overdue_report.php">
|
||||
<i class="fas fa-clock me-2"></i> بريد متأخر
|
||||
<i class="fas fa-exclamation-circle me-2"></i> تقرير التأخير
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (canView('inbound')): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= (basename($_SERVER['PHP_SELF']) == 'inbound.php' && isset($_GET['my_tasks'])) ? 'active' : '' ?>" href="inbound.php?my_tasks=1">
|
||||
<i class="fas fa-tasks me-2"></i> مهامي الحالية
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (canView('users') || canView('settings')): ?>
|
||||
<div class="sidebar-heading">الإدارة</div>
|
||||
<?php endif; ?>
|
||||
@ -329,74 +362,64 @@ if (!isLoggedIn() && basename($_SERVER['PHP_SELF']) !== 'login.php' && basename(
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<?php if (canView('settings')): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= (basename($_SERVER['PHP_SELF']) == 'charity-settings.php' && !isset($_GET['tab'])) ? 'active' : '' ?>" href="charity-settings.php" onclick="localStorage.setItem('activeSettingsTab', '#general');">
|
||||
<i class="fas fa-cog me-2"></i> الإعدادات
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="charity-settings.php#logs" onclick="localStorage.setItem('activeSettingsTab', '#logs'); if(location.pathname.includes('charity-settings.php')) location.hash='#logs';">
|
||||
<i class="fas fa-history me-2"></i> سجل المراسلات
|
||||
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'charity-settings.php' ? 'active' : '' ?>" href="charity-settings.php">
|
||||
<i class="fas fa-cog me-2"></i> إعدادات النظام
|
||||
</a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="sidebar-heading">الحساب</div>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'profile.php' ? 'active' : '' ?>" href="profile.php">
|
||||
<i class="fas fa-user-circle me-2"></i> الملف الشخصي
|
||||
</a>
|
||||
</li>
|
||||
|
||||
<!-- Theme Switcher -->
|
||||
<li class="nav-item mt-4 px-3">
|
||||
<div class="d-flex align-items-center justify-content-between text-secondary small">
|
||||
<span>الوضع الليلي</span>
|
||||
<label class="theme-switch" for="checkbox">
|
||||
<input type="checkbox" id="checkbox" <?= $user_theme === 'dark' ? 'checked' : '' ?> />
|
||||
<div class="slider"></div>
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li class="nav-item mt-auto border-top border-secondary">
|
||||
<a class="nav-link text-danger" href="logout.php">
|
||||
<i class="fas fa-sign-out-alt me-2"></i> تسجيل الخروج
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="mt-auto p-3 text-center opacity-50 small">
|
||||
© <?= date('Y') ?> <?= htmlspecialchars($sys_settings['site_name']) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Top Navbar -->
|
||||
<nav class="navbar navbar-expand navbar-light top-navbar sticky-top">
|
||||
<div class="container-fluid">
|
||||
<button class="btn btn-outline-secondary d-lg-none me-2" id="sidebarToggle">
|
||||
<nav class="navbar navbar-expand-lg top-navbar sticky-top p-0 shadow-sm">
|
||||
<div class="container-fluid px-3">
|
||||
<button class="btn d-lg-none" type="button" onclick="toggleSidebar()">
|
||||
<i class="fas fa-bars"></i>
|
||||
</button>
|
||||
|
||||
<div class="ms-auto d-flex align-items-center">
|
||||
<!-- Theme Switcher -->
|
||||
<div class="theme-switch-wrapper me-3">
|
||||
<label class="theme-switch" for="checkbox">
|
||||
<input type="checkbox" id="checkbox" <?= $user_theme === 'dark' ? 'checked' : '' ?> onchange="toggleTheme(this)">
|
||||
<div class="slider">
|
||||
<i class="fas fa-sun"></i>
|
||||
<i class="fas fa-moon"></i>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<a class="nav-link dropdown-toggle d-flex align-items-center" href="#" role="button" data-bs-toggle="dropdown">
|
||||
<?php if (isset($current_user['profile_image']) && $current_user['profile_image']): ?>
|
||||
<img src="<?= $current_user['profile_image'] ?>" alt="Profile" class="rounded-circle me-2 shadow-sm" style="width: 32px; height: 32px; object-fit: cover;">
|
||||
<button class="btn d-flex align-items-center dropdown-toggle border-0" type="button" id="userMenu" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<div class="text-end me-2 d-none d-md-block">
|
||||
<div class="fw-bold small"><?= htmlspecialchars($_SESSION['name'] ?? 'المستخدم') ?></div>
|
||||
<div class="text-muted" style="font-size: 0.7rem;"><?= ucfirst($_SESSION['user_role'] ?? 'موظف') ?></div>
|
||||
</div>
|
||||
<?php if (!empty($current_user['profile_image'])): ?>
|
||||
<img src="<?= $current_user['profile_image'] ?>" alt="Profile" class="rounded-circle" width="35" height="35" style="object-fit: cover;">
|
||||
<?php else: ?>
|
||||
<div class="<?= isSuperAdmin() ? 'bg-danger' : 'bg-primary' ?> text-white rounded-circle d-flex align-items-center justify-content-center me-2" style="width: 32px; height: 32px; font-size: 0.8rem;">
|
||||
<?= mb_substr($_SESSION['name'] ?? 'U', 0, 1) ?>
|
||||
<div class="rounded-circle bg-primary bg-opacity-10 d-flex align-items-center justify-content-center" style="width: 35px; height: 35px;">
|
||||
<i class="fas fa-user text-primary"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<span class="d-none d-md-inline"><?= htmlspecialchars($_SESSION['name'] ?? 'المستخدم') ?> <?= isSuperAdmin() ? '<small class="badge bg-danger ms-1">مدير خارق</small>' : '' ?></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a class="dropdown-item" href="profile.php"><i class="fas fa-user me-2"></i> الملف الشخصي</a></li>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end shadow border-0" aria-labelledby="userMenu">
|
||||
<li><a class="dropdown-item" href="profile.php"><i class="fas fa-user-circle me-2 text-muted"></i> ملفي الشخصي</a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item text-danger" href="logout.php"><i class="fas fa-sign-out-alt me-2"></i> خروج</a></li>
|
||||
<li><a class="dropdown-item text-danger" href="logout.php"><i class="fas fa-sign-out-alt me-2"></i> تسجيل الخروج</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="main-content">
|
||||
<?php endif; ?>
|
||||
<!-- Main Content -->
|
||||
<main class="main-content">
|
||||
<?php endif; ?>
|
||||
|
||||
@ -27,8 +27,6 @@ foreach ($statuses_data as $id => $s) {
|
||||
$in_progress_count = 0;
|
||||
if ($in_progress_id) {
|
||||
if (canView('inbound')) {
|
||||
$in_progress_count += db()->prepare("SELECT COUNT(*) FROM inbound_mail WHERE status_id = ?")->execute([$in_progress_id]) ? db()->prepare("SELECT COUNT(*) FROM inbound_mail WHERE status_id = ?")->execute([$in_progress_id]) : 0;
|
||||
// Wait, execute returns bool.
|
||||
$stmt = db()->prepare("SELECT COUNT(*) FROM inbound_mail WHERE status_id = ?");
|
||||
$stmt->execute([$in_progress_id]);
|
||||
$in_progress_count += $stmt->fetchColumn();
|
||||
|
||||
@ -17,7 +17,7 @@ $limit = 10;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$params = [$user_id];
|
||||
$where = "m.type = 'internal' AND m.assigned_to = ?";
|
||||
$where = "1=1 AND m.assigned_to = ?";
|
||||
|
||||
if ($search) {
|
||||
$where .= " AND (m.subject LIKE ? OR m.description LIKE ? OR u_sender.full_name LIKE ?)";
|
||||
|
||||
@ -107,7 +107,7 @@ $limit = 10;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$params = [$user_id];
|
||||
$where = "m.type = 'internal' AND m.created_by = ?";
|
||||
$where = "1=1 AND m.created_by = ?";
|
||||
|
||||
if ($search) {
|
||||
$where .= " AND (m.subject LIKE ? OR m.description LIKE ? OR u_recp.full_name LIKE ?)";
|
||||
|
||||
@ -38,10 +38,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-body p-4">
|
||||
<div class="text-center mb-4">
|
||||
<a href="index.php" class="text-decoration-none text-dark d-block">
|
||||
<?php if (!empty($sys_settings['site_logo'])): ?>
|
||||
<img src="<?php echo htmlspecialchars($sys_settings['site_logo']); ?>" alt="Logo" class="img-fluid mb-3" style="max-height: 80px;">
|
||||
<?php endif; ?>
|
||||
<h4 class="fw-bold mb-0"><?php echo htmlspecialchars($sys_settings['site_name']); ?></h4>
|
||||
</a>
|
||||
<p class="text-muted small">يرجى إدخال بيانات الاعتماد الخاصة بك</p>
|
||||
</div>
|
||||
|
||||
|
||||
@ -87,7 +87,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
db()->beginTransaction();
|
||||
if ($action === 'add') {
|
||||
$stmt = db()->prepare("INSERT INTO outbound_mail (ref_no, date_registered, due_date, sender, recipient, subject, description, status_id, assigned_to, created_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$$ref_no, $date_registered, $due_date, $sender, $recipient, $subject, $description, $status_id, $assigned_to, $user_id]);
|
||||
$stmt->execute([$ref_no, $date_registered, $due_date, $sender, $recipient, $subject, $description, $status_id, $assigned_to, $user_id]);
|
||||
$mail_id = db()->lastInsertId();
|
||||
|
||||
if ($assigned_to) {
|
||||
@ -184,7 +184,7 @@ $page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int)$_GET['page'] :
|
||||
if ($page < 1) $page = 1;
|
||||
$offset = ($page - 1) * $limit;
|
||||
|
||||
$where_clauses = ["m.type = 'outbound'"];
|
||||
$where_clauses = ["1=1"];
|
||||
$params = [];
|
||||
|
||||
if ($search) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user