39414-vm/display.php
2026-03-31 10:39:17 +00:00

98 lines
6.2 KiB
PHP

<?php
declare(strict_types=1);
require_once __DIR__ . '/queue_bootstrap.php';
qh_boot();
$activeCalls = qh_fetch_tickets(['called', 'in_progress'], null, 6);
$queueOverview = qh_queue_overview();
qh_page_start(
'display',
qh_t('General display board', 'لوحة العرض العامة'),
qh_t('Public queue display with separated English and Arabic modes.', 'شاشة طوابير عامة مع وضعي عرض منفصلين بالعربية والإنجليزية.')
);
?>
<div class="container-fluid px-3 px-lg-4 py-2" data-auto-refresh="20">
<section class="display-shell">
<div class="display-main panel-card p-4">
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-4">
<div>
<div class="section-kicker"><?= qh_h(qh_t('General display', 'الشاشة العامة')) ?></div>
<h1 class="section-title-xl mt-2 mb-1"><?= qh_h(qh_t('Now serving', 'يتم الآن النداء')) ?></h1>
<p class="section-copy mb-0"><?= qh_h(qh_t('This page shows a single language view. Use the language switch in the main app to open the English or Arabic display mode.', 'تعرض هذه الصفحة لغة واحدة فقط. استخدم مبدل اللغة في التطبيق لفتح وضع العرض العربي أو الإنجليزي.')) ?></p>
</div>
<div class="d-flex align-items-center gap-2 flex-wrap justify-content-end">
<button type="button" class="btn btn-dark btn-sm js-fullscreen-toggle" aria-pressed="false" data-label-enter="<?= qh_h(qh_t('Full display', 'عرض كامل')) ?>" data-label-exit="<?= qh_h(qh_t('Exit full display', 'إنهاء العرض الكامل')) ?>"><?= qh_h(qh_t('Full display', 'عرض كامل')) ?></button>
<div class="live-clock js-live-clock"><?= qh_h(date('H:i')) ?></div>
</div>
</div>
<?php if ($activeCalls): ?>
<div class="vstack gap-3">
<?php foreach ($activeCalls as $ticket): $speech = qh_call_message($ticket); ?>
<article class="announcement-card" data-announcement-key="<?= qh_h((string) $ticket['id']) ?>-<?= qh_h((string) strtotime((string) $ticket['called_at'])) ?>" data-announcement-en="<?= qh_h($speech['en']) ?>" data-announcement-ar="<?= qh_h($speech['ar']) ?>">
<div>
<div class="ticket-number large"><?= qh_h($ticket['ticket_number']) ?></div>
<div class="display-meta"><?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?> · <?= qh_h(qh_t('Room', 'غرفة')) ?> <?= qh_h($ticket['doctor_room'] ?? '--') ?></div>
</div>
<div class="text-end">
<?= qh_status_badge($ticket['status']) ?>
<div class="small text-secondary mt-2"><?= qh_format_datetime($ticket['called_at'] ?? $ticket['updated_at']) ?></div>
</div>
</article>
<?php endforeach; ?>
</div>
<?php else: ?>
<div class="empty-state display-empty">
<strong><?= qh_h(qh_t('No live calls right now.', 'لا توجد نداءات مباشرة حالياً.')) ?></strong>
<span><?= qh_h(qh_t('When a doctor presses “Call patient”, the ticket will appear here.', 'عندما يضغط الطبيب على زر نداء المريض ستظهر التذكرة هنا.')) ?></span>
</div>
<?php endif; ?>
<div class="panel-subsection mt-4">
<h2 class="section-title mb-3"><?= qh_h(qh_t('Queue by clinic', 'الطابور حسب العيادة')) ?></h2>
<div class="row g-3">
<?php foreach ($queueOverview as $row): ?>
<div class="col-md-6 col-xl-4">
<div class="mini-overview-card">
<div class="fw-semibold"><?= qh_h(qh_name($row)) ?></div>
<div class="d-flex gap-2 mt-3 flex-wrap">
<span class="table-pill warning"><?= qh_h(qh_t('Vitals', 'العلامات')) ?> <?= qh_h((string) $row['vitals_waiting']) ?></span>
<span class="table-pill info"><?= qh_h(qh_t('Doctor', 'الطبيب')) ?> <?= qh_h((string) $row['doctor_waiting']) ?></span>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</div>
<aside class="display-ads panel-card p-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
<div class="section-kicker"><?= qh_h(qh_t('Ads and notices', 'الإعلانات والتنبيهات')) ?></div>
<h2 class="section-title mb-1"><?= qh_h(qh_t('Patient information', 'معلومات المرضى')) ?></h2>
</div>
<span class="badge rounded-pill text-bg-dark"><?= qh_h(qh_t('Looping', 'متكرر')) ?></span>
</div>
<div class="ad-card mb-3">
<div class="ad-tag"><?= qh_h(qh_t('Service', 'خدمة')) ?></div>
<h3><?= qh_h(qh_t('Lab packages and wellness checks', 'باقات المختبر والفحوصات الوقائية')) ?></h3>
<p><?= qh_h(qh_t('Ask reception about bundled blood tests, diabetes follow-up, and annual screenings.', 'اسأل الاستقبال عن باقات تحاليل الدم، ومتابعة السكري، والفحوصات السنوية.')) ?></p>
</div>
<div class="ad-card mb-3">
<div class="ad-tag"><?= qh_h(qh_t('Reminder', 'تذكير')) ?></div>
<h3><?= qh_h(qh_t('Keep your ticket visible', 'احتفظ بتذكرتك ظاهرة')) ?></h3>
<p><?= qh_h(qh_t('We announce ticket numbers on this screen and by voice. Stay near your department area.', 'نعلن أرقام التذاكر على هذه الشاشة وبالصوت. يرجى البقاء قرب منطقة القسم الخاص بك.')) ?></p>
</div>
<div class="ad-card">
<div class="ad-tag"><?= qh_h(qh_t('Wayfinding', 'الإرشاد')) ?></div>
<h3><?= qh_h(qh_t('Pharmacy and billing', 'الصيدلية والمحاسبة')) ?></h3>
<p><?= qh_h(qh_t('Completed visits can proceed to the pharmacy and billing desk near the main exit.', 'بعد انتهاء الزيارة يمكن التوجه إلى الصيدلية ومكتب المحاسبة قرب المخرج الرئيسي.')) ?></p>
</div>
</aside>
</section>
</div>
<?php qh_page_end(); ?>