<?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";
}

