108 lines
5.6 KiB
PHP
108 lines
5.6 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
require_once __DIR__ . '/queue_bootstrap.php';
|
|
qh_boot();
|
|
|
|
$ticketId = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
|
$ticket = $ticketId > 0 ? qh_fetch_ticket($ticketId) : null;
|
|
|
|
qh_page_start('home', 'Ticket detail', 'Detailed patient ticket timeline for the hospital queue workflow.');
|
|
?>
|
|
<div class="container-lg px-3 px-lg-4">
|
|
<section class="page-header-panel mb-4">
|
|
<div>
|
|
<span class="section-kicker">Ticket detail / تفاصيل التذكرة</span>
|
|
<h1 class="section-title-xl mt-2">Track one patient through the visit.</h1>
|
|
<p class="section-copy mb-0">This view confirms the assigned clinic, doctor, room, vitals notes, and current status.</p>
|
|
</div>
|
|
</section>
|
|
|
|
<?php if (!$ticket): ?>
|
|
<div class="panel-card">
|
|
<div class="empty-state">
|
|
<strong>Ticket not found.</strong>
|
|
<span>Return to reception and choose a valid ticket.</span>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="panel-card mb-4">
|
|
<div class="d-flex justify-content-between flex-wrap gap-3 align-items-start">
|
|
<div>
|
|
<div class="ticket-number"><?= qh_h($ticket['ticket_number']) ?></div>
|
|
<div class="mt-2 fw-semibold"><?= qh_h($ticket['patient_name']) ?></div>
|
|
<div class="text-secondary"><?= qh_h($ticket['clinic_name_en'] ?? '') ?> · <?= qh_h($ticket['doctor_name_en'] ?? '') ?> · Room <?= qh_h($ticket['doctor_room'] ?? '--') ?></div>
|
|
</div>
|
|
<div class="d-flex flex-column gap-2 align-items-lg-end">
|
|
<?= qh_status_badge($ticket['status']) ?>
|
|
<span class="small text-secondary">Preferred language: <?= strtoupper(qh_h($ticket['language_pref'])) ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row g-4">
|
|
<div class="col-lg-7">
|
|
<div class="panel-card h-100">
|
|
<h2 class="section-title mb-3">Visit timeline / خط سير الزيارة</h2>
|
|
<div class="timeline-list">
|
|
<div class="timeline-item done">
|
|
<div class="timeline-dot"></div>
|
|
<div>
|
|
<div class="fw-semibold">Ticket issued / تم إصدار التذكرة</div>
|
|
<div class="small text-secondary"><?= qh_format_datetime($ticket['created_at']) ?></div>
|
|
</div>
|
|
</div>
|
|
<?php if ((int) $ticket['clinic_requires_vitals'] === 1): ?>
|
|
<div class="timeline-item <?= in_array($ticket['status'], ['ready_for_doctor', 'called', 'in_progress', 'done', 'no_show'], true) ? 'done' : 'current' ?>">
|
|
<div class="timeline-dot"></div>
|
|
<div>
|
|
<div class="fw-semibold">Nursing vitals / العلامات الحيوية</div>
|
|
<div class="small text-secondary"><?= qh_h($ticket['vitals_notes'] ?: 'Waiting for nursing input.') ?></div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
<div class="timeline-item <?= in_array($ticket['status'], ['called', 'in_progress', 'done', 'no_show'], true) ? 'done' : 'current' ?>">
|
|
<div class="timeline-dot"></div>
|
|
<div>
|
|
<div class="fw-semibold">Ready for doctor / جاهز للطبيب</div>
|
|
<div class="small text-secondary">Assigned to <?= qh_h($ticket['doctor_name_en'] ?? 'Doctor') ?>, room <?= qh_h($ticket['doctor_room'] ?? '--') ?></div>
|
|
</div>
|
|
</div>
|
|
<div class="timeline-item <?= in_array($ticket['status'], ['in_progress', 'done', 'no_show'], true) ? 'done' : (($ticket['status'] === 'called') ? 'current' : '') ?>">
|
|
<div class="timeline-dot"></div>
|
|
<div>
|
|
<div class="fw-semibold">Called to room / تم النداء للغرفة</div>
|
|
<div class="small text-secondary"><?= qh_format_datetime($ticket['called_at']) ?></div>
|
|
</div>
|
|
</div>
|
|
<div class="timeline-item <?= in_array($ticket['status'], ['done', 'no_show'], true) ? 'done' : '' ?>">
|
|
<div class="timeline-dot"></div>
|
|
<div>
|
|
<div class="fw-semibold">Visit closed / إغلاق الزيارة</div>
|
|
<div class="small text-secondary"><?= $ticket['status'] === 'done' ? 'Completed successfully.' : ($ticket['status'] === 'no_show' ? 'Marked as no-show.' : 'Still active.') ?></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-5">
|
|
<div class="panel-card h-100">
|
|
<h2 class="section-title mb-3">Details / التفاصيل</h2>
|
|
<dl class="detail-list mb-0">
|
|
<div><dt>Clinic</dt><dd><?= qh_h($ticket['clinic_name_en'] ?? '—') ?></dd></div>
|
|
<div><dt>Doctor</dt><dd><?= qh_h($ticket['doctor_name_en'] ?? '—') ?></dd></div>
|
|
<div><dt>Room</dt><dd><?= qh_h($ticket['doctor_room'] ?? '--') ?></dd></div>
|
|
<div><dt>Vitals note</dt><dd><?= qh_h($ticket['vitals_notes'] ?: 'Not captured yet.') ?></dd></div>
|
|
<div><dt>Last note</dt><dd><?= qh_h($ticket['display_note'] ?: '—') ?></dd></div>
|
|
</dl>
|
|
<div class="d-flex flex-wrap gap-2 mt-4">
|
|
<a class="btn btn-outline-dark btn-sm" href="reception.php?ticket_id=<?= qh_h((string) $ticket['id']) ?>">Back to reception</a>
|
|
<a class="btn btn-outline-dark btn-sm" href="doctor.php?doctor_id=<?= qh_h((string) ($ticket['doctor_id'] ?? 0)) ?>">Open doctor queue</a>
|
|
<a class="btn btn-outline-dark btn-sm" href="display.php">Open display</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php qh_page_end(); ?>
|