updating printing ticket

This commit is contained in:
Flatlogic Bot 2026-04-02 17:35:51 +00:00
parent 9991d51541
commit 1148add8f4
4 changed files with 29 additions and 4 deletions

View File

@ -142,8 +142,8 @@ qh_page_start(
<div class="sticky-top" style="top: 1rem; height: 60vh;"> <div class="sticky-top" style="top: 1rem; height: 60vh;">
<?php if (!empty($activeVideos)): ?> <?php if (!empty($activeVideos)): ?>
<div class="card shadow-sm border-0 h-100 bg-black overflow-hidden d-flex justify-content-center align-items-center"> <div class="card shadow-sm border-0 h-100 bg-black overflow-hidden d-flex justify-content-center align-items-center">
<video id="adsVideoPlayer" class="w-100 h-100 object-fit-contain" autoplay muted playsinline> <video id="adsVideoPlayer" class="w-100 h-100 object-fit-contain" src="<?= qh_h($activeVideos[0]) ?>" autoplay muted playsinline>
<source src="<?= qh_h($activeVideos[0]) ?>" type="video/mp4">
</video> </video>
<script> <script>
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
@ -161,7 +161,12 @@ qh_page_start(
} }
player.src = videos[currentIdx]; player.src = videos[currentIdx];
player.currentTime = isNaN(currentTime) ? 0 : currentTime; player.load();
player.addEventListener('loadedmetadata', function() {
if (currentTime > 0) {
player.currentTime = isNaN(currentTime) ? 0 : currentTime;
}
}, { once: true });
if (window.localStorage.getItem('hospitalQueue:audioEnabled') === 'true') { if (window.localStorage.getItem('hospitalQueue:audioEnabled') === 'true') {
player.muted = false; player.muted = false;
@ -179,6 +184,7 @@ qh_page_start(
player.addEventListener('ended', function() { player.addEventListener('ended', function() {
currentIdx = (currentIdx + 1) % videos.length; currentIdx = (currentIdx + 1) % videos.length;
player.src = videos[currentIdx]; player.src = videos[currentIdx];
player.load();
player.play().catch(function(e) { console.error("Error playing video:", e); }); player.play().catch(function(e) { console.error("Error playing video:", e); });
}); });
} else { } else {

View File

@ -848,6 +848,19 @@ function qh_fetch_tickets(array $statuses = [], ?int $doctorId = null, ?int $lim
return $stmt->fetchAll(); return $stmt->fetchAll();
} }
function qh_get_waiting_count_for_ticket(array $ticket): int
{
try {
$pdo = db();
$stmt = $pdo->prepare("SELECT COUNT(*) FROM hospital_queue_records WHERE item_type = 'ticket' AND DATE(created_at) = CURDATE() AND doctor_id = :doctor_id AND status IN ('waiting_vitals', 'nursing_called', 'ready_for_doctor', 'called', 'in_progress') AND id < :ticket_id");
$stmt->execute(['doctor_id' => (int)$ticket['doctor_id'], 'ticket_id' => (int)$ticket['id']]);
return (int) $stmt->fetchColumn();
} catch (Throwable $e) {
return 0;
}
}
function qh_queue_overview(): array function qh_queue_overview(): array
{ {
$sql = "SELECT c.id, c.name_en, c.name_ar, c.code, c.requires_vitals, $sql = "SELECT c.id, c.name_en, c.name_ar, c.code, c.requires_vitals,

View File

@ -154,6 +154,9 @@ qh_page_start(
<div class="pt-detail"> <div class="pt-detail">
<span class="pt-label"><?= qh_h(qh_t("Room", "الغرفة")) ?>:</span> <?= qh_h($currentTicket["doctor_room"] ?? "--") ?> <span class="pt-label"><?= qh_h(qh_t("Room", "الغرفة")) ?>:</span> <?= qh_h($currentTicket["doctor_room"] ?? "--") ?>
</div> </div>
<div class="pt-detail">
<span class="pt-label"><?= qh_h(qh_t("Waiting ahead", "أمامك في الطابور")) ?>:</span> <strong><?= qh_get_waiting_count_for_ticket($currentTicket) ?></strong>
</div>
<div class="pt-detail pt-datetime"> <div class="pt-detail pt-datetime">
<span class="pt-label"><?= qh_h(qh_t("Time", "الوقت")) ?>:</span> <span><?= qh_format_datetime($currentTicket["created_at"]) ?></span> <span class="pt-label"><?= qh_h(qh_t("Time", "الوقت")) ?>:</span> <span><?= qh_format_datetime($currentTicket["created_at"]) ?></span>
</div> </div>
@ -164,4 +167,4 @@ qh_page_start(
</div> </div>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php qh_page_end(); ?> <?php qh_page_end(); ?>

View File

@ -102,6 +102,9 @@ qh_page_start(
<div class="pt-detail"> <div class="pt-detail">
<span class="pt-label"><?= qh_h(qh_t("Room", "الغرفة")) ?>:</span> <?= qh_h($ticket["doctor_room"] ?? "--") ?> <span class="pt-label"><?= qh_h(qh_t("Room", "الغرفة")) ?>:</span> <?= qh_h($ticket["doctor_room"] ?? "--") ?>
</div> </div>
<div class="pt-detail">
<span class="pt-label"><?= qh_h(qh_t("Waiting ahead", "أمامك في الطابور")) ?>:</span> <strong><?= qh_get_waiting_count_for_ticket($ticket) ?></strong>
</div>
<div class="pt-detail pt-datetime"> <div class="pt-detail pt-datetime">
<span class="pt-label"><?= qh_h(qh_t("Time", "الوقت")) ?>:</span> <span><?= qh_format_datetime($ticket["created_at"]) ?></span> <span class="pt-label"><?= qh_h(qh_t("Time", "الوقت")) ?>:</span> <span><?= qh_format_datetime($ticket["created_at"]) ?></span>
</div> </div>