2024-12-13 14:20:14 +07:00
|
|
|
<?= $this->extend($_SESSION['userrole'].'/layout/main.php') ?>
|
|
|
|
|
|
|
|
|
|
<?= $this->section('content') ?>
|
2024-12-15 16:25:39 +07:00
|
|
|
<div id="alert">
|
|
|
|
|
|
|
|
|
|
</div>
|
2024-12-13 14:20:14 +07:00
|
|
|
<div class="card border-0">
|
|
|
|
|
<div class="card-body">
|
|
|
|
|
<div class='card-title'>Order List</div>
|
2024-12-19 08:13:27 +07:00
|
|
|
<p>
|
2024-12-13 14:20:14 +07:00
|
|
|
<b>Date</b> <input class='date1' type='date' value=''> - <input class='date2' type='date'> <button class='btn btn-sm btn-primary' onclick='index()'><i class="bi bi-calendar2-event"></i> Filter</button>
|
2024-12-19 08:13:27 +07:00
|
|
|
</p>
|
|
|
|
|
<p> <button class='btn btn-sm btn-success' onclick='create()'><i class="bi bi-plus-circle"></i> New Order</button> </p>
|
|
|
|
|
|
|
|
|
|
|
2024-12-13 14:20:14 +07:00
|
|
|
<div class="table-responsive">
|
|
|
|
|
<table id="myTable" class="table">
|
|
|
|
|
<thead>
|
|
|
|
|
<th>VisitDate</th>
|
|
|
|
|
<th>Visit#</th>
|
|
|
|
|
<th>MR#</th>
|
|
|
|
|
<th>Patient Name</th>
|
|
|
|
|
<th>Payer Name</th>
|
|
|
|
|
<th>Test</th>
|
2024-12-15 14:36:57 +07:00
|
|
|
<th>Action</th>
|
2024-12-13 14:20:14 +07:00
|
|
|
</thead>
|
|
|
|
|
<tbody id="table-body">
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="modal fade" id="modal_orderdetail" aria-hidden="true" tabindex="-1">
|
|
|
|
|
<div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
|
|
|
|
|
<div class="modal-content">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<?= $this->endSection() ?>
|
|
|
|
|
|
|
|
|
|
<?= $this->section('script') ?>
|
|
|
|
|
<script>
|
|
|
|
|
let curDate = new Date().toJSON().slice(0, 10);
|
|
|
|
|
$('.date1').val(curDate);
|
|
|
|
|
$('.date2').val(curDate);
|
|
|
|
|
index();
|
|
|
|
|
|
|
|
|
|
function index() {
|
|
|
|
|
let url = '<?=base_url('');?>api/orders/index';
|
|
|
|
|
date1 = $('.date1').val();
|
|
|
|
|
date2 = $('.date2').val();
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: url,
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data : {date1:date1, date2:date2},
|
|
|
|
|
success: function(response) {
|
2024-12-19 08:13:27 +07:00
|
|
|
$("#myTable").DataTable().destroy();
|
2024-12-13 14:20:14 +07:00
|
|
|
$("#table-body").html("");
|
|
|
|
|
var data = response['data'];
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
2024-12-15 14:36:57 +07:00
|
|
|
orderid = data[i].ORDERID;
|
2024-12-13 14:20:14 +07:00
|
|
|
visitdate = data[i].VISITDATE;
|
|
|
|
|
visitnumber = data[i].VISITNUMBER;
|
|
|
|
|
patnumber = data[i].PATNUMBER;
|
|
|
|
|
patname = data[i].PATNAME;
|
|
|
|
|
payername = data[i].PAYERNAME;
|
|
|
|
|
tests = data[i].TESTS;
|
2024-12-15 14:36:57 +07:00
|
|
|
editBtn = '<button class="btn btn-sm btn-warning" onclick="edit(\''+ orderid +'\')"><i class="bi bi-pencil"></i> edit</button>';
|
|
|
|
|
resendBtn = '<button class="btn btn-sm btn-primary" onclick="resend(\''+ visitnumber +'\')"><i class="bi bi-send"></i> resend</button>';
|
2024-12-13 14:20:14 +07:00
|
|
|
let datarow = '<tr class="align-middle">' +
|
|
|
|
|
'<td>' + visitdate + '</td> <td>' + visitnumber + '</td> <td>' + patnumber + '</td> <td>' + patname +
|
2024-12-15 14:36:57 +07:00
|
|
|
'</td> <td>' + payername + '</td> <td>' + tests + '</td> ' +
|
|
|
|
|
'<td>' + resendBtn + ' ' + editBtn + '</td>' +
|
|
|
|
|
'</tr>';
|
2024-12-13 14:20:14 +07:00
|
|
|
$("#table-body").append(datarow);
|
|
|
|
|
}
|
2024-12-19 08:13:27 +07:00
|
|
|
$('#myTable').DataTable();
|
2024-12-13 14:20:14 +07:00
|
|
|
},
|
|
|
|
|
error: function(response) { console.log(response.responseJSON); }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
|
window.open("<?php echo base_url();echo $_SESSION['userrole']?>/orders/create",
|
|
|
|
|
'_blank', "width=1200,height=700,location=no,toolbar=no,menubar=no"
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-12-15 14:36:57 +07:00
|
|
|
|
|
|
|
|
function edit(orderid) {
|
|
|
|
|
window.open("<?php echo base_url();echo $_SESSION['userrole']?>/orders/edit/"+orderid,
|
|
|
|
|
'_blank', "width=1200,height=700,location=no,toolbar=no,menubar=no"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function resend(visitnumber) {
|
|
|
|
|
let url = '<?=base_url('');?>api/orders/resend/'+visitnumber;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: url,
|
2024-12-15 16:25:39 +07:00
|
|
|
method: 'GET',
|
|
|
|
|
success: function(response) {
|
|
|
|
|
alert = '<div class="alert alert-primary alert-dismissible fade show" role="alert">' +
|
|
|
|
|
'Re-send '+visitnumber+' success.' +
|
|
|
|
|
'<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>'+
|
|
|
|
|
'</div>';
|
|
|
|
|
$('#alert').html(alert);
|
|
|
|
|
},
|
2024-12-15 14:36:57 +07:00
|
|
|
error: function(response) { console.log(response.responseJSON); }
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-12-13 14:20:14 +07:00
|
|
|
</script>
|
|
|
|
|
<?= $this->endSection() ?>
|