Autosave: 20260213-103515
This commit is contained in:
parent
6d57961985
commit
6bc3920550
52
admin/admin.css
Normal file
52
admin/admin.css
Normal file
@ -0,0 +1,52 @@
|
||||
:root {
|
||||
--sidebar-width: 260px;
|
||||
--primary-color: #059669;
|
||||
}
|
||||
body { background-color: #f3f4f6; }
|
||||
|
||||
/* Sidebar English / LTR */
|
||||
[dir="ltr"] .sidebar {
|
||||
width: var(--sidebar-width);
|
||||
height: 100vh;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background: #111827;
|
||||
color: #fff;
|
||||
padding: 1.5rem;
|
||||
z-index: 1000;
|
||||
}
|
||||
[dir="ltr"] .main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
|
||||
/* Sidebar Arabic / RTL */
|
||||
[dir="rtl"] .sidebar {
|
||||
width: var(--sidebar-width);
|
||||
height: 100vh;
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 0;
|
||||
background: #111827;
|
||||
color: #fff;
|
||||
padding: 1.5rem;
|
||||
z-index: 1000;
|
||||
}
|
||||
[dir="rtl"] .main-content { margin-right: var(--sidebar-width); padding: 2rem; }
|
||||
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
.stat-card { padding: 1.5rem; }
|
||||
.stat-icon { font-size: 2rem; color: var(--primary-color); }
|
||||
.badge-pending { background-color: #fef3c7; color: #92400e; }
|
||||
.badge-completed { background-color: #d1fae5; color: #065f46; }
|
||||
.badge-failed { background-color: #fee2e2; color: #991b1b; }
|
||||
.chart-container { height: 300px; position: relative; }
|
||||
|
||||
.badge-super_admin { background-color: #059669; }
|
||||
.badge-org_admin { background-color: #3b82f6; }
|
||||
|
||||
/* Arabic font fallback */
|
||||
[dir="rtl"] body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
}
|
||||
@ -3,9 +3,16 @@ require_once 'auth.php';
|
||||
require_once '../db/config.php';
|
||||
require_login();
|
||||
|
||||
if (!is_super_admin()) {
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$user = get_user();
|
||||
$pdo = db();
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
|
||||
// Fetch audit logs with user info
|
||||
$logs = $pdo->query("
|
||||
SELECT l.*, u.email as user_email
|
||||
@ -16,33 +23,30 @@ $logs = $pdo->query("
|
||||
")->fetchAll();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Audit Logs - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('audit_logs') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
</style>
|
||||
<link rel="stylesheet" href="admin.css?v=<?= time() ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php include "sidebar.php"; ?>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2 class="mb-0">Activity Audit Logs</h2>
|
||||
<h2 class="mb-0"><?= __('audit_logs') ?></h2>
|
||||
</div>
|
||||
|
||||
<div class="card p-0">
|
||||
@ -50,17 +54,17 @@ $logs = $pdo->query("
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-4">User</th>
|
||||
<th>Action</th>
|
||||
<th>Details</th>
|
||||
<th>Date</th>
|
||||
<th class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>"><?= __('users') ?></th>
|
||||
<th><?= __('Actions') ?></th>
|
||||
<th><?= __('Details') ?></th>
|
||||
<th><?= __('date') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($logs as $log): ?>
|
||||
<tr>
|
||||
<td class="ps-4">
|
||||
<strong><?= htmlspecialchars($log['user_email'] ?? 'System/Unknown') ?></strong>
|
||||
<td class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>">
|
||||
<strong><?= htmlspecialchars($log['user_email'] ?? __('System/Unknown')) ?></strong>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge bg-secondary rounded-pill"><?= htmlspecialchars($log['action']) ?></span>
|
||||
@ -71,7 +75,7 @@ $logs = $pdo->query("
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($logs)): ?>
|
||||
<tr>
|
||||
<td colspan="4" class="text-center py-4 text-muted">No logs found.</td>
|
||||
<td colspan="4" class="text-center py-4 text-muted"><?= __('No logs found.') ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
@ -79,5 +83,6 @@ $logs = $pdo->query("
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@ -5,6 +5,7 @@ if (session_status() === PHP_SESSION_NONE) {
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
require_once __DIR__ . '/i18n.php';
|
||||
|
||||
/**
|
||||
* Check if the user is logged in
|
||||
@ -71,10 +72,13 @@ function get_org_name() {
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$profile = $pdo->query("SELECT name_en FROM org_profile LIMIT 1")->fetch();
|
||||
if ($profile && !empty($profile['name_en'])) {
|
||||
$_SESSION['org_name'] = $profile['name_en'];
|
||||
return $profile['name_en'];
|
||||
$profile = $pdo->query("SELECT name_en, name_ar FROM org_profile LIMIT 1")->fetch();
|
||||
if ($profile) {
|
||||
$name = (get_current_lang() === 'ar' && !empty($profile['name_ar'])) ? $profile['name_ar'] : $profile['name_en'];
|
||||
if (!empty($name)) {
|
||||
$_SESSION['org_name'] = $name;
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
|
||||
117
admin/cases.php
117
admin/cases.php
@ -46,7 +46,7 @@ if (isset($_GET['delete'])) {
|
||||
}
|
||||
|
||||
// Fetch cases
|
||||
$cases = $pdo->query("SELECT c.*, cat.name_en as cat_name FROM cases c LEFT JOIN categories cat ON c.category_id = cat.id ORDER BY c.id DESC")->fetchAll();
|
||||
$cases = $pdo->query("SELECT c.*, cat.name_en as cat_name_en, cat.name_ar as cat_name_ar FROM cases c LEFT JOIN categories cat ON c.category_id = cat.id ORDER BY c.id DESC")->fetchAll();
|
||||
$categories = $pdo->query("SELECT * FROM categories")->fetchAll();
|
||||
|
||||
// Handle Add/Edit
|
||||
@ -105,27 +105,26 @@ if (isset($_GET['edit'])) {
|
||||
$stmt->execute([$id]);
|
||||
$edit_case = $stmt->fetch();
|
||||
}
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Manage Cases - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('Manage Cases') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
.badge-urgent { background-color: #ef4444; }
|
||||
.badge-top_priority { background-color: #8b5cf6; }
|
||||
.badge-normal { background-color: #6b7280; }
|
||||
@ -137,15 +136,15 @@ if (isset($_GET['edit'])) {
|
||||
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Manage Donation Cases</h2>
|
||||
<h2><?= __('Manage Donation Cases') ?></h2>
|
||||
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#caseModal" onclick="clearForm()">
|
||||
<i class="bi bi-plus-lg me-1"></i> New Case
|
||||
<i class="bi bi-plus-lg <?= $is_rtl ? 'ms-1' : 'me-1' ?>"></i> <?= __('New Case') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['success'])): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show">
|
||||
Operation successful!
|
||||
<?= __('Operation successful!') ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -155,54 +154,54 @@ if (isset($_GET['edit'])) {
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-4">Case</th>
|
||||
<th>Category</th>
|
||||
<th>Goal</th>
|
||||
<th>Status</th>
|
||||
<th>Importance</th>
|
||||
<th class="text-end pe-4">Actions</th>
|
||||
<th class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>"><?= __('Case') ?></th>
|
||||
<th><?= __('Category') ?></th>
|
||||
<th><?= __('Goal') ?></th>
|
||||
<th><?= __('Status') ?></th>
|
||||
<th><?= __('Importance') ?></th>
|
||||
<th class="<?= $is_rtl ? 'text-start ps-4' : 'text-end pe-4' ?>"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($cases as $case): ?>
|
||||
<tr>
|
||||
<td class="ps-4">
|
||||
<td class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>">
|
||||
<div class="d-flex align-items-center">
|
||||
<?php if ($case['image_url']): ?>
|
||||
<img src="../<?= htmlspecialchars($case['image_url']) ?>" class="case-img-preview me-3" alt="">
|
||||
<img src="../<?= htmlspecialchars($case['image_url']) ?>" class="case-img-preview <?= $is_rtl ? 'ms-3' : 'me-3' ?>" alt="">
|
||||
<?php else: ?>
|
||||
<div class="case-img-preview me-3 bg-secondary d-flex align-items-center justify-content-center text-white">
|
||||
<div class="case-img-preview <?= $is_rtl ? 'ms-3' : 'me-3' ?> bg-secondary d-flex align-items-center justify-content-center text-white">
|
||||
<i class="bi bi-image"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div>
|
||||
<div><strong><?= htmlspecialchars($case['title_en']) ?></strong></div>
|
||||
<small class="text-muted"><?= htmlspecialchars($case['title_ar']) ?></small>
|
||||
<div><strong><?= htmlspecialchars($is_rtl ? ($case['title_ar'] ?: $case['title_en']) : $case['title_en']) ?></strong></div>
|
||||
<small class="text-muted"><?= htmlspecialchars($is_rtl ? $case['title_en'] : $case['title_ar']) ?></small>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($case['cat_name'] ?? 'N/A') ?></td>
|
||||
<td><?= htmlspecialchars($is_rtl ? ($case['cat_name_ar'] ?: $case['cat_name_en']) : ($case['cat_name_en'] ?? __('N/A'))) ?></td>
|
||||
<td>
|
||||
<div>OMR <?= number_format($case['goal'], 3) ?></div>
|
||||
<small class="text-muted">Raised: OMR <?= number_format($case['raised'], 3) ?></small>
|
||||
<div><?= __('OMR') ?> <?= number_format($case['goal'], 3) ?></div>
|
||||
<small class="text-muted"><?= __('Raised') ?>: <?= __('OMR') ?> <?= number_format($case['raised'], 3) ?></small>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($case['status'] === 'active'): ?>
|
||||
<span class="badge bg-success">Active</span>
|
||||
<span class="badge bg-success"><?= __('Active') ?></span>
|
||||
<?php elseif ($case['status'] === 'paused'): ?>
|
||||
<span class="badge bg-warning text-dark">Paused</span>
|
||||
<span class="badge bg-warning text-dark"><?= __('Paused') ?></span>
|
||||
<?php else: ?>
|
||||
<span class="badge bg-danger">Disabled</span>
|
||||
<span class="badge bg-danger"><?= __('Disabled') ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<span class="badge badge-<?= $case['importance'] ?>">
|
||||
<?= ucfirst(str_replace('_', ' ', $case['importance'])) ?>
|
||||
<?= __($case['importance']) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="text-end pe-4">
|
||||
<a href="?edit=<?= $case['id'] ?>" class="btn btn-sm btn-outline-primary me-1"><i class="bi bi-pencil"></i></a>
|
||||
<a href="?delete=<?= $case['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('Are you sure?')"><i class="bi bi-trash"></i></a>
|
||||
<td class="<?= $is_rtl ? 'text-start ps-4' : 'text-end pe-4' ?>">
|
||||
<a href="?edit=<?= $case['id'] ?>" class="btn btn-sm btn-outline-primary <?= $is_rtl ? 'ms-1' : 'me-1' ?>"><i class="bi bi-pencil"></i></a>
|
||||
<a href="?delete=<?= $case['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('<?= __('Are you sure?') ?>')"><i class="bi bi-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@ -218,7 +217,7 @@ if (isset($_GET['edit'])) {
|
||||
<div class="modal-content">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="modalTitle">New Case</h5>
|
||||
<h5 class="modal-title" id="modalTitle"><?= __('New Case') ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
@ -226,72 +225,72 @@ if (isset($_GET['edit'])) {
|
||||
<input type="hidden" name="image_url_existing" id="caseImageUrlExisting">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Category</label>
|
||||
<label class="form-label"><?= __('Category') ?></label>
|
||||
<select name="category_id" id="caseCategory" class="form-select" required>
|
||||
<option value="">Select Category</option>
|
||||
<option value=""><?= __('Select Category') ?></option>
|
||||
<?php foreach ($categories as $cat): ?>
|
||||
<option value="<?= $cat['id'] ?>"><?= htmlspecialchars($cat['name_en']) ?></option>
|
||||
<option value="<?= $cat['id'] ?>"><?= htmlspecialchars($is_rtl ? ($cat['name_ar'] ?: $cat['name_en']) : $cat['name_en']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">Title (English)</label>
|
||||
<label class="form-label"><?= __('Title (English)') ?></label>
|
||||
<input type="text" name="title_en" id="caseTitleEn" class="form-control" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">Title (Arabic)</label>
|
||||
<label class="form-label"><?= __('Title (Arabic)') ?></label>
|
||||
<input type="text" name="title_ar" id="caseTitleAr" class="form-control" dir="rtl" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">Description (English)</label>
|
||||
<label class="form-label"><?= __('Description (English)') ?></label>
|
||||
<textarea name="desc_en" id="caseDescEn" class="form-control" rows="3"></textarea>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">Description (Arabic)</label>
|
||||
<label class="form-label"><?= __('Description (Arabic)') ?></label>
|
||||
<textarea name="desc_ar" id="caseDescAr" class="form-control" dir="rtl" rows="3"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label">Goal Amount (OMR)</label>
|
||||
<label class="form-label"><?= __('Goal Amount (OMR)') ?></label>
|
||||
<input type="number" name="goal" id="caseGoal" class="form-control" step="0.001" required>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label">Importance</label>
|
||||
<label class="form-label"><?= __('Importance') ?></label>
|
||||
<select name="importance" id="caseImportance" class="form-select">
|
||||
<option value="normal">Normal</option>
|
||||
<option value="urgent">Urgent</option>
|
||||
<option value="top_priority">Top Priority</option>
|
||||
<option value="normal"><?= __('Normal') ?></option>
|
||||
<option value="urgent"><?= __('Urgent') ?></option>
|
||||
<option value="top_priority"><?= __('Top Priority') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4 mb-3">
|
||||
<label class="form-label">Status</label>
|
||||
<label class="form-label"><?= __('Status') ?></label>
|
||||
<select name="status" id="caseStatus" class="form-select">
|
||||
<option value="active">Active</option>
|
||||
<option value="paused">Paused</option>
|
||||
<option value="disabled">Disabled</option>
|
||||
<option value="active"><?= __('Active') ?></option>
|
||||
<option value="paused"><?= __('Paused') ?></option>
|
||||
<option value="disabled"><?= __('Disabled') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Case Image</label>
|
||||
<label class="form-label"><?= __('Case Image') ?></label>
|
||||
<input type="file" name="image" class="form-control" accept="image/*">
|
||||
<div id="imagePreviewContainer" class="mt-2" style="display:none;">
|
||||
<small class="text-muted d-block mb-1">Current Image:</small>
|
||||
<small class="text-muted d-block mb-1"><?= __('Current Image') ?>:</small>
|
||||
<img id="imagePreview" src="" class="rounded border" style="max-height: 100px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Save Case</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?= __('Cancel') ?></button>
|
||||
<button type="submit" class="btn btn-primary"><?= __('Save Case') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -314,7 +313,7 @@ if (isset($_GET['edit'])) {
|
||||
document.getElementById('caseStatus').value = 'active';
|
||||
document.getElementById('caseImageUrlExisting').value = '';
|
||||
document.getElementById('imagePreviewContainer').style.display = 'none';
|
||||
document.getElementById('modalTitle').innerText = 'New Case';
|
||||
document.getElementById('modalTitle').innerText = '<?= __('New Case') ?>';
|
||||
}
|
||||
|
||||
<?php if ($edit_case): ?>
|
||||
@ -335,7 +334,7 @@ if (isset($_GET['edit'])) {
|
||||
document.getElementById('imagePreviewContainer').style.display = 'block';
|
||||
}
|
||||
|
||||
document.getElementById('modalTitle').innerText = 'Edit Case';
|
||||
document.getElementById('modalTitle').innerText = '<?= __('Edit Case') ?>';
|
||||
caseModal.show();
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
@ -44,43 +44,40 @@ if (isset($_GET['edit'])) {
|
||||
$stmt->execute([$id]);
|
||||
$edit_cat = $stmt->fetch();
|
||||
}
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Manage Categories - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('Manage Categories') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
</style>
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
</head>
|
||||
<body>
|
||||
<?php include "sidebar.php"; ?>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Manage Categories</h2>
|
||||
<h2><?= __('Manage Categories') ?></h2>
|
||||
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#catModal" onclick="clearForm()">
|
||||
<i class="bi bi-plus-lg me-1"></i> New Category
|
||||
<i class="bi bi-plus-lg <?= $is_rtl ? 'ms-1' : 'me-1' ?>"></i> <?= __('New Category') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['success'])): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show">
|
||||
Operation successful!
|
||||
<?= __('Operation successful!') ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -90,20 +87,20 @@ if (isset($_GET['edit'])) {
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-4">Name (EN/AR)</th>
|
||||
<th class="text-end pe-4">Actions</th>
|
||||
<th class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>"><?= __('Name') ?> (EN/AR)</th>
|
||||
<th class="<?= $is_rtl ? 'text-start ps-4' : 'text-end pe-4' ?>"><?= __('Actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($categories as $cat): ?>
|
||||
<tr>
|
||||
<td class="ps-4">
|
||||
<td class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>">
|
||||
<div><strong><?= htmlspecialchars($cat['name_en']) ?></strong></div>
|
||||
<small class="text-muted"><?= htmlspecialchars($cat['name_ar']) ?></small>
|
||||
</td>
|
||||
<td class="text-end pe-4">
|
||||
<a href="?edit=<?= $cat['id'] ?>" class="btn btn-sm btn-outline-primary me-1"><i class="bi bi-pencil"></i></a>
|
||||
<a href="?delete=<?= $cat['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('Are you sure?')"><i class="bi bi-trash"></i></a>
|
||||
<td class="<?= $is_rtl ? 'text-start ps-4' : 'text-end pe-4' ?>">
|
||||
<a href="?edit=<?= $cat['id'] ?>" class="btn btn-sm btn-outline-primary <?= $is_rtl ? 'ms-1' : 'me-1' ?>"><i class="bi bi-pencil"></i></a>
|
||||
<a href="?delete=<?= $cat['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('<?= __('Are you sure?') ?>')"><i class="bi bi-trash"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@ -119,23 +116,23 @@ if (isset($_GET['edit'])) {
|
||||
<div class="modal-content">
|
||||
<form method="POST">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="modalTitle">New Category</h5>
|
||||
<h5 class="modal-title" id="modalTitle"><?= __('New Category') ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="id" id="catId">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Name (English)</label>
|
||||
<label class="form-label"><?= __('Name (English)') ?></label>
|
||||
<input type="text" name="name_en" id="catNameEn" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Name (Arabic)</label>
|
||||
<label class="form-label"><?= __('Name (Arabic)') ?></label>
|
||||
<input type="text" name="name_ar" id="catNameAr" class="form-control" dir="rtl" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Save Category</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?= __('Cancel') ?></button>
|
||||
<button type="submit" class="btn btn-primary"><?= __('Save Category') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -150,7 +147,7 @@ if (isset($_GET['edit'])) {
|
||||
document.getElementById('catId').value = '';
|
||||
document.getElementById('catNameEn').value = '';
|
||||
document.getElementById('catNameAr').value = '';
|
||||
document.getElementById('modalTitle').innerText = 'New Category';
|
||||
document.getElementById('modalTitle').innerText = '<?= __('New Category') ?>';
|
||||
}
|
||||
|
||||
<?php if ($edit_cat): ?>
|
||||
@ -158,7 +155,7 @@ if (isset($_GET['edit'])) {
|
||||
document.getElementById('catId').value = '<?= $edit_cat['id'] ?>';
|
||||
document.getElementById('catNameEn').value = '<?= addslashes($edit_cat['name_en']) ?>';
|
||||
document.getElementById('catNameAr').value = '<?= addslashes($edit_cat['name_ar']) ?>';
|
||||
document.getElementById('modalTitle').innerText = 'Edit Category';
|
||||
document.getElementById('modalTitle').innerText = '<?= __('Edit Category') ?>';
|
||||
catModal.show();
|
||||
});
|
||||
<?php endif; ?>
|
||||
|
||||
@ -6,33 +6,32 @@ require_login();
|
||||
$user = get_user();
|
||||
$pdo = db();
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
|
||||
// Fetch donations
|
||||
$donations = $pdo->query("SELECT d.*, c.title_en as case_title, cat.name_en as cat_name
|
||||
$donations = $pdo->query("SELECT d.*, c.title_en as case_title_en, c.title_ar as case_title_ar, cat.name_en as cat_name_en, cat.name_ar as cat_name_ar
|
||||
FROM donations d
|
||||
JOIN cases c ON d.case_id = c.id
|
||||
LEFT JOIN categories cat ON c.category_id = cat.id
|
||||
ORDER BY d.created_at DESC")->fetchAll();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Donations - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('Donations') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
.badge-completed { background-color: #d1fae5; color: #065f46; }
|
||||
.badge-pending { background-color: #fef3c7; color: #92400e; }
|
||||
.badge-failed { background-color: #fee2e2; color: #991b1b; }
|
||||
@ -43,9 +42,9 @@ $donations = $pdo->query("SELECT d.*, c.title_en as case_title, cat.name_en as c
|
||||
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2 class="mb-0">Donations History</h2>
|
||||
<h2 class="mb-0"><?= __('Donations History') ?></h2>
|
||||
<a href="export_donations.php" class="btn btn-outline-success">
|
||||
<i class="bi bi-file-earmark-excel me-2"></i>Export to CSV
|
||||
<i class="bi bi-file-earmark-excel <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i><?= __('Export to CSV') ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -54,35 +53,35 @@ $donations = $pdo->query("SELECT d.*, c.title_en as case_title, cat.name_en as c
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-4">Donor</th>
|
||||
<th>Contact</th>
|
||||
<th>Case</th>
|
||||
<th>Amount</th>
|
||||
<th>Status</th>
|
||||
<th>Date</th>
|
||||
<th class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>"><?= __('Donor') ?></th>
|
||||
<th><?= __('Contact') ?></th>
|
||||
<th><?= __('Case') ?></th>
|
||||
<th><?= __('Amount') ?></th>
|
||||
<th><?= __('Status') ?></th>
|
||||
<th><?= __('Date') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($donations as $don): ?>
|
||||
<tr>
|
||||
<td class="ps-4">
|
||||
<strong><?= htmlspecialchars($don['donor_name'] ?: 'Anonymous') ?></strong>
|
||||
<td class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>">
|
||||
<strong><?= htmlspecialchars($don['donor_name'] ?: __('Anonymous')) ?></strong>
|
||||
<?php if ($don['is_gift']): ?>
|
||||
<span class="badge bg-info-subtle text-info rounded-pill ms-2" style="font-size: 0.7rem;">Gift</span>
|
||||
<span class="badge bg-info-subtle text-info rounded-pill <?= $is_rtl ? 'me-2' : 'ms-2' ?>" style="font-size: 0.7rem;"><?= __('Gift') ?></span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small"><?= htmlspecialchars($don['donor_email']) ?></div>
|
||||
<div class="small text-muted"><?= htmlspecialchars($don['donor_phone'] ?? 'N/A') ?></div>
|
||||
<div class="small text-muted"><?= htmlspecialchars($don['donor_phone'] ?? __('N/A')) ?></div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="small fw-bold"><?= htmlspecialchars($don['case_title']) ?></div>
|
||||
<div class="small text-muted"><?= htmlspecialchars($don['cat_name'] ?? 'General') ?></div>
|
||||
<div class="small fw-bold"><?= htmlspecialchars($is_rtl ? ($don['case_title_ar'] ?: $don['case_title_en']) : $don['case_title_en']) ?></div>
|
||||
<div class="small text-muted"><?= htmlspecialchars($is_rtl ? ($don['cat_name_ar'] ?: $don['cat_name_en']) : ($don['cat_name_en'] ?? __('General'))) ?></div>
|
||||
</td>
|
||||
<td>OMR <?= number_format($don['amount'], 3) ?></td>
|
||||
<td><?= __('OMR') ?> <?= number_format($don['amount'], 3) ?></td>
|
||||
<td>
|
||||
<span class="badge badge-<?= $don['status'] ?>">
|
||||
<?= ucfirst($don['status']) ?>
|
||||
<?= __($don['status']) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= date('Y-m-d H:i', strtotime($don['created_at'])) ?></td>
|
||||
@ -90,7 +89,7 @@ $donations = $pdo->query("SELECT d.*, c.title_en as case_title, cat.name_en as c
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($donations)): ?>
|
||||
<tr>
|
||||
<td colspan="6" class="text-center py-4 text-muted">No donations found.</td>
|
||||
<td colspan="6" class="text-center py-4 text-muted"><?= __('No donations found.') ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
|
||||
@ -6,6 +6,8 @@ require_login();
|
||||
$user = get_user();
|
||||
$pdo = db();
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
|
||||
// Fetch unique donors based on email, with total amount and count
|
||||
$donors = $pdo->query("
|
||||
SELECT
|
||||
@ -22,33 +24,28 @@ $donors = $pdo->query("
|
||||
")->fetchAll();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Donors CRM - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('Donors CRM') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
</style>
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
</head>
|
||||
<body>
|
||||
<?php include "sidebar.php"; ?>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2 class="mb-0">Donor CRM</h2>
|
||||
<h2 class="mb-0"><?= __('Donor CRM') ?></h2>
|
||||
</div>
|
||||
|
||||
<div class="card p-0">
|
||||
@ -56,30 +53,30 @@ $donors = $pdo->query("
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th class="ps-4">Donor Name</th>
|
||||
<th>Email</th>
|
||||
<th>Phone</th>
|
||||
<th>Donations</th>
|
||||
<th>Total Amount</th>
|
||||
<th>Last Donation</th>
|
||||
<th class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>"><?= __('Donor Name') ?></th>
|
||||
<th><?= __('Email') ?></th>
|
||||
<th><?= __('Phone') ?></th>
|
||||
<th><?= __('Donations') ?></th>
|
||||
<th><?= __('Total Amount') ?></th>
|
||||
<th><?= __('Last Donation') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($donors as $donor): ?>
|
||||
<tr>
|
||||
<td class="ps-4">
|
||||
<strong><?= htmlspecialchars($donor['donor_name'] ?: 'Anonymous') ?></strong>
|
||||
<td class="<?= $is_rtl ? 'pe-4' : 'ps-4' ?>">
|
||||
<strong><?= htmlspecialchars($donor['donor_name'] ?: __('Anonymous')) ?></strong>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($donor['donor_email']) ?></td>
|
||||
<td><?= htmlspecialchars($donor['donor_phone'] ?? 'N/A') ?></td>
|
||||
<td><?= htmlspecialchars($donor['donor_phone'] ?? __('N/A')) ?></td>
|
||||
<td><span class="badge bg-primary rounded-pill"><?= $donor['donation_count'] ?></span></td>
|
||||
<td><strong>OMR <?= number_format($donor['total_contributed'], 3) ?></strong></td>
|
||||
<td><strong><?= __('OMR') ?> <?= number_format($donor['total_contributed'], 3) ?></strong></td>
|
||||
<td class="small text-muted"><?= date('M j, Y', strtotime($donor['last_donation'])) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($donors)): ?>
|
||||
<tr>
|
||||
<td colspan="6" class="text-center py-4 text-muted">No donors found with completed payments.</td>
|
||||
<td colspan="6" class="text-center py-4 text-muted"><?= __('No donors found with completed payments.') ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
|
||||
@ -6,8 +6,10 @@ require_login();
|
||||
$user = get_user();
|
||||
$pdo = db();
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
|
||||
// Fetch Categories for filter
|
||||
$stmt = $pdo->query("SELECT id, name_en FROM categories ORDER BY name_en ASC");
|
||||
$stmt = $pdo->query("SELECT id, name_en, name_ar FROM categories ORDER BY name_en ASC");
|
||||
$categories = $stmt->fetchAll();
|
||||
|
||||
// Filters
|
||||
@ -66,7 +68,7 @@ if (empty($status_filter)) {
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT c.name_en, SUM(d.amount) as total
|
||||
SELECT c.name_en, c.name_ar, SUM(d.amount) as total
|
||||
FROM categories c
|
||||
JOIN cases cs ON cs.category_id = c.id
|
||||
JOIN donations d ON d.case_id = cs.id
|
||||
@ -80,7 +82,7 @@ $category_revenue = $stmt->fetchAll();
|
||||
$cat_labels = [];
|
||||
$cat_totals = [];
|
||||
foreach ($category_revenue as $row) {
|
||||
$cat_labels[] = $row['name_en'];
|
||||
$cat_labels[] = $is_rtl ? ($row['name_ar'] ?: $row['name_en']) : $row['name_en'];
|
||||
$cat_totals[] = (float)$row['total'];
|
||||
}
|
||||
|
||||
@ -123,7 +125,7 @@ if (empty($status_filter)) {
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT cs.title_en, SUM(d.amount) as total, cs.goal
|
||||
SELECT cs.title_en, cs.title_ar, SUM(d.amount) as total, cs.goal
|
||||
FROM cases cs
|
||||
JOIN donations d ON d.case_id = cs.id
|
||||
WHERE $top_where
|
||||
@ -154,7 +156,7 @@ $stmt = $pdo->prepare("
|
||||
$stmt->execute($gift_params);
|
||||
$gift_stats = $stmt->fetchAll();
|
||||
|
||||
$gift_labels = ['Regular', 'Gift'];
|
||||
$gift_labels = [__('Regular'), __('Gift')];
|
||||
$gift_totals = [0, 0];
|
||||
foreach ($gift_stats as $row) {
|
||||
if ($row['is_gift']) {
|
||||
@ -166,23 +168,23 @@ foreach ($gift_stats as $row) {
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Financial Summary - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('Financial Summary') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
.stat-card { padding: 1.5rem; border-left: 4px solid var(--primary-color); }
|
||||
.chart-container { position: relative; height: 250px; }
|
||||
.filter-section { background: #fff; padding: 1.25rem; border-radius: 12px; margin-bottom: 2rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
|
||||
@ -221,12 +223,12 @@ foreach ($gift_stats as $row) {
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h2 class="mb-0">Financial Summary Report</h2>
|
||||
<p class="text-muted mb-0">Detailed analysis of donations and revenue streams.</p>
|
||||
<h2 class="mb-0"><?= __('Financial Summary Report') ?></h2>
|
||||
<p class="text-muted mb-0"><?= __('Detailed analysis of donations and revenue streams.') ?></p>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
<div class="fw-bold"><?= date('l, F j, Y') ?></div>
|
||||
<div class="text-muted small no-print"><?= htmlspecialchars(get_org_name()) ?> Admin Panel</div>
|
||||
<div class="text-muted small no-print"><?= htmlspecialchars(get_org_name()) ?> <?= __('Admin Panel') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -234,40 +236,40 @@ foreach ($gift_stats as $row) {
|
||||
<div class="filter-section">
|
||||
<form method="GET" class="row g-3 align-items-end">
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small fw-bold text-muted">Start Date</label>
|
||||
<label class="form-label small fw-bold text-muted"><?= __('Start Date') ?></label>
|
||||
<input type="date" name="start_date" class="form-control" value="<?= htmlspecialchars($start_date) ?>">
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small fw-bold text-muted">End Date</label>
|
||||
<label class="form-label small fw-bold text-muted"><?= __('End Date') ?></label>
|
||||
<input type="date" name="end_date" class="form-control" value="<?= htmlspecialchars($end_date) ?>">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label small fw-bold text-muted">Category</label>
|
||||
<label class="form-label small fw-bold text-muted"><?= __('Category') ?></label>
|
||||
<select name="category_id" class="form-select">
|
||||
<option value="">All Categories</option>
|
||||
<option value=""><?= __('All Categories') ?></option>
|
||||
<?php foreach ($categories as $cat): ?>
|
||||
<option value="<?= $cat['id'] ?>" <?= $category_id == $cat['id'] ? 'selected' : '' ?>>
|
||||
<?= htmlspecialchars($cat['name_en']) ?>
|
||||
<?= htmlspecialchars($is_rtl ? ($cat['name_ar'] ?: $cat['name_en']) : $cat['name_en']) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<label class="form-label small fw-bold text-muted">Status</label>
|
||||
<label class="form-label small fw-bold text-muted"><?= __('Status') ?></label>
|
||||
<select name="status" class="form-select">
|
||||
<option value="">All (Default: Completed)</option>
|
||||
<option value="completed" <?= $status_filter == 'completed' ? 'selected' : '' ?>>Completed</option>
|
||||
<option value="pending" <?= $status_filter == 'pending' ? 'selected' : '' ?>>Pending</option>
|
||||
<option value="failed" <?= $status_filter == 'failed' ? 'selected' : '' ?>>Failed</option>
|
||||
<option value=""><?= __('All (Default: Completed)') ?></option>
|
||||
<option value="completed" <?= $status_filter == 'completed' ? 'selected' : '' ?>><?= __('Completed') ?></option>
|
||||
<option value="pending" <?= $status_filter == 'pending' ? 'selected' : '' ?>><?= __('Pending') ?></option>
|
||||
<option value="failed" <?= $status_filter == 'failed' ? 'selected' : '' ?>><?= __('Failed') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<button type="submit" class="btn btn-primary px-3">
|
||||
<i class="bi bi-filter"></i> Apply
|
||||
<i class="bi bi-filter"></i> <?= __('Apply') ?>
|
||||
</button>
|
||||
<a href="financial_summary.php" class="btn btn-outline-secondary ms-1">Reset</a>
|
||||
<a href="financial_summary.php" class="btn btn-outline-secondary ms-1"><?= __('Reset') ?></a>
|
||||
<button type="button" onclick="window.print()" class="btn btn-outline-danger ms-1">
|
||||
<i class="bi bi-file-earmark-pdf"></i> Export PDF
|
||||
<i class="bi bi-file-earmark-pdf"></i> <?= __('Export PDF') ?>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
@ -277,23 +279,23 @@ foreach ($gift_stats as $row) {
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<?php if (!empty($start_date) || !empty($end_date)): ?>
|
||||
<span class="badge bg-light text-dark border p-2">
|
||||
<i class="bi bi-calendar-check me-1"></i>
|
||||
<?= $start_date ?: 'Beginning' ?> - <?= $end_date ?: 'Today' ?>
|
||||
<i class="bi bi-calendar-check <?= $is_rtl ? 'ms-1' : 'me-1' ?>"></i>
|
||||
<?= $start_date ?: __('Beginning') ?> - <?= $end_date ?: __('Today') ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($category_id)):
|
||||
$cat_name = "";
|
||||
foreach($categories as $c) if($c['id'] == $category_id) $cat_name = $c['name_en'];
|
||||
foreach($categories as $c) if($c['id'] == $category_id) $cat_name = $is_rtl ? ($c['name_ar'] ?: $c['name_en']) : $c['name_en'];
|
||||
?>
|
||||
<span class="badge bg-light text-dark border p-2">
|
||||
<i class="bi bi-tag me-1"></i>
|
||||
Category: <?= htmlspecialchars($cat_name) ?>
|
||||
<i class="bi bi-tag <?= $is_rtl ? 'ms-1' : 'me-1' ?>"></i>
|
||||
<?= __('Category') ?>: <?= htmlspecialchars($cat_name) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($status_filter)): ?>
|
||||
<span class="badge bg-light text-dark border p-2">
|
||||
<i class="bi bi-info-circle me-1"></i>
|
||||
Status: <?= ucfirst(htmlspecialchars($status_filter)) ?>
|
||||
<i class="bi bi-info-circle <?= $is_rtl ? 'ms-1' : 'me-1' ?>"></i>
|
||||
<?= __('Status') ?>: <?= __(ucfirst(htmlspecialchars($status_filter))) ?>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@ -303,18 +305,18 @@ foreach ($gift_stats as $row) {
|
||||
|
||||
<!-- Print-only filter summary -->
|
||||
<div class="d-none d-print-block mb-4 p-3 bg-light border rounded">
|
||||
<h6 class="mb-2 fw-bold text-uppercase small text-muted">Report Filters</h6>
|
||||
<h6 class="mb-2 fw-bold text-uppercase small text-muted"><?= __('Report Filters') ?></h6>
|
||||
<div class="row">
|
||||
<div class="col-3 small"><strong>Date Range:</strong> <?= ($start_date ?: 'All') . ' to ' . ($end_date ?: 'Today') ?></div>
|
||||
<div class="col-3 small"><strong>Category:</strong> <?php
|
||||
<div class="col-3 small"><strong><?= __('Date Range') ?>:</strong> <?= ($start_date ?: __('All')) . ' ' . __('to') . ' ' . ($end_date ?: __('Today')) ?></div>
|
||||
<div class="col-3 small"><strong><?= __('Category') ?>:</strong> <?php
|
||||
if($category_id) {
|
||||
foreach($categories as $c) if($c['id'] == $category_id) echo htmlspecialchars($c['name_en']);
|
||||
foreach($categories as $c) if($c['id'] == $category_id) echo htmlspecialchars($is_rtl ? ($c['name_ar'] ?: $c['name_en']) : $c['name_en']);
|
||||
} else {
|
||||
echo "All Categories";
|
||||
echo __('All Categories');
|
||||
}
|
||||
?></div>
|
||||
<div class="col-3 small"><strong>Status:</strong> <?= $status_filter ? ucfirst(htmlspecialchars($status_filter)) : 'Completed (Default)' ?></div>
|
||||
<div class="col-3 small text-end text-muted">Generated by: <?= htmlspecialchars($user['email']) ?></div>
|
||||
<div class="col-3 small"><strong><?= __('Status') ?>:</strong> <?= $status_filter ? __(ucfirst(htmlspecialchars($status_filter))) : __('Completed (Default)') ?></div>
|
||||
<div class="col-3 small text-end text-muted"><?= __('Generated by') ?>: <?= htmlspecialchars($user['email']) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -322,30 +324,30 @@ foreach ($gift_stats as $row) {
|
||||
<div class="row g-4 mb-4">
|
||||
<div class="col-md-3">
|
||||
<div class="card stat-card">
|
||||
<div class="text-muted small">Total Revenue</div>
|
||||
<div class="h3 mb-0">OMR <?= number_format($stats['total_revenue'] ?? 0, 3) ?></div>
|
||||
<div class="text-success small"><i class="bi bi-check-circle"></i> From <?= $stats['completed_count'] ?> donations</div>
|
||||
<div class="text-muted small"><?= __('Total Revenue') ?></div>
|
||||
<div class="h3 mb-0"><?= __('OMR') ?> <?= number_format($stats['total_revenue'] ?? 0, 3) ?></div>
|
||||
<div class="text-success small"><i class="bi bi-check-circle"></i> <?= __('From') ?> <?= $stats['completed_count'] ?> <?= __('donations') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card stat-card" style="border-left-color: #3b82f6;">
|
||||
<div class="text-muted small">Avg. Donation</div>
|
||||
<div class="h3 mb-0">OMR <?= number_format($stats['avg_donation'] ?? 0, 3) ?></div>
|
||||
<div class="text-primary small">Per completed donation</div>
|
||||
<div class="text-muted small"><?= __('Avg. Donation') ?></div>
|
||||
<div class="h3 mb-0"><?= __('OMR') ?> <?= number_format($stats['avg_donation'] ?? 0, 3) ?></div>
|
||||
<div class="text-primary small"><?= __('Per completed donation') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card stat-card" style="border-left-color: #f59e0b;">
|
||||
<div class="text-muted small">Pending Count</div>
|
||||
<div class="text-muted small"><?= __('Pending Count') ?></div>
|
||||
<div class="h3 mb-0"><?= $stats['pending_count'] ?></div>
|
||||
<div class="text-warning small">Awaiting payment</div>
|
||||
<div class="text-warning small"><?= __('Awaiting payment') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="card stat-card" style="border-left-color: #ec4899;">
|
||||
<div class="text-muted small">Total Donations</div>
|
||||
<div class="text-muted small"><?= __('Total Donations') ?></div>
|
||||
<div class="h3 mb-0"><?= $stats['total_count'] ?></div>
|
||||
<div class="text-danger small">Based on active filters</div>
|
||||
<div class="text-danger small"><?= __('Based on active filters') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -354,7 +356,7 @@ foreach ($gift_stats as $row) {
|
||||
<!-- Monthly Trend -->
|
||||
<div class="col-lg-8">
|
||||
<div class="card p-4 h-100">
|
||||
<h5 class="mb-4">Revenue Trend <?= empty($start_date) && empty($end_date) ? '(Last 12 Months)' : '' ?></h5>
|
||||
<h5 class="mb-4"><?= __('Revenue Trend') ?> <?= empty($start_date) && empty($end_date) ? '(' . __('Last 12 Months') . ')' : '' ?></h5>
|
||||
<div style="height: 300px;">
|
||||
<canvas id="trendChart"></canvas>
|
||||
</div>
|
||||
@ -363,7 +365,7 @@ foreach ($gift_stats as $row) {
|
||||
<!-- Category Distribution -->
|
||||
<div class="col-lg-4">
|
||||
<div class="card p-4 h-100">
|
||||
<h5 class="mb-4">Revenue by Category</h5>
|
||||
<h5 class="mb-4"><?= __('Revenue by Category') ?></h5>
|
||||
<div class="chart-container">
|
||||
<canvas id="categoryChart"></canvas>
|
||||
</div>
|
||||
@ -375,16 +377,16 @@ foreach ($gift_stats as $row) {
|
||||
<!-- Top Cases -->
|
||||
<div class="col-lg-6">
|
||||
<div class="card p-4 h-100">
|
||||
<h5 class="mb-4">Top Performing Cases</h5>
|
||||
<h5 class="mb-4"><?= __('Top Performing Cases') ?></h5>
|
||||
<div class="list-group list-group-flush">
|
||||
<?php if (empty($top_cases)): ?>
|
||||
<p class="text-muted text-center py-5">No donations found for this selection.</p>
|
||||
<p class="text-muted text-center py-5"><?= __('No donations found for this selection.') ?></p>
|
||||
<?php else: ?>
|
||||
<?php foreach ($top_cases as $case): ?>
|
||||
<div class="list-group-item px-0 border-0 mb-3">
|
||||
<div class="d-flex justify-content-between mb-1">
|
||||
<span class="fw-bold"><?= htmlspecialchars($case['title_en']) ?></span>
|
||||
<span>OMR <?= number_format($case['total'], 3) ?></span>
|
||||
<span class="fw-bold"><?= htmlspecialchars($is_rtl ? ($case['title_ar'] ?: $case['title_en']) : $case['title_en']) ?></span>
|
||||
<span><?= __('OMR') ?> <?= number_format($case['total'], 3) ?></span>
|
||||
</div>
|
||||
<?php
|
||||
$percent = $case['goal'] > 0 ? ($case['total'] / $case['goal']) * 100 : 0;
|
||||
@ -392,7 +394,7 @@ foreach ($gift_stats as $row) {
|
||||
<div class="progress" style="height: 8px;">
|
||||
<div class="progress-bar bg-success" role="progressbar" style="width: <?= min(100, $percent) ?>%"></div>
|
||||
</div>
|
||||
<div class="text-muted small mt-1"><?= number_format($percent, 1) ?>% of OMR <?= number_format($case['goal'], 0) ?> goal</div>
|
||||
<div class="text-muted small mt-1"><?= number_format($percent, 1) ?>% <?= __('of') ?> <?= __('OMR') ?> <?= number_format($case['goal'], 0) ?> <?= __('goal') ?></div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
@ -402,18 +404,18 @@ foreach ($gift_stats as $row) {
|
||||
<!-- Gift vs Regular -->
|
||||
<div class="col-lg-6">
|
||||
<div class="card p-4 h-100">
|
||||
<h5 class="mb-4">Regular vs Gift Donations (Revenue)</h5>
|
||||
<h5 class="mb-4"><?= __('Regular vs Gift Donations (Revenue)') ?></h5>
|
||||
<div class="d-flex align-items-center justify-content-center" style="height: 250px;">
|
||||
<canvas id="giftChart"></canvas>
|
||||
</div>
|
||||
<div class="mt-4 row text-center">
|
||||
<div class="col-6">
|
||||
<div class="text-muted small">Regular</div>
|
||||
<div class="h5">OMR <?= number_format($gift_totals[0], 3) ?></div>
|
||||
<div class="text-muted small"><?= __('Regular') ?></div>
|
||||
<div class="h5"><?= __('OMR') ?> <?= number_format($gift_totals[0], 3) ?></div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="text-muted small">Gift</div>
|
||||
<div class="h5">OMR <?= number_format($gift_totals[1], 3) ?></div>
|
||||
<div class="text-muted small"><?= __('Gift') ?></div>
|
||||
<div class="h5"><?= __('OMR') ?> <?= number_format($gift_totals[1], 3) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -434,7 +436,7 @@ foreach ($gift_stats as $row) {
|
||||
data: {
|
||||
labels: <?= json_encode($trend_labels) ?>,
|
||||
datasets: [{
|
||||
label: 'Revenue (OMR)',
|
||||
label: '<?= __('Revenue') ?> (<?= __('OMR') ?>)',
|
||||
data: <?= json_encode($trend_totals) ?>,
|
||||
backgroundColor: '#059669',
|
||||
borderRadius: 6
|
||||
@ -500,4 +502,4 @@ foreach ($gift_stats as $row) {
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
393
admin/i18n.php
Normal file
393
admin/i18n.php
Normal file
@ -0,0 +1,393 @@
|
||||
<?php
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_name('ORG_ADMIN_SESS');
|
||||
session_start();
|
||||
}
|
||||
|
||||
// Language selection logic
|
||||
if (isset($_GET['lang']) && in_array($_GET['lang'], ['en', 'ar'])) {
|
||||
$_SESSION['lang'] = $_GET['lang'];
|
||||
}
|
||||
|
||||
$lang = $_SESSION['lang'] ?? 'en';
|
||||
$is_rtl = ($lang === 'ar');
|
||||
|
||||
$translations = [
|
||||
'en' => [
|
||||
'dashboard' => 'Dashboard',
|
||||
'org_profile' => 'Org Profile',
|
||||
'users' => 'Users',
|
||||
'my_profile' => 'My Profile',
|
||||
'gateway_settings' => 'Gateway Settings',
|
||||
'categories' => 'Categories',
|
||||
'cases' => 'Cases',
|
||||
'donations' => 'Donations',
|
||||
'financial_summary' => 'Financial Summary',
|
||||
'donors_crm' => 'Donors (CRM)',
|
||||
'audit_logs' => 'Audit Logs',
|
||||
'logout' => 'Logout',
|
||||
'welcome' => 'Welcome',
|
||||
'total_categories' => 'Total Categories',
|
||||
'total_cases' => 'Total Cases',
|
||||
'total_donations' => 'Total Donations',
|
||||
'recent_donations' => 'Recent Donations',
|
||||
'donor' => 'Donor',
|
||||
'case' => 'Case',
|
||||
'amount' => 'Amount',
|
||||
'status' => 'Status',
|
||||
'date' => 'Date',
|
||||
'actions' => 'Actions',
|
||||
'save' => 'Save',
|
||||
'edit' => 'Edit',
|
||||
'delete' => 'Delete',
|
||||
'add_new' => 'Add New',
|
||||
'english' => 'English',
|
||||
'arabic' => 'Arabic',
|
||||
'search' => 'Search',
|
||||
'filter' => 'Filter',
|
||||
'all' => 'All',
|
||||
'active' => 'Active',
|
||||
'inactive' => 'Inactive',
|
||||
'completed' => 'Completed',
|
||||
'pending' => 'Pending',
|
||||
'failed' => 'Failed',
|
||||
'role' => 'Role',
|
||||
'email' => 'Email',
|
||||
'password' => 'Password',
|
||||
'confirm_password' => 'Confirm Password',
|
||||
'current_password' => 'Current Password',
|
||||
'update' => 'Update',
|
||||
'cancel' => 'Cancel',
|
||||
'Manage Cases' => 'Manage Cases',
|
||||
'Manage Donation Cases' => 'Manage Donation Cases',
|
||||
'New Case' => 'New Case',
|
||||
'Operation successful!' => 'Operation successful!',
|
||||
'Category' => 'Category',
|
||||
'Goal' => 'Goal',
|
||||
'OMR' => 'OMR',
|
||||
'Raised' => 'Raised',
|
||||
'Paused' => 'Paused',
|
||||
'Disabled' => 'Disabled',
|
||||
'Importance' => 'Importance',
|
||||
'Are you sure?' => 'Are you sure?',
|
||||
'Select Category' => 'Select Category',
|
||||
'Title (English)' => 'Title (English)',
|
||||
'Title (Arabic)' => 'Title (Arabic)',
|
||||
'Description (English)' => 'Description (English)',
|
||||
'Description (Arabic)' => 'Description (Arabic)',
|
||||
'Goal Amount (OMR)' => 'Goal Amount (OMR)',
|
||||
'Normal' => 'Normal',
|
||||
'Urgent' => 'Urgent',
|
||||
'Top Priority' => 'Top Priority',
|
||||
'Case Image' => 'Case Image',
|
||||
'Current Image' => 'Current Image',
|
||||
'Save Case' => 'Save Case',
|
||||
'Edit Case' => 'Edit Case',
|
||||
'Manage Categories' => 'Manage Categories',
|
||||
'New Category' => 'New Category',
|
||||
'Name' => 'Name',
|
||||
'Name (English)' => 'Name (English)',
|
||||
'Name (Arabic)' => 'Name (Arabic)',
|
||||
'Save Category' => 'Save Category',
|
||||
'Edit Category' => 'Edit Category',
|
||||
'Donations History' => 'Donations History',
|
||||
'Export to CSV' => 'Export to CSV',
|
||||
'Anonymous' => 'Anonymous',
|
||||
'Gift' => 'Gift',
|
||||
'No donations found.' => 'No donations found.',
|
||||
'General' => 'General',
|
||||
'Donor Name' => 'Donor Name',
|
||||
'Phone' => 'Phone',
|
||||
'Last Donation' => 'Last Donation',
|
||||
'No donors found with completed payments.' => 'No donors found with completed payments.',
|
||||
'Financial Summary Report' => 'Financial Summary Report',
|
||||
'Detailed analysis of donations and revenue streams.' => 'Detailed analysis of donations and revenue streams.',
|
||||
'Start Date' => 'Start Date',
|
||||
'End Date' => 'End Date',
|
||||
'Apply' => 'Apply',
|
||||
'Reset' => 'Reset',
|
||||
'Export PDF' => 'Export PDF',
|
||||
'Beginning' => 'Beginning',
|
||||
'Today' => 'Today',
|
||||
'Report Filters' => 'Report Filters',
|
||||
'Date Range' => 'Date Range',
|
||||
'to' => 'to',
|
||||
'All' => 'All',
|
||||
'Completed (Default)' => 'Completed (Default)',
|
||||
'Generated by' => 'Generated by',
|
||||
'Total Revenue' => 'Total Revenue',
|
||||
'From' => 'From',
|
||||
'donations' => 'donations',
|
||||
'Avg. Donation' => 'Avg. Donation',
|
||||
'Per completed donation' => 'Per completed donation',
|
||||
'Pending Count' => 'Pending Count',
|
||||
'Awaiting payment' => 'Awaiting payment',
|
||||
'Based on active filters' => 'Based on active filters',
|
||||
'Revenue Trend' => 'Revenue Trend',
|
||||
'Last 12 Months' => 'Last 12 Months',
|
||||
'Revenue by Category' => 'Revenue by Category',
|
||||
'Top Performing Cases' => 'Top Performing Cases',
|
||||
'of' => 'of',
|
||||
'goal' => 'goal',
|
||||
'Regular vs Gift Donations (Revenue)' => 'Regular vs Gift Donations (Revenue)',
|
||||
'Regular' => 'Regular',
|
||||
'Revenue' => 'Revenue',
|
||||
'SMTP Configuration' => 'SMTP Configuration',
|
||||
'Test Email' => 'Test Email',
|
||||
'SMTP Host' => 'SMTP Host',
|
||||
'SMTP Port' => 'SMTP Port',
|
||||
'Encryption' => 'Encryption',
|
||||
'None' => 'None',
|
||||
'SMTP Username' => 'SMTP Username',
|
||||
'SMTP Password' => 'SMTP Password',
|
||||
'From Address' => 'From Address',
|
||||
'From Name' => 'From Name',
|
||||
'Report Settings' => 'Report Settings',
|
||||
'Monthly Report Recipient Email' => 'Monthly Report Recipient Email',
|
||||
'The email address that will receive the automated monthly financial summary.' => 'The email address that will receive the automated monthly financial summary.',
|
||||
'POP3 Configuration' => 'POP3 Configuration',
|
||||
'POP3 Host' => 'POP3 Host',
|
||||
'POP3 Port' => 'POP3 Port',
|
||||
'POP3 Username' => 'POP3 Username',
|
||||
'POP3 Password' => 'POP3 Password',
|
||||
'Thawani Payment Gateway' => 'Thawani Payment Gateway',
|
||||
'Secret Key' => 'Secret Key',
|
||||
'Publishable Key' => 'Publishable Key',
|
||||
'Environment' => 'Environment',
|
||||
'Sandbox (Test)' => 'Sandbox (Test)',
|
||||
'Production (Live)' => 'Production (Live)',
|
||||
'Wablas WhatsApp Gateway' => 'Wablas WhatsApp Gateway',
|
||||
'API Token' => 'API Token',
|
||||
'Security Key' => 'Security Key',
|
||||
'Server URL' => 'Server URL',
|
||||
'Save Settings' => 'Save Settings',
|
||||
'Test SMTP Connection' => 'Test SMTP Connection',
|
||||
'Please save your settings before testing if you have made any changes.' => 'Please save your settings before testing if you have made any changes.',
|
||||
'Recipient Email' => 'Recipient Email',
|
||||
'Send Test Email' => 'Send Test Email',
|
||||
'Please enter a recipient email.' => 'Please enter a recipient email.',
|
||||
'Sending...' => 'Sending...',
|
||||
'Test email sent successfully! Please check your inbox.' => 'Test email sent successfully! Please check your inbox.',
|
||||
'Failed to send test email:' => 'Failed to send test email:',
|
||||
'Unknown error' => 'Unknown error',
|
||||
'An error occurred while sending the test email.' => 'An error occurred while sending the test email.',
|
||||
'Manage your personal account settings.' => 'Manage your personal account settings.',
|
||||
'Email is required.' => 'Email is required.',
|
||||
'Incorrect current password.' => 'Incorrect current password.',
|
||||
'New passwords do not match.' => 'New passwords do not match.',
|
||||
'Profile and password updated successfully.' => 'Profile and password updated successfully.',
|
||||
'Profile updated successfully.' => 'Profile updated successfully.',
|
||||
'Error' => 'Error',
|
||||
'Email Address' => 'Email Address',
|
||||
'Change Password' => 'Change Password',
|
||||
'Leave blank to keep current' => 'Leave blank to keep current',
|
||||
'Repeat new password' => 'Repeat new password',
|
||||
'Current Password (Required to save changes)' => 'Current Password (Required to save changes)',
|
||||
'Save Changes' => 'Save Changes',
|
||||
'Account Information' => 'Account Information',
|
||||
'Account Created' => 'Account Created',
|
||||
'For security reasons, your role can only be changed by a Super Admin.' => 'For security reasons, your role can only be changed by a Super Admin.',
|
||||
'Admin Panel' => 'Admin Panel',
|
||||
'super admin' => 'Super Admin',
|
||||
'admin' => 'Admin',
|
||||
'Last 30 Days' => 'Last 30 Days',
|
||||
'Quick Links' => 'Quick Links',
|
||||
'View All' => 'View All',
|
||||
],
|
||||
'ar' => [
|
||||
'dashboard' => 'لوحة التحكم',
|
||||
'org_profile' => 'ملف المنظمة',
|
||||
'users' => 'المستخدمين',
|
||||
'my_profile' => 'ملفي الشخصي',
|
||||
'gateway_settings' => 'إعدادات البوابة',
|
||||
'categories' => 'الفئات',
|
||||
'cases' => 'الحالات',
|
||||
'donations' => 'التبرعات',
|
||||
'financial_summary' => 'الملخص المالي',
|
||||
'donors_crm' => 'المتبرعين (CRM)',
|
||||
'audit_logs' => 'سجلات المراجعة',
|
||||
'logout' => 'تسجيل الخروج',
|
||||
'welcome' => 'أهلاً بك',
|
||||
'total_categories' => 'إجمالي الفئات',
|
||||
'total_cases' => 'إجمالي الحالات',
|
||||
'total_donations' => 'إجمالي التبرعات',
|
||||
'recent_donations' => 'التبرعات الأخيرة',
|
||||
'donor' => 'المتبرع',
|
||||
'case' => 'الحالة',
|
||||
'amount' => 'المبلغ',
|
||||
'status' => 'الحالة',
|
||||
'date' => 'التاريخ',
|
||||
'actions' => 'الإجراءات',
|
||||
'save' => 'حفظ',
|
||||
'edit' => 'تعديل',
|
||||
'delete' => 'حذف',
|
||||
'add_new' => 'إضافة جديد',
|
||||
'english' => 'الإنجليزية',
|
||||
'arabic' => 'العربية',
|
||||
'search' => 'بحث',
|
||||
'filter' => 'تصفية',
|
||||
'all' => 'الكل',
|
||||
'active' => 'نشط',
|
||||
'inactive' => 'غير نشط',
|
||||
'completed' => 'مكتمل',
|
||||
'pending' => 'قيد الانتظار',
|
||||
'failed' => 'فاشل',
|
||||
'role' => 'الدور',
|
||||
'email' => 'البريد الإلكتروني',
|
||||
'password' => 'كلمة المرور',
|
||||
'confirm_password' => 'تأكيد كلمة المرور',
|
||||
'current_password' => 'كلمة المرور الحالية',
|
||||
'update' => 'تحديث',
|
||||
'cancel' => 'إلغاء',
|
||||
'Manage Cases' => 'إدارة الحالات',
|
||||
'Manage Donation Cases' => 'إدارة حالات التبرع',
|
||||
'New Case' => 'حالة جديدة',
|
||||
'Operation successful!' => 'تمت العملية بنجاح!',
|
||||
'Category' => 'الفئة',
|
||||
'Goal' => 'الهدف',
|
||||
'OMR' => 'ر.ع.',
|
||||
'Raised' => 'تم جمع',
|
||||
'Paused' => 'متوقف مؤقتاً',
|
||||
'Disabled' => 'معطل',
|
||||
'Importance' => 'الأهمية',
|
||||
'Are you sure?' => 'هل أنت متأكد؟',
|
||||
'Select Category' => 'اختر الفئة',
|
||||
'Title (English)' => 'العنوان (بالانجليزية)',
|
||||
'Title (Arabic)' => 'العنوان (بالعربية)',
|
||||
'Description (English)' => 'الوصف (بالانجليزية)',
|
||||
'Description (Arabic)' => 'الوصف (بالعربية)',
|
||||
'Goal Amount (OMR)' => 'مبلغ الهدف (ر.ع.)',
|
||||
'Normal' => 'عادي',
|
||||
'Urgent' => 'عاجل',
|
||||
'Top Priority' => 'أولوية قصوى',
|
||||
'Case Image' => 'صورة الحالة',
|
||||
'Current Image' => 'الصورة الحالية',
|
||||
'Save Case' => 'حفظ الحالة',
|
||||
'Edit Case' => 'تعديل الحالة',
|
||||
'Manage Categories' => 'إدارة الفئات',
|
||||
'New Category' => 'فئة جديدة',
|
||||
'Name' => 'الاسم',
|
||||
'Name (English)' => 'الاسم (بالانجليزية)',
|
||||
'Name (Arabic)' => 'الاسم (بالعربية)',
|
||||
'Save Category' => 'حفظ الفئة',
|
||||
'Edit Category' => 'تعديل الفئة',
|
||||
'Donations History' => 'سجل التبرعات',
|
||||
'Export to CSV' => 'تصدير إلى CSV',
|
||||
'Anonymous' => 'فاعل خير',
|
||||
'Gift' => 'هدية',
|
||||
'No donations found.' => 'لم يتم العثور على تبرعات.',
|
||||
'General' => 'عام',
|
||||
'Donor Name' => 'اسم المتبرع',
|
||||
'Phone' => 'الهاتف',
|
||||
'Last Donation' => 'آخر تبرع',
|
||||
'No donors found with completed payments.' => 'لم يتم العثور على متبرعين بدفعات مكتملة.',
|
||||
'Financial Summary Report' => 'تقرير الملخص المالي',
|
||||
'Detailed analysis of donations and revenue streams.' => 'تحليل مفصل للتبرعات ومصادر الإيرادات.',
|
||||
'Start Date' => 'تاريخ البدء',
|
||||
'End Date' => 'تاريخ الانتهاء',
|
||||
'Apply' => 'تطبيق',
|
||||
'Reset' => 'إعادة تعيين',
|
||||
'Export PDF' => 'تصدير PDF',
|
||||
'Beginning' => 'البداية',
|
||||
'Today' => 'اليوم',
|
||||
'Report Filters' => 'فلاتر التقرير',
|
||||
'Date Range' => 'نطاق التاريخ',
|
||||
'to' => 'إلى',
|
||||
'All' => 'الكل',
|
||||
'Completed (Default)' => 'مكتمل (افتراضي)',
|
||||
'Generated by' => 'تم إنشاؤه بواسطة',
|
||||
'Total Revenue' => 'إجمالي الإيرادات',
|
||||
'From' => 'من',
|
||||
'donations' => 'تبرعات',
|
||||
'Avg. Donation' => 'متوسط التبرع',
|
||||
'Per completed donation' => 'لكل تبرع مكتمل',
|
||||
'Pending Count' => 'عدد المنتظر',
|
||||
'Awaiting payment' => 'في انتظار الدفع',
|
||||
'Based on active filters' => 'بناءً على الفلاتر النشطة',
|
||||
'Revenue Trend' => 'اتجاه الإيرادات',
|
||||
'Last 12 Months' => 'آخر 12 شهراً',
|
||||
'Revenue by Category' => 'الإيرادات حسب الفئة',
|
||||
'Top Performing Cases' => 'أفضل الحالات أداءً',
|
||||
'of' => 'من',
|
||||
'goal' => 'الهدف',
|
||||
'Regular vs Gift Donations (Revenue)' => 'التبرعات العادية مقابل الهدايا (الإيرادات)',
|
||||
'Regular' => 'عادي',
|
||||
'Revenue' => 'الإيرادات',
|
||||
'SMTP Configuration' => 'إعدادات SMTP',
|
||||
'Test Email' => 'بريد تجريبي',
|
||||
'SMTP Host' => 'مضيف SMTP',
|
||||
'SMTP Port' => 'منفذ SMTP',
|
||||
'Encryption' => 'التشفير',
|
||||
'None' => 'بدون',
|
||||
'SMTP Username' => 'اسم مستخدم SMTP',
|
||||
'SMTP Password' => 'كلمة مرور SMTP',
|
||||
'From Address' => 'عنوان المرسل',
|
||||
'From Name' => 'اسم المرسل',
|
||||
'Report Settings' => 'إعدادات التقارير',
|
||||
'Monthly Report Recipient Email' => 'البريد الإلكتروني لمستلم التقرير الشهري',
|
||||
'The email address that will receive the automated monthly financial summary.' => 'البريد الإلكتروني الذي سيتلقى الملخص المالي الشهري الآلي.',
|
||||
'POP3 Configuration' => 'إعدادات POP3',
|
||||
'POP3 Host' => 'مضيف POP3',
|
||||
'POP3 Port' => 'منفذ POP3',
|
||||
'POP3 Username' => 'اسم مستخدم POP3',
|
||||
'POP3 Password' => 'كلمة مرور POP3',
|
||||
'Thawani Payment Gateway' => 'بوابة دفع ثواني',
|
||||
'Secret Key' => 'المفتاح السري',
|
||||
'Publishable Key' => 'المفتاح القابل للنشر',
|
||||
'Environment' => 'البيئة',
|
||||
'Sandbox (Test)' => 'Sandbox (تجريبي)',
|
||||
'Production (Live)' => 'الإنتاج (مباشر)',
|
||||
'Wablas WhatsApp Gateway' => 'بوابة واتساب Wablas',
|
||||
'API Token' => 'رمز API',
|
||||
'Security Key' => 'مفتاح الأمان',
|
||||
'Server URL' => 'رابط السيرفر',
|
||||
'Save Settings' => 'حفظ الإعدادات',
|
||||
'Test SMTP Connection' => 'اختبار اتصال SMTP',
|
||||
'Please save your settings before testing if you have made any changes.' => 'يرجى حفظ إعداداتك قبل الاختبار إذا أجريت أي تغييرات.',
|
||||
'Recipient Email' => 'بريد المستلم',
|
||||
'Send Test Email' => 'إرسال بريد تجريبي',
|
||||
'Please enter a recipient email.' => 'يرجى إدخال بريد إلكتروني للمستلم.',
|
||||
'Sending...' => 'جاري الإرسال...',
|
||||
'Test email sent successfully! Please check your inbox.' => 'تم إرسال البريد التجريبي بنجاح! يرجى التحقق من بريدك الوارد.',
|
||||
'Failed to send test email:' => 'فشل إرسال البريد التجريبي:',
|
||||
'Unknown error' => 'خطأ غير معروف',
|
||||
'An error occurred while sending the test email.' => 'حدث خطأ أثناء إرسال البريد التجريبي.',
|
||||
'Manage your personal account settings.' => 'إدارة إعدادات حسابك الشخصي.',
|
||||
'Email is required.' => 'البريد الإلكتروني مطلوب.',
|
||||
'Incorrect current password.' => 'كلمة المرور الحالية غير صحيحة.',
|
||||
'New passwords do not match.' => 'كلمات المرور الجديدة غير متطابقة.',
|
||||
'Profile and password updated successfully.' => 'تم تحديث الملف الشخصي وكلمة المرور بنجاح.',
|
||||
'Profile updated successfully.' => 'تم تحديث الملف الشخصي بنجاح.',
|
||||
'Error' => 'خطأ',
|
||||
'Email Address' => 'عنوان البريد الإلكتروني',
|
||||
'Change Password' => 'تغيير كلمة المرور',
|
||||
'Leave blank to keep current' => 'اتركه فارغاً للإبقاء على الحالي',
|
||||
'Repeat new password' => 'كرر كلمة المرور الجديدة',
|
||||
'Current Password (Required to save changes)' => 'كلمة المرور الحالية (مطلوبة لحفظ التغييرات)',
|
||||
'Save Changes' => 'حفظ التغييرات',
|
||||
'Account Information' => 'معلومات الحساب',
|
||||
'Account Created' => 'تاريخ إنشاء الحساب',
|
||||
'For security reasons, your role can only be changed by a Super Admin.' => 'لأسباب أمنية، لا يمكن تغيير دورك إلا من قبل المسؤول الفائق.',
|
||||
'Admin Panel' => 'لوحة الإدارة',
|
||||
'super admin' => 'مسؤول فائق',
|
||||
'admin' => 'مسؤول',
|
||||
'Last 30 Days' => 'آخر 30 يوماً',
|
||||
'Quick Links' => 'روابط سريعة',
|
||||
'View All' => 'عرض الكل',
|
||||
]
|
||||
];
|
||||
|
||||
function __($key) {
|
||||
global $translations, $lang;
|
||||
return $translations[$lang][$key] ?? $key;
|
||||
}
|
||||
|
||||
function get_current_lang() {
|
||||
global $lang;
|
||||
return $lang;
|
||||
}
|
||||
|
||||
function is_rtl() {
|
||||
global $is_rtl;
|
||||
return $is_rtl;
|
||||
}
|
||||
114
admin/index.php
114
admin/index.php
@ -29,41 +29,34 @@ foreach ($chart_data as $row) {
|
||||
|
||||
// Fetch recent donations
|
||||
$recent_donations = $pdo->query("
|
||||
SELECT d.*, c.title_en as case_title
|
||||
SELECT d.*, c.title_en as case_title_en, c.title_ar as case_title_ar
|
||||
FROM donations d
|
||||
JOIN cases c ON d.case_id = c.id
|
||||
ORDER BY d.created_at DESC
|
||||
LIMIT 5
|
||||
")->fetchAll();
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Dashboard - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('dashboard') ?> - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="admin.css?v=<?= time() ?>">
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
.stat-card { padding: 1.5rem; }
|
||||
.stat-icon { font-size: 2rem; color: var(--primary-color); }
|
||||
.badge-pending { background-color: #fef3c7; color: #92400e; }
|
||||
.badge-completed { background-color: #d1fae5; color: #065f46; }
|
||||
.badge-failed { background-color: #fee2e2; color: #991b1b; }
|
||||
.chart-container { height: 300px; position: relative; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php include "sidebar.php"; ?>
|
||||
@ -71,8 +64,8 @@ $recent_donations = $pdo->query("
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h2 class="mb-0">Welcome, <?= htmlspecialchars($user['email'] ?? 'Admin') ?></h2>
|
||||
<p class="text-muted mb-0">Manage your charity activities and donations.</p>
|
||||
<h2 class="mb-0"><?= __('welcome') ?>, <?= htmlspecialchars($user['email'] ?? __('admin')) ?></h2>
|
||||
<p class="text-muted mb-0"><?= __('Detailed analysis of donations and revenue streams.') ?></p>
|
||||
</div>
|
||||
<div class="text-muted"><?= date('l, F j, Y') ?></div>
|
||||
</div>
|
||||
@ -82,7 +75,7 @@ $recent_donations = $pdo->query("
|
||||
<div class="card stat-card">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<div class="text-muted small">Categories</div>
|
||||
<div class="text-muted small"><?= __('total_categories') ?></div>
|
||||
<div class="h3 mb-0"><?= $total_categories ?></div>
|
||||
</div>
|
||||
<i class="bi bi-tags stat-icon"></i>
|
||||
@ -93,7 +86,7 @@ $recent_donations = $pdo->query("
|
||||
<div class="card stat-card">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<div class="text-muted small">Active Cases</div>
|
||||
<div class="text-muted small"><?= __('total_cases') ?></div>
|
||||
<div class="h3 mb-0"><?= $total_cases ?></div>
|
||||
</div>
|
||||
<i class="bi bi-grid stat-icon"></i>
|
||||
@ -104,8 +97,8 @@ $recent_donations = $pdo->query("
|
||||
<div class="card stat-card">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<div class="text-muted small">Total Donations</div>
|
||||
<div class="h3 mb-0">OMR <?= number_format($total_donations, 3) ?></div>
|
||||
<div class="text-muted small"><?= __('total_donations') ?></div>
|
||||
<div class="h3 mb-0"><?= __('OMR') ?> <?= number_format($total_donations, 3) ?></div>
|
||||
</div>
|
||||
<i class="bi bi-cash-stack stat-icon"></i>
|
||||
</div>
|
||||
@ -116,7 +109,7 @@ $recent_donations = $pdo->query("
|
||||
<div class="row g-4 mb-4">
|
||||
<div class="col-lg-8">
|
||||
<div class="card p-4">
|
||||
<h5 class="mb-4">Donation Trends (Last 30 Days)</h5>
|
||||
<h5 class="mb-4"><?= __('Revenue Trend') ?> (<?= __('Last 30 Days') ?>)</h5>
|
||||
<div class="chart-container">
|
||||
<canvas id="donationsChart"></canvas>
|
||||
</div>
|
||||
@ -124,11 +117,11 @@ $recent_donations = $pdo->query("
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="card p-4 h-100">
|
||||
<h5 class="mb-4">Quick Links</h5>
|
||||
<h5 class="mb-4"><?= __('Quick Links') ?></h5>
|
||||
<div class="d-grid gap-2">
|
||||
<a href="cases.php" class="btn btn-outline-primary text-start"><i class="bi bi-plus-circle me-2"></i> Create New Case</a>
|
||||
<a href="donations.php" class="btn btn-outline-success text-start"><i class="bi bi-download me-2"></i> Export Donations</a>
|
||||
<a href="settings.php" class="btn btn-outline-secondary text-start"><i class="bi bi-gear me-2"></i> System Settings</a>
|
||||
<a href="cases.php" class="btn btn-outline-primary text-start"><i class="bi bi-plus-circle <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i> <?= __('New Case') ?></a>
|
||||
<a href="donations.php" class="btn btn-outline-success text-start"><i class="bi bi-download <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i> <?= __('Export to CSV') ?></a>
|
||||
<a href="settings.php" class="btn btn-outline-secondary text-start"><i class="bi bi-gear <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i> <?= __('Gateway Settings') ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -136,49 +129,41 @@ $recent_donations = $pdo->query("
|
||||
|
||||
<div class="card p-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5 class="mb-0">Recent Donations</h5>
|
||||
<a href="donations.php" class="btn btn-sm btn-outline-success">View All</a>
|
||||
<h5 class="mb-0"><?= __('recent_donations') ?></h5>
|
||||
<a href="donations.php" class="btn btn-sm btn-outline-success"><?= __('View All') ?></a>
|
||||
</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th>Donor</th>
|
||||
<th>Case</th>
|
||||
<th>Amount</th>
|
||||
<th>Status</th>
|
||||
<th>Date</th>
|
||||
<th><?= __('donor') ?></th>
|
||||
<th><?= __('case') ?></th>
|
||||
<th><?= __('amount') ?></th>
|
||||
<th><?= __('status') ?></th>
|
||||
<th><?= __('date') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($recent_donations)): ?>
|
||||
<?php foreach ($recent_donations as $donation): ?>
|
||||
<tr>
|
||||
<td colspan="5" class="text-center text-muted py-4">No recent donations found.</td>
|
||||
<td><?= htmlspecialchars($donation['donor_name'] ?: __('Anonymous')) ?></td>
|
||||
<td><?= htmlspecialchars($is_rtl ? ($donation['case_title_ar'] ?: $donation['case_title_en']) : $donation['case_title_en']) ?></td>
|
||||
<td><?= __('OMR') ?> <?= number_format($donation['amount'], 3) ?></td>
|
||||
<td>
|
||||
<span class="badge badge-<?= $donation['status'] ?>">
|
||||
<?= __($donation['status']) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= date('M j, Y', strtotime($donation['created_at'])) ?></td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($recent_donations as $donation): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="fw-bold"><?= htmlspecialchars($donation['donor_name'] ?: 'Anonymous') ?></div>
|
||||
<div class="small text-muted"><?= htmlspecialchars($donation['donor_email']) ?></div>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($donation['case_title']) ?></td>
|
||||
<td>OMR <?= number_format($donation['amount'], 3) ?></td>
|
||||
<td>
|
||||
<span class="badge badge-<?= $donation['status'] ?> rounded-pill">
|
||||
<?= ucfirst($donation['status']) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td class="small"><?= date('M j, Y H:i', strtotime($donation['created_at'])) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
const ctx = document.getElementById('donationsChart').getContext('2d');
|
||||
new Chart(ctx, {
|
||||
@ -186,15 +171,12 @@ $recent_donations = $pdo->query("
|
||||
data: {
|
||||
labels: <?= json_encode($labels) ?>,
|
||||
datasets: [{
|
||||
label: 'Donations (OMR)',
|
||||
label: '<?= __('Revenue') ?> (<?= __('OMR') ?>)',
|
||||
data: <?= json_encode($totals) ?>,
|
||||
borderColor: '#059669',
|
||||
backgroundColor: 'rgba(5, 150, 105, 0.1)',
|
||||
fill: true,
|
||||
tension: 0.4,
|
||||
borderWidth: 3,
|
||||
pointRadius: 4,
|
||||
pointBackgroundColor: '#059669'
|
||||
tension: 0.4
|
||||
}]
|
||||
},
|
||||
options: {
|
||||
@ -204,13 +186,7 @@ $recent_donations = $pdo->query("
|
||||
legend: { display: false }
|
||||
},
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true,
|
||||
grid: { color: '#f3f4f6' }
|
||||
},
|
||||
x: {
|
||||
grid: { display: false }
|
||||
}
|
||||
y: { beginAtZero: true }
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -46,7 +46,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= is_rtl() ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
@ -54,12 +54,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (is_rtl()): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<style>
|
||||
body { background: #f3f4f6; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; font-family: sans-serif; }
|
||||
body { background: #f3f4f6; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; font-family: sans-serif; }
|
||||
.login-card { width: 100%; max-width: 400px; padding: 2rem; background: #fff; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1); }
|
||||
.btn-success { background-color: #059669; border: none; padding: 0.6rem; }
|
||||
.lang-switcher { margin-top: 1rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@ -72,16 +79,23 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
<form method="POST" action="login.php">
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-bold">Email</label>
|
||||
<label class="form-label small fw-bold"><?= __('email') ?></label>
|
||||
<input type="email" name="email" class="form-control" value="<?= htmlspecialchars($_POST['email'] ?? '') ?>" required autofocus>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label small fw-bold">Password</label>
|
||||
<label class="form-label small fw-bold"><?= __('password') ?></label>
|
||||
<input type="password" name="password" class="form-control" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-success w-100 fw-bold">Sign In</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="lang-switcher">
|
||||
<div class="btn-group" role="group">
|
||||
<a href="?lang=en" class="btn btn-sm btn-outline-secondary <?= get_current_lang() == 'en' ? 'active' : '' ?>">English</a>
|
||||
<a href="?lang=ar" class="btn btn-sm btn-outline-secondary <?= get_current_lang() == 'ar' ? 'active' : '' ?>">العربية</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php ob_end_flush(); ?>
|
||||
@ -55,123 +55,112 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$stmt->execute([$name_en, $name_ar, $description_en, $description_ar, $email, $phone, $address, $logo_url, $favicon_url]);
|
||||
}
|
||||
|
||||
$_SESSION['org_name'] = $name_en;
|
||||
$_SESSION['logo_url'] = $logo_url;
|
||||
$_SESSION['favicon_url'] = $favicon_url;
|
||||
// Clear session cache
|
||||
unset($_SESSION['org_name']);
|
||||
unset($_SESSION['logo_url']);
|
||||
unset($_SESSION['favicon_url']);
|
||||
|
||||
header('Location: profile.php?success=1');
|
||||
exit;
|
||||
}
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Organization Profile - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('org_profile') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
|
||||
</style>
|
||||
<link rel="stylesheet" href="admin.css?v=<?= time() ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php include "sidebar.php"; ?>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Organization Profile</h2>
|
||||
<h2><?= __('org_profile') ?></h2>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['success'])): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show">
|
||||
Profile updated successfully!
|
||||
<?= __('Operation successful!') ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card p-4">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="row mb-3">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="card p-4 mb-4">
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Name (English)</label>
|
||||
<label class="form-label"><?= __('Name (English)') ?></label>
|
||||
<input type="text" name="name_en" class="form-control" value="<?= htmlspecialchars($profile['name_en'] ?? '') ?>" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Name (Arabic)</label>
|
||||
<input type="text" name="name_ar" class="form-control" dir="rtl" value="<?= htmlspecialchars($profile['name_ar'] ?? '') ?>" required>
|
||||
<label class="form-label"><?= __('Name (Arabic)') ?></label>
|
||||
<input type="text" name="name_ar" class="form-control" value="<?= htmlspecialchars($profile['name_ar'] ?? '') ?>" dir="rtl">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Description (English)</label>
|
||||
<textarea name="description_en" class="form-control" rows="3"><?= htmlspecialchars($profile['description_en'] ?? '') ?></textarea>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Description (Arabic)</label>
|
||||
<textarea name="description_ar" class="form-control" rows="3" dir="rtl"><?= htmlspecialchars($profile['description_ar'] ?? '') ?></textarea>
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Email</label>
|
||||
<div class="col-12">
|
||||
<label class="form-label"><?= __('Description (English)') ?></label>
|
||||
<textarea name="description_en" class="form-control" rows="3"><?= htmlspecialchars($profile['description_en'] ?? '') ?></textarea>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label"><?= __('Description (Arabic)') ?></label>
|
||||
<textarea name="description_ar" class="form-control" rows="3" dir="rtl"><?= htmlspecialchars($profile['description_ar'] ?? '') ?></textarea>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label"><?= __('Email Address') ?></label>
|
||||
<input type="email" name="email" class="form-control" value="<?= htmlspecialchars($profile['email'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Phone</label>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label"><?= __('Phone') ?></label>
|
||||
<input type="text" name="phone" class="form-control" value="<?= htmlspecialchars($profile['phone'] ?? '') ?>">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Address</label>
|
||||
<textarea name="address" class="form-control" rows="2"><?= htmlspecialchars($profile['address'] ?? '') ?></textarea>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label"><?= __('Address') ?></label>
|
||||
<input type="text" name="address" class="form-control" value="<?= htmlspecialchars($profile['address'] ?? '') ?>">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card p-4 mb-4">
|
||||
<div class="mb-4">
|
||||
<label class="form-label">Organization Logo</label>
|
||||
<div class="mb-2">
|
||||
<?php if (!empty($profile['logo_url'])): ?>
|
||||
<img src="../<?= htmlspecialchars($profile['logo_url']) ?>" class="img-thumbnail" style="max-height: 150px;">
|
||||
<?php else: ?>
|
||||
<div class="bg-light d-flex align-items-center justify-content-center border rounded" style="height: 150px;">
|
||||
<i class="bi bi-image text-muted fs-1"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<input type="file" name="logo" class="form-control" accept="image/*">
|
||||
<label class="form-label"><?= __('Logo') ?></label>
|
||||
<?php if (!empty($profile['logo_url'])): ?>
|
||||
<div class="mb-2">
|
||||
<img src="../<?= htmlspecialchars($profile['logo_url'] ?? '') ?>" alt="Logo" class="img-thumbnail" style="max-height: 100px;">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="file" name="logo" class="form-control">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Favicon (Small icon for browser tabs)</label>
|
||||
<div class="mb-2">
|
||||
<?php if (!empty($profile['favicon_url'])): ?>
|
||||
<img src="../<?= htmlspecialchars($profile['favicon_url']) ?>" class="img-thumbnail" style="max-height: 64px;">
|
||||
<?php else: ?>
|
||||
<div class="bg-light d-flex align-items-center justify-content-center border rounded" style="height: 64px; width: 64px;">
|
||||
<i class="bi bi-app text-muted fs-3"></i>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<input type="file" name="favicon" class="form-control" accept="image/*">
|
||||
<div class="mb-0">
|
||||
<label class="form-label"><?= __('Favicon') ?></label>
|
||||
<?php if (!empty($profile['favicon_url'])): ?>
|
||||
<div class="mb-2">
|
||||
<img src="../<?= htmlspecialchars($profile['favicon_url'] ?? '') ?>" alt="Favicon" class="img-thumbnail" style="max-height: 50px;">
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<input type="file" name="favicon" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary w-100"><?= __('save') ?></button>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="text-end">
|
||||
<button type="submit" class="btn btn-primary px-4">Update Profile</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
@ -24,26 +24,26 @@ $settings = [];
|
||||
foreach ($settings_raw as $s) {
|
||||
$settings[$s['setting_key']] = $s['setting_value'];
|
||||
}
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Gateway Settings - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<title><?= __('Gateway Settings') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
<style>
|
||||
:root { --sidebar-width: 260px; --primary-color: #059669; }
|
||||
body { background-color: #f3f4f6; }
|
||||
.sidebar { width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0; background: #111827; color: #fff; padding: 1.5rem; }
|
||||
.main-content { margin-left: var(--sidebar-width); padding: 2rem; }
|
||||
.nav-link { color: #9ca3af; margin-bottom: 0.5rem; border-radius: 8px; }
|
||||
.nav-link:hover, .nav-link.active { color: #fff; background: #1f2937; }
|
||||
.nav-link.active { background: var(--primary-color); }
|
||||
.card { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 1.5rem; }
|
||||
.card-header { font-weight: 600; }
|
||||
.btn-test { font-size: 0.85rem; padding: 0.25rem 0.75rem; }
|
||||
@ -54,12 +54,12 @@ foreach ($settings_raw as $s) {
|
||||
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2>Gateway Settings</h2>
|
||||
<h2><?= __('Gateway Settings') ?></h2>
|
||||
</div>
|
||||
|
||||
<?php if (isset($_GET['success'])): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show">
|
||||
Settings updated successfully!
|
||||
<?= __('Settings updated successfully!') ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -72,45 +72,45 @@ foreach ($settings_raw as $s) {
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header bg-white py-3 d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0"><i class="bi bi-envelope me-2"></i> SMTP Configuration</h5>
|
||||
<h5 class="mb-0"><i class="bi bi-envelope <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i> <?= __('SMTP Configuration') ?></h5>
|
||||
<button type="button" class="btn btn-outline-secondary btn-test" id="btn-test-smtp">
|
||||
<i class="bi bi-send me-1"></i> Test Email
|
||||
<i class="bi bi-send <?= $is_rtl ? 'ms-1' : 'me-1' ?>"></i> <?= __('Test Email') ?>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">SMTP Host</label>
|
||||
<label class="form-label"><?= __('SMTP Host') ?></label>
|
||||
<input type="text" name="settings[mail_host]" class="form-control" value="<?= htmlspecialchars($settings['mail_host'] ?? '') ?>" placeholder="e.g. smtp.gmail.com">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">SMTP Port</label>
|
||||
<label class="form-label"><?= __('SMTP Port') ?></label>
|
||||
<input type="text" name="settings[mail_port]" class="form-control" value="<?= htmlspecialchars($settings['mail_port'] ?? '587') ?>">
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label">Encryption</label>
|
||||
<label class="form-label"><?= __('Encryption') ?></label>
|
||||
<select name="settings[mail_encryption]" class="form-select">
|
||||
<option value="tls" <?= ($settings['mail_encryption'] ?? 'tls') === 'tls' ? 'selected' : '' ?>>TLS</option>
|
||||
<option value="ssl" <?= ($settings['mail_encryption'] ?? '') === 'ssl' ? 'selected' : '' ?>>SSL</option>
|
||||
<option value="none" <?= ($settings['mail_encryption'] ?? '') === 'none' ? 'selected' : '' ?>>None</option>
|
||||
<option value="none" <?= ($settings['mail_encryption'] ?? '') === 'none' ? 'selected' : '' ?>><?= __('None') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">SMTP Username</label>
|
||||
<label class="form-label"><?= __('SMTP Username') ?></label>
|
||||
<input type="text" name="settings[mail_username]" class="form-control" value="<?= htmlspecialchars($settings['mail_username'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">SMTP Password</label>
|
||||
<label class="form-label"><?= __('SMTP Password') ?></label>
|
||||
<input type="password" name="settings[mail_password]" class="form-control" value="<?= htmlspecialchars($settings['mail_password'] ?? '') ?>">
|
||||
</div>
|
||||
<hr>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">From Address</label>
|
||||
<label class="form-label"><?= __('From Address') ?></label>
|
||||
<input type="email" name="settings[mail_from_address]" class="form-control" value="<?= htmlspecialchars($settings['mail_from_address'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">From Name</label>
|
||||
<label class="form-label"><?= __('From Name') ?></label>
|
||||
<input type="text" name="settings[mail_from_name]" class="form-control" value="<?= htmlspecialchars($settings['mail_from_name'] ?? get_org_name()) ?>">
|
||||
</div>
|
||||
</div>
|
||||
@ -119,13 +119,13 @@ foreach ($settings_raw as $s) {
|
||||
<!-- Report Settings -->
|
||||
<div class="card">
|
||||
<div class="card-header bg-white py-3">
|
||||
<h5 class="mb-0"><i class="bi bi-file-earmark-bar-graph me-2"></i> Report Settings</h5>
|
||||
<h5 class="mb-0"><i class="bi bi-file-earmark-bar-graph <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i> <?= __('Report Settings') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Monthly Report Recipient Email</label>
|
||||
<label class="form-label"><?= __('Monthly Report Recipient Email') ?></label>
|
||||
<input type="email" name="settings[report_recipient_email]" class="form-control" value="<?= htmlspecialchars($settings['report_recipient_email'] ?? '') ?>" placeholder="admin@example.com">
|
||||
<div class="form-text">The email address that will receive the automated monthly financial summary.</div>
|
||||
<div class="form-text"><?= __('The email address that will receive the automated monthly financial summary.') ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -135,23 +135,23 @@ foreach ($settings_raw as $s) {
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header bg-white py-3">
|
||||
<h5 class="mb-0"><i class="bi bi-mailbox me-2"></i> POP3 Configuration</h5>
|
||||
<h5 class="mb-0"><i class="bi bi-mailbox <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i> <?= __('POP3 Configuration') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">POP3 Host</label>
|
||||
<label class="form-label"><?= __('POP3 Host') ?></label>
|
||||
<input type="text" name="settings[pop3_host]" class="form-control" value="<?= htmlspecialchars($settings['pop3_host'] ?? '') ?>" placeholder="e.g. pop.gmail.com">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">POP3 Port</label>
|
||||
<label class="form-label"><?= __('POP3 Port') ?></label>
|
||||
<input type="text" name="settings[pop3_port]" class="form-control" value="<?= htmlspecialchars($settings['pop3_port'] ?? '995') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">POP3 Username</label>
|
||||
<label class="form-label"><?= __('POP3 Username') ?></label>
|
||||
<input type="text" name="settings[pop3_username]" class="form-control" value="<?= htmlspecialchars($settings['pop3_username'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">POP3 Password</label>
|
||||
<label class="form-label"><?= __('POP3 Password') ?></label>
|
||||
<input type="password" name="settings[pop3_password]" class="form-control" value="<?= htmlspecialchars($settings['pop3_password'] ?? '') ?>">
|
||||
</div>
|
||||
</div>
|
||||
@ -160,22 +160,22 @@ foreach ($settings_raw as $s) {
|
||||
<!-- Thawani Settings -->
|
||||
<div class="card">
|
||||
<div class="card-header bg-white py-3">
|
||||
<h5 class="mb-0"><i class="bi bi-credit-card me-2"></i> Thawani Payment Gateway</h5>
|
||||
<h5 class="mb-0"><i class="bi bi-credit-card <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i> <?= __('Thawani Payment Gateway') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Secret Key</label>
|
||||
<label class="form-label"><?= __('Secret Key') ?></label>
|
||||
<input type="password" name="settings[thawani_secret_key]" class="form-control" value="<?= htmlspecialchars($settings['thawani_secret_key'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Publishable Key</label>
|
||||
<label class="form-label"><?= __('Publishable Key') ?></label>
|
||||
<input type="text" name="settings[thawani_publishable_key]" class="form-control" value="<?= htmlspecialchars($settings['thawani_publishable_key'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Environment</label>
|
||||
<label class="form-label"><?= __('Environment') ?></label>
|
||||
<select name="settings[thawani_env]" class="form-select">
|
||||
<option value="sandbox" <?= ($settings['thawani_env'] ?? 'sandbox') === 'sandbox' ? 'selected' : '' ?>>Sandbox (Test)</option>
|
||||
<option value="production" <?= ($settings['thawani_env'] ?? '') === 'production' ? 'selected' : '' ?>>Production (Live)</option>
|
||||
<option value="sandbox" <?= ($settings['thawani_env'] ?? 'sandbox') === 'sandbox' ? 'selected' : '' ?>><?= __('Sandbox (Test)') ?></option>
|
||||
<option value="production" <?= ($settings['thawani_env'] ?? '') === 'production' ? 'selected' : '' ?>><?= __('Production (Live)') ?></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -184,19 +184,19 @@ foreach ($settings_raw as $s) {
|
||||
<!-- Wablas Settings -->
|
||||
<div class="card">
|
||||
<div class="card-header bg-white py-3">
|
||||
<h5 class="mb-0"><i class="bi bi-whatsapp me-2"></i> Wablas WhatsApp Gateway</h5>
|
||||
<h5 class="mb-0"><i class="bi bi-whatsapp <?= $is_rtl ? 'ms-2' : 'me-2' ?>"></i> <?= __('Wablas WhatsApp Gateway') ?></h5>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">API Token</label>
|
||||
<label class="form-label"><?= __('API Token') ?></label>
|
||||
<input type="password" name="settings[wablas_api_token]" class="form-control" value="<?= htmlspecialchars($settings['wablas_api_token'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Security Key</label>
|
||||
<label class="form-label"><?= __('Security Key') ?></label>
|
||||
<input type="password" name="settings[wablas_security_key]" class="form-control" value="<?= htmlspecialchars($settings['wablas_security_key'] ?? '') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Server URL</label>
|
||||
<label class="form-label"><?= __('Server URL') ?></label>
|
||||
<input type="url" name="settings[wablas_server_url]" class="form-control" value="<?= htmlspecialchars($settings['wablas_server_url'] ?? 'https://console.wablas.com') ?>">
|
||||
</div>
|
||||
</div>
|
||||
@ -204,8 +204,8 @@ foreach ($settings_raw as $s) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-end">
|
||||
<button type="submit" class="btn btn-primary px-5">Save Settings</button>
|
||||
<div class="mt-4 <?= $is_rtl ? 'text-start' : 'text-end' ?>">
|
||||
<button type="submit" class="btn btn-primary px-5"><?= __('Save Settings') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@ -215,19 +215,19 @@ foreach ($settings_raw as $s) {
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Test SMTP Connection</h5>
|
||||
<h5 class="modal-title"><?= __('Test SMTP Connection') ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p class="text-muted small">Please save your settings before testing if you have made any changes.</p>
|
||||
<p class="text-muted small"><?= __('Please save your settings before testing if you have made any changes.') ?></p>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Recipient Email</label>
|
||||
<label class="form-label"><?= __('Recipient Email') ?></label>
|
||||
<input type="email" id="test_recipient" class="form-control" placeholder="your-email@example.com">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="btn-send-test">Send Test Email</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?= __('Cancel') ?></button>
|
||||
<button type="button" class="btn btn-primary" id="btn-send-test"><?= __('Send Test Email') ?></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -249,12 +249,12 @@ foreach ($settings_raw as $s) {
|
||||
btnSendTest.addEventListener('click', function() {
|
||||
const recipient = recipientInput.value.trim();
|
||||
if (!recipient) {
|
||||
alert('Please enter a recipient email.');
|
||||
alert('<?= __('Please enter a recipient email.') ?>');
|
||||
return;
|
||||
}
|
||||
|
||||
btnSendTest.disabled = true;
|
||||
btnSendTest.innerHTML = '<span class="spinner-border spinner-border-sm me-1"></span> Sending...';
|
||||
btnSendTest.innerHTML = '<span class="spinner-border spinner-border-sm <?= $is_rtl ? 'ms-1' : 'me-1' ?>"></span> <?= __('Sending...') ?>';
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('recipient', recipient);
|
||||
@ -266,11 +266,11 @@ foreach ($settings_raw as $s) {
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
btnSendTest.disabled = false;
|
||||
btnSendTest.innerHTML = 'Send Test Email';
|
||||
btnSendTest.innerHTML = '<?= __('Send Test Email') ?>';
|
||||
testEmailModal.hide();
|
||||
|
||||
const alertType = data.success ? 'success' : 'danger';
|
||||
const alertMsg = data.success ? 'Test email sent successfully! Please check your inbox.' : 'Failed to send test email: ' + (data.error || 'Unknown error');
|
||||
const alertMsg = data.success ? '<?= __('Test email sent successfully! Please check your inbox.') ?>' : '<?= __('Failed to send test email:') ?> ' + (data.error || '<?= __('Unknown error') ?>');
|
||||
|
||||
const alertHtml = `
|
||||
<div class="alert alert-${alertType} alert-dismissible fade show">
|
||||
@ -282,9 +282,9 @@ foreach ($settings_raw as $s) {
|
||||
})
|
||||
.catch(error => {
|
||||
btnSendTest.disabled = false;
|
||||
btnSendTest.innerHTML = 'Send Test Email';
|
||||
btnSendTest.innerHTML = '<?= __('Send Test Email') ?>';
|
||||
console.error('Error:', error);
|
||||
alert('An error occurred while sending the test email.');
|
||||
alert('<?= __('An error occurred while sending the test email.') ?>');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,19 +1,60 @@
|
||||
<?php
|
||||
$current_page = basename($_SERVER['PHP_SELF']);
|
||||
$current_lang = get_current_lang();
|
||||
?>
|
||||
<div class="sidebar">
|
||||
<h4 class="mb-4"><?= htmlspecialchars(get_org_name()) ?></h4>
|
||||
<nav class="nav flex-column">
|
||||
<a href="index.php" class="nav-link <?= $current_page == 'index.php' ? 'active' : '' ?>"><i class="bi bi-speedometer2 me-2"></i> Dashboard</a>
|
||||
<a href="profile.php" class="nav-link <?= $current_page == 'profile.php' ? 'active' : '' ?>"><i class="bi bi-building me-2"></i> Org Profile</a>
|
||||
<a href="settings.php" class="nav-link <?= $current_page == 'settings.php' ? 'active' : '' ?>"><i class="bi bi-gear me-2"></i> Gateway Settings</a>
|
||||
<a href="categories.php" class="nav-link <?= $current_page == 'categories.php' ? 'active' : '' ?>"><i class="bi bi-tags me-2"></i> Categories</a>
|
||||
<a href="cases.php" class="nav-link <?= $current_page == 'cases.php' ? 'active' : '' ?>"><i class="bi bi-grid me-2"></i> Cases</a>
|
||||
<a href="donations.php" class="nav-link <?= $current_page == 'donations.php' ? 'active' : '' ?>"><i class="bi bi-cash-stack me-2"></i> Donations</a>
|
||||
<a href="financial_summary.php" class="nav-link <?= $current_page == 'financial_summary.php' ? 'active' : '' ?>"><i class="bi bi-graph-up-arrow me-2"></i> Financial Summary</a>
|
||||
<a href="donors.php" class="nav-link <?= $current_page == 'donors.php' ? 'active' : '' ?>"><i class="bi bi-people me-2"></i> Donors (CRM)</a>
|
||||
<a href="audit_logs.php" class="nav-link <?= $current_page == 'audit_logs.php' ? 'active' : '' ?>"><i class="bi bi-journal-text me-2"></i> Audit Logs</a>
|
||||
<a href="index.php" class="nav-link <?= $current_page == 'index.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-speedometer2 me-2"></i> <?= __('dashboard') ?>
|
||||
</a>
|
||||
<a href="profile.php" class="nav-link <?= $current_page == 'profile.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-building me-2"></i> <?= __('org_profile') ?>
|
||||
</a>
|
||||
|
||||
<?php if (is_super_admin()): ?>
|
||||
<a href="users.php" class="nav-link <?= $current_page == 'users.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-people-fill me-2"></i> <?= __('users') ?>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="user_profile.php" class="nav-link <?= $current_page == 'user_profile.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-person-circle me-2"></i> <?= __('my_profile') ?>
|
||||
</a>
|
||||
|
||||
<a href="settings.php" class="nav-link <?= $current_page == 'settings.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-gear me-2"></i> <?= __('gateway_settings') ?>
|
||||
</a>
|
||||
<a href="categories.php" class="nav-link <?= $current_page == 'categories.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-tags me-2"></i> <?= __('categories') ?>
|
||||
</a>
|
||||
<a href="cases.php" class="nav-link <?= $current_page == 'cases.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-grid me-2"></i> <?= __('cases') ?>
|
||||
</a>
|
||||
<a href="donations.php" class="nav-link <?= $current_page == 'donations.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-cash-stack me-2"></i> <?= __('donations') ?>
|
||||
</a>
|
||||
<a href="financial_summary.php" class="nav-link <?= $current_page == 'financial_summary.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-graph-up-arrow me-2"></i> <?= __('financial_summary') ?>
|
||||
</a>
|
||||
<a href="donors.php" class="nav-link <?= $current_page == 'donors.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-people me-2"></i> <?= __('donors_crm') ?>
|
||||
</a>
|
||||
<a href="audit_logs.php" class="nav-link <?= $current_page == 'audit_logs.php' ? 'active' : '' ?>">
|
||||
<i class="bi bi-journal-text me-2"></i> <?= __('audit_logs') ?>
|
||||
</a>
|
||||
|
||||
<hr>
|
||||
<a href="logout.php" class="nav-link text-danger"><i class="bi bi-box-arrow-right me-2"></i> Logout</a>
|
||||
|
||||
<div class="px-3 mb-3">
|
||||
<div class="btn-group w-100" role="group">
|
||||
<a href="?lang=en" class="btn btn-sm btn-outline-primary <?= $current_lang == 'en' ? 'active' : '' ?>">EN</a>
|
||||
<a href="?lang=ar" class="btn btn-sm btn-outline-primary <?= $current_lang == 'ar' ? 'active' : '' ?>">AR</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<a href="logout.php" class="nav-link text-danger">
|
||||
<i class="bi bi-box-arrow-right me-2"></i> <?= __('logout') ?>
|
||||
</a>
|
||||
</nav>
|
||||
</div>
|
||||
141
admin/user_profile.php
Normal file
141
admin/user_profile.php
Normal file
@ -0,0 +1,141 @@
|
||||
<?php
|
||||
require_once 'auth.php';
|
||||
require_once '../db/config.php';
|
||||
require_login();
|
||||
|
||||
$pdo = db();
|
||||
$user_id = $_SESSION['user_id'];
|
||||
$error = '';
|
||||
$success = '';
|
||||
|
||||
$user = get_user();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$email = trim($_POST['email'] ?? '');
|
||||
$current_password = $_POST['current_password'] ?? '';
|
||||
$new_password = $_POST['new_password'] ?? '';
|
||||
$confirm_password = $_POST['confirm_password'] ?? '';
|
||||
|
||||
if (empty($email)) {
|
||||
$error = __("Email is required.");
|
||||
} elseif (!password_verify($current_password, $user['password'])) {
|
||||
$error = __("Incorrect current password.");
|
||||
} else {
|
||||
try {
|
||||
if (!empty($new_password)) {
|
||||
if ($new_password !== $confirm_password) {
|
||||
$error = __("New passwords do not match.");
|
||||
} else {
|
||||
$hashed_password = password_hash($new_password, PASSWORD_DEFAULT);
|
||||
$stmt = $pdo->prepare("UPDATE users SET email = ?, password = ? WHERE id = ?");
|
||||
$stmt->execute([$email, $hashed_password, $user_id]);
|
||||
$success = __("Profile and password updated successfully.");
|
||||
}
|
||||
} else {
|
||||
$stmt = $pdo->prepare("UPDATE users SET email = ? WHERE id = ?");
|
||||
$stmt->execute([$email, $user_id]);
|
||||
$success = __("Profile updated successfully.");
|
||||
}
|
||||
|
||||
if ($success) {
|
||||
log_action('update_profile', "User updated their own profile.");
|
||||
// Refresh user data
|
||||
$user = get_user();
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$error = __("Error") . ": " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$is_rtl = (get_current_lang() === 'ar');
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= $is_rtl ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= __('My Profile') ?> - <?= htmlspecialchars(get_org_name()) ?></title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
<?php if ($is_rtl): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="admin.css">
|
||||
</head>
|
||||
<body>
|
||||
<?php include "sidebar.php"; ?>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="mb-4">
|
||||
<h2><?= __('My Profile') ?></h2>
|
||||
<p class="text-muted"><?= __('Manage your personal account settings.') ?></p>
|
||||
</div>
|
||||
|
||||
<?php if ($success): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show">
|
||||
<?= htmlspecialchars($success) ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger alert-dismissible fade show">
|
||||
<?= htmlspecialchars($error) ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card p-4">
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold"><?= __('Email Address') ?></label>
|
||||
<input type="email" name="email" class="form-control" value="<?= htmlspecialchars($user['email']) ?>" required>
|
||||
</div>
|
||||
|
||||
<hr class="my-4">
|
||||
<h5 class="mb-3"><?= __('Change Password') ?></h5>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= __('New Password') ?></label>
|
||||
<input type="password" name="new_password" class="form-control" placeholder="<?= __('Leave blank to keep current') ?>">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= __('Confirm New Password') ?></label>
|
||||
<input type="password" name="confirm_password" class="form-control" placeholder="<?= __('Repeat new password') ?>">
|
||||
</div>
|
||||
|
||||
<hr class="my-4">
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold text-danger"><?= __('Current Password (Required to save changes)') ?></label>
|
||||
<input type="password" name="current_password" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="<?= $is_rtl ? 'text-start' : 'text-end' ?>">
|
||||
<button type="submit" class="btn btn-primary px-4"><?= __('Save Changes') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="card p-4">
|
||||
<h5><?= __('Account Information') ?></h5>
|
||||
<div class="mt-3">
|
||||
<p><strong><?= __('Role') ?>:</strong> <span class="badge bg-secondary"><?= __(str_replace('_', ' ', ucfirst($user['role']))) ?></span></p>
|
||||
<p><strong><?= __('Account Created') ?>:</strong> <?= date('F j, Y', strtotime($user['created_at'])) ?></p>
|
||||
<p class="text-muted small"><?= __('For security reasons, your role can only be changed by a Super Admin.') ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
210
admin/users.php
Normal file
210
admin/users.php
Normal file
@ -0,0 +1,210 @@
|
||||
<?php
|
||||
require_once 'auth.php';
|
||||
require_once '../db/config.php';
|
||||
require_login();
|
||||
|
||||
if (!is_super_admin()) {
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$pdo = db();
|
||||
$error = '';
|
||||
$success = '';
|
||||
|
||||
// Handle User Deletion
|
||||
if (isset($_GET['delete']) && is_numeric($_GET['delete'])) {
|
||||
$id = $_GET['delete'];
|
||||
if ($id == $_SESSION['user_id']) {
|
||||
$error = "You cannot delete your own account.";
|
||||
} else {
|
||||
try {
|
||||
$stmt = $pdo->prepare("DELETE FROM users WHERE id = ?");
|
||||
$stmt->execute([$id]);
|
||||
log_action('delete_user', "Deleted user ID: $id");
|
||||
$success = "User deleted successfully.";
|
||||
} catch (Exception $e) {
|
||||
$error = "Error deleting user: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Add/Edit User
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$id = $_POST['id'] ?? null;
|
||||
$email = trim($_POST['email'] ?? '');
|
||||
$password = $_POST['password'] ?? '';
|
||||
$role = $_POST['role'] ?? 'org_admin';
|
||||
|
||||
if (empty($email)) {
|
||||
$error = "Email is required.";
|
||||
} else {
|
||||
try {
|
||||
if ($id) {
|
||||
// Update
|
||||
if (!empty($password)) {
|
||||
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
|
||||
$stmt = $pdo->prepare("UPDATE users SET email = ?, password = ?, role = ? WHERE id = ?");
|
||||
$stmt->execute([$email, $hashed_password, $role, $id]);
|
||||
} else {
|
||||
$stmt = $pdo->prepare("UPDATE users SET email = ?, role = ? WHERE id = ?");
|
||||
$stmt->execute([$email, $role, $id]);
|
||||
}
|
||||
log_action('update_user', "Updated user: $email");
|
||||
$success = "User updated successfully.";
|
||||
} else {
|
||||
// Create
|
||||
if (empty($password)) {
|
||||
$error = "Password is required for new users.";
|
||||
} else {
|
||||
$hashed_password = password_hash($password, PASSWORD_DEFAULT);
|
||||
$stmt = $pdo->prepare("INSERT INTO users (email, password, role) VALUES (?, ?, ?)");
|
||||
$stmt->execute([$email, $hashed_password, $role]);
|
||||
log_action('create_user', "Created user: $email");
|
||||
$success = "User created successfully.";
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$error = "Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$users = $pdo->query("SELECT * FROM users ORDER BY created_at DESC")->fetchAll();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= get_current_lang() ?>" dir="<?= is_rtl() ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= __('users') ?> - <?= htmlspecialchars(get_org_name()) ?> Admin</title>
|
||||
<?php if ($favicon = get_favicon_url()): ?>
|
||||
<link rel="icon" type="image/x-icon" href="../<?= htmlspecialchars($favicon) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (is_rtl()): ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.rtl.min.css">
|
||||
<?php else: ?>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css">
|
||||
<?php endif; ?>
|
||||
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="admin.css?v=<?= time() ?>">
|
||||
</head>
|
||||
<body>
|
||||
<?php include "sidebar.php"; ?>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h2 class="mb-0"><?= __('users') ?></h2>
|
||||
<button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#userModal">
|
||||
<i class="bi bi-plus-lg me-2"></i> <?= __('add_new') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger"><?= $error ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($success): ?>
|
||||
<div class="alert alert-success"><?= $success ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="card p-4">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead class="table-light">
|
||||
<tr>
|
||||
<th><?= __('email') ?></th>
|
||||
<th><?= __('role') ?></th>
|
||||
<th><?= __('date') ?></th>
|
||||
<th><?= __('actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($users as $u): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($u['email']) ?></td>
|
||||
<td>
|
||||
<span class="badge badge-<?= $u['role'] ?>">
|
||||
<?= str_replace('_', ' ', ucfirst($u['role'])) ?>
|
||||
</span>
|
||||
</td>
|
||||
<td><?= date('M j, Y', strtotime($u['created_at'])) ?></td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-outline-primary edit-user"
|
||||
data-id="<?= $u['id'] ?>"
|
||||
data-email="<?= htmlspecialchars($u['email']) ?>"
|
||||
data-role="<?= $u['role'] ?>"
|
||||
data-bs-toggle="modal"
|
||||
data-bs-target="#userModal">
|
||||
<i class="bi bi-pencil"></i>
|
||||
</button>
|
||||
<?php if ($u['id'] != $_SESSION['user_id']): ?>
|
||||
<a href="?delete=<?= $u['id'] ?>" class="btn btn-sm btn-outline-danger" onclick="return confirm('Are you sure?')">
|
||||
<i class="bi bi-trash"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- User Modal -->
|
||||
<div class="modal fade" id="userModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form method="POST">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><?= __('users') ?></h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="id" id="user_id">
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= __('email') ?></label>
|
||||
<input type="email" name="email" id="user_email" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= __('password') ?></label>
|
||||
<input type="password" name="password" class="form-control" placeholder="Leave blank to keep current">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label"><?= __('role') ?></label>
|
||||
<select name="role" id="user_role" class="form-control">
|
||||
<option value="org_admin">Organization Admin</option>
|
||||
<option value="super_admin">Super Admin</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><?= __('cancel') ?></button>
|
||||
<button type="submit" class="btn btn-primary"><?= __('save') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
document.querySelectorAll('.edit-user').forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
document.getElementById('user_id').value = button.dataset.id;
|
||||
document.getElementById('user_email').value = button.dataset.email;
|
||||
document.getElementById('user_role').value = button.dataset.role;
|
||||
});
|
||||
});
|
||||
|
||||
// Reset modal on close
|
||||
document.getElementById('userModal').addEventListener('hidden.bs.modal', () => {
|
||||
document.getElementById('user_id').value = '';
|
||||
document.getElementById('user_email').value = '';
|
||||
document.getElementById('user_role').value = 'org_admin';
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
273
database_backup.sql
Normal file
273
database_backup.sql
Normal file
@ -0,0 +1,273 @@
|
||||
/*M!999999\- enable the sandbox mode */
|
||||
-- MariaDB dump 10.19 Distrib 10.11.14-MariaDB, for debian-linux-gnu (x86_64)
|
||||
--
|
||||
-- Host: 127.0.0.1 Database: app_38394
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.11.14-MariaDB-0+deb12u2
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8mb4 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `audit_logs`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `audit_logs`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `audit_logs` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`user_id` int(11) DEFAULT NULL,
|
||||
`action` varchar(255) NOT NULL,
|
||||
`details` text DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `user_id` (`user_id`),
|
||||
CONSTRAINT `audit_logs_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `audit_logs`
|
||||
--
|
||||
|
||||
LOCK TABLES `audit_logs` WRITE;
|
||||
/*!40000 ALTER TABLE `audit_logs` DISABLE KEYS */;
|
||||
INSERT INTO `audit_logs` VALUES
|
||||
(1,1,'login','User admin@charityhub.com logged in successfully.','2026-02-13 10:13:11');
|
||||
/*!40000 ALTER TABLE `audit_logs` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `cases`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `cases`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `cases` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`category_id` int(11) NOT NULL,
|
||||
`title_en` varchar(255) NOT NULL,
|
||||
`title_ar` varchar(255) NOT NULL,
|
||||
`desc_en` text DEFAULT NULL,
|
||||
`desc_ar` text DEFAULT NULL,
|
||||
`goal` decimal(10,2) NOT NULL,
|
||||
`raised` decimal(10,2) DEFAULT 0.00,
|
||||
`image_url` varchar(255) DEFAULT NULL,
|
||||
`importance` enum('normal','urgent','top_priority') DEFAULT 'normal',
|
||||
`status` enum('active','paused','disabled') DEFAULT 'active',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `cases`
|
||||
--
|
||||
|
||||
LOCK TABLES `cases` WRITE;
|
||||
/*!40000 ALTER TABLE `cases` DISABLE KEYS */;
|
||||
INSERT INTO `cases` VALUES
|
||||
(1,1,'Clean Water Project','مشروع المياه النظيفة','Providing clean water to remote villages.','توفير المياه النظيفة للقرى النائية.',50000.00,15000.00,'https://images.pexels.com/photos/1072824/pexels-photo-1072824.jpeg?auto=compress&cs=tinysrgb&w=600','normal','active'),
|
||||
(2,1,'Emergency Medical Supplies','إمدادات طبية طارئة','Urgent medical aid for disaster-stricken areas.','مساعدات طبية عاجلة للمناطق المنكوبة.',25000.00,18500.00,'https://images.pexels.com/photos/115594/pexels-photo-115594.jpeg?auto=compress&cs=tinysrgb&w=600','urgent','active'),
|
||||
(3,2,'Scholarships for Orphans','منح دراسية للأيتام','Supporting orphans with higher education costs.','دعم الأيتام في تكاليف التعليم العالي.\r\nدعم الأيتام في تكاليف التعليم العالي.\r\nدعم الأيتام في تكاليف التعليم العالي.\r\nدعم الأيتام في تكاليف التعليم العالي.\r\nدعم الأيتام في تكاليف التعليم العالي.\r\nدعم الأيتام في تكاليف التعليم العالي.\r\nدعم الأيتام في تكاليف التعليم العالي.',10000.00,2000.00,'assets/images/cases/case_698edda6587b1.jpg','top_priority','active');
|
||||
/*!40000 ALTER TABLE `cases` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `categories`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `categories`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `categories` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name_en` varchar(255) NOT NULL,
|
||||
`name_ar` varchar(255) NOT NULL,
|
||||
`logo_url` varchar(255) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `categories`
|
||||
--
|
||||
|
||||
LOCK TABLES `categories` WRITE;
|
||||
/*!40000 ALTER TABLE `categories` DISABLE KEYS */;
|
||||
INSERT INTO `categories` VALUES
|
||||
(1,'Global Health Initiative','المبادرة العالمية للصحة','https://images.pexels.com/photos/6646917/pexels-photo-6646917.jpeg?auto=compress&cs=tinysrgb&w=150'),
|
||||
(2,'Education for All','التعليم للجميع','https://images.pexels.com/photos/301920/pexels-photo-301920.jpeg?auto=compress&cs=tinysrgb&w=150');
|
||||
/*!40000 ALTER TABLE `categories` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `donations`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `donations`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `donations` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`case_id` int(11) NOT NULL,
|
||||
`amount` decimal(10,2) NOT NULL,
|
||||
`status` enum('pending','completed','failed') DEFAULT 'pending',
|
||||
`transaction_id` varchar(255) DEFAULT NULL,
|
||||
`donor_name` varchar(255) DEFAULT NULL,
|
||||
`donor_email` varchar(255) DEFAULT NULL,
|
||||
`donor_phone` varchar(50) DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
`is_gift` tinyint(1) DEFAULT 0,
|
||||
`gift_recipient_name` varchar(255) DEFAULT NULL,
|
||||
`gift_recipient_phone` varchar(50) DEFAULT NULL,
|
||||
`gift_message` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `case_id` (`case_id`),
|
||||
CONSTRAINT `donations_ibfk_1` FOREIGN KEY (`case_id`) REFERENCES `cases` (`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `donations`
|
||||
--
|
||||
|
||||
LOCK TABLES `donations` WRITE;
|
||||
/*!40000 ALTER TABLE `donations` DISABLE KEYS */;
|
||||
INSERT INTO `donations` VALUES
|
||||
(1,3,250.00,'pending',NULL,'moosa','aalabry@gmail.com','96899359472','2026-02-13 07:53:08',0,NULL,NULL,NULL);
|
||||
/*!40000 ALTER TABLE `donations` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `org_profile`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `org_profile`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `org_profile` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`name_en` varchar(255) NOT NULL,
|
||||
`name_ar` varchar(255) NOT NULL,
|
||||
`logo_url` varchar(255) DEFAULT NULL,
|
||||
`favicon_url` varchar(255) DEFAULT NULL,
|
||||
`description_en` text DEFAULT NULL,
|
||||
`description_ar` text DEFAULT NULL,
|
||||
`email` varchar(255) DEFAULT NULL,
|
||||
`phone` varchar(255) DEFAULT NULL,
|
||||
`address` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `org_profile`
|
||||
--
|
||||
|
||||
LOCK TABLES `org_profile` WRITE;
|
||||
/*!40000 ALTER TABLE `org_profile` DISABLE KEYS */;
|
||||
INSERT INTO `org_profile` VALUES
|
||||
(1,'Al-Hamra Charity Team','فريق الحمراء التطوعي','assets/images/logo_1770967720.jpg','assets/images/favicon_1770977716.jpg','','','','','');
|
||||
/*!40000 ALTER TABLE `org_profile` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `settings`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `settings`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `settings` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`setting_key` varchar(100) NOT NULL,
|
||||
`setting_value` text DEFAULT NULL,
|
||||
`updated_at` timestamp NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `setting_key` (`setting_key`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `settings`
|
||||
--
|
||||
|
||||
LOCK TABLES `settings` WRITE;
|
||||
/*!40000 ALTER TABLE `settings` DISABLE KEYS */;
|
||||
INSERT INTO `settings` VALUES
|
||||
(1,'thawani_secret_key','','2026-02-13 07:31:27'),
|
||||
(2,'thawani_publishable_key','','2026-02-13 07:31:27'),
|
||||
(3,'thawani_env','sandbox','2026-02-13 07:31:27'),
|
||||
(4,'wablas_api_token','','2026-02-13 07:31:27'),
|
||||
(5,'wablas_server_url','https://console.wablas.com','2026-02-13 07:31:27'),
|
||||
(6,'wablas_security_key','','2026-02-13 07:38:18'),
|
||||
(7,'mail_transport','smtp','2026-02-13 09:47:55'),
|
||||
(8,'mail_host','','2026-02-13 09:47:55'),
|
||||
(9,'mail_port','587','2026-02-13 09:47:55'),
|
||||
(10,'mail_encryption','tls','2026-02-13 09:47:55'),
|
||||
(11,'mail_username','','2026-02-13 09:47:55'),
|
||||
(12,'mail_password','','2026-02-13 09:47:55'),
|
||||
(13,'mail_from_address','','2026-02-13 09:47:55'),
|
||||
(14,'mail_from_name','','2026-02-13 09:58:10'),
|
||||
(15,'pop3_host','','2026-02-13 09:47:55'),
|
||||
(16,'pop3_port','995','2026-02-13 09:47:55'),
|
||||
(17,'pop3_username','','2026-02-13 09:47:55'),
|
||||
(18,'pop3_password','','2026-02-13 09:47:55'),
|
||||
(19,'report_recipient_email','','2026-02-13 09:48:27');
|
||||
/*!40000 ALTER TABLE `settings` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `users`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `users`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8mb4 */;
|
||||
CREATE TABLE `users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`email` varchar(255) NOT NULL,
|
||||
`password` varchar(255) NOT NULL,
|
||||
`role` enum('super_admin','org_admin') NOT NULL,
|
||||
`org_id` int(11) DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `email` (`email`),
|
||||
KEY `org_id` (`org_id`),
|
||||
CONSTRAINT `users_ibfk_1` FOREIGN KEY (`org_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `users`
|
||||
--
|
||||
|
||||
LOCK TABLES `users` WRITE;
|
||||
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
|
||||
INSERT INTO `users` VALUES
|
||||
(1,'admin@charityhub.com','$2y$10$IzrWwdMjLg1EMZFFfXD1W.sHiqzJPmgvVhr.0rNkXyCL6EBwjxmku','super_admin',NULL,'2026-02-13 06:33:47'),
|
||||
(2,'org1@test.com','$2y$10$IzrWwdMjLg1EMZFFfXD1W.sHiqzJPmgvVhr.0rNkXyCL6EBwjxmku','org_admin',1,'2026-02-13 06:33:47'),
|
||||
(3,'org2@test.com','$2y$10$IzrWwdMjLg1EMZFFfXD1W.sHiqzJPmgvVhr.0rNkXyCL6EBwjxmku','org_admin',2,'2026-02-13 06:33:47');
|
||||
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2026-02-13 10:33:17
|
||||
Loading…
x
Reference in New Issue
Block a user