update css for display
This commit is contained in:
parent
a82cf57175
commit
d2da4004c3
@ -376,8 +376,9 @@ a:hover {
|
||||
|
||||
.announcement-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
padding: 1rem 1.2rem;
|
||||
border: 1px solid var(--border);
|
||||
@ -538,7 +539,6 @@ html[dir="rtl"] .timeline-list::before {
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
.queue-row-head,
|
||||
.announcement-card,
|
||||
.call-strip,
|
||||
.doctor-spotlight {
|
||||
flex-direction: column;
|
||||
@ -835,7 +835,6 @@ html[dir="rtl"] .toast-container {
|
||||
|
||||
html[dir="rtl"] .admin-list-head,
|
||||
html[dir="rtl"] .call-strip,
|
||||
html[dir="rtl"] .announcement-card,
|
||||
html[dir="rtl"] .admin-sidebar-link {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
12
display.php
12
display.php
@ -82,15 +82,15 @@ qh_page_start(
|
||||
<?php foreach ($activeCalls as $ticket): $speech = qh_call_message($ticket); ?>
|
||||
<div class="col">
|
||||
<div class="card border-0 shadow-sm h-100 announcement-card" data-announcement-key="<?= qh_h((string) $ticket['id']) ?>-<?= qh_h((string) strtotime((string) $ticket['called_at'])) ?>" data-announcement-en="<?= qh_h($speech['speech_en'] ?? $speech['en']) ?>" data-announcement-ar="<?= qh_h($speech['speech_ar'] ?? $speech['ar']) ?>">
|
||||
<div class="card-body text-center p-2">
|
||||
<div class="card-body w-100 text-center p-2 d-flex flex-column align-items-center justify-content-center">
|
||||
<div class="fs-2 fw-bold text-primary mb-1"><?= qh_h($ticket['ticket_number']) ?></div>
|
||||
<div class="small text-muted mb-1 text-truncate" style="max-width: 100%;" title="<?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?>"><?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?></div>
|
||||
<div class="d-inline-block bg-primary text-white rounded px-2 py-1 small fw-bold mt-1">
|
||||
<div class="small text-muted mb-1 text-truncate w-100" title="<?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?>"><?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?></div>
|
||||
<div class="bg-primary text-white rounded px-2 py-1 small fw-bold mt-1 mb-2">
|
||||
<?= qh_h(qh_t('Room', 'غرفة')) ?> <?= qh_h($ticket['doctor_room'] ?? '--') ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer bg-white text-center text-muted small py-1" style="font-size: 0.65rem;">
|
||||
<?= qh_format_datetime($ticket['called_at'] ?? $ticket['updated_at']) ?>
|
||||
<div class="text-muted mt-auto" style="font-size: 0.65rem;">
|
||||
<?= qh_format_datetime($ticket['called_at'] ?? $ticket['updated_at']) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
117
patch.php
117
patch.php
@ -1,117 +0,0 @@
|
||||
<?php
|
||||
$content = file_get_contents('queue_bootstrap.php');
|
||||
|
||||
$search1 = <<<'EOD'
|
||||
'waiting_vitals' => ['class' => 'warning', 'en' => 'Waiting for vitals', 'ar' => 'بانتظار العلامات الحيوية'],
|
||||
EOD;
|
||||
|
||||
$replace1 = <<<'EOD'
|
||||
'waiting_vitals' => ['class' => 'warning', 'en' => 'Waiting for vitals', 'ar' => 'بانتظار العلامات الحيوية'],
|
||||
'nursing_called' => ['class' => 'primary', 'en' => 'Nursing Call', 'ar' => 'نداء التمريض'],
|
||||
EOD;
|
||||
$content = str_replace($search1, $replace1, $content);
|
||||
|
||||
$search2 = <<<'EOD'
|
||||
SUM(CASE WHEN t.status = 'waiting_vitals' THEN 1 ELSE 0 END) AS vitals_waiting,
|
||||
EOD;
|
||||
|
||||
$replace2 = <<<'EOD'
|
||||
SUM(CASE WHEN t.status IN ('waiting_vitals', 'nursing_called') THEN 1 ELSE 0 END) AS vitals_waiting,
|
||||
EOD;
|
||||
$content = str_replace($search2, $replace2, $content);
|
||||
|
||||
$search3 = <<<'EOD'
|
||||
'waiting_vitals' => (int) $pdo->query("SELECT COUNT(*) FROM hospital_queue_records WHERE item_type = 'ticket' AND DATE(created_at) = CURDATE() AND status = 'waiting_vitals'")->fetchColumn(),
|
||||
EOD;
|
||||
|
||||
$replace3 = <<<'EOD'
|
||||
'waiting_vitals' => (int) $pdo->query("SELECT COUNT(*) FROM hospital_queue_records WHERE item_type = 'ticket' AND DATE(created_at) = CURDATE() AND status IN ('waiting_vitals', 'nursing_called')")->fetchColumn(),
|
||||
EOD;
|
||||
$content = str_replace($search3, $replace3, $content);
|
||||
|
||||
$search4 = <<<'EOD'
|
||||
function qh_call_message(array $ticket): array
|
||||
{
|
||||
$ticketNumber = $ticket['ticket_number'] ?? '---';
|
||||
$doctorNameEn = $ticket['doctor_name_en'] ?? 'Doctor';
|
||||
EOD;
|
||||
|
||||
$replace4 = <<<'EOD'
|
||||
function qh_call_message(array $ticket): array
|
||||
{
|
||||
$ticketNumber = $ticket['ticket_number'] ?? '---';
|
||||
|
||||
if (("ticket['status']" ?? '') === 'nursing_called') {
|
||||
return [
|
||||
'en' => sprintf('Ticket %s, please proceed to Nursing Station.', $ticketNumber),
|
||||
'ar' => sprintf('رقم التذكرة %s، يرجى التوجه إلى محطة التمريض.', $ticketNumber),
|
||||
];
|
||||
}
|
||||
|
||||
$doctorNameEn = $ticket['doctor_name_en'] ?? 'Doctor';
|
||||
EOD;
|
||||
$content = str_replace($search4, $replace4, $content);
|
||||
|
||||
$searchHandler = <<<'EOD'
|
||||
$ticketId = (int) ($_POST['ticket_id'] ?? 0);
|
||||
$vitalsNotes = trim((string) ($_POST['vitals_notes'] ?? ''));
|
||||
if ($ticketId <= 0 || $vitalsNotes === '') {
|
||||
throw new InvalidArgumentException(qh_t('Please add a short vitals note before sending the patient forward.', 'يرجى إضافة ملاحظة قصيرة للعلامات الحيوية قبل إرسال المريض.'));
|
||||
}
|
||||
|
||||
$stmt = db()->prepare(
|
||||
"UPDATE hospital_queue_records
|
||||
SET vitals_notes = :vitals_notes,
|
||||
status = 'ready_for_doctor',
|
||||
display_note = 'Vitals completed. Wait for doctor call.'
|
||||
WHERE item_type = 'ticket' AND id = :ticket_id AND status = 'waiting_vitals'"
|
||||
);
|
||||
$stmt->execute([
|
||||
'vitals_notes' => $vitalsNotes,
|
||||
'ticket_id' => $ticketId,
|
||||
]);
|
||||
qh_set_flash('success', qh_t('Vitals captured and patient moved to the doctor queue.', 'تم حفظ العلامات الحيوية ونقل المريض إلى طابور الطبيب.'));
|
||||
EOD;
|
||||
|
||||
$replaceHandler = <<<'EOD'
|
||||
$ticketId = (int) ($_POST['ticket_id'] ?? 0);
|
||||
$action = trim((string) ($_POST['action'] ?? 'send'));
|
||||
|
||||
$ticket = qh_fetch_ticket($ticketId);
|
||||
if (!$ticket) throw new InvalidArgumentException(qh_t('Invalid ticket.', 'تذكرة غير صالحة.'));
|
||||
|
||||
if ($action === 'call_ticket') {
|
||||
$stmt = db()->prepare(
|
||||
"UPDATE hospital_queue_records
|
||||
SET status = 'nursing_called', called_at = NOW(), display_note = :display_note
|
||||
WHERE item_type = 'ticket' AND id = :ticket_id"
|
||||
);
|
||||
$stmt->execute([
|
||||
'display_note' => sprintf('Ticket %s, proceed to Nursing Station.', $ticket['ticket_number']),
|
||||
'ticket_id' => $ticketId
|
||||
]);
|
||||
qh_set_flash('success', qh_t('Patient call was sent to the public display.', 'تم إرسال نداء المريض إلى الشاشة العامة.'));
|
||||
} else {
|
||||
$vitalsNotes = trim((string) ($_POST['vitals_notes'] ?? ''));
|
||||
if ($vitalsNotes === '') throw new InvalidArgumentException(qh_t('Please add a short vitals note before sending the patient forward.', 'يرجى إضافة ملاحظة قصيرة للعلامات الحيوية قبل إرسال المريض.'));
|
||||
|
||||
$stmt = db()->prepare(
|
||||
"UPDATE hospital_queue_records
|
||||
SET vitals_notes = :vitals_notes,
|
||||
status = 'ready_for_doctor',
|
||||
display_note = 'Vitals completed. Wait for doctor call.'
|
||||
WHERE item_type = 'ticket' AND id = :ticket_id AND status IN ('waiting_vitals', 'nursing_called')"
|
||||
);
|
||||
$stmt->execute([
|
||||
'vitals_notes' => $vitalsNotes,
|
||||
'ticket_id' => $ticketId,
|
||||
]);
|
||||
qh_set_flash('success', qh_t('Vitals captured and patient moved to the doctor queue.', 'تم حفظ العلامات الحيوية ونقل المريض إلى طابور الطبيب.'));
|
||||
}
|
||||
EOD;
|
||||
$content = str_replace($searchHandler, $replaceHandler, $content);
|
||||
|
||||
file_put_contents('queue_bootstrap.php', $content);
|
||||
echo "SUCCESS!\n";
|
||||
|
||||
?>
|
||||
@ -1,87 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const jsPath = path.join(__dirname, 'assets/js/main.js');
|
||||
let jsCode = fs.readFileSync(jsPath, 'utf8');
|
||||
|
||||
// Replace the icon logic
|
||||
jsCode = jsCode.replace(
|
||||
/audioBtn\.innerHTML = '<i class="bi bi-volume-up"><\/i>';/g,
|
||||
`audioBtn.innerHTML = '<i class="bi bi-megaphone-fill text-success"></i>';`
|
||||
).replace(
|
||||
/audioBtn\.innerHTML = '<i class="bi bi-volume-mute"><\/i>';/g,
|
||||
`audioBtn.innerHTML = '<i class="bi bi-megaphone"></i>';`
|
||||
);
|
||||
|
||||
// Add logic to test sound when audio is enabled
|
||||
const repl1 = `if (nextState) {
|
||||
initAudio();
|
||||
if ('speechSynthesis' in window) {
|
||||
const primeUtterance = new SpeechSynthesisUtterance('');
|
||||
window.speechSynthesis.speak(primeUtterance);
|
||||
}
|
||||
}`;
|
||||
const repl2 = `if (nextState) {
|
||||
initAudio();
|
||||
if ('speechSynthesis' in window) {
|
||||
const primeUtterance = new SpeechSynthesisUtterance('');
|
||||
window.speechSynthesis.speak(primeUtterance);
|
||||
}
|
||||
|
||||
// Force latest announcement to replay
|
||||
const cards = Array.from(document.querySelectorAll('.announcement-card'));
|
||||
const latest = cards[0];
|
||||
if (latest) {
|
||||
const storageKey =
|
||||
`hospitalQueue:lastAnnouncement:${locale}
|
||||
`;
|
||||
window.localStorage.removeItem(storageKey);
|
||||
setTimeout(checkAnnouncements, 200);
|
||||
}
|
||||
}`;
|
||||
jsCode = jsCode.replace(repl1, repl2);
|
||||
|
||||
// Make sure speech synthesis gets voices early, and handle fallback properly
|
||||
const oldVoiceLogic = `if (langVoices.length > 0) {
|
||||
// Try to find a high-quality (Google/Microsoft Natural) voice
|
||||
const bestVoice = langVoices.find(v =>
|
||||
v.name.includes('Google') ||
|
||||
v.name.includes('Natural') ||
|
||||
v.name.includes('Premium') ||
|
||||
v.name.includes('Online')
|
||||
) || langVoices.find(v => v.name.includes('Microsoft')) || langVoices[0];
|
||||
|
||||
utterance.voice = bestVoice;
|
||||
}`;
|
||||
|
||||
const newVoiceLogic = `if (langVoices.length > 0) {
|
||||
// Try to find a high-quality (Google/Microsoft Natural) voice
|
||||
const bestVoice = langVoices.find(v =>
|
||||
v.name.includes('Google') ||
|
||||
v.name.includes('Natural') ||
|
||||
v.name.includes('Premium') ||
|
||||
v.name.includes('Online')
|
||||
) || langVoices.find(v => v.name.includes('Microsoft')) || langVoices[0];
|
||||
|
||||
utterance.voice = bestVoice;
|
||||
} else if (voices.length > 0) {
|
||||
// Fallback to any available voice to ensure sound plays
|
||||
utterance.voice = voices[0];
|
||||
}`;
|
||||
|
||||
jsCode = jsCode.replace(oldVoiceLogic, newVoiceLogic);
|
||||
|
||||
// Call getVoices early
|
||||
if (!jsCode.includes('window.speechSynthesis.getVoices();')) {
|
||||
jsCode = jsCode.replace(
|
||||
`document.addEventListener('DOMContentLoaded', () => {`,
|
||||
`document.addEventListener('DOMContentLoaded', () => {
|
||||
if ('speechSynthesis' in window) {
|
||||
window.speechSynthesis.onvoiceschanged = () => { window.speechSynthesis.getVoices(); };
|
||||
window.speechSynthesis.getVoices();
|
||||
}`
|
||||
);
|
||||
}
|
||||
|
||||
fs.writeFileSync(jsPath, jsCode);
|
||||
console.log('patched');
|
||||
38
patch_css.php
Normal file
38
patch_css.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
$css = file_get_contents('assets/css/custom.css');
|
||||
|
||||
$search = <<<CSS
|
||||
.announcement-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
padding: 1rem 1.2rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--surface-muted);
|
||||
}
|
||||
CSS;
|
||||
|
||||
$replace = <<<CSS
|
||||
.announcement-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1rem;
|
||||
padding: 1rem 1.2rem;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--surface-muted);
|
||||
}
|
||||
CSS;
|
||||
|
||||
$newCss = str_replace($search, $replace, $css);
|
||||
if ($newCss !== $css) {
|
||||
file_put_contents('assets/css/custom.css', $newCss);
|
||||
echo "CSS modified.\n";
|
||||
} else {
|
||||
echo "CSS not found.\n";
|
||||
}
|
||||
|
||||
18
patch_css_media.php
Normal file
18
patch_css_media.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
$css = file_get_contents('assets/css/custom.css');
|
||||
|
||||
$css = str_replace(
|
||||
" .queue-row-head,\n .announcement-card,\n .call-strip,",
|
||||
" .queue-row-head,\n .call-strip,",
|
||||
$css
|
||||
);
|
||||
|
||||
$css = str_replace(
|
||||
"html[dir=\"rtl\"] .call-strip,\nhtml[dir=\"rtl\"] .announcement-card,\nhtml[dir=\"rtl\"] .admin-sidebar-link",
|
||||
"html[dir=\"rtl\"] .call-strip,\nhtml[dir=\"rtl\"] .admin-sidebar-link",
|
||||
$css
|
||||
);
|
||||
|
||||
file_put_contents('assets/css/custom.css', $css);
|
||||
echo "CSS RTL and Mobile media queries modified for announcement-card.\n";
|
||||
|
||||
36
patch_display.php
Normal file
36
patch_display.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
$content = file_get_contents('display.php');
|
||||
$search = <<<'HTML'
|
||||
<div class="card-body text-center p-2">
|
||||
<div class="fs-2 fw-bold text-primary mb-1"><?= qh_h($ticket['ticket_number']) ?></div>
|
||||
<div class="small text-muted mb-1 text-truncate" style="max-width: 100%;" title="<?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?>"><?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?></div>
|
||||
<div class="d-inline-block bg-primary text-white rounded px-2 py-1 small fw-bold mt-1">
|
||||
<?= qh_h(qh_t('Room', 'غرفة')) ?> <?= qh_h($ticket['doctor_room'] ?? '--') ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer bg-white text-center text-muted small py-1" style="font-size: 0.65rem;">
|
||||
<?= qh_format_datetime($ticket['called_at'] ?? $ticket['updated_at']) ?>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
$replace = <<<'HTML'
|
||||
<div class="card-body text-center p-2 d-flex flex-column align-items-center justify-content-center">
|
||||
<div class="fs-2 fw-bold text-primary mb-1"><?= qh_h($ticket['ticket_number']) ?></div>
|
||||
<div class="small text-muted mb-1 text-truncate w-100" title="<?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?>"><?= qh_h(qh_name($ticket, 'doctor_name', qh_t('Doctor', 'الطبيب'))) ?></div>
|
||||
<div class="bg-primary text-white rounded px-2 py-1 small fw-bold mt-1 mb-2">
|
||||
<?= qh_h(qh_t('Room', 'غرفة')) ?> <?= qh_h($ticket['doctor_room'] ?? '--') ?>
|
||||
</div>
|
||||
<div class="text-muted mt-auto" style="font-size: 0.65rem;">
|
||||
<?= qh_format_datetime($ticket['called_at'] ?? $ticket['updated_at']) ?>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
|
||||
$newContent = str_replace($search, $replace, $content);
|
||||
if ($newContent !== $content) {
|
||||
file_put_contents('display.php', $newContent);
|
||||
echo "Replaced successfully\n";
|
||||
} else {
|
||||
echo "Pattern not found\n";
|
||||
}
|
||||
|
||||
12
patch_display_w100.php
Normal file
12
patch_display_w100.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$content = file_get_contents('display.php');
|
||||
$search = '<div class="card-body text-center p-2 d-flex flex-column align-items-center justify-content-center">';
|
||||
$replace = '<div class="card-body w-100 text-center p-2 d-flex flex-column align-items-center justify-content-center">';
|
||||
$newContent = str_replace($search, $replace, $content);
|
||||
if ($newContent !== $content) {
|
||||
file_put_contents('display.php', $newContent);
|
||||
echo "Added w-100 to card-body\n";
|
||||
} else {
|
||||
echo "w-100 already added or not found\n";
|
||||
}
|
||||
|
||||
@ -972,14 +972,24 @@ function qh_status_badge(string $status): string
|
||||
function qh_call_message(array $ticket): array
|
||||
{
|
||||
$ticketNumber = $ticket['ticket_number'] ?? '---';
|
||||
$spokenTicket = trim(preg_replace('/([a-zA-Z])/u', '$1, ', str_replace('-', ' ', $ticketNumber)));
|
||||
// For English speech, replacing the hyphen with a space helps it say "DRR 001" instead of "DRR minus 001"
|
||||
$speechEn = strtoupper(str_replace('-', ' ', $ticketNumber));
|
||||
|
||||
// Map English letters to Arabic phonetics so Arabic TTS pronounces them correctly
|
||||
$arMap = [
|
||||
'A'=>'إيه ', 'B'=>'بي ', 'C'=>'سي ', 'D'=>'دي ', 'E'=>'إي ', 'F'=>'إف ', 'G'=>'جي ', 'H'=>'إتش ',
|
||||
'I'=>'آي ', 'J'=>'جيه ', 'K'=>'كيه ', 'L'=>'إل ', 'M'=>'إم ', 'N'=>'إن ', 'O'=>'أو ', 'P'=>'بي ',
|
||||
'Q'=>'كيو ', 'R'=>'آر ', 'S'=>'إس ', 'T'=>'تي ', 'U'=>'يو ', 'V'=>'في ', 'W'=>'دبليو ', 'X'=>'إكس ',
|
||||
'Y'=>'واي ', 'Z'=>'زِد '
|
||||
];
|
||||
$speechAr = trim(preg_replace('/ +/', ' ', strtr($speechEn, $arMap)));
|
||||
|
||||
if (($ticket['status'] ?? '') === 'nursing_called') {
|
||||
return [
|
||||
'en' => sprintf('Ticket %s, please proceed to Nursing Station.', $ticketNumber),
|
||||
'ar' => sprintf('رقم التذكرة %s، يرجى التوجه إلى محطة التمريض.', $ticketNumber),
|
||||
'speech_en' => sprintf('Ticket %s, please proceed to Nursing Station.', $spokenTicket),
|
||||
'speech_ar' => sprintf('رقم التذكرة %s، يرجى التوجه إلى محطة التمريض.', $spokenTicket),
|
||||
'speech_en' => sprintf('Ticket %s, please proceed to Nursing Station.', $speechEn),
|
||||
'speech_ar' => sprintf('رقم التذكرة %s، يرجى التوجه إلى محطة التمريض.', $speechAr),
|
||||
];
|
||||
}
|
||||
|
||||
@ -990,8 +1000,8 @@ function qh_call_message(array $ticket): array
|
||||
return [
|
||||
'en' => sprintf('Ticket %s, please proceed to room %s for %s.', $ticketNumber, $room, $doctorNameEn),
|
||||
'ar' => sprintf('رقم التذكرة %s، يرجى التوجه إلى الغرفة %s إلى %s.', $ticketNumber, $room, $doctorNameAr),
|
||||
'speech_en' => sprintf('Ticket %s, please proceed to room %s for %s.', $spokenTicket, $room, $doctorNameEn),
|
||||
'speech_ar' => sprintf('رقم التذكرة %s، يرجى التوجه إلى الغرفة %s إلى %s.', $spokenTicket, $room, $doctorNameAr),
|
||||
'speech_en' => sprintf('Ticket %s, please proceed to room %s for %s.', $speechEn, $room, $doctorNameEn),
|
||||
'speech_ar' => sprintf('رقم التذكرة %s، يرجى التوجه إلى الغرفة %s إلى %s.', $speechAr, $room, $doctorNameAr),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user