Autosave: 20260327-063637
This commit is contained in:
parent
518c9fdd19
commit
10d64f8648
@ -521,3 +521,4 @@ body {
|
||||
.sidebar .collapse .nav-link.active {
|
||||
color: #fff;
|
||||
}
|
||||
.group-meetings { color: #20c997 !important; } /* Teal */
|
||||
|
||||
16
db/migrations/027_add_meeting_module.sql
Normal file
16
db/migrations/027_add_meeting_module.sql
Normal file
@ -0,0 +1,16 @@
|
||||
CREATE TABLE IF NOT EXISTS `meetings` (
|
||||
`id` INT AUTO_INCREMENT PRIMARY KEY,
|
||||
`title` VARCHAR(255) NOT NULL,
|
||||
`description` TEXT,
|
||||
`start_time` DATETIME NOT NULL,
|
||||
`end_time` DATETIME NOT NULL,
|
||||
`location` VARCHAR(255),
|
||||
`status` ENUM('scheduled', 'completed', 'cancelled') DEFAULT 'scheduled',
|
||||
`created_by` INT,
|
||||
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- Add permissions for existing admins
|
||||
INSERT IGNORE INTO `user_permissions` (`user_id`, `page`, `can_view`, `can_add`, `can_edit`, `can_delete`)
|
||||
SELECT `id`, 'meetings', 1, 1, 1, 1 FROM `users` WHERE `role` = 'admin' OR `is_super_admin` = 1;
|
||||
5
db/migrations/028_expand_meetings_table.sql
Normal file
5
db/migrations/028_expand_meetings_table.sql
Normal file
@ -0,0 +1,5 @@
|
||||
ALTER TABLE `meetings`
|
||||
ADD COLUMN `agenda` TEXT AFTER `description`,
|
||||
ADD COLUMN `attendees` TEXT AFTER `location`,
|
||||
ADD COLUMN `absentees` TEXT AFTER `attendees`,
|
||||
ADD COLUMN `meeting_details` TEXT AFTER `absentees`;
|
||||
@ -133,6 +133,9 @@ $is_stock_open = in_array($cp, $stock_pages);
|
||||
$expenses_pages = ['expenses.php', 'expense_categories.php', 'expense_reports.php'];
|
||||
$is_expenses_open = in_array($cp, $expenses_pages);
|
||||
|
||||
$meetings_pages = ['meetings.php'];
|
||||
$is_meetings_open = in_array($cp, $meetings_pages);
|
||||
|
||||
$admin_pages = ['index.php', 'users.php', 'charity-settings.php'];
|
||||
$is_admin_open = in_array($cp, $admin_pages);
|
||||
?>
|
||||
@ -527,6 +530,27 @@ $is_admin_open = in_array($cp, $admin_pages);
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Meetings Group -->
|
||||
<?php if (canView('meetings')): ?>
|
||||
<li class="nav-item">
|
||||
<button class="sidebar-group-btn <?= $is_meetings_open ? '' : 'collapsed' ?>" type="button" data-bs-toggle="collapse" data-bs-target="#menu-meetings" aria-expanded="<?= $is_meetings_open ? 'true' : 'false' ?>">
|
||||
<span class="group-content group-meetings">
|
||||
<i class="fas fa-handshake"></i> الاجتماعات
|
||||
</span>
|
||||
<i class="fas fa-chevron-down arrow-icon"></i>
|
||||
</button>
|
||||
<div class="collapse <?= $is_meetings_open ? 'show' : '' ?>" id="menu-meetings">
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link <?= $cp == 'meetings.php' ? 'active' : '' ?>" href="meetings.php">
|
||||
جدول الاجتماعات
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Admin Group -->
|
||||
<?php if (canView('users') || canView('settings') || isAdmin()): ?>
|
||||
<li class="nav-item">
|
||||
|
||||
454
meetings.php
Normal file
454
meetings.php
Normal file
@ -0,0 +1,454 @@
|
||||
<?php
|
||||
ob_start();
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
|
||||
if (!canView('meetings')) {
|
||||
redirect('index.php');
|
||||
}
|
||||
|
||||
$error = '';
|
||||
$success = '';
|
||||
|
||||
// Handle Actions
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$action = $_POST['action'] ?? '';
|
||||
$id = $_POST['id'] ?? 0;
|
||||
|
||||
if ($action === 'add' || $action === 'edit') {
|
||||
if (($action === 'add' && !canAdd('meetings')) || ($action === 'edit' && !canEdit('meetings'))) {
|
||||
$error = 'ليس لديك صلاحية للقيام بهذا الإجراء';
|
||||
} else {
|
||||
$title = $_POST['title'] ?? '';
|
||||
$description = $_POST['description'] ?? '';
|
||||
$agenda = $_POST['agenda'] ?? '';
|
||||
$attendees = $_POST['attendees'] ?? '';
|
||||
$absentees = $_POST['absentees'] ?? '';
|
||||
$meeting_details = $_POST['meeting_details'] ?? '';
|
||||
$start_time = $_POST['start_time'] ?? '';
|
||||
$end_time = $_POST['end_time'] ?? '';
|
||||
$location = $_POST['location'] ?? '';
|
||||
$status = $_POST['status'] ?? 'scheduled';
|
||||
|
||||
try {
|
||||
$db = db();
|
||||
|
||||
if ($action === 'add') {
|
||||
$stmt = $db->prepare("INSERT INTO meetings (title, description, agenda, attendees, absentees, meeting_details, start_time, end_time, location, status, created_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
$stmt->execute([$title, $description, $agenda, $attendees, $absentees, $meeting_details, $start_time, $end_time, $location, $status, $_SESSION['user_id']]);
|
||||
$_SESSION['success'] = 'تم جدولة الاجتماع بنجاح';
|
||||
} else {
|
||||
$stmt = $db->prepare("UPDATE meetings SET title=?, description=?, agenda=?, attendees=?, absentees=?, meeting_details=?, start_time=?, end_time=?, location=?, status=? WHERE id=?");
|
||||
$stmt->execute([$title, $description, $agenda, $attendees, $absentees, $meeting_details, $start_time, $end_time, $location, $status, $id]);
|
||||
$_SESSION['success'] = 'تم تحديث الاجتماع بنجاح';
|
||||
}
|
||||
redirect('meetings.php');
|
||||
} catch (PDOException $e) {
|
||||
$error = 'حدث خطأ: ' . $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_GET['action']) && $_GET['action'] === 'delete' && isset($_GET['id'])) {
|
||||
if (!canDelete('meetings')) redirect('meetings.php');
|
||||
$id = $_GET['id'];
|
||||
$db = db();
|
||||
|
||||
$stmt = $db->prepare("DELETE FROM meetings WHERE id = ?");
|
||||
$stmt->execute([$id]);
|
||||
|
||||
$_SESSION['success'] = 'تم حذف الاجتماع بنجاح';
|
||||
redirect('meetings.php');
|
||||
}
|
||||
|
||||
// Fetch Data for List
|
||||
$date_from = $_GET['date_from'] ?? date('Y-m-01');
|
||||
$date_to = $_GET['date_to'] ?? date('Y-m-t');
|
||||
$status_filter = $_GET['status'] ?? '';
|
||||
$search = $_GET['search'] ?? '';
|
||||
|
||||
$sql = "SELECT m.*, u.username as created_by_name
|
||||
FROM meetings m
|
||||
LEFT JOIN users u ON m.created_by = u.id
|
||||
WHERE DATE(m.start_time) BETWEEN ? AND ?";
|
||||
$params = [$date_from, $date_to];
|
||||
|
||||
if ($status_filter) {
|
||||
$sql .= " AND m.status = ?";
|
||||
$params[] = $status_filter;
|
||||
}
|
||||
if ($search) {
|
||||
$sql .= " AND (m.title LIKE ? OR m.description LIKE ? OR m.location LIKE ?)";
|
||||
$params[] = "%$search%";
|
||||
$params[] = "%$search%";
|
||||
$params[] = "%$search%";
|
||||
}
|
||||
|
||||
$sql .= " ORDER BY m.start_time ASC";
|
||||
|
||||
$stmt = db()->prepare($sql);
|
||||
$stmt->execute($params);
|
||||
$meetings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (isset($_SESSION['success'])) {
|
||||
$success = $_SESSION['success'];
|
||||
unset($_SESSION['success']);
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- Quill CSS -->
|
||||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
||||
<style>
|
||||
/* Custom Quill Styles for Bootstrap Integration */
|
||||
.ql-container {
|
||||
font-family: 'Cairo', sans-serif;
|
||||
font-size: 1rem;
|
||||
}
|
||||
.ql-editor {
|
||||
min-height: 150px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
||||
<h1 class="h2">إدارة الاجتماعات</h1>
|
||||
<?php if (canAdd('meetings')): ?>
|
||||
<button type="button" class="btn btn-primary shadow-sm" onclick="openModal('add')">
|
||||
<i class="fas fa-plus"></i> جدولة اجتماع جديد
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ($success): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<?= $success ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<?= $error ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Filters -->
|
||||
<div class="card shadow-sm border-0 mb-4">
|
||||
<div class="card-body bg-light">
|
||||
<form method="GET" class="row g-3">
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">من تاريخ</label>
|
||||
<input type="date" name="date_from" class="form-control" value="<?= $date_from ?>">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">إلى تاريخ</label>
|
||||
<input type="date" name="date_to" class="form-control" value="<?= $date_to ?>">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">الحالة</label>
|
||||
<select name="status" class="form-select">
|
||||
<option value="">الكل</option>
|
||||
<option value="scheduled" <?= $status_filter == 'scheduled' ? 'selected' : '' ?>>مجدول</option>
|
||||
<option value="completed" <?= $status_filter == 'completed' ? 'selected' : '' ?>>منتهي</option>
|
||||
<option value="cancelled" <?= $status_filter == 'cancelled' ? 'selected' : '' ?>>ملغي</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">بحث</label>
|
||||
<div class="input-group">
|
||||
<input type="text" name="search" class="form-control" placeholder="عنوان، وصف، مكان..." value="<?= htmlspecialchars($search) ?>">
|
||||
<button class="btn btn-primary" type="submit"><i class="fas fa-search"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-body p-0">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover align-middle mb-0">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th class="ps-4">العنوان</th>
|
||||
<th>التاريخ والوقت</th>
|
||||
<th>المكان</th>
|
||||
<th>المنظم</th>
|
||||
<th>الحالة</th>
|
||||
<th class="text-center">الإجراءات</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($meetings)): ?>
|
||||
<tr>
|
||||
<td colspan="6" class="text-center py-5 text-muted">لا توجد اجتماعات مطابقة</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($meetings as $meeting): ?>
|
||||
<?php
|
||||
$status_class = match($meeting['status']) {
|
||||
'scheduled' => 'bg-primary',
|
||||
'completed' => 'bg-success',
|
||||
'cancelled' => 'bg-danger',
|
||||
default => 'bg-secondary'
|
||||
};
|
||||
$status_text = match($meeting['status']) {
|
||||
'scheduled' => 'مجدول',
|
||||
'completed' => 'منتهي',
|
||||
'cancelled' => 'ملغي',
|
||||
default => $meeting['status']
|
||||
};
|
||||
// Strip tags for preview, but keep it clean
|
||||
$agenda_preview = strip_tags($meeting['agenda'] ?? '');
|
||||
?>
|
||||
<tr>
|
||||
<td class="ps-4 fw-bold">
|
||||
<?= htmlspecialchars($meeting['title']) ?>
|
||||
<?php if ($agenda_preview): ?>
|
||||
<div class="small text-muted fw-normal text-truncate" style="max-width: 250px;"><?= htmlspecialchars($agenda_preview) ?></div>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<div><i class="fas fa-calendar-alt text-muted me-1"></i> <?= date('Y-m-d', strtotime($meeting['start_time'])) ?></div>
|
||||
<div class="small text-muted"><i class="fas fa-clock me-1"></i> <?= date('H:i', strtotime($meeting['start_time'])) ?> - <?= date('H:i', strtotime($meeting['end_time'])) ?></div>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($meeting['location']): ?>
|
||||
<i class="fas fa-map-marker-alt text-danger me-1"></i> <?= htmlspecialchars($meeting['location']) ?>
|
||||
<?php else: ?>
|
||||
-
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?= htmlspecialchars($meeting['created_by_name']) ?></td>
|
||||
<td><span class="badge <?= $status_class ?>"><?= $status_text ?></span></td>
|
||||
<td class="text-center">
|
||||
<?php if (canEdit('meetings')): ?>
|
||||
<button class="btn btn-sm btn-outline-primary" onclick='openModal("edit", <?= json_encode($meeting, JSON_HEX_APOS | JSON_HEX_QUOT) ?>)'>
|
||||
<i class="fas fa-edit"></i>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<a href="print_meeting.php?id=<?= $meeting['id'] ?>" target="_blank" class="btn btn-sm btn-outline-secondary" title="طباعة">
|
||||
<i class="fas fa-print"></i>
|
||||
</a>
|
||||
<?php if (canDelete('meetings')): ?>
|
||||
<a href="javascript:void(0)" onclick="confirmDelete(<?= $meeting['id'] ?>)" class="btn btn-sm btn-outline-danger">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="meetingModal" tabindex="-1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header bg-primary text-white">
|
||||
<h5 class="modal-title" id="modalTitle">جدولة اجتماع جديد</h5>
|
||||
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="POST" id="meetingForm">
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="action" id="modalAction" value="add">
|
||||
<input type="hidden" name="id" id="modalId" value="0">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">عنوان الاجتماع (Title)</label>
|
||||
<input type="text" name="title" id="modalTitleInput" class="form-control" required placeholder="مثال: اجتماع الفريق الأسبوعي">
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-bold">وقت البدء (Start)</label>
|
||||
<input type="datetime-local" name="start_time" id="modalStartTime" class="form-control" required>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-bold">وقت الانتهاء (End)</label>
|
||||
<input type="datetime-local" name="end_time" id="modalEndTime" class="form-control" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">الموقع / الرابط (Place Held)</label>
|
||||
<input type="text" name="location" id="modalLocation" class="form-control" placeholder="غرفة الاجتماعات، Zoom، Google Meet...">
|
||||
</div>
|
||||
|
||||
<!-- Hidden inputs for Quill content -->
|
||||
<input type="hidden" name="agenda" id="hiddenAgenda">
|
||||
<input type="hidden" name="meeting_details" id="hiddenMeetingDetails">
|
||||
<input type="hidden" name="description" id="hiddenDescription">
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">جدول الأعمال (Agenda) <span class="badge bg-secondary">Rich Text</span></label>
|
||||
<div id="editorAgenda"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-bold">الحضور (Attendees)</label>
|
||||
<textarea name="attendees" id="modalAttendees" class="form-control" rows="2" placeholder="أسماء الحضور..."></textarea>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label fw-bold">الغياب (Absentees)</label>
|
||||
<textarea name="absentees" id="modalAbsentees" class="form-control" rows="2" placeholder="أسماء الغائبين..."></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">تفاصيل الاجتماع / المحضر (Meeting Details) <span class="badge bg-secondary">Rich Text</span></label>
|
||||
<div id="editorMeetingDetails"></div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">ملاحظات إضافية (Description) <span class="badge bg-secondary">Rich Text</span></label>
|
||||
<div id="editorDescription"></div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-bold">الحالة</label>
|
||||
<select name="status" id="modalStatus" class="form-select">
|
||||
<option value="scheduled">مجدول (Scheduled)</option>
|
||||
<option value="completed">منتهي (Completed)</option>
|
||||
<option value="cancelled">ملغي (Cancelled)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">إلغاء</button>
|
||||
<button type="submit" class="btn btn-primary">حفظ</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
|
||||
<!-- Quill JS -->
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
||||
<script>
|
||||
// Initialize Quill editors
|
||||
var quillAgenda, quillMeetingDetails, quillDescription;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var toolbarOptions = [
|
||||
['bold', 'italic', 'underline', 'strike'], // toggled buttons
|
||||
['blockquote', 'code-block'],
|
||||
|
||||
[{ 'header': 1 }, { 'header': 2 }], // custom button values
|
||||
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
|
||||
[{ 'script': 'sub'}, { 'script': 'super' }], // superscript/subscript
|
||||
[{ 'indent': '-1'}, { 'indent': '+1' }], // outdent/indent
|
||||
[{ 'direction': 'rtl' }], // text direction
|
||||
|
||||
[{ 'size': ['small', false, 'large', 'huge'] }], // custom dropdown
|
||||
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
|
||||
|
||||
[{ 'color': [] }, { 'background': [] }], // dropdown with defaults from theme
|
||||
[{ 'font': [] }],
|
||||
[{ 'align': [] }],
|
||||
|
||||
['clean'] // remove formatting button
|
||||
];
|
||||
|
||||
quillAgenda = new Quill('#editorAgenda', {
|
||||
modules: { toolbar: toolbarOptions },
|
||||
theme: 'snow'
|
||||
});
|
||||
|
||||
quillMeetingDetails = new Quill('#editorMeetingDetails', {
|
||||
modules: { toolbar: toolbarOptions },
|
||||
theme: 'snow'
|
||||
});
|
||||
|
||||
quillDescription = new Quill('#editorDescription', {
|
||||
modules: { toolbar: toolbarOptions },
|
||||
theme: 'snow'
|
||||
});
|
||||
|
||||
// Form Submission Handling
|
||||
document.getElementById('meetingForm').addEventListener('submit', function() {
|
||||
document.getElementById('hiddenAgenda').value = quillAgenda.root.innerHTML;
|
||||
document.getElementById('hiddenMeetingDetails').value = quillMeetingDetails.root.innerHTML;
|
||||
document.getElementById('hiddenDescription').value = quillDescription.root.innerHTML;
|
||||
});
|
||||
});
|
||||
|
||||
let meetingModal;
|
||||
|
||||
function openModal(action, data = null) {
|
||||
if (!meetingModal) {
|
||||
meetingModal = new bootstrap.Modal(document.getElementById('meetingModal'));
|
||||
}
|
||||
|
||||
document.getElementById('modalAction').value = action;
|
||||
const title = document.getElementById('modalTitle');
|
||||
|
||||
if (action === 'add') {
|
||||
title.textContent = 'جدولة اجتماع جديد';
|
||||
document.getElementById('modalId').value = 0;
|
||||
document.getElementById('modalTitleInput').value = '';
|
||||
document.getElementById('modalAttendees').value = '';
|
||||
document.getElementById('modalAbsentees').value = '';
|
||||
document.getElementById('modalLocation').value = '';
|
||||
|
||||
// Clear Quill content
|
||||
quillAgenda.setText('');
|
||||
quillMeetingDetails.setText('');
|
||||
quillDescription.setText('');
|
||||
|
||||
// Default start time: Next hour, :00
|
||||
const now = new Date();
|
||||
now.setMinutes(0, 0, 0);
|
||||
now.setHours(now.getHours() + 1);
|
||||
|
||||
const formatDateTime = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
return `${year}-${month}-${day}T${hours}:${minutes}`;
|
||||
};
|
||||
|
||||
document.getElementById('modalStartTime').value = formatDateTime(now);
|
||||
|
||||
const end = new Date(now);
|
||||
end.setHours(end.getHours() + 1);
|
||||
document.getElementById('modalEndTime').value = formatDateTime(end);
|
||||
|
||||
document.getElementById('modalStatus').value = 'scheduled';
|
||||
} else {
|
||||
title.textContent = 'تعديل الاجتماع';
|
||||
document.getElementById('modalId').value = data.id;
|
||||
document.getElementById('modalTitleInput').value = data.title;
|
||||
document.getElementById('modalAttendees').value = data.attendees || '';
|
||||
document.getElementById('modalAbsentees').value = data.absentees || '';
|
||||
document.getElementById('modalLocation').value = data.location || '';
|
||||
document.getElementById('modalStartTime').value = data.start_time.replace(' ', 'T').slice(0, 16);
|
||||
document.getElementById('modalEndTime').value = data.end_time.replace(' ', 'T').slice(0, 16);
|
||||
document.getElementById('modalStatus').value = data.status;
|
||||
|
||||
// Set Quill content (safely handle nulls)
|
||||
// Note: We use clipboard.dangerouslyPasteHTML to properly render existing HTML
|
||||
quillAgenda.clipboard.dangerouslyPasteHTML(data.agenda || '');
|
||||
quillMeetingDetails.clipboard.dangerouslyPasteHTML(data.meeting_details || '');
|
||||
quillDescription.clipboard.dangerouslyPasteHTML(data.description || '');
|
||||
}
|
||||
|
||||
meetingModal.show();
|
||||
}
|
||||
|
||||
function confirmDelete(id) {
|
||||
if (confirm('هل أنت متأكد من حذف هذا الاجتماع؟')) {
|
||||
window.location.href = 'meetings.php?action=delete&id=' + id;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
260
print_meeting.php
Normal file
260
print_meeting.php
Normal file
@ -0,0 +1,260 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/db/config.php';
|
||||
require_once __DIR__ . '/includes/settings.php';
|
||||
|
||||
session_start();
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$id = $_GET['id'] ?? 0;
|
||||
|
||||
if (!$id) {
|
||||
die("رقم الاجتماع غير صحيح");
|
||||
}
|
||||
|
||||
try {
|
||||
$db = db();
|
||||
$stmt = $db->prepare("SELECT m.*, u.username as created_by_name FROM meetings m LEFT JOIN users u ON m.created_by = u.id WHERE m.id = ?");
|
||||
$stmt->execute([$id]);
|
||||
$meeting = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$meeting) {
|
||||
die("الاجتماع غير موجود");
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
die("خطأ في قاعدة البيانات");
|
||||
}
|
||||
|
||||
$settings = get_settings();
|
||||
$logo_path = 'uploads/charity/' . ($settings['site_logo'] ?? 'default_logo.png');
|
||||
// Check if logo exists
|
||||
if (!file_exists($logo_path)) {
|
||||
// Try to find any logo in the directory if the specific one is missing
|
||||
$possible_logos = glob('uploads/charity/*logo*.*');
|
||||
if (!empty($possible_logos)) {
|
||||
$logo_path = $possible_logos[0];
|
||||
} else {
|
||||
$logo_path = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($logo_path) {
|
||||
$logo_html = '<img src="' . $logo_path . '" alt="Logo" style="max-height: 100px;">';
|
||||
} else {
|
||||
$logo_html = '';
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="ar" dir="rtl">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>محضر اجتماع - <?= htmlspecialchars($meeting['title']) ?></title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||
background: #fff;
|
||||
color: #000;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
direction: rtl;
|
||||
}
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
border: 1px solid #ddd;
|
||||
padding: 40px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
.header {
|
||||
text-align: center;
|
||||
border-bottom: 2px solid #333;
|
||||
padding-bottom: 20px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.header h1 {
|
||||
margin: 10px 0 5px;
|
||||
font-size: 24px;
|
||||
}
|
||||
.header h2 {
|
||||
margin: 5px 0;
|
||||
font-size: 18px;
|
||||
color: #555;
|
||||
}
|
||||
.header .meta {
|
||||
font-size: 14px;
|
||||
color: #777;
|
||||
}
|
||||
.section {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
background: #f4f4f4;
|
||||
padding: 8px 15px;
|
||||
border-right: 4px solid #333;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 15px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.info-item {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.info-label {
|
||||
font-weight: bold;
|
||||
color: #555;
|
||||
}
|
||||
.content-box {
|
||||
padding: 10px;
|
||||
border: 1px solid #eee;
|
||||
background: #fafafa;
|
||||
min-height: 50px;
|
||||
}
|
||||
/* Style for rich text content to ensure it looks good */
|
||||
.rich-text {
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
.rich-text p { margin-top: 0; }
|
||||
.rich-text ul, .rich-text ol { margin-right: 20px; padding-right: 0; }
|
||||
|
||||
/* Quill Alignment Classes */
|
||||
.ql-align-center { text-align: center; }
|
||||
.ql-align-right { text-align: right; }
|
||||
.ql-align-justify { text-align: justify; }
|
||||
.ql-direction-rtl { direction: rtl; text-align: right; }
|
||||
.ql-direction-ltr { direction: ltr; text-align: left; }
|
||||
.ql-indent-1 { margin-right: 3em; } /* RTL indent */
|
||||
.ql-indent-2 { margin-right: 6em; }
|
||||
|
||||
.signatures {
|
||||
margin-top: 50px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.signature-box {
|
||||
width: 40%;
|
||||
text-align: center;
|
||||
}
|
||||
.signature-line {
|
||||
margin-top: 50px;
|
||||
border-top: 1px solid #000;
|
||||
}
|
||||
@media print {
|
||||
body {
|
||||
padding: 0;
|
||||
background: #fff;
|
||||
}
|
||||
.container {
|
||||
box-shadow: none;
|
||||
border: none;
|
||||
padding: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
.no-print {
|
||||
display: none;
|
||||
}
|
||||
button { display: none; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="no-print" style="text-align: center; margin-bottom: 20px;">
|
||||
<button onclick="window.print()" style="padding: 10px 20px; font-size: 16px; cursor: pointer; background: #333; color: #fff; border: none; border-radius: 5px;">طباعة المحضر</button>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<?php if ($logo_html): ?>
|
||||
<div style="margin-bottom: 10px;"><?= $logo_html ?></div>
|
||||
<?php endif; ?>
|
||||
<h1><?= htmlspecialchars($settings['site_name']) ?></h1>
|
||||
<?php if ($settings['site_slogan']): ?>
|
||||
<h2><?= htmlspecialchars($settings['site_slogan']) ?></h2>
|
||||
<?php endif; ?>
|
||||
<div style="margin-top: 20px; font-size: 20px; font-weight: bold; text-decoration: underline;">محضر اجتماع رسمي</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="info-grid">
|
||||
<div class="info-item">
|
||||
<span class="info-label">عنوان الاجتماع:</span>
|
||||
<?= htmlspecialchars($meeting['title']) ?>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">المنظم:</span>
|
||||
<?= htmlspecialchars($meeting['created_by_name']) ?>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">التاريخ:</span>
|
||||
<?= date('Y-m-d', strtotime($meeting['start_time'])) ?>
|
||||
</div>
|
||||
<div class="info-item">
|
||||
<span class="info-label">الوقت:</span>
|
||||
<?= date('H:i', strtotime($meeting['start_time'])) ?> - <?= date('H:i', strtotime($meeting['end_time'])) ?>
|
||||
</div>
|
||||
<div class="info-item" style="grid-column: span 2;">
|
||||
<span class="info-label">المكان:</span>
|
||||
<?= htmlspecialchars($meeting['location'] ?: 'غير محدد') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($meeting['agenda']): ?>
|
||||
<div class="section">
|
||||
<div class="section-title">جدول الأعمال (Agenda)</div>
|
||||
<div class="content-box rich-text"><?= $meeting['agenda'] ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="section">
|
||||
<div class="info-grid">
|
||||
<div>
|
||||
<div class="section-title">الحضور (Present)</div>
|
||||
<div class="content-box"><?= nl2br(htmlspecialchars($meeting['attendees'] ?: 'لا يوجد')) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="section-title">الغياب / الاعتذار (Absent)</div>
|
||||
<div class="content-box"><?= nl2br(htmlspecialchars($meeting['absentees'] ?: 'لا يوجد')) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($meeting['meeting_details']): ?>
|
||||
<div class="section">
|
||||
<div class="section-title">تفاصيل الاجتماع / المحضر (Minutes)</div>
|
||||
<div class="content-box rich-text" style="min-height: 150px;"><?= $meeting['meeting_details'] ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($meeting['description']): ?>
|
||||
<div class="section">
|
||||
<div class="section-title">ملاحظات إضافية</div>
|
||||
<div class="content-box rich-text"><?= $meeting['description'] ?></div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="signatures">
|
||||
<div class="signature-box">
|
||||
<div>توقيع مقرر الاجتماع</div>
|
||||
<div class="signature-line"></div>
|
||||
</div>
|
||||
<div class="signature-box">
|
||||
<div>اعتماد المدير / الرئيس</div>
|
||||
<div class="signature-line"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 30px; text-align: center; font-size: 12px; color: #999;">
|
||||
تم استخراج هذا المستند إلكترونياً من النظام بتاريخ <?= date('Y-m-d H:i') ?>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user