Autosave: 20260213-090159

This commit is contained in:
Flatlogic Bot 2026-02-13 09:02:00 +00:00
parent 0e4184bcba
commit 39610613f2

View File

@ -42,7 +42,9 @@ $texts = [
'recipient_name' => 'Recipient Name',
'recipient_phone' => 'Recipient Phone',
'gift_message' => 'Gift Message',
'gift_notice' => 'The system will send a notification to the recipient.'
'gift_notice' => 'The system will send a notification to the recipient.',
'read_more' => 'Read More',
'close' => 'Close'
],
'ar' => [
'title' => 'ادعم قضية',
@ -78,7 +80,9 @@ $texts = [
'recipient_name' => 'اسم المستلم',
'recipient_phone' => 'رقم هاتف المستلم',
'gift_message' => 'رسالة الهدية',
'gift_notice' => 'سيقوم النظام بإرسال إشعار إلى المستلم.'
'gift_notice' => 'سيقوم النظام بإرسال إشعار إلى المستلم.',
'read_more' => 'اقرأ المزيد',
'close' => 'إغلاق'
]
];
@ -548,6 +552,15 @@ function safe_truncate($text, $limit = 120) {
background: #f9fafb;
margin-top: 1rem;
}
.read-more-btn {
font-size: 0.8125rem;
cursor: pointer;
transition: opacity 0.2s;
}
.read-more-btn:hover {
opacity: 0.8;
}
</style>
</head>
<body>
@ -650,7 +663,9 @@ function safe_truncate($text, $limit = 120) {
<?php foreach ($cases as $case): ?>
<?php
$pct = min(100, round(($case['raised'] / $case['goal']) * 100));
$desc = safe_truncate($lang === 'en' ? $case['desc_en'] : $case['desc_ar'], 120);
$full_desc = $lang === 'en' ? $case['desc_en'] : $case['desc_ar'];
$is_long = mb_strlen($full_desc) > 120;
$truncated_desc = safe_truncate($full_desc, 120);
?>
<div class="col-md-6 col-lg-4" id="case-<?= $case['id'] ?>">
<div class="case-card">
@ -672,7 +687,18 @@ function safe_truncate($text, $limit = 120) {
<div class="case-content">
<span class="case-cat"><?= $lang === 'en' ? ($case['cat_name_en'] ?? 'General') : ($case['cat_name_ar'] ?? 'عام') ?></span>
<h3 class="case-title"><?= $lang === 'en' ? $case['title_en'] : $case['title_ar'] ?></h3>
<p class="text-muted small mb-0"><?= htmlspecialchars($desc) ?></p>
<p class="text-muted small mb-0">
<?= htmlspecialchars($truncated_desc) ?>
<?php if ($is_long): ?>
<span class="text-primary fw-bold read-more-btn"
data-bs-toggle="modal"
data-bs-target="#readMoreModal"
data-title="<?= htmlspecialchars($lang === 'en' ? $case['title_en'] : $case['title_ar']) ?>"
data-full-text="<?= htmlspecialchars($full_desc) ?>">
<?= $t['read_more'] ?>
</span>
<?php endif; ?>
</p>
<div class="progress-container">
<div class="progress">
@ -696,6 +722,24 @@ function safe_truncate($text, $limit = 120) {
</div>
</main>
<!-- Read More Modal -->
<div class="modal fade" id="readMoreModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content border-0 shadow-lg rounded-4">
<div class="modal-header border-0 pb-0">
<h5 class="modal-title fw-bold" id="readMoreModalTitle"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body p-4">
<div id="readMoreModalContent" class="text-muted" style="white-space: pre-line; line-height: 1.6;"></div>
</div>
<div class="modal-footer border-0 p-4 pt-0">
<button type="button" class="btn btn-secondary rounded-pill px-4" data-bs-dismiss="modal"><?= $t['close'] ?></button>
</div>
</div>
</div>
</div>
<!-- Donate Modal -->
<div class="modal fade" id="donateModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
@ -795,6 +839,18 @@ function safe_truncate($text, $limit = 120) {
});
}
const readMoreModal = document.getElementById('readMoreModal');
if (readMoreModal) {
readMoreModal.addEventListener('show.bs.modal', event => {
const button = event.relatedTarget;
const title = button.getAttribute('data-title');
const fullText = button.getAttribute('data-full-text');
readMoreModal.querySelector('#readMoreModalTitle').textContent = title;
readMoreModal.querySelector('#readMoreModalContent').textContent = fullText;
});
}
function setDonateType(type) {
const isGift = type === 'gift';
document.getElementById('isGiftInput').value = isGift ? '1' : '0';