83 lines
2.2 KiB
PHP
83 lines
2.2 KiB
PHP
<?= $this->extend('admin/layout') ?>
|
|
|
|
<?= $this->section('content') ?>
|
|
<div class='container-fluid'>
|
|
<div class="card bg-light">
|
|
<div class="card-body">
|
|
<h5 class="card-title">Requests</h5>
|
|
<form class="row g-2 align-items-center" id="myForm">
|
|
<div class="col-auto">
|
|
<label for="startDate" class="col-form-label">Date</label>
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
<input type="date" class="form-control form-control-sm" id="date1" name='date1'>
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
<span>-</span>
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
<input type="date" class="form-control form-control-sm" id="date2" name='date2'>
|
|
</div>
|
|
|
|
<div class="col-auto">
|
|
<button type="button" class="btn btn-sm btn-primary" onclick='searchRequests()'>Search</button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class='table-responsive'>
|
|
<table class='table table-striped table-bordered' id='dataTable'>
|
|
<thead>
|
|
<tr>
|
|
<th>ID#</th> <th>Pat#</th> <th>PatName</th> <th>Loc</th> <th>Test</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id='tbody'>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?= $this->endSection() ?>
|
|
<?= $this->section('script') ?>
|
|
<script>
|
|
let curDate = new Date().toJSON().slice(0, 10);
|
|
$('#date1').val(curDate);
|
|
$('#date2').val(curDate);
|
|
|
|
function searchRequests() {
|
|
const url = '<?=base_url('');?>admin/api/HISRequests';
|
|
const form = document.getElementById('myForm');
|
|
const formData = new FormData(form);
|
|
|
|
fetch(url, {
|
|
method: 'POST',
|
|
body: formData
|
|
}).then(response => {
|
|
if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); }
|
|
return response.json();
|
|
}).then(data => {
|
|
$("#dataTable").DataTable().destroy();
|
|
$("#tbody").html("");
|
|
data.data.forEach(item => {
|
|
const row = `<tr>
|
|
<td class='text-nowrap'>Access# : ${item.SP_ACCESSNUMBER}<br/>Reff# : ${item.REFFID} | Visit : ${item.REQNUMBER}</td>
|
|
<td>${item.PATNUMBER}</td>
|
|
<td>${item.FIRSTNAME} ${item.NAME}</td>
|
|
<td>${item.LOC}</td>
|
|
<td>${item.TESTS}</td>
|
|
</tr>`;
|
|
$("#tbody").append(row);
|
|
});
|
|
$('#dataTable').DataTable({
|
|
"pageLength": 20,
|
|
"lengthMenu": [10, 20, 50, 100]
|
|
});
|
|
});
|
|
|
|
}
|
|
</script>
|
|
<?= $this->endSection() ?>
|