Reduce OPD list response payload by using relative URLs and single status handler
This commit is contained in:
parent
232cfa15b0
commit
eef581a1cf
|
|
@ -190,13 +190,25 @@
|
|||
$('#testentry-bodyc').html('<div class="text-muted">Loading...</div>');
|
||||
modalObj.show();
|
||||
|
||||
$.post('<?= base_url('Opd/opd_load_doc') ?>/' + opdid, {}, function(html) {
|
||||
$.post('/Opd/opd_load_doc/' + opdid, {}, function(html) {
|
||||
$('#testentry-bodyc').html(html || '<div class="text-danger">Unable to load scan panel.</div>');
|
||||
}).fail(function() {
|
||||
$('#testentry-bodyc').html('<div class="text-danger">Unable to load scan panel.</div>');
|
||||
});
|
||||
});
|
||||
|
||||
$(document).off('click.opdstatus', '.btn-opd-status').on('click.opdstatus', '.btn-opd-status', function() {
|
||||
var opdId = $(this).data('opd-id');
|
||||
var opdStatus = $(this).data('opd-status');
|
||||
if (!opdId || !opdStatus) {
|
||||
return;
|
||||
}
|
||||
|
||||
$.post('/Opd/opd_status/' + opdId + '/' + opdStatus, {}, function() {
|
||||
load_form('/Opd/get_appointment_list/<?= esc((int) ($doc_id ?? 0)) ?>/<?= esc($opd_date ?? date('Y-m-d')) ?>', 'OPD Appointment List');
|
||||
});
|
||||
});
|
||||
|
||||
$(document).off('click.opdvitalsopen', '.btn-opd-vitals').on('click.opdvitalsopen', '.btn-opd-vitals', function() {
|
||||
// Open vitals modal and prefill with any existing values from prescription session.
|
||||
var opdid = parseInt($(this).data('opdid') || '0', 10);
|
||||
|
|
@ -212,7 +224,7 @@
|
|||
setVitalMessage('normal', 'Loading previous vitals...');
|
||||
vitalsModalObj.show();
|
||||
|
||||
$.getJSON('<?= base_url('Opd_prescription/vitals_get') ?>/' + opdid, function(data) {
|
||||
$.getJSON('/Opd_prescription/vitals_get/' + opdid, function(data) {
|
||||
updateCsrf(data);
|
||||
if (parseInt(data.update || 0, 10) !== 1) {
|
||||
setVitalMessage('err', data.error_text || 'Unable to load vitals');
|
||||
|
|
@ -253,7 +265,7 @@
|
|||
|
||||
var $btn = $(this);
|
||||
$btn.prop('disabled', true).text('Saving...');
|
||||
$.post('<?= base_url('Opd_prescription/vitals_save') ?>', payload, function(data) {
|
||||
$.post('/Opd_prescription/vitals_save', payload, function(data) {
|
||||
updateCsrf(data);
|
||||
$btn.prop('disabled', false).text('Save Vitals');
|
||||
if (parseInt(data.update || 0, 10) !== 1) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ if ($authUser) {
|
|||
<td>
|
||||
<?php $hasVitals = isset($row->has_vitals) && (int) $row->has_vitals === 1; ?>
|
||||
<?php if ($canOpenPrescription) : ?>
|
||||
<a class="btn btn-outline-primary btn-sm" title="Consult" href="javascript:load_form('<?= base_url('Opd_prescription/Prescription') ?>/<?= esc((int) ($row->opd_id ?? 0)) ?>','Consult');">
|
||||
<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
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
|
|
@ -44,7 +44,7 @@ if ($authUser) {
|
|||
<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>
|
||||
<a class="btn btn-outline-dark btn-sm" title="Profile" href="javascript:load_form('<?= base_url('billing/patient/person_record') ?>/<?= esc((int) ($row->id ?? 0)) ?>/0','Patient Profile');">
|
||||
<a class="btn btn-outline-dark btn-sm" title="Profile" href="javascript:load_form('/billing/patient/person_record/<?= esc((int) ($row->id ?? 0)) ?>/0','Patient Profile');">
|
||||
Profile
|
||||
</a>
|
||||
<?php if (($tabType ?? '') === 'waiting') : ?>
|
||||
|
|
@ -66,20 +66,4 @@ if ($authUser) {
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<?php if (in_array(($tabType ?? ''), ['waiting', 'visited'], true)) : ?>
|
||||
<script>
|
||||
(function() {
|
||||
// Update OPD status (for example, Visit Done) and reload the doctor queue view.
|
||||
$(document).off('click', '.btn-opd-status').on('click', '.btn-opd-status', function() {
|
||||
var opdId = $(this).data('opd-id');
|
||||
var opdStatus = $(this).data('opd-status');
|
||||
if (!opdId || !opdStatus) {
|
||||
return;
|
||||
}
|
||||
$.post('<?= base_url('Opd/opd_status') ?>/' + opdId + '/' + opdStatus, {}, function() {
|
||||
load_form('<?= base_url('Opd/get_appointment_list') ?>/<?= esc((int) ($doc_id ?? 0)) ?>/<?= esc($opd_date ?? date('Y-m-d')) ?>', 'OPD Appointment List');
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user