39414-vm/display.php
2026-03-31 09:50:11 +00:00

95 lines
4.5 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', 'General display board', 'Public hospital queue display with bilingual callouts, text-to-speech, and an ads pane.');
?>
<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">General display / الشاشة العامة</div>
<h1 class="section-title-xl mt-2 mb-1">Now serving</h1>
<p class="section-copy mb-0">Latest calls are read aloud in English and Arabic when supported by the browser.</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">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($ticket['doctor_name_en'] ?? 'Doctor') ?> · 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>No live calls right now.</strong>
<span>When a doctor presses “Call patient”, the ticket will appear here and play on TTS.</span>
</div>
<?php endif; ?>
<div class="panel-subsection mt-4">
<h2 class="section-title mb-3">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($row['name_en']) ?></div>
<div class="small text-secondary" lang="ar" dir="rtl"><?= qh_h($row['name_ar']) ?></div>
<div class="d-flex gap-2 mt-3 flex-wrap">
<span class="table-pill warning">Vitals <?= qh_h((string) $row['vitals_waiting']) ?></span>
<span class="table-pill info">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">Ads & notices / الإعلانات</div>
<h2 class="section-title mb-1">Patient information</h2>
</div>
<span class="badge rounded-pill text-bg-dark">Looping</span>
</div>
<div class="ad-card mb-3">
<div class="ad-tag">Service</div>
<h3>Lab packages & wellness checks</h3>
<p>Ask reception about bundled blood tests, diabetes follow-up, and annual screenings.</p>
</div>
<div class="ad-card mb-3">
<div class="ad-tag">Reminder</div>
<h3>Keep your ticket visible</h3>
<p>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">Wayfinding</div>
<h3>Pharmacy & billing</h3>
<p>Completed visits can proceed to the pharmacy and billing desk near the main exit.</p>
</div>
</aside>
</section>
</div>
<?php qh_page_end(); ?>