ABDM task board: show submit action for FHIR-ready OPD rows
This commit is contained in:
parent
ed48a447e5
commit
7a38c3e55d
|
|
@ -56,7 +56,7 @@
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-sm table-striped mb-0" id="taskTable">
|
<table class="table table-sm table-striped mb-0" id="taskTable">
|
||||||
<thead class="table-light">
|
<thead class="table-light">
|
||||||
<tr data-push-status="<?= esc((string) ($r['push_status'] ?? '')) ?>">
|
<tr>
|
||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>Task</th>
|
<th>Task</th>
|
||||||
<th>Patient</th>
|
<th>Patient</th>
|
||||||
|
|
@ -284,12 +284,14 @@
|
||||||
$linkStatus = trim((string) ($r['link_status'] ?? ''));
|
$linkStatus = trim((string) ($r['link_status'] ?? ''));
|
||||||
$bridgeRecordId = trim((string) ($r['bridge_record_id'] ?? ''));
|
$bridgeRecordId = trim((string) ($r['bridge_record_id'] ?? ''));
|
||||||
$hasFhir = (int) ($r['has_fhir'] ?? 0) === 1;
|
$hasFhir = (int) ($r['has_fhir'] ?? 0) === 1;
|
||||||
|
$pushStatusRaw = strtolower(trim((string) ($r['push_status'] ?? '')));
|
||||||
|
$canSubmitGateway = $hasFhir && ! in_array($pushStatusRaw, ['queued', 'linked'], true);
|
||||||
$statusBadgeClass = 'badge bg-' . $statusTone;
|
$statusBadgeClass = 'badge bg-' . $statusTone;
|
||||||
if ($statusTone === 'warning') {
|
if ($statusTone === 'warning') {
|
||||||
$statusBadgeClass .= ' text-dark';
|
$statusBadgeClass .= ' text-dark';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr data-push-status="<?= esc($pushStatusRaw) ?>">
|
||||||
<td>#<?= (int) ($r['opd_id'] ?? 0) ?></td>
|
<td>#<?= (int) ($r['opd_id'] ?? 0) ?></td>
|
||||||
<td><?= esc((string) ($r['P_name'] ?? '')) ?></td>
|
<td><?= esc((string) ($r['P_name'] ?? '')) ?></td>
|
||||||
<td><span class="text-primary small"><?= esc((string) ($r['abha_id'] ?? '')) ?></span></td>
|
<td><span class="text-primary small"><?= esc((string) ($r['abha_id'] ?? '')) ?></span></td>
|
||||||
|
|
@ -318,13 +320,13 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button type="button" class="btn btn-sm btn-outline-primary btn-opd-consult-fhir" data-opd-id="<?= (int) ($r['opd_id'] ?? 0) ?>">Preview FHIR</button>
|
<button type="button" class="btn btn-sm btn-outline-primary btn-opd-consult-fhir" data-opd-id="<?= (int) ($r['opd_id'] ?? 0) ?>">Preview FHIR</button>
|
||||||
<?php if ((string) ($r['push_status'] ?? '') === 'failed'): ?>
|
<?php if ($canSubmitGateway): ?>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-sm btn-outline-warning btn-opd-consult-submit-gateway ms-1"
|
class="btn btn-sm btn-outline-warning btn-opd-consult-submit-gateway ms-1"
|
||||||
data-opd-id="<?= (int) ($r['opd_id'] ?? 0) ?>"
|
data-opd-id="<?= (int) ($r['opd_id'] ?? 0) ?>"
|
||||||
data-abha-id="<?= esc((string) ($r['abha_id'] ?? '')) ?>"
|
data-abha-id="<?= esc((string) ($r['abha_id'] ?? '')) ?>"
|
||||||
>Submit to Gateway</button>
|
>Submit to ABDM</button>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -2058,11 +2060,11 @@
|
||||||
btnSubmitFhirToAbdm.className = defaultSubmitBtnClass;
|
btnSubmitFhirToAbdm.className = defaultSubmitBtnClass;
|
||||||
btnSubmitFhirToAbdm.innerHTML = defaultSubmitBtnHtml;
|
btnSubmitFhirToAbdm.innerHTML = defaultSubmitBtnHtml;
|
||||||
btnSubmitFhirToAbdm.title = defaultSubmitBtnTitle;
|
btnSubmitFhirToAbdm.title = defaultSubmitBtnTitle;
|
||||||
if (['linked', 'queued', 'local_discovery_ready'].indexOf(rowPushStatus) !== -1) {
|
if (['linked', 'queued'].indexOf(rowPushStatus) !== -1) {
|
||||||
btnSubmitFhirToAbdm.disabled = true;
|
btnSubmitFhirToAbdm.disabled = true;
|
||||||
btnSubmitFhirToAbdm.className = 'btn btn-sm btn-outline-secondary';
|
btnSubmitFhirToAbdm.className = 'btn btn-sm btn-outline-secondary';
|
||||||
btnSubmitFhirToAbdm.innerHTML = '<i class="bi bi-check2-circle"></i> Already Submitted';
|
btnSubmitFhirToAbdm.innerHTML = '<i class="bi bi-check2-circle"></i> Already Submitted';
|
||||||
btnSubmitFhirToAbdm.title = 'Record is already queued/linked/discovery-ready. Use retry only on failed rows.';
|
btnSubmitFhirToAbdm.title = 'Record is already queued or linked.';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user