79 lines
3.1 KiB
PHP
Executable File

<table class="table table-bordered">
<thead>
<tr>
<th scope="col">
<label class="checkboxCustom">
<input type="checkbox" onchange="getCheckBox(this)" id="checkAll">
<span class="checkmark"></span>
</label> Check All
</th>
<th>Caregiver Name</th>
<th>Patient Name</th>
<th>Date</th>
<th>Time In</th>
<th>Time Out</th>
<th>Period</th>
</tr>
</thead>
<tbody id="patientMapCOd">
<?php foreach ($caregiver as $value) { ?>
<tr>
<th scope="row"><input onchange="getCheckBox(this)" class="check_bill" type="checkbox" name="patient_list[]" value="<?= $value->id; ?>"></th>
<td><?= $value->caregiver_fname." ".$value->caregiver_lnam ?></td>
<td><?= $value->patient_name ?></td>
<td><?= $value->date ?></td>
<td><?= $value->inTime ?></td>
<td><?= $value->outTime ?></td>
<?php $from_time = strtotime($value->inTime);
$to_time = strtotime($value->outTime);
$dateDiff = round(abs($to_time - $from_time) / 60,2);
$hours = intval($dateDiff/60);
$minutes = $dateDiff%60;
$period = $hours."Hrs ".$minutes."Mins"; ?>
<td><?= $period ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<div class="form-group col-md-12">
<button type="submit" onClick="checkId()" name="submit" class="btn btn-info submit"><?php echo lang('submit'); ?></button>
</div>
<script>
$('.submit').attr('disabled',true);
function getCheckBox(_this){
var care = _this.value;
if(care != 0)
$('.submit').attr('disabled',false);
else
$('.submit').attr('disabled',true);
}
$("#checkAll").click(function () {
if ($(this).is(':checked')) {
$('.check_bill').prop('checked', true);
} else {
$('.check_bill').prop('checked', false);
}
});
function checkId(){
var myCheckboxes = new Array();
$(".check_bill:checkbox:checked").each(function () {
myCheckboxes.push($(this).val());
});
$.ajax({
url:"generate_bill/createBill",
type:"POST",
data:{id:myCheckboxes, <?php echo $this->security->get_csrf_token_name(); ?>:'<?php echo $this->security->get_csrf_hash(); ?>'},
dataType: "json",
success:function(data){
$(".nav-item").removeClass('active');
$("#genBill").addClass('active');
$(".tab-pane").removeClass('active in show');
$("#tab3").addClass('active in show');
$("#tab3").html(data.view_link);
}
});
}
</script>