This commit is contained in:
mahdahar 2025-11-25 08:53:52 +07:00
parent 4f1d3e1097
commit 05846f4344
4 changed files with 73 additions and 32 deletions

View File

@ -71,6 +71,8 @@ class Admin extends BaseController
'isval' => $row['ISVAL'] ?? 0, 'isval' => $row['ISVAL'] ?? 0,
'isdelete' => $isDelete, 'isdelete' => $isDelete,
'val' => $row['VAL'] ?? 0, 'val' => $row['VAL'] ?? 0,
'val1user' => $row['VAL1USER'] ?? '-',
'val2user' => $row['VAL2USER'] ?? '-',
]; ];
} }

View File

@ -128,9 +128,8 @@
background-color: purple; background-color: purple;
} }
.btn-xs { .btn-xs { font-size : 0.7rem; }
font-size : 0.7rem; .text-xs { font-size : 0.7rem; }
}
</style> </style>
<?= $this->renderSection('css'); ?> <?= $this->renderSection('css'); ?>

View File

@ -74,7 +74,7 @@
<th style='width:8%;'>Doctor</th> <th style='width:8%;'>Doctor</th>
<th style='width:15%;'>Tests</th> <th style='width:15%;'>Tests</th>
<th style='width:5%;'>Result To</th> <th style='width:5%;'>Result To</th>
<th style='width:10%;'>Validation</th> <th style='width:5%;'>Validation</th>
<th style='width:4%;'>Status</th> <th style='width:4%;'>Status</th>
</tr> </tr>
</thead> </thead>
@ -115,13 +115,24 @@
<?= esc($row['odr_cresult_to']) ?> <br/> <?= esc($row['odr_cresult_to']) ?> <br/>
<input type="checkbox" name="printed"> Printed <input type="checkbox" name="printed"> Printed
</td> </td>
<td data-acc="<?=$row['sp_accessnumber'];?>"> <td data-acc="<?=$row['sp_accessnumber'];?>" class="text-center">
<span class="border border-success rounded p-1 mb-2 me-2"> <?=$row['val'];?> </span> <table class='mx-auto'>
<?php if($row['val'] != 2) { ?> <tr>
<!-- <a href="<?=base_url('result/'.$row['sp_accessnumber']);?>" target="_blank" class="btn btn-xs btn-outline-primary px-1 py-0 mb-1">Verify</a> --> <td>1 : <?=$row['val1user'];?></td>
<button class='btn btn-xs btn-outline-success px-1 py-0 mb-1' onclick="verify(<?=$row['sp_accessnumber'];?>)" data-bs-toggle="modal" data-bs-target="#verifyModal">Verify</button> </tr>
<br/> <tr>
<?php } else { echo "<br />"; } ?> <td>2 : <?=$row['val2user'];?></td>
</tr>
<?php if($row['val'] != 2) { ?>
<tr>
<td>
<button class='btn btn-xs btn-outline-secondary px-1 py-0 mb-1' onclick="unverify(<?=$row['sp_accessnumber'];?>)"><i class="bi bi-arrow-counterclockwise"></i></button>
<button class='btn btn-xs btn-outline-success px-1 py-0 mb-1' onclick="verifyShow(<?=$row['sp_accessnumber'];?>)" data-bs-toggle="modal" data-bs-target="#verifyModal"><i class="bi bi-check-lg"></i></button>
</td>
</tr>
<?php } ?>
</table>
<!--
<?php if($row['val'] == 2) { ?> <?php if($row['val'] == 2) { ?>
<a href="http://glenlis/spooler_db/main_dev.php?acc=<?=$row['sp_accessnumber'];?>" target="_blank" class="btn btn-xs btn-primary py-0 px-1">Ind</a> | <a href="http://glenlis/spooler_db/main_dev.php?acc=<?=$row['sp_accessnumber'];?>" target="_blank" class="btn btn-xs btn-primary py-0 px-1">Ind</a> |
<a href="http://glenlis/spooler_db/main_dev.php?acc=<?=$row['sp_accessnumber'];?>&eng=1" target="_blank" class="btn btn-xs btn-primary py-0 px-1">Eng</a> | <a href="http://glenlis/spooler_db/main_dev.php?acc=<?=$row['sp_accessnumber'];?>&eng=1" target="_blank" class="btn btn-xs btn-primary py-0 px-1">Eng</a> |
@ -130,7 +141,7 @@
<?php if ($row['val'] != 0) {?> <?php if ($row['val'] != 0) {?>
<a href="#" class="btn btn-xs btn-secondary py-0 px-2 invalidate-btn" onclick="invalidate('<?=$row['sp_accessnumber'];?>'); return false;">Invalidate</a><br> <a href="#" class="btn btn-xs btn-secondary py-0 px-2 invalidate-btn" onclick="invalidate('<?=$row['sp_accessnumber'];?>'); return false;">Invalidate</a><br>
<?php }?> <?php }?>
-->
</td> </td>
<td class="pointercol <?= esc($class) ?>" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['stats']) ?> </td> <td class="pointercol <?= esc($class) ?>" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['stats']) ?> </td>
</tr> </tr>
@ -138,8 +149,6 @@
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<!-- Modal Specimen Collection--> <!-- Modal Specimen Collection-->
@ -249,14 +258,13 @@
}); });
} }
window.verify = function(accessNumber) { function verifyShow(accessNumber) {
const modalBody = $('#verifyModal .modal-body'); const modalBody = $('#verifyModal .modal-body');
modalBody.html('<div class="text-center py-5"><div class="spinner-border text-primary" role="status"><span class="visually-hidden">Loading...</span></div><p class="mt-2">Fetching verification details for #' + accessNumber + '...</p></div>'); modalBody.html('<div class="text-center py-5"><div class="spinner-border text-primary" role="status"><span class="visually-hidden">Loading...</span></div><p class="mt-2">Fetching verification details for #' + accessNumber + '...</p></div>');
$.ajax({ $.ajax({
url: '<?= base_url('api/result/'); ?>'+accessNumber, url: '<?= base_url('api/result/'); ?>'+accessNumber,
method: 'GET', // Or 'POST', depending on your server setup method: 'GET',
data: { access_number: accessNumber },
dataType: 'html', dataType: 'html',
success: function(response) { success: function(response) {
modalBody.html(response); modalBody.html(response);
@ -273,19 +281,16 @@
}); });
}; };
/*
function verify(accessnumber) { function verify(accessnumber) {
// toggle checkbox // toggle checkbox
const row = document.getElementById(`row-${accessnumber}-${samplenumber}`); const row = document.getElementById(`row-${accessnumber}`);
const checkbox = row.querySelector('.coll-checkbox');
checkbox.checked = status;
$.ajax({ $.ajax({
url: `<?=base_url('api/request/collect');?>/${accessnumber}`, url: `<?=base_url('api/request/verify');?>/${accessnumber}`,
type: "POST", type: "POST",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
dataType: "json", dataType: "json",
data: JSON.stringify({ samplenumber:samplenumber, status:status, userid:"<?=session('userid');?>" }), data: JSON.stringify({ userid:"<?=session('userid');?>" }),
success: function(response) { success: function(response) {
console.log("Success:", response); console.log("Success:", response);
}, },
@ -294,7 +299,6 @@
} }
}); });
} }
*/
function unreceive(accessnumber, samplenumber) { function unreceive(accessnumber, samplenumber) {
// toggle checkbox // toggle checkbox
@ -351,5 +355,6 @@
}); });
}); });
}); });
</script> </script>
<?= $this->endSection() ?> <?= $this->endSection() ?>

