114 lines
4.3 KiB
PHP
114 lines
4.3 KiB
PHP
<?php
|
|
session_start();
|
|
require_once __DIR__ . '/../db/config.php';
|
|
|
|
function isLoggedIn() {
|
|
return isset($_SESSION['user_id']);
|
|
}
|
|
|
|
function isAdmin() {
|
|
return isset($_SESSION['user_role']) && $_SESSION['user_role'] === 'admin';
|
|
}
|
|
|
|
function redirect($path) {
|
|
header("Location: $path");
|
|
exit;
|
|
}
|
|
|
|
if (!isLoggedIn() && basename($_SERVER['PHP_SELF']) !== 'login.php') {
|
|
redirect('login.php');
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="ar" dir="rtl">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>بريد الجمعية الخيرية</title>
|
|
<!-- Bootstrap 5 RTL CSS -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.rtl.min.css">
|
|
<!-- Google Fonts: Cairo -->
|
|
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap" rel="stylesheet">
|
|
<!-- Font Awesome -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
<style>
|
|
body {
|
|
font-family: 'Cairo', sans-serif;
|
|
background-color: #f8f9fa;
|
|
}
|
|
.sidebar {
|
|
min-height: 100vh;
|
|
background: #fff;
|
|
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
|
padding-top: 2rem;
|
|
}
|
|
.nav-link {
|
|
color: #333;
|
|
font-weight: 600;
|
|
padding: 0.8rem 1.5rem;
|
|
}
|
|
.nav-link:hover, .nav-link.active {
|
|
background-color: #f0f7ff;
|
|
color: #0d6efd;
|
|
border-left: 4px solid #0d6efd;
|
|
}
|
|
.card {
|
|
border: none;
|
|
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
|
border-radius: 10px;
|
|
}
|
|
.btn-primary {
|
|
background-color: #0d6efd;
|
|
border: none;
|
|
}
|
|
.status-received { background-color: #e9ecef; color: #495057; }
|
|
.status-in_progress { background-color: #cff4fc; color: #055160; }
|
|
.status-closed { background-color: #d1e7dd; color: #0f5132; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<?php if (isLoggedIn()): ?>
|
|
<!-- Sidebar -->
|
|
<nav class="col-md-3 col-lg-2 d-md-block sidebar collapse">
|
|
<div class="position-sticky">
|
|
<div class="text-center mb-4">
|
|
<h5 class="fw-bold">بريد الجمعية</h5>
|
|
</div>
|
|
<ul class="nav flex-column">
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : '' ?>" href="index.php">
|
|
<i class="fas fa-home me-2"></i> لوحة التحكم
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'inbound.php' ? 'active' : '' ?>" href="inbound.php">
|
|
<i class="fas fa-download me-2"></i> البريد الوارد
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'outbound.php' ? 'active' : '' ?>" href="outbound.php">
|
|
<i class="fas fa-upload me-2"></i> البريد الصادر
|
|
</a>
|
|
</li>
|
|
<?php if (isAdmin()): ?>
|
|
<li class="nav-item">
|
|
<a class="nav-link <?= basename($_SERVER['PHP_SELF']) == 'users.php' ? 'active' : '' ?>" href="users.php">
|
|
<i class="fas fa-users me-2"></i> إدارة المستخدمين
|
|
</a>
|
|
</li>
|
|
<?php endif; ?>
|
|
<li class="nav-item mt-5">
|
|
<a class="nav-link text-danger" href="logout.php">
|
|
<i class="fas fa-sign-out-alt me-2"></i> تسجيل الخروج
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
<?php endif; ?>
|
|
|
|
<main class="<?= isLoggedIn() ? 'col-md-9 ms-sm-auto col-lg-10' : 'col-12' ?> px-md-4 py-4">
|