Autosave: 20260228-102254
This commit is contained in:
parent
dcb1aa0c6b
commit
6ddb4f9f37
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
require_once __DIR__ . '/mail/MailService.php';
|
require_once __DIR__ . '/m_services/MailService.php';
|
||||||
|
|
||||||
// Only users with settings view permission can access this page
|
// Only users with settings view permission can access this page
|
||||||
if (!canView('settings')) {
|
if (!canView('settings')) {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
require_once __DIR__ . '/mail/MailService.php';
|
require_once __DIR__ . '/m_services/MailService.php';
|
||||||
|
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
redirect('index.php');
|
redirect('index.php');
|
||||||
|
|||||||
36
inbound.php
36
inbound.php
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
require_once __DIR__ . '/mail/MailService.php';
|
require_once __DIR__ . '/m_services/MailService.php';
|
||||||
|
|
||||||
// Check if user has view permission
|
// Check if user has view permission
|
||||||
if (!canView('inbound')) {
|
if (!canView('inbound')) {
|
||||||
@ -196,7 +196,8 @@ $total_records = $stmt_count->fetchColumn();
|
|||||||
$total_pages = ceil($total_records / $limit);
|
$total_pages = ceil($total_records / $limit);
|
||||||
|
|
||||||
// Fetch paginated results
|
// Fetch paginated results
|
||||||
$query = "SELECT m.*, s.name as status_name, s.color as status_color, u.full_name as assigned_to_name
|
$query = "SELECT m.*, s.name as status_name, s.color as status_color, u.full_name as assigned_to_name,
|
||||||
|
(SELECT GROUP_CONCAT(display_name SEPARATOR '|||') FROM inbound_attachments WHERE mail_id = m.id) as attachment_names
|
||||||
FROM inbound_mail m
|
FROM inbound_mail m
|
||||||
LEFT JOIN mailbox_statuses s ON m.status_id = s.id
|
LEFT JOIN mailbox_statuses s ON m.status_id = s.id
|
||||||
LEFT JOIN users u ON m.assigned_to = u.id
|
LEFT JOIN users u ON m.assigned_to = u.id
|
||||||
@ -214,7 +215,7 @@ $users_list = db()->query("SELECT id, full_name FROM users ORDER BY full_name")-
|
|||||||
$deepLinkData = null;
|
$deepLinkData = null;
|
||||||
if (isset($_GET['action']) && $_GET['action'] === 'edit' && isset($_GET['id'])) {
|
if (isset($_GET['action']) && $_GET['action'] === 'edit' && isset($_GET['id'])) {
|
||||||
if (canEdit('inbound')) {
|
if (canEdit('inbound')) {
|
||||||
$stmt = db()->prepare("SELECT * FROM inbound_mail WHERE id = ? ");
|
$stmt = db()->prepare("SELECT m.*, (SELECT GROUP_CONCAT(display_name SEPARATOR '|||') FROM inbound_attachments WHERE mail_id = m.id) as attachment_names FROM inbound_mail m WHERE m.id = ? ");
|
||||||
$stmt->execute([$_GET['id']]);
|
$stmt->execute([$_GET['id']]);
|
||||||
$deepLinkData = $stmt->fetch();
|
$deepLinkData = $stmt->fetch();
|
||||||
}
|
}
|
||||||
@ -289,6 +290,7 @@ function getStatusBadgeInList($mail) {
|
|||||||
<th>الموعد النهائي</th>
|
<th>الموعد النهائي</th>
|
||||||
<th>الموضوع</th>
|
<th>الموضوع</th>
|
||||||
<th>المرسل</th>
|
<th>المرسل</th>
|
||||||
|
<th>المرفقات</th>
|
||||||
<th>المسؤول</th>
|
<th>المسؤول</th>
|
||||||
<th>الحالة</th>
|
<th>الحالة</th>
|
||||||
<th class="pe-4 text-center">الإجراءات</th>
|
<th class="pe-4 text-center">الإجراءات</th>
|
||||||
@ -313,6 +315,13 @@ function getStatusBadgeInList($mail) {
|
|||||||
</td>
|
</td>
|
||||||
<td><?= htmlspecialchars($mail['subject']) ?></td>
|
<td><?= htmlspecialchars($mail['subject']) ?></td>
|
||||||
<td><?= htmlspecialchars($mail['sender']) ?></td>
|
<td><?= htmlspecialchars($mail['sender']) ?></td>
|
||||||
|
<td>
|
||||||
|
<?php if (!empty($mail['attachment_names'])): ?>
|
||||||
|
<small class="text-muted"><i class="fas fa-paperclip me-1"></i> <?= htmlspecialchars(str_replace('|||', ', ', $mail['attachment_names'])) ?></small>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($mail['assigned_to_name']): ?>
|
<?php if ($mail['assigned_to_name']): ?>
|
||||||
<span class="text-nowrap"><i class="fas fa-user-tag me-1 text-muted"></i> <?= htmlspecialchars($mail['assigned_to_name']) ?></span>
|
<span class="text-nowrap"><i class="fas fa-user-tag me-1 text-muted"></i> <?= htmlspecialchars($mail['assigned_to_name']) ?></span>
|
||||||
@ -338,7 +347,7 @@ function getStatusBadgeInList($mail) {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; else: ?>
|
<?php endforeach; else: ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="8" class="text-center py-4 text-muted">لا يوجد بريد وارد مسجل حالياً</td>
|
<td colspan="9" class="text-center py-4 text-muted">لا يوجد بريد وارد مسجل حالياً</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -415,7 +424,8 @@ function getStatusBadgeInList($mail) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label class="form-label fw-bold">المرفقات</label>
|
<label class="form-label fw-bold">المرفقات</label>
|
||||||
<input type="file" name="inbound_attachments[]" class="form-control" multiple>
|
<input type="file" name="attachments[]" class="form-control" multiple>
|
||||||
|
<div id="modalExistingAttachments" class="mt-2"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label fw-bold">الحالة</label>
|
<label class="form-label fw-bold">الحالة</label>
|
||||||
@ -487,6 +497,7 @@ function openMailModal(action, data = null) {
|
|||||||
const label = document.getElementById('mailModalLabel');
|
const label = document.getElementById('mailModalLabel');
|
||||||
const modalAction = document.getElementById('modalAction');
|
const modalAction = document.getElementById('modalAction');
|
||||||
const modalId = document.getElementById('modalId');
|
const modalId = document.getElementById('modalId');
|
||||||
|
const existingAttachmentsDiv = document.getElementById('modalExistingAttachments');
|
||||||
|
|
||||||
const fields = {
|
const fields = {
|
||||||
ref_no: document.getElementById('modalRefNo'),
|
ref_no: document.getElementById('modalRefNo'),
|
||||||
@ -500,6 +511,7 @@ function openMailModal(action, data = null) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
modalAction.value = action;
|
modalAction.value = action;
|
||||||
|
existingAttachmentsDiv.innerHTML = '';
|
||||||
|
|
||||||
if (action === 'add') {
|
if (action === 'add') {
|
||||||
label.textContent = 'إضافة بريد وارد جديد';
|
label.textContent = 'إضافة بريد وارد جديد';
|
||||||
@ -524,6 +536,17 @@ function openMailModal(action, data = null) {
|
|||||||
|
|
||||||
if (descriptionEditor) descriptionEditor.setData(data.description || '');
|
if (descriptionEditor) descriptionEditor.setData(data.description || '');
|
||||||
else document.getElementById('modalDescription').value = data.description || '';
|
else document.getElementById('modalDescription').value = data.description || '';
|
||||||
|
|
||||||
|
// Display existing attachments
|
||||||
|
if (data.attachment_names) {
|
||||||
|
const names = data.attachment_names.split('|||');
|
||||||
|
let html = '<div class="mt-2"><p class="mb-1 fw-bold small">المرفقات الحالية:</p><ul class="list-unstyled small">';
|
||||||
|
names.forEach(name => {
|
||||||
|
html += `<li><i class="fas fa-file-alt me-1 text-muted"></i> ${name}</li>`;
|
||||||
|
});
|
||||||
|
html += '</ul></div>';
|
||||||
|
existingAttachmentsDiv.innerHTML = html;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mailModal.show();
|
mailModal.show();
|
||||||
@ -544,7 +567,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
'subject' => $_POST['subject'] ?? '',
|
'subject' => $_POST['subject'] ?? '',
|
||||||
'description' => $_POST['description'] ?? '',
|
'description' => $_POST['description'] ?? '',
|
||||||
'status_id' => $_POST['status_id'] ?? $default_status_id,
|
'status_id' => $_POST['status_id'] ?? $default_status_id,
|
||||||
'assigned_to' => $_POST['assigned_to'] ?? ''
|
'assigned_to' => $_POST['assigned_to'] ?? '',
|
||||||
|
'attachment_names' => $_POST['attachment_names'] ?? ''
|
||||||
]) ?>;
|
]) ?>;
|
||||||
openMailModal('<?= $_POST['action'] ?>', errorData);
|
openMailModal('<?= $_POST['action'] ?>', errorData);
|
||||||
<?php elseif (isset($_GET['action']) && $_GET['action'] === 'add'): ?>
|
<?php elseif (isset($_GET['action']) && $_GET['action'] === 'add'): ?>
|
||||||
|
|||||||
@ -33,7 +33,8 @@ $total_records = $count_stmt->fetchColumn();
|
|||||||
$total_pages = ceil($total_records / $limit);
|
$total_pages = ceil($total_records / $limit);
|
||||||
|
|
||||||
// Fetch messages
|
// Fetch messages
|
||||||
$query = "SELECT m.*, u_sender.full_name as sender_name, u_sender.profile_image as sender_image, s.name as status_name, s.color as status_color
|
$query = "SELECT m.*, u_sender.full_name as sender_name, u_sender.profile_image as sender_image, s.name as status_name, s.color as status_color,
|
||||||
|
(SELECT GROUP_CONCAT(display_name SEPARATOR ', ') FROM internal_attachments WHERE mail_id = m.id) as attachment_names
|
||||||
FROM internal_mail m
|
FROM internal_mail m
|
||||||
LEFT JOIN users u_sender ON m.created_by = u_sender.id
|
LEFT JOIN users u_sender ON m.created_by = u_sender.id
|
||||||
LEFT JOIN mailbox_statuses s ON m.status_id = s.id
|
LEFT JOIN mailbox_statuses s ON m.status_id = s.id
|
||||||
@ -100,6 +101,7 @@ function getStatusBadgeInternal($mail) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="ps-4">المرسل</th>
|
<th class="ps-4">المرسل</th>
|
||||||
<th>الموضوع</th>
|
<th>الموضوع</th>
|
||||||
|
<th>المرفقات</th>
|
||||||
<th>التاريخ</th>
|
<th>التاريخ</th>
|
||||||
<th>الحالة</th>
|
<th>الحالة</th>
|
||||||
<th class="pe-4 text-center">الإجراء</th>
|
<th class="pe-4 text-center">الإجراء</th>
|
||||||
@ -127,6 +129,13 @@ function getStatusBadgeInternal($mail) {
|
|||||||
<?= strip_tags($msg['description']) ?>
|
<?= strip_tags($msg['description']) ?>
|
||||||
</small>
|
</small>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if (!empty($msg['attachment_names'])): ?>
|
||||||
|
<small class="text-muted"><i class="fas fa-paperclip me-1"></i> <?= htmlspecialchars($msg['attachment_names']) ?></small>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<small class="text-muted"><?= date('Y-m-d H:i', strtotime($msg['created_at'])) ?></small>
|
<small class="text-muted"><?= date('Y-m-d H:i', strtotime($msg['created_at'])) ?></small>
|
||||||
</td>
|
</td>
|
||||||
@ -138,7 +147,7 @@ function getStatusBadgeInternal($mail) {
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5" class="text-center py-5 text-muted">
|
<td colspan="6" class="text-center py-5 text-muted">
|
||||||
<i class="fas fa-envelope-open fa-3x mb-3 opacity-25"></i>
|
<i class="fas fa-envelope-open fa-3x mb-3 opacity-25"></i>
|
||||||
<p>لا توجد رسائل واردة حالياً</p>
|
<p>لا توجد رسائل واردة حالياً</p>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
require_once __DIR__ . '/mail/MailService.php';
|
require_once __DIR__ . '/m_services/MailService.php';
|
||||||
|
|
||||||
if (!canView('internal')) {
|
if (!canView('internal')) {
|
||||||
redirect('index.php');
|
redirect('index.php');
|
||||||
@ -123,7 +123,8 @@ $total_records = $count_stmt->fetchColumn();
|
|||||||
$total_pages = ceil($total_records / $limit);
|
$total_pages = ceil($total_records / $limit);
|
||||||
|
|
||||||
// Fetch messages
|
// Fetch messages
|
||||||
$query = "SELECT m.*, u_recp.full_name as recipient_name, u_recp.profile_image as recipient_image, s.name as status_name, s.color as status_color
|
$query = "SELECT m.*, u_recp.full_name as recipient_name, u_recp.profile_image as recipient_image, s.name as status_name, s.color as status_color,
|
||||||
|
(SELECT GROUP_CONCAT(display_name SEPARATOR ', ') FROM internal_attachments WHERE mail_id = m.id) as attachment_names
|
||||||
FROM internal_mail m
|
FROM internal_mail m
|
||||||
LEFT JOIN users u_recp ON m.assigned_to = u_recp.id
|
LEFT JOIN users u_recp ON m.assigned_to = u_recp.id
|
||||||
LEFT JOIN mailbox_statuses s ON m.status_id = s.id
|
LEFT JOIN mailbox_statuses s ON m.status_id = s.id
|
||||||
@ -202,6 +203,7 @@ function getStatusBadgeInternal($mail) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="ps-4">المستلم</th>
|
<th class="ps-4">المستلم</th>
|
||||||
<th>الموضوع</th>
|
<th>الموضوع</th>
|
||||||
|
<th>المرفقات</th>
|
||||||
<th>التاريخ</th>
|
<th>التاريخ</th>
|
||||||
<th>الحالة</th>
|
<th>الحالة</th>
|
||||||
<th class="pe-4 text-center">الإجراء</th>
|
<th class="pe-4 text-center">الإجراء</th>
|
||||||
@ -229,6 +231,13 @@ function getStatusBadgeInternal($mail) {
|
|||||||
<?= strip_tags($msg['description']) ?>
|
<?= strip_tags($msg['description']) ?>
|
||||||
</small>
|
</small>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if (!empty($msg['attachment_names'])): ?>
|
||||||
|
<small class="text-muted"><i class="fas fa-paperclip me-1"></i> <?= htmlspecialchars($msg['attachment_names']) ?></small>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<small class="text-muted"><?= date('Y-m-d H:i', strtotime($msg['created_at'])) ?></small>
|
<small class="text-muted"><?= date('Y-m-d H:i', strtotime($msg['created_at'])) ?></small>
|
||||||
</td>
|
</td>
|
||||||
@ -240,7 +249,7 @@ function getStatusBadgeInternal($mail) {
|
|||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5" class="text-center py-5 text-muted">
|
<td colspan="6" class="text-center py-5 text-muted">
|
||||||
<i class="fas fa-paper-plane fa-3x mb-3 opacity-25"></i>
|
<i class="fas fa-paper-plane fa-3x mb-3 opacity-25"></i>
|
||||||
<p>لم يتم إرسال أي رسائل حالياً</p>
|
<p>لم يتم إرسال أي رسائل حالياً</p>
|
||||||
</td>
|
</td>
|
||||||
@ -296,7 +305,7 @@ function getStatusBadgeInternal($mail) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<label class="form-label fw-bold">المرفقات</label>
|
<label class="form-label fw-bold">المرفقات</label>
|
||||||
<input type="file" name="internal_attachments[]" class="form-control border-2" multiple>
|
<input type="file" name="attachments[]" class="form-control border-2" multiple>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
36
outbound.php
36
outbound.php
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
require_once __DIR__ . '/mail/MailService.php';
|
require_once __DIR__ . '/m_services/MailService.php';
|
||||||
|
|
||||||
// Check if user has view permission
|
// Check if user has view permission
|
||||||
if (!canView('outbound')) {
|
if (!canView('outbound')) {
|
||||||
@ -209,7 +209,8 @@ $total_records = $stmt_count->fetchColumn();
|
|||||||
$total_pages = ceil($total_records / $limit);
|
$total_pages = ceil($total_records / $limit);
|
||||||
|
|
||||||
// Fetch paginated results
|
// Fetch paginated results
|
||||||
$query = "SELECT m.*, s.name as status_name, s.color as status_color, u.full_name as assigned_to_name
|
$query = "SELECT m.*, s.name as status_name, s.color as status_color, u.full_name as assigned_to_name,
|
||||||
|
(SELECT GROUP_CONCAT(display_name SEPARATOR '|||') FROM outbound_attachments WHERE mail_id = m.id) as attachment_names
|
||||||
FROM outbound_mail m
|
FROM outbound_mail m
|
||||||
LEFT JOIN mailbox_statuses s ON m.status_id = s.id
|
LEFT JOIN mailbox_statuses s ON m.status_id = s.id
|
||||||
LEFT JOIN users u ON m.assigned_to = u.id
|
LEFT JOIN users u ON m.assigned_to = u.id
|
||||||
@ -227,7 +228,7 @@ $users_list = db()->query("SELECT id, full_name FROM users ORDER BY full_name")-
|
|||||||
$deepLinkData = null;
|
$deepLinkData = null;
|
||||||
if (isset($_GET['action']) && $_GET['action'] === 'edit' && isset($_GET['id'])) {
|
if (isset($_GET['action']) && $_GET['action'] === 'edit' && isset($_GET['id'])) {
|
||||||
if (canEdit('outbound')) {
|
if (canEdit('outbound')) {
|
||||||
$stmt = db()->prepare("SELECT * FROM outbound_mail WHERE id = ? ");
|
$stmt = db()->prepare("SELECT m.*, (SELECT GROUP_CONCAT(display_name SEPARATOR '|||') FROM outbound_attachments WHERE mail_id = m.id) as attachment_names FROM outbound_mail m WHERE m.id = ? ");
|
||||||
$stmt->execute([$_GET['id']]);
|
$stmt->execute([$_GET['id']]);
|
||||||
$deepLinkData = $stmt->fetch();
|
$deepLinkData = $stmt->fetch();
|
||||||
}
|
}
|
||||||
@ -302,6 +303,7 @@ function getStatusBadgeInList($mail) {
|
|||||||
<th>الموعد النهائي</th>
|
<th>الموعد النهائي</th>
|
||||||
<th>الموضوع</th>
|
<th>الموضوع</th>
|
||||||
<th>المستلم</th>
|
<th>المستلم</th>
|
||||||
|
<th>المرفقات</th>
|
||||||
<th>المسؤول</th>
|
<th>المسؤول</th>
|
||||||
<th>الحالة</th>
|
<th>الحالة</th>
|
||||||
<th class="pe-4 text-center">الإجراءات</th>
|
<th class="pe-4 text-center">الإجراءات</th>
|
||||||
@ -326,6 +328,13 @@ function getStatusBadgeInList($mail) {
|
|||||||
</td>
|
</td>
|
||||||
<td><?= truncate_text($mail['subject'], 80) ?></td>
|
<td><?= truncate_text($mail['subject'], 80) ?></td>
|
||||||
<td><?= htmlspecialchars($mail['recipient']) ?></td>
|
<td><?= htmlspecialchars($mail['recipient']) ?></td>
|
||||||
|
<td>
|
||||||
|
<?php if (!empty($mail['attachment_names'])): ?>
|
||||||
|
<small class="text-muted"><i class="fas fa-paperclip me-1"></i> <?= htmlspecialchars(str_replace('|||', ', ', $mail['attachment_names'])) ?></small>
|
||||||
|
<?php else: ?>
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<?php if ($mail['assigned_to_name']): ?>
|
<?php if ($mail['assigned_to_name']): ?>
|
||||||
<span class="text-nowrap"><i class="fas fa-user-tag me-1 text-muted"></i> <?= htmlspecialchars($mail['assigned_to_name']) ?></span>
|
<span class="text-nowrap"><i class="fas fa-user-tag me-1 text-muted"></i> <?= htmlspecialchars($mail['assigned_to_name']) ?></span>
|
||||||
@ -351,7 +360,7 @@ function getStatusBadgeInList($mail) {
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; else: ?>
|
<?php endforeach; else: ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="8" class="text-center py-4 text-muted">لا يوجد بريد صادر مسجل حالياً</td>
|
<td colspan="9" class="text-center py-4 text-muted">لا يوجد بريد صادر مسجل حالياً</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -428,7 +437,8 @@ function getStatusBadgeInList($mail) {
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label class="form-label fw-bold">المرفقات</label>
|
<label class="form-label fw-bold">المرفقات</label>
|
||||||
<input type="file" name="outbound_attachments[]" class="form-control" multiple>
|
<input type="file" name="attachments[]" class="form-control" multiple>
|
||||||
|
<div id="modalExistingAttachments" class="mt-2"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label fw-bold">الحالة</label>
|
<label class="form-label fw-bold">الحالة</label>
|
||||||
@ -500,6 +510,7 @@ function openMailModal(action, data = null) {
|
|||||||
const label = document.getElementById('mailModalLabel');
|
const label = document.getElementById('mailModalLabel');
|
||||||
const modalAction = document.getElementById('modalAction');
|
const modalAction = document.getElementById('modalAction');
|
||||||
const modalId = document.getElementById('modalId');
|
const modalId = document.getElementById('modalId');
|
||||||
|
const existingAttachmentsDiv = document.getElementById('modalExistingAttachments');
|
||||||
|
|
||||||
const fields = {
|
const fields = {
|
||||||
ref_no: document.getElementById('modalRefNo'),
|
ref_no: document.getElementById('modalRefNo'),
|
||||||
@ -513,6 +524,7 @@ function openMailModal(action, data = null) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
modalAction.value = action;
|
modalAction.value = action;
|
||||||
|
existingAttachmentsDiv.innerHTML = '';
|
||||||
|
|
||||||
if (action === 'add') {
|
if (action === 'add') {
|
||||||
label.textContent = 'إضافة بريد صادر جديد';
|
label.textContent = 'إضافة بريد صادر جديد';
|
||||||
@ -537,6 +549,17 @@ function openMailModal(action, data = null) {
|
|||||||
|
|
||||||
if (descriptionEditor) descriptionEditor.setData(data.description || '');
|
if (descriptionEditor) descriptionEditor.setData(data.description || '');
|
||||||
else document.getElementById('description_editor').value = data.description || '';
|
else document.getElementById('description_editor').value = data.description || '';
|
||||||
|
|
||||||
|
// Display existing attachments
|
||||||
|
if (data.attachment_names) {
|
||||||
|
const names = data.attachment_names.split('|||');
|
||||||
|
let html = '<div class="mt-2"><p class="mb-1 fw-bold small">المرفقات الحالية:</p><ul class="list-unstyled small">';
|
||||||
|
names.forEach(name => {
|
||||||
|
html += `<li><i class="fas fa-file-alt me-1 text-muted"></i> ${name}</li>`;
|
||||||
|
});
|
||||||
|
html += '</ul></div>';
|
||||||
|
existingAttachmentsDiv.innerHTML = html;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mailModal.show();
|
mailModal.show();
|
||||||
@ -557,7 +580,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
'subject' => $_POST['subject'] ?? '',
|
'subject' => $_POST['subject'] ?? '',
|
||||||
'description' => $_POST['description'] ?? '',
|
'description' => $_POST['description'] ?? '',
|
||||||
'status_id' => $_POST['status_id'] ?? $default_status_id,
|
'status_id' => $_POST['status_id'] ?? $default_status_id,
|
||||||
'assigned_to' => $_POST['assigned_to'] ?? ''
|
'assigned_to' => $_POST['assigned_to'] ?? '',
|
||||||
|
'attachment_names' => $_POST['attachment_names'] ?? ''
|
||||||
]) ?>;
|
]) ?>;
|
||||||
openMailModal('<?= $_POST['action'] ?>', errorData);
|
openMailModal('<?= $_POST['action'] ?>', errorData);
|
||||||
<?php elseif (isset($_GET['action']) && $_GET['action'] === 'add'): ?>
|
<?php elseif (isset($_GET['action']) && $_GET['action'] === 'add'): ?>
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
// Should be run as a cron job daily: php scripts/send_reminders.php
|
// Should be run as a cron job daily: php scripts/send_reminders.php
|
||||||
|
|
||||||
require_once __DIR__ . '/../db/config.php';
|
require_once __DIR__ . '/../db/config.php';
|
||||||
require_once __DIR__ . '/../mail/MailService.php';
|
require_once __DIR__ . '/../m_services/MailService.php';
|
||||||
|
|
||||||
echo "[" . date('Y-m-d H:i:s') . "] Starting reminder process..." . PHP_EOL;
|
echo "[" . date('Y-m-d H:i:s') . "] Starting reminder process..." . PHP_EOL;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once __DIR__ . '/includes/header.php';
|
require_once __DIR__ . '/includes/header.php';
|
||||||
require_once __DIR__ . '/mail/MailService.php';
|
require_once __DIR__ . '/m_services/MailService.php';
|
||||||
|
|
||||||
$id = $_GET['id'] ?? 0;
|
$id = $_GET['id'] ?? 0;
|
||||||
$type = $_GET['type'] ?? '';
|
$type = $_GET['type'] ?? '';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user