fix: show booked queue actions in waiting list
This commit is contained in:
parent
44cb24c4e1
commit
b03eb0064a
|
|
@ -845,6 +845,7 @@ class Opd extends BaseController
|
|||
|
||||
$opdList0 = [];
|
||||
$opdList1 = [];
|
||||
$opdListWaitingAll = [];
|
||||
$opdList2 = [];
|
||||
$opdList3 = [];
|
||||
|
||||
|
|
@ -863,11 +864,13 @@ class Opd extends BaseController
|
|||
|
||||
if ($status === 1 && ! $hasPrescription) {
|
||||
$opdList0[] = $row;
|
||||
$opdListWaitingAll[] = $row;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($status === 1 && $hasPrescription) {
|
||||
$opdList1[] = $row;
|
||||
$opdListWaitingAll[] = $row;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -903,6 +906,36 @@ class Opd extends BaseController
|
|||
return ((int) ($left->opd_id ?? 0)) <=> ((int) ($right->opd_id ?? 0));
|
||||
});
|
||||
|
||||
usort($opdListWaitingAll, static function ($left, $right): int {
|
||||
$leftHasPrescription = (int) ($left->has_prescription ?? 0);
|
||||
$rightHasPrescription = (int) ($right->has_prescription ?? 0);
|
||||
if ($leftHasPrescription !== $rightHasPrescription) {
|
||||
return $rightHasPrescription <=> $leftHasPrescription;
|
||||
}
|
||||
|
||||
if ($leftHasPrescription === 1) {
|
||||
$leftVitals = (int) ($left->has_vitals ?? 0);
|
||||
$rightVitals = (int) ($right->has_vitals ?? 0);
|
||||
if ($leftVitals !== $rightVitals) {
|
||||
return $leftVitals <=> $rightVitals;
|
||||
}
|
||||
|
||||
$leftQueue = (int) ($left->queue_no ?? 0);
|
||||
$rightQueue = (int) ($right->queue_no ?? 0);
|
||||
if ($leftQueue !== $rightQueue) {
|
||||
return $leftQueue <=> $rightQueue;
|
||||
}
|
||||
}
|
||||
|
||||
$leftConfirmed = (int) ($left->is_confirmed_for_queue ?? 0);
|
||||
$rightConfirmed = (int) ($right->is_confirmed_for_queue ?? 0);
|
||||
if ($leftConfirmed !== $rightConfirmed) {
|
||||
return $rightConfirmed <=> $leftConfirmed;
|
||||
}
|
||||
|
||||
return ((int) ($left->opd_id ?? 0)) <=> ((int) ($right->opd_id ?? 0));
|
||||
});
|
||||
|
||||
usort($opdList2, static function ($left, $right): int {
|
||||
return ((int) ($left->opd_id ?? 0)) <=> ((int) ($right->opd_id ?? 0));
|
||||
});
|
||||
|
|
@ -923,6 +956,7 @@ class Opd extends BaseController
|
|||
'doc_master' => $docMaster,
|
||||
'opd_list_0' => $opdList0,
|
||||
'opd_list_1' => $opdList1,
|
||||
'opd_list_waiting_all' => $opdListWaitingAll,
|
||||
'opd_list_2' => $opdList2,
|
||||
'opd_list_3' => $opdList3,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
<label class="form-check-label" for="toggle_missing_vitals_only">Only Missing Vitals</label>
|
||||
</div>
|
||||
</div>
|
||||
<?= view('billing/opd_appointment_list_table', ['rows' => $opd_list_1, 'showQueue' => true, 'tabType' => 'waiting', 'opd_date' => $opd_date, 'doc_id' => $doc_id]) ?>
|
||||
<?= view('billing/opd_appointment_list_table', ['rows' => $opd_list_waiting_all ?? $opd_list_1, 'showQueue' => true, 'tabType' => 'waiting', 'opd_date' => $opd_date, 'doc_id' => $doc_id]) ?>
|
||||
<div id="waitingNoRowsHint" class="small text-muted mt-2 d-none">All waiting patients already have vitals.</div>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="tab_visited">
|
||||
|
|
@ -158,7 +158,8 @@
|
|||
|
||||
$rows.each(function() {
|
||||
var hasVitals = parseInt($(this).attr('data-has-vitals') || '0', 10) === 1;
|
||||
var show = !onlyMissing || !hasVitals;
|
||||
var hasPrescription = parseInt($(this).attr('data-has-prescription') || '0', 10) === 1;
|
||||
var show = !onlyMissing || (hasPrescription && !hasVitals);
|
||||
$(this).toggle(show);
|
||||
if (show) {
|
||||
visibleCount++;
|
||||
|
|
@ -173,7 +174,8 @@
|
|||
var missingCount = 0;
|
||||
$('#tab_waiting tbody tr[data-opd-id]').each(function() {
|
||||
var hasVitals = parseInt($(this).attr('data-has-vitals') || '0', 10) === 1;
|
||||
if (!hasVitals) {
|
||||
var hasPrescription = parseInt($(this).attr('data-has-prescription') || '0', 10) === 1;
|
||||
if (hasPrescription && !hasVitals) {
|
||||
missingCount++;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,18 +22,20 @@ if ($authUser) {
|
|||
<tbody>
|
||||
<?php if (!empty($rows)) : ?>
|
||||
<?php foreach ($rows as $row) : ?>
|
||||
<tr data-opd-id="<?= esc((int) ($row->opd_id ?? 0)) ?>" data-has-vitals="<?= esc((int) ($row->has_vitals ?? 0)) ?>">
|
||||
<tr data-opd-id="<?= esc((int) ($row->opd_id ?? 0)) ?>" data-has-vitals="<?= esc((int) ($row->has_vitals ?? 0)) ?>" data-has-prescription="<?= esc((int) ($row->has_prescription ?? 0)) ?>">
|
||||
<td><?= esc($row->opd_code ?? '') ?></td>
|
||||
<td><?= esc(($row->P_name ?? '') . ' { ' . ($row->p_rname ?? '') . ' }') ?></td>
|
||||
<?php if (!empty($showQueue)) : ?><td><?= esc((int) ($row->queue_no ?? 0)) ?></td><?php endif; ?>
|
||||
<?php if (!empty($showQueue)) : ?><td><?= (int) ($row->has_prescription ?? 0) === 1 ? esc((int) ($row->queue_no ?? 0)) : '-' ?></td><?php endif; ?>
|
||||
<td><?= esc($row->p_code ?? '') ?></td>
|
||||
<td><?= esc($row->opd_type ?? '') ?> / Amt: <?= esc($row->opd_fee_amount ?? '') ?></td>
|
||||
<td>
|
||||
<?php $hasVitals = isset($row->has_vitals) && (int) $row->has_vitals === 1; ?>
|
||||
<?php $isBookedTab = ($tabType ?? '') === 'booking'; ?>
|
||||
<?php $isWaitingTab = ($tabType ?? '') === 'waiting'; ?>
|
||||
<?php $isConfirmedForQueue = (int) ($row->is_confirmed_for_queue ?? 0) === 1; ?>
|
||||
<?php $hasPrescription = (int) ($row->has_prescription ?? 0) === 1; ?>
|
||||
|
||||
<?php if ($isBookedTab) : ?>
|
||||
<?php if (! $hasPrescription) : ?>
|
||||
<?php if ($isConfirmedForQueue) : ?>
|
||||
<button type="button" class="btn btn-outline-success btn-sm btn-opd-create-queue" data-opdid="<?= esc((int) ($row->opd_id ?? 0)) ?>" title="Queue">
|
||||
Queue
|
||||
|
|
@ -43,7 +45,9 @@ if ($authUser) {
|
|||
Go For Payment
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($hasPrescription) : ?>
|
||||
<?php if ($canOpenPrescription) : ?>
|
||||
<a class="btn btn-outline-primary btn-sm" title="Consult" href="javascript:load_form('/Opd_prescription/Prescription/<?= esc((int) ($row->opd_id ?? 0)) ?>','Consult');">
|
||||
Consult
|
||||
|
|
@ -61,8 +65,19 @@ if ($authUser) {
|
|||
<button type="button" class="btn btn-outline-dark btn-sm btn-opd-scan-list" title="Scan Document List" data-opdid="<?= esc((int) ($row->opd_id ?? 0)) ?>">
|
||||
Scan Doc List
|
||||
</button>
|
||||
<?php elseif ($isWaitingTab) : ?>
|
||||
<button type="button" class="btn btn-outline-info btn-sm btn-opd-scan" title="Scan" data-opdid="<?= esc((int) ($row->opd_id ?? 0)) ?>">
|
||||
Scan
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-secondary btn-sm btn-opd-scan" title="Upload Scan" data-opdid="<?= esc((int) ($row->opd_id ?? 0)) ?>">
|
||||
Upload
|
||||
</button>
|
||||
<button type="button" class="btn btn-outline-dark btn-sm btn-opd-scan-list" title="Scan Document List" data-opdid="<?= esc((int) ($row->opd_id ?? 0)) ?>">
|
||||
Scan Doc List
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<?php if (($tabType ?? '') === 'waiting') : ?>
|
||||
|
||||
<?php if (($tabType ?? '') === 'waiting' && $hasPrescription) : ?>
|
||||
<button type="button" class="btn btn-outline-success btn-sm btn-opd-status" data-opd-id="<?= esc((int) ($row->opd_id ?? 0)) ?>" data-opd-status="2" title="Visit Done">
|
||||
Visit Done
|
||||
</button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user