459 lines
27 KiB
PHP
Executable File

<!--sidebar end-->
<!--main content start-->
<?php if($this->session->flashdata('feedback_error')){ ?>
<script>
Swal.fire({
position: 'center',
icon: 'error',
title: '<?php echo $this->session->flashdata('feedback_error'); ?>',
showConfirmButton: false,
timer: 3500
})
</script>
<?php } ?>
<?php if($this->session->flashdata('feedback_success')){ ?>
<script>
Swal.fire({
position: 'center',
icon: 'success',
title: '<?php echo $this->session->flashdata('feedback_success'); ?>',
showConfirmButton: false,
timer: 3500
})
</script>
<?php } ?>
<div class="app-content content">
<section class="content-wrapper">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<div class="col-md-12">
<h3 class="font-weight-bold">
<?php echo lang('Schedule of').' '.$caregiver->fname.' '.$caregiver->lname; ?>
</h3>
</div>
<div class="col-md-2">
<!-- <div class="dropdwn">
<select class="form-control input-lg" name="category">
<option value="all">Week</option>
<option value="">Month</option>
<option value="">Day</option>
</select>
</div> -->
</div>
</div>
<hr class="mt-0 mb-0" />
<div class="card-body">
<div class="row">
<div class="col-12">
<div class="row">
<div class="col-3 table-responsive">
<div id='calendar-view' class="Lft_calndr"></div>
<div class="dropdwn">
<div class="marker-available"><span></span> &nbsp;<p>Available Zone</p></div>
<div class="marker-patient-schedule"><span></span> &nbsp;<p>Patient Schedule</p></div>
</div>
</div>
<div class="col-8">
<div id='caregiver-calendar' class="rght_calndr"></div>
</div>
<div class="col-1">
<div class="align-items-center">
<a href="#" class="modal1 tooltip" data-toggle="modal" data-target="#exampleModal">
<span class="tooltiptext">Patient SCHEDULE</span>
<i class="la la-calendar-o"></i>
</a><br>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog2 modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="la la-angle-right"></i></span>
</button>
<h5 class="modal-title" id="exampleModalLabel">Caregiver Availability</h5>
</div>
<div class="modal-body">
<div id="patient-Schedule">
<table class="table table-striped table-bordered dom-jQuery-events" cellspacing="0" width="100%">
<thead>
<tr>
<th><?php echo lang('Date'); ?></th>
<th><?php echo lang('From (Time)'); ?></th>
<th><?php echo lang('To (Time)'); ?></th>
<th><?php echo lang('Status'); ?></th>
</tr>
</thead>
<tbody>
<?php if(isset($AvailableSchedule)){ ?>
<?php foreach ($AvailableSchedule as $as) { ?>
<?php
if($as->status=='1'){
$status='Created';
$style='style="color: #4ac344;"';
}else{
$status='Removed';
$style='style="color: #de2066;"';
} ?>
<tr>
<td><?php echo date("Y/m/d",strtotime($as->start)); ?></td>
<td><?php echo date("g:i A",strtotime($as->start)); ?></td>
<td><?php echo date("g:i A",strtotime($as->end)); ?></td>
<td <?php echo $style; ?>><?php echo $status; ?></td>
</tr>
<?php } ?>
<?php }else{ ?>
<tr><td colspan="4">No schedule</td></tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--- second modal ---->
<a href="#" class="modal2 tooltip" data-toggle="modal" data-target="#exampleModal2">
<span class="tooltiptext">Patient SCHEDULE</span>
<i class="la la-calendar-o"></i>
</a><br>
<div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog2 modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="la la-angle-right"></i></span>
</button>
<h5 class="modal-title" id="exampleModalLabel">Patient Schedule</h5>
</div>
<div class="modal-body">
<div id="patient-Schedule">
<table class="table table-striped table-bordered dom-jQuery-events" cellspacing="0" width="100%">
<thead>
<tr>
<th><?php echo lang('Date'); ?></th>
<th><?php echo lang('From (Time)'); ?></th>
<th><?php echo lang('To (Time)'); ?></th>
<th><?php echo lang('Patient Name'); ?></th>
<th><?php echo lang('Status'); ?></th>
</tr>
</thead>
<tbody>
<?php if(isset($patientSchedule)){ ?>
<?php foreach ($patientSchedule as $ps) { ?>
<tr>
<td><?php echo date("Y/m/d",strtotime($ps->start)); ?></td>
<td><?php echo date("g:i A",strtotime($ps->start)); ?></td>
<td><?php echo date("g:i A",strtotime($ps->end)); ?></td>
<td><?php echo $ps->first_name.' '.$ps->last_name; ?></td>
<?php
if($ps->acceptance_status=='Unconfirmed'){
$style='style="color: #de2066;"';
}else if($ps->acceptance_status=='Accepted'){
$style='style="color: #4ac344;"';
}else if($ps->acceptance_status=='Declined'){
$style='style="color: #de2066;"';
}else if($ps->acceptance_status=='Reported'){
$style='style="color: #bb6e06;"';
}
?>
<td <?php echo $style; ?> ><?php echo $ps->acceptance_status; ?></td>
</tr>
<?php } ?>
<?php }else{ ?>
<tr><td colspan="4">No schedule</td></tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--- third modal ---->
<a href="#" class="modal3 tooltip" data-toggle="modal" data-target="#exampleModal3">
<span class="tooltiptext">PREVIOUS SCHEDULE</span>
<i class="la la-calendar-o"></i><br>
</a>
<div class="modal fade" id="exampleModal3" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog2 modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="la la-angle-right"></i></span>
</button>
<h5 class="modal-title" id="exampleModalLabel">Previous Schedule of <?php echo $caregiver->fname.' '.$caregiver->lname; ?></h5>
</div>
<div class="modal-body">
<div id="Caregiver-Schedule2">
<table class="table table-striped table-bordered dom-jQuery-events" cellspacing="0" width="100%">
<thead>
<tr>
<th><?php echo lang('Date'); ?></th>
<th><?php echo lang('From (Time)'); ?></th>
<th><?php echo lang('To (Time)'); ?></th>
<th><?php echo lang('Patient Name'); ?></th>
<th><?php echo lang('Status'); ?></th>
</tr>
</thead>
<tbody>
<?php if(isset($previousSchedule)){ ?>
<?php foreach ($previousSchedule as $ps) { ?>
<?php
if($ps->acceptance_status=='Reported'){
$status='Done';
$style='style="color: #bb6e06;"';
}else{
$status='Not Done';
$style='style="color: #de2066;"';
}
?>
<tr>
<td><?php echo date("Y/m/d",strtotime($ps->start)); ?></td>
<td><?php echo date("g:i A",strtotime($ps->start)); ?></td>
<td><?php echo date("g:i A",strtotime($ps->end)); ?></td>
<td><?php echo $ps->first_name.' '.$ps->last_name; ?></td>
<td <?php echo $style; ?> ><?php echo $status; ?></td>
</tr>
<?php } ?>
<?php }else{ ?>
<tr><td colspan="4">No schedule</td></tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- Add Availability Modal -->
<div class="modal fade" id="addAvailability" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-lg modal-dialog-centered" role="document">
<div class="modal-content">
<form action="<?php echo base_url(); ?>caregivers/saveAvailability" use="saveAvailabilityData" method="post">
<input type="hidden" name="caregiver_id" id="caregiver_id" value="">
<input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Add Availability</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<div class="row">
<div class="form-group col-6">
<label for="exampleInputEmail1" class="required-field"><?php echo lang('Caregiver Name'); ?></label>
<input type="text" class="form-control" id="caregiver_fullName" value='' readonly>
</div>
<div class="form-group col-6">
<label for="exampleInputEmail1" class="required-field"><?php echo lang('Date'); ?></label>
<input type="date" name="Sdate" id="Sdate" class="form-control" readonly>
</div>
</div>
<div class="row">
<div class="form-group col-6">
<label for="exampleInputEmail1" class="required-field"><?php echo lang('From'); ?></label>
<input type="time" name="startTime" id="startTime" class="form-control">
<div class="error alert alert-light text-danger" id="startError" style="display:none;"></div>
</div>
<div class="form-group col-6">
<label for="exampleInputEmail1" class="required-field"><?php echo lang('To'); ?></label>
<input type="time" name="endTime" id="endTime" class="form-control">
<div class="error alert alert-light text-danger" id="endError" style="display:none;"></div>
</div>
</div>
<div class="row" id="OldScheduleInfo">
</div>
<div class="row error" id="saveError"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="submit" id="SubmitsaveEvent" class="btn btn-primary" onclick="return check_conflict();">Save</button>
</div>
</form>
</div>
</div>
</div>
<input type="hidden" id="caregiver_name" value="<?php echo $caregiver->fname.' '.$caregiver->lname; ?>" >
<!-- <script src="<?php echo base_url(); ?>common/app-assets/js/scripts/extensions/fullcalendar.js" type="text/javascript"></script> -->
<script>
$(document).ready(function () {
//alert('1');
//$("#hambargar-menu").hide();
var caregiverId=<?php echo $caregiver->id; ?>;
var today=new Date();
var calendar1=$('#calendar-view').fullCalendar({
header: {
//left: 'prev,next',
center: 'title',
//right: 'month,agendaWeek,agendaDay'
},
defaultView:"month",
allDaySlot: false,
editable: false,
selectable: true,
droppable: false, // this allows things to be dropped onto the calendar
defaultDate: today,
dayNamesShort: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
select: function(info,start) {
var today=info.format('YYYY-MM-DD');
$("#caregiver-calendar").fullCalendar('changeView', 'agendaWeek')
$("#caregiver-calendar").fullCalendar('gotoDate', today);
}
// events: {
// url: '../home/getSchedule/',
// data: {caregiverId : caregiverId},
// error: function() {
// alert('error');
// }
// },
});
var calendar=$('#caregiver-calendar').fullCalendar({
header: {
left: 'prev,next',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView:"agendaWeek",
allDaySlot: false,
editable: false,
selectable: true,
droppable: false, // this allows things to be dropped onto the calendar
defaultDate: today,
columnHeaderFormat: 'D - ddd',
events: {
url: '../home/getSchedule/',
data: {caregiverId : caregiverId},
error: function() {
alert('error');
}
},
// columnHeaderFormat : {
// month: 'ddd', // Monday, Wednesday, etc
// week: 'ddd', // Monday 9/7
// day: 'ddd, MMM dS' // Monday 9/7
// },
select: function(info,start) {
var scheduleDate=info.format('YYYY-MM-DD');
if(start.isBefore(moment())) {
$('#caregiver-calendar').fullCalendar('unselect');
console.log('Previous date');
return false;
}else{
if(info){
loadModal(caregiverId,scheduleDate);
}else{
//loadModal(caregiverId,CaregiverName);
}
}
},
});
});
function loadModal(caregiverId,scheduleDate){
var CaregiverName=$("#caregiver_name").val();
$(".Error").html('');
$('#caregiver_fullName').val(CaregiverName);
$('#Sdate').val(scheduleDate);
$('#caregiver_id').val(caregiverId);
$("#addAvailability").modal('show');
}
function check_conflict(){
var startTime=$("#startTime").val();
var endTime=$("#endTime").val();
var caregiver_id=$("#caregiver_id").val();
//var patient_id=$("#patient_id").val();
var scheduleDate=$("#Sdate").val();
$(".error").html('');
$("#startError").hide();
$("#endError").hide();
if(startTime==""){
$("#startError").html('Please Enter From Time.').show();
return false;
}else
if(endTime==""){
$("#endError").html('Please Enter To Time.').show();
return false;
}else
if(startTime>=endTime){
$("#saveError").append('<div class="alert alert-light text-danger col-12">To Time Must be Greater Then From Time.</div>');
return false;
}else{
//alert('check');
$.get('<?php echo base_url(); ?>caregivers/CheckAvailability',
{ caregiver_id:caregiver_id, scheduleDate:scheduleDate, startTime:startTime, endTime:endTime },
function(data){
console.log(data);
//return false;
if(data!=""){
$("#saveError").append('<div class="alert alert-light text-danger col-12">'+data+'</div>');
return false;
}else{
$(".error").html('');
$("form[use=saveAvailabilityData]").submit();
return true;
}
}
);
return false;
}
// else{
// $(".error").html('');
// $("form[use=saveAvailabilityData]").submit();
// return true;
// }
//var switchwith=$("input[type='radio'][name='switch_with']:checked").val();
//alert(switchwith);
//if(switchwith==""){
// }else{
// $(".error").html('');
// $("form[use=saveScheduleData]").submit();
// }
return false;
}
</script>
<script>
$("document").ready(function(){
//$(function(){
$("#hambargar-menu").trigger("click");
//alert('load');
});
</script>
<!--main content end-->
<!--footer start-->