124 lines
6.0 KiB
PHP
124 lines
6.0 KiB
PHP
<?php
|
||
declare(strict_types=1);
|
||
require_once __DIR__ . '/queue_bootstrap.php';
|
||
qh_boot();
|
||
qh_reception_handle_request();
|
||
|
||
$clinics = qh_fetch_clinics();
|
||
$doctors = qh_fetch_doctors();
|
||
$currentTicket = isset($_GET['ticket_id']) ? qh_fetch_ticket((int) $_GET['ticket_id']) : null;
|
||
$todayTickets = qh_fetch_tickets(['waiting_vitals', 'ready_for_doctor', 'called', 'in_progress', 'done', 'no_show'], null, 12);
|
||
|
||
qh_page_start('reception', 'Reception ticket issuance', 'Reception desk ticket issue flow with one ticket that follows the patient through vitals and doctor visit.');
|
||
?>
|
||
<div class="container-xxl px-3 px-lg-4">
|
||
<section class="page-header-panel mb-4">
|
||
<div>
|
||
<span class="section-kicker">Reception / الاستقبال</span>
|
||
<h1 class="section-title-xl mt-2">Issue one ticket for the full visit.</h1>
|
||
<p class="section-copy mb-0">Reception decides the clinic and doctor once. The system automatically routes the patient to vitals first only when the selected clinic requires it.</p>
|
||
</div>
|
||
</section>
|
||
|
||
<div class="row g-4">
|
||
<div class="col-xl-5">
|
||
<div class="panel-card h-100">
|
||
<h2 class="section-title mb-3">New patient ticket / تذكرة مريض جديدة</h2>
|
||
<form method="post" class="vstack gap-3" novalidate>
|
||
<div>
|
||
<label class="form-label">Patient name / اسم المريض</label>
|
||
<input class="form-control" type="text" name="patient_name" placeholder="Maha Ali" required>
|
||
</div>
|
||
<div>
|
||
<label class="form-label">Clinic / العيادة</label>
|
||
<select class="form-select js-clinic-select" name="clinic_id" required>
|
||
<option value="">Choose clinic</option>
|
||
<?php foreach ($clinics as $clinic): ?>
|
||
<option value="<?= qh_h((string) $clinic['id']) ?>"><?= qh_h($clinic['name_en']) ?> / <?= qh_h($clinic['name_ar']) ?><?= (int) $clinic['requires_vitals'] === 1 ? ' · Vitals first' : '' ?></option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label class="form-label">Doctor / الطبيب</label>
|
||
<select class="form-select js-doctor-select" name="doctor_id" required>
|
||
<option value="">Choose doctor</option>
|
||
<?php foreach ($doctors as $doctor): ?>
|
||
<option value="<?= qh_h((string) $doctor['id']) ?>" data-clinic-id="<?= qh_h((string) $doctor['clinic_id']) ?>">
|
||
<?= qh_h($doctor['name_en']) ?> / <?= qh_h($doctor['name_ar']) ?> · Room <?= qh_h($doctor['room_number']) ?>
|
||
</option>
|
||
<?php endforeach; ?>
|
||
</select>
|
||
</div>
|
||
<div>
|
||
<label class="form-label">Preferred language / اللغة المفضلة</label>
|
||
<select class="form-select" name="language_pref">
|
||
<option value="en">English</option>
|
||
<option value="ar">العربية</option>
|
||
</select>
|
||
</div>
|
||
<button class="btn btn-dark" type="submit">Issue ticket / إصدار التذكرة</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="col-xl-7">
|
||
<?php if ($currentTicket): ?>
|
||
<div class="panel-card ticket-card mb-4">
|
||
<div class="d-flex justify-content-between align-items-start gap-3 flex-wrap">
|
||
<div>
|
||
<div class="section-kicker">Issued ticket / التذكرة الصادرة</div>
|
||
<div class="ticket-number mt-2"><?= qh_h($currentTicket['ticket_number']) ?></div>
|
||
<div class="mt-2 fw-semibold"><?= qh_h($currentTicket['patient_name']) ?></div>
|
||
<div class="text-secondary"><?= qh_h($currentTicket['clinic_name_en'] ?? '') ?> · <?= qh_h($currentTicket['doctor_name_en'] ?? '') ?> · Room <?= qh_h($currentTicket['doctor_room'] ?? '--') ?></div>
|
||
</div>
|
||
<div class="d-flex flex-column align-items-lg-end gap-2">
|
||
<?= qh_status_badge($currentTicket['status']) ?>
|
||
<button class="btn btn-outline-dark btn-sm js-print-ticket" type="button">Print ticket</button>
|
||
</div>
|
||
</div>
|
||
<hr>
|
||
<div class="row g-3 small">
|
||
<div class="col-md-4"><strong>Issued:</strong><br><?= qh_format_datetime($currentTicket['created_at']) ?></div>
|
||
<div class="col-md-4"><strong>Language:</strong><br><?= strtoupper(qh_h($currentTicket['language_pref'])) ?></div>
|
||
<div class="col-md-4"><strong>Next stop:</strong><br><?= (int) $currentTicket['clinic_requires_vitals'] === 1 ? 'Nursing vitals / التمريض' : 'Doctor waiting / انتظار الطبيب' ?></div>
|
||
</div>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<div class="panel-card h-100">
|
||
<div class="d-flex justify-content-between align-items-center flex-wrap gap-2 mb-3">
|
||
<div>
|
||
<h2 class="section-title mb-1">Today’s tickets / تذاكر اليوم</h2>
|
||
<p class="section-copy mb-0">The latest issued tickets and where they currently are in the visit flow.</p>
|
||
</div>
|
||
</div>
|
||
<div class="table-responsive">
|
||
<table class="table align-middle mb-0">
|
||
<thead>
|
||
<tr>
|
||
<th>Ticket</th>
|
||
<th>Patient</th>
|
||
<th>Clinic</th>
|
||
<th>Status</th>
|
||
<th></th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php foreach ($todayTickets as $ticket): ?>
|
||
<tr>
|
||
<td class="fw-semibold"><?= qh_h($ticket['ticket_number']) ?></td>
|
||
<td><?= qh_h($ticket['patient_name']) ?></td>
|
||
<td><?= qh_h($ticket['clinic_name_en'] ?? '—') ?></td>
|
||
<td><?= qh_status_badge($ticket['status']) ?></td>
|
||
<td class="text-end"><a class="btn btn-sm btn-outline-dark" href="ticket.php?id=<?= qh_h((string) $ticket['id']) ?>">View</a></td>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<?php qh_page_end(); ?>
|