View File

@ -1,8 +1,43 @@
<iframe <div class='row mt-1'>
id="result-iframe" <div class="col"></div>
title="PHP Embedded Content Demo" <div class='col text-end'>
class="flex-1" <button id='result-button' class='btn btn-xs btn-success' onclick='verify(<?=$accessnumber;?>)' disabled>Verify</button>
src="http://glenlis/spooler_db/main_dev.php?acc=<?=$accessnumber;?>"> </div>
</div>
<p>Your browser does not support iframes. Please contact the technical support.</p>
</iframe> <div class="row mx-auto">
<iframe
id="result-iframe"
class="embed-responsive-item"
src="http://glenlis/spooler_db/main_dev.php?acc=<?=$accessnumber;?>"
width="750px" height="600px"
>
<p>Your browser does not support iframes. Please contact the technical support.</p>
</iframe>
</div>
<script>
{
// verifymodal
let iframe = document.getElementById('result-iframe');
let button = document.getElementById('result-button');
iframe.addEventListener('load', () => {
//console.log('loaded');
let iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
let scrollElement = iframeDoc.scrollingElement || iframeDoc.documentElement;
iframeDoc.addEventListener('scroll', () => {
let scrollTop = scrollElement.scrollTop;
let scrollHeight = scrollElement.scrollHeight;
let clientHeight = scrollElement.clientHeight;
// Check if scrolled to bottom
if (scrollTop + clientHeight >= scrollHeight - 2) {
button.disabled = false;
}
});
});
}
</script>