1002 lines
58 KiB
PHP
Executable File
1002 lines
58 KiB
PHP
Executable File
<!--sidebar end-->
|
|
<!--main content start-->
|
|
<?php
|
|
if($this->session->flashdata('feedback_greeting_by_system_user')){
|
|
?>
|
|
<script>
|
|
Swal.fire({
|
|
position: 'center',
|
|
icon: 'success',
|
|
title: '<?php echo $this->session->flashdata('feedback_greeting_by_system_user'); ?>',
|
|
showConfirmButton: false,
|
|
timer: 3500
|
|
})
|
|
</script>
|
|
<?php
|
|
unset($_SESSION['feedback_greeting_by_system_user']);
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
$dayArr=array();
|
|
$dayTimeArr=array();
|
|
foreach($master_schdule as $schedule){
|
|
$dayArr[$schedule->week_day][]=$schedule->id;
|
|
$dayTimeArr[$schedule->week_day][]=$schedule->from_time.' - '.$schedule->to_time;
|
|
}
|
|
$progressData = json_decode($nurse->from_tab_status_pctg);
|
|
$progress = $progressData->form1+$progressData->form2+$progressData->form3+$progressData->form4+$progressData->form5+$progressData->form6+$progressData->form7+$progressData->form8+$progressData->form9+$progressData->form10+$progressData->form11;
|
|
?>
|
|
<style type="text/css">
|
|
.selectedTD{background-color: skyblue !important;cursor: pointer !important;}
|
|
.onboard-img{height:300px;width:300px;}
|
|
@media(max-width:500px){.onboard-img{height:200px;width:200px;}}
|
|
</style>
|
|
|
|
<?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
|
|
unset($_SESSION['feedback_error']);
|
|
}
|
|
?>
|
|
|
|
<?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
|
|
unset($_SESSION['feedback_success']);
|
|
}
|
|
?>
|
|
|
|
<div class="app-content content">
|
|
<div class="content-wrapper">
|
|
<div class="content-body">
|
|
<section id="block-examples">
|
|
<?php
|
|
if($nurse->submited_for_verification=='yes' && $nurse->verification_status=='verified'){
|
|
?>
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12">
|
|
<div class="card">
|
|
<div class="card-header p-1 bg-gradient-y-light">
|
|
<h3>
|
|
<span class="font-weight-bold">
|
|
<i class="fa fa-file-pdf-o text-info" aria-hidden="true"></i> 
|
|
Adverse Incident Addendum
|
|
</span>
|
|
<a class="pull-right pointer" href="<?php echo base_url();?>CaregiversDashboard/createAddendumPdfFile?id=<?php echo $nurse->id;?>">
|
|
<i class="fa fa-cloud-download text-info" aria-hidden="true"></i>
|
|
download
|
|
<!-- <i class="fa fa-download text-info" aria-hidden="true"></i> -->
|
|
</a>
|
|
</h3>
|
|
</div>
|
|
<!-- <div class="card-body">
|
|
<div class="row mb-0">
|
|
<div class="col-md-12">
|
|
</div>
|
|
<div class="col-md-12">
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12">
|
|
<div class="card">
|
|
<div class="card-header bg-gradient-y-info">
|
|
<h2 class="text-center p-1">
|
|
<span class="font-weight-bold text-white">
|
|
<?php
|
|
if($nurse->submited_for_verification=='yes' && $nurse->verification_status=='verified'){
|
|
echo "Schedule Panel";
|
|
}else{
|
|
echo "Notice Panel";
|
|
}
|
|
?>
|
|
|
|
</span>
|
|
</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row mb-0">
|
|
<div class="col-md-12">
|
|
<?php
|
|
if($nurse->submited_for_verification=='no'){
|
|
if($progress>99){
|
|
$progress=100;
|
|
}
|
|
?>
|
|
<div class="col-md-12 card">
|
|
<label class="progres_bar"> Progress (<?php echo $progress; ?>%)</label>
|
|
<div class="progress">
|
|
<div class="progress-bar" role="progressbar" style="width: <?php echo $progress; ?>%;" aria-valuenow="<?php echo $progress; ?>" aria-valuemin="0" aria-valuemax="100">
|
|
<?php echo $progress;?>%
|
|
</div>
|
|
</div>
|
|
<?php
|
|
if($progress<100){
|
|
?>
|
|
<span class="text-center text-danger custm_de">Please complete your profile.</span>
|
|
<?php
|
|
}
|
|
else if($nurse->rejection_reason!=""){
|
|
?>
|
|
<span class="text-center text-danger custm_de">Rejected For: <?php echo $nurse->rejection_reason; ?></span>
|
|
<span class="text-center text-danger custm_de">Check and update profile.</span>
|
|
<?php
|
|
}
|
|
else{
|
|
?>
|
|
<span class="text-center text-danger custm_de">Go to profile and click send for approval.</span>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
<?php
|
|
}
|
|
if($nurse->verification_status=='docverified'){
|
|
?>
|
|
<div class="col-md-12 card py-3">
|
|
<?php
|
|
if($onboardQuiz['status']==0){
|
|
if($onboardQuiz['token']==""){
|
|
?>
|
|
<h1 class="text-center">Your Documents are verified</h1>
|
|
<h2 class="text-center text-danger custm_de py-0">Please wait for Onboarding Link</h2>
|
|
<div class="center">
|
|
<i class="fa fa-hand-o-right mx-1"></i>
|
|
<span class="text-center text-info">Contact to Admin for further Details</span>
|
|
</div>
|
|
<?php
|
|
}
|
|
else{
|
|
?>
|
|
<div class="center">
|
|
<!-- <img src="<?=base_url();?>common/img/onboard.png" class="onboard-img" alt="incomplete onboarding process" title="incomplete onboarding process"> -->
|
|
</div>
|
|
<h1 class="text-center">Incomplete Onboarding Process</h1>
|
|
<div class="center"><small>Click the button below to complete the onboarding process</small></div>
|
|
<div class="m-auto py-2 center">
|
|
<i class="fa fa-2x fa-hand-o-right mx-1"></i>
|
|
<a class="btn btn-lg btn-danger" href="<?php echo base_url()."onboarding/process/".$onboardQuiz['token'];?>"
|
|
target="_blank">
|
|
Click to contiune
|
|
</a>
|
|
</div>
|
|
<?php
|
|
}
|
|
}
|
|
else{
|
|
?>
|
|
<span class="text-center text-danger custm_de">Wait for onboarding Verification.</span>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
<!-- <div class="form-check col-md-12" style="text-align: center;">
|
|
<a target="_blank" class="btn btn-success btn_clr" href="<?php echo base_url(); ?>CaregiversDashboard/formPrint/<?= $nurse->id ?>">Print Submitted Form</a>
|
|
</div> -->
|
|
<?php
|
|
}
|
|
if($nurse->verification_status=='unverified' && $nurse->submited_for_verification=='yes'){
|
|
?>
|
|
<div class="col-md-12 card py-3">
|
|
<div class="center"></div>
|
|
<h1 class="text-center text-danger custm_de py-0">Please Wait For Document Verification</h1>
|
|
<h2 class="text-center">OR</h2>
|
|
<div class="center py-1">
|
|
<i class="fa fa-hand-o-right mx-1"></i>
|
|
<span class="text-center text-info">Contact to Admin for further Details</span>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="col-md-12">
|
|
<?php
|
|
if($nurse->submited_for_verification=='yes' && $nurse->verification_status=='verified'){
|
|
?>
|
|
<div class="state-overview col-md-12">
|
|
<div class="clearfix card">
|
|
<div class="col-12">
|
|
<div class="row ">
|
|
<div class="col-11">
|
|
<div id='caregiver-calendar' class="rght_calndr mt_20"></div>
|
|
</div>
|
|
<div class="col-md-1">
|
|
<div class="align-items-center mt_20">
|
|
<!--- first modal ---->
|
|
<a href="#" class="modal1 tooltip" data-toggle="modal" data-target="#exampleModal">
|
|
<span class="tooltiptext">Upcoming 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">Upcoming 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('Status'); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($upcomming_schedules as $us) { ?>
|
|
<tr>
|
|
<td><?php echo date("Y/m/d",strtotime($us->start)); ?></td>
|
|
<td><?php echo date("g:i A",strtotime($us->start)); ?></td>
|
|
<td><?php echo date("g:i A",strtotime($us->end)); ?></td>
|
|
<?php
|
|
if($us->acceptance_status=='Unconfirmed'){
|
|
$style='style="color: #de2066;"';
|
|
}else if($us->acceptance_status=='Accepted'){
|
|
$style='style="color: #4ac344;"';
|
|
}else if($us->acceptance_status=='Declined'){
|
|
$style='style="color: #de2066;"';
|
|
}else if($us->acceptance_status=='Reported'){
|
|
$style='style="color: #bb6e06;"';
|
|
}
|
|
?>
|
|
<td <?php echo $style; ?> ><?php echo $us->acceptance_status; ?></td>
|
|
</tr>
|
|
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--- first modal ---->
|
|
|
|
<!--- second modal ---->
|
|
<a href="#" class="modal2 tooltip" data-toggle="modal" data-target="#exampleModal2">
|
|
<span class="tooltiptext">Previous 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">Previous 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('Status'); ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php
|
|
foreach ($previuos_schedules 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>
|
|
<?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
|
|
}
|
|
?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--- second modal ---->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</div>
|
|
</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(); ?>CaregiversSchedule/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" onclick="modalClose()" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</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='<?php echo $nurse->fname.' '.$nurse->lname; ?>' 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 class="form-group col-6">
|
|
<label for="exampleInputEmail1" class="required-field"><?php echo lang('Preference Time'); ?></label>
|
|
<input type="text" class="form-control" value="<?php echo $nurse->preferred_time; ?> " readonly>
|
|
</div> -->
|
|
</div>
|
|
<div class="row" id="timediv">
|
|
<div class="form-group col-6">
|
|
<label for="exampleInputEmail1" class="required-field"><?php echo lang('From'); ?></label>
|
|
<input type="time" name="startTime" id="startTime" value="<?php echo $nurse->preferred_start; ?>" 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" value="<?php echo $nurse->preferred_end; ?>" 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 class="row error" id="showmsg"></div>
|
|
<p id="test"></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" onclick="modalClose()" 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 $nurse->fname.' '.$nurse->lname; ?>">
|
|
<input type="hidden" id="caregiver_day" value="">
|
|
<!-- Add Availability Modal Ending here -->
|
|
|
|
<!-- patient handling modal -->
|
|
<div class="modal fade" id="infoSchedule" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
|
|
<div class="modal-dialog modal-sm modal-dialog-centered" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="exampleModalLongTitle">Schedule Details</h5>
|
|
<button type="button" class="close" onclick="modalClose()" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col-12 insert-html">
|
|
<input type="hidden" class="caregiver-id" value="">
|
|
<input type="hidden" class="patient-id" value="">
|
|
<input type="hidden" class="schedule-id" value="">
|
|
<div class="row">
|
|
<div class="form-group col-12">
|
|
<div class="w-100 center">
|
|
<img src="https://openclipart.org/image/800px/216807" style="height:100px;width:100px;">
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-12">
|
|
<h4 class="text-center" style="font-weight: bold;">Naran Saha</h4>
|
|
</div>
|
|
</div>
|
|
<!-- <div class="row">
|
|
<div class="form-group col-12">
|
|
<h4 class="text-center text-info">Schedule Start : 10:00 AM</h4>
|
|
</div>
|
|
<div class="form-group col-12">
|
|
<h4 class="text-center text-info">Schedule End : 10:00 PM</h4>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-12">
|
|
<h4 class="text-center">......................................</h4>
|
|
</div>
|
|
<div class="form-group col-12">
|
|
<h4 class="text-center text-info">Clocked In : 10:00 PM</h4>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group col-12">
|
|
<h4 class="text-center text-info">Clocked Out : 10:00 PM</h4>
|
|
</div>
|
|
</div> -->
|
|
<!-- <div class="row pt-2">
|
|
<div class="form-group col-5">
|
|
<button class="btn btn-lg btn-danger decline-button pull-right">Decline</button>
|
|
</div>
|
|
<div class="form-group col-2 center">
|
|
<span class="text-info">OR</span>
|
|
</div>
|
|
<div class="form-group col-5">
|
|
<button class="btn btn-lg btn-info accept-button">Accept</button>
|
|
</div>
|
|
<div class="form-group col-12 decline-reason-container pt-2">
|
|
<div class="row">
|
|
<div class="form-group col-10 center rejection-reason-container">
|
|
<textarea class="rejection-reason" style="height:100px;width:90%;" placeholder="Write here the reason"></textarea>
|
|
</div>
|
|
<div class="form-group col-2 center">
|
|
<button class="btn btn-lg btn-info decline-save-button">Save</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div> -->
|
|
|
|
<div class="row pt-2">
|
|
<div class="form-group col-12 center">
|
|
<button class="btn btn-success pull-right clock-in-button">Clock In</button>
|
|
</div>
|
|
</div>
|
|
<div class="row pt-2">
|
|
<div class="form-group col-6">
|
|
<button class="btn btn-danger pull-right clock-out-button">Clock Out</button>
|
|
</div>
|
|
<div class="form-group col-6">
|
|
<button class="btn btn-warning report-button">Report</button>
|
|
</div>
|
|
</div>
|
|
<div class="row pt-2">
|
|
<div class="form-group col-12 center">
|
|
<!-- <button class="btn btn-warning report-button">Report</button> -->
|
|
<a type="button" href="<?php echo base_url();?>assessment?id=62&scheduleId=109" class="btn btn-danger">Report</a>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- <div class="row pt-2">
|
|
<div class="form-group col-4 center">
|
|
<button class="btn btn-success pull-right">Clock In</button>
|
|
</div>
|
|
<div class="form-group col-4 center">
|
|
<button class="btn btn-warning">Report</button>
|
|
</div>
|
|
<div class="form-group col-4 center">
|
|
<button class="btn btn-danger">Clock Out</button>
|
|
</div>
|
|
</div> -->
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" onclick="modalClose()" data-dismiss="modal">Close</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- patient handling modal -->
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <script>
|
|
$(document).ready(function () {
|
|
$('#Patient-DataTable').DataTable();
|
|
var calendar=$('#caregiver-calendar').fullCalendar({
|
|
// header: {
|
|
// left: 'prev,next today',
|
|
// center: 'title',
|
|
// right: 'month,agendaWeek,agendaDay'
|
|
// },
|
|
allDaySlot: false,
|
|
defaultView:"agendaWeek",
|
|
columnHeaderFormat: 'D - ddd',
|
|
editable: false,
|
|
droppable: false, // this allows things to be dropped onto the calendar
|
|
defaultDate: new Date(),
|
|
//defaultView: 'agendaWeek',
|
|
slotDuration: '01:00',
|
|
defaultTimedEventDuration: '00:60:00',
|
|
forceEventDuration: true,
|
|
eventOverlap: false,
|
|
// events: {
|
|
// url: '<?php echo base_url()?>CaregiversDashboard/caregiverEventDetails/',
|
|
// data: {id : <?php echo $nurse->id; ?>},
|
|
// error: function() {
|
|
// alert('error');
|
|
// }
|
|
// },
|
|
events: {
|
|
url: '<?php echo base_url()?>home/getSchedule/',
|
|
data: {caregiverId : <?php echo $nurse->id; ?>},
|
|
error: function() {
|
|
alert('error');
|
|
}
|
|
}
|
|
|
|
});
|
|
});
|
|
</script> -->
|
|
<!--main content end-->
|
|
<!--footer start-->
|
|
|
|
|
|
|
|
|
|
<script>
|
|
function modalClose(){
|
|
$("#showmsg").text('');
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
var caregiverId=<?php echo $nurse->id;?>;
|
|
var today=new Date();
|
|
var calendar=$('#caregiver-calendar').fullCalendar({
|
|
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: '<?php echo base_url(); ?>home/getSchedule/',
|
|
data: {caregiverId : caregiverId},
|
|
error: function() {
|
|
alert('error');
|
|
}
|
|
},
|
|
eventClick: function(event) {
|
|
console.log(event);
|
|
// if(confirm("Are you sure you want to delete schedule?")){
|
|
// deleteSchedule(event.id,event.patientId,event.caregiverId);
|
|
// }
|
|
getScheduledetails(event.caregiverId,event.patientId,event.id);
|
|
|
|
},
|
|
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);
|
|
}
|
|
}
|
|
},
|
|
});
|
|
});
|
|
|
|
function loadModal(caregiverId,scheduleDate)
|
|
{
|
|
var CaregiverName=$("#caregiver_name").val();
|
|
$(".Error").html('');
|
|
$('#caregiver_fullName').val(CaregiverName);
|
|
$('#Sdate').val(scheduleDate);
|
|
$('#caregiver_id').val(caregiverId);
|
|
var newDay=[];
|
|
var newAllDay=[];
|
|
$.ajax({ //create an ajax request to display.php
|
|
type: "GET",
|
|
url: "<?php echo base_url(); ?>CaregiversSchedule/getPreferenceDay",
|
|
dataType: 'json',
|
|
data: {
|
|
caregiver_id: caregiverId,
|
|
},
|
|
success: function(data){
|
|
// console.log(data[0]) ;
|
|
for(var i=0; i< data.length; i++){
|
|
// newDay.push( data[i].day);
|
|
|
|
if(data[i].day == 1){
|
|
newAllDay.push("everyday");
|
|
}else if(data[i].day == 2){
|
|
newDay.push("Sun");
|
|
}else if(data[i].day == 3){
|
|
newDay.push("Mon");
|
|
}else if(data[i].day == 4){
|
|
newDay.push("Tues");
|
|
}else if(data[i].day == 5){
|
|
newDay.push("Wed");
|
|
}else if(data[i].day == 6){
|
|
newDay.push("Thu");
|
|
}else if(data[i].day == 7){
|
|
newDay.push("Fri");
|
|
}else if(data[i].day == 8){
|
|
newDay.push("Sat");
|
|
}
|
|
}
|
|
|
|
$('#caregiver_day').val(JSON.stringify( newDay));
|
|
const dateStr = scheduleDate,
|
|
getWeekday = s => {
|
|
const [yyyy, mm, dd] = s.split('-'),
|
|
date = new Date(yyyy, mm-1, dd)
|
|
return date.toLocaleDateString('en-US', {weekday: 'short'})
|
|
}
|
|
var dayName = getWeekday(dateStr);
|
|
if(dayName == "Sun"){
|
|
var day = 2;
|
|
}else if(dayName == "Mon"){
|
|
var day = 3;
|
|
}else if(dayName == "Tues"){
|
|
var day = 4;
|
|
}else if(dayName == "Wed"){
|
|
var day = 5;
|
|
}else if(dayName == "Thu"){
|
|
var day = 6;
|
|
}else if(dayName == "Fri"){
|
|
var day = 7;
|
|
}else if(dayName == "Sat"){
|
|
var day = 8;
|
|
}
|
|
|
|
if( ($.inArray(dayName, newDay) !== -1) || (newAllDay.length != 0) ) {
|
|
|
|
if(newAllDay.length != 0){
|
|
|
|
var allday = 1;
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "<?php echo base_url(); ?>CaregiversSchedule/getCaregiverPreferenceDate",
|
|
dataType: 'json',
|
|
data: {
|
|
caregiver_id: caregiverId,
|
|
day: allday,
|
|
},
|
|
success: function(data){
|
|
if(data.time){
|
|
let array = (data.time).split(",");
|
|
$("#startTime").val(array[0]);
|
|
$("#endTime").val(array[1]);
|
|
console.log(array);
|
|
}else if(data.session){
|
|
var name = data.name;
|
|
var from_time = "";
|
|
var to_time = "";
|
|
var parts = (data.name).split(" ");
|
|
console.log(parts);
|
|
if(parts.length > 1) {
|
|
var lastname = parts.pop();
|
|
}
|
|
else
|
|
{
|
|
var lastname = " ";
|
|
}
|
|
var time= lastname.split("-");
|
|
from_time = time[0];
|
|
to_time = time[1];
|
|
var hours = parseInt(from_time.substr(0, 2));
|
|
if(from_time.indexOf('am') != -1 && hours == 12) {
|
|
from_time = from_time.replace('12', '00'+':00');
|
|
}
|
|
if(from_time.indexOf('pm') != -1 && hours < 12) {
|
|
from_time = from_time.replace(hours, (hours + 12)+':00');
|
|
}
|
|
if(from_time.indexOf('pm') != -1 && hours == 12) {
|
|
from_time = from_time.replace('12', '12'+':00');
|
|
}
|
|
|
|
var to_time_hours = parseInt(to_time.substr(0, 2));
|
|
if(to_time.indexOf('am') != -1 && to_time_hours == 12) {
|
|
to_time = to_time.replace('12', '00'+':00');
|
|
}
|
|
if(to_time.indexOf('pm') != -1 && to_time_hours < 12) {
|
|
to_time = to_time.replace(to_time_hours, (to_time_hours + 12)+':00');
|
|
}
|
|
if(to_time.indexOf('pm') != -1 && to_time_hours == 12) {
|
|
to_time = to_time.replace('12', '12'+':00');
|
|
}
|
|
// return to_time.replace(/(am|pm)/, '');
|
|
$("#startTime").val(from_time.replace(/(am|pm)/, ''));
|
|
$("#endTime").val(to_time.replace(/(am|pm)/, ''));
|
|
}
|
|
}
|
|
})
|
|
}else{
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "<?php echo base_url(); ?>CaregiversSchedule/getCaregiverPreferenceDate",
|
|
dataType: 'json',
|
|
data: {
|
|
caregiver_id: caregiverId,
|
|
day: day,
|
|
},
|
|
success: function(data){
|
|
if(data.time){
|
|
let array = (data.time).split(",");
|
|
$("#startTime").val(array[0]);
|
|
$("#endTime").val(array[1]);
|
|
console.log(array);
|
|
}else if(data.session){
|
|
|
|
var name = data.name;
|
|
var from_time = "";
|
|
var to_time = "";
|
|
var parts = (data.name).split(" ");
|
|
console.log(parts);
|
|
if(parts.length > 1) {
|
|
var lastname = parts.pop();
|
|
}
|
|
else
|
|
{
|
|
var lastname = " ";
|
|
}
|
|
var time= lastname.split("-");
|
|
from_time = time[0];
|
|
to_time = time[1];
|
|
var hours = parseInt(from_time.substr(0, 2));
|
|
if(from_time.indexOf('am') != -1 && hours == 12) {
|
|
from_time = from_time.replace('12', '00'+':00');
|
|
}
|
|
if(from_time.indexOf('pm') != -1 && hours < 12) {
|
|
from_time = from_time.replace(hours, (hours + 12)+':00');
|
|
}
|
|
if(from_time.indexOf('pm') != -1 && hours == 12) {
|
|
from_time = from_time.replace('12', '12'+':00');
|
|
}
|
|
|
|
var to_time_hours = parseInt(to_time.substr(0, 2));
|
|
if(to_time.indexOf('am') != -1 && to_time_hours == 12) {
|
|
to_time = to_time.replace('12', '00'+':00');
|
|
}
|
|
if(to_time.indexOf('pm') != -1 && to_time_hours < 12) {
|
|
to_time = to_time.replace(to_time_hours, (to_time_hours + 12)+':00');
|
|
}
|
|
if(to_time.indexOf('pm') != -1 && to_time_hours == 12) {
|
|
to_time = to_time.replace('12', '12'+':00');
|
|
}
|
|
// return to_time.replace(/(am|pm)/, '');
|
|
$("#startTime").val(from_time.replace(/(am|pm)/, ''));
|
|
$("#endTime").val(to_time.replace(/(am|pm)/, ''));
|
|
|
|
}
|
|
}
|
|
})
|
|
|
|
}
|
|
$("#timediv").show();
|
|
$("#SubmitsaveEvent").show();
|
|
$("#showmsg").hide();
|
|
}else{
|
|
// alert("not found");
|
|
$("#timediv").hide();
|
|
$("#SubmitsaveEvent").hide();
|
|
$("#showmsg").append('<div class="alert alert-light text-danger col-12">Caregiver Not Available.</div>');
|
|
}
|
|
},
|
|
error: function(data){
|
|
// $("#test").html("ajax error");
|
|
}
|
|
});
|
|
$("#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{
|
|
$.get('<?php echo base_url(); ?>CaregiversSchedule/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;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function getScheduledetails(cg_id,pt_id,sch_id){
|
|
$.ajax({
|
|
url:"<?php echo base_url();?>CaregiversDashboard/getScheduleDetailsByScheduleId",
|
|
type:"GET",
|
|
data:{cg_id:cg_id,pt_id:pt_id,sch_id:sch_id},
|
|
// dataType:"JSON",
|
|
success:function(data){
|
|
// alert(data.title);
|
|
// $(".caregiver-id").val(cg_id);
|
|
// $(".patient-id").val(pt_id);
|
|
// $(".schedule-id").val(sch_id);
|
|
|
|
$(".insert-html").html(data);
|
|
$(".decline-reason-container").hide();
|
|
$("#infoSchedule").modal('show');
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<!-- for accept or declination -->
|
|
<script type="text/javascript">
|
|
$(document).on('click','.decline-button',function(){
|
|
var target_parent=$(this).parent().siblings('.decline-reason-container');
|
|
target_parent.toggle("slow");
|
|
});
|
|
$(document).on('click','.accept-button',function(){
|
|
var acceptance_status="Accepted";
|
|
var rejection_reason="";
|
|
var sch_id=$(this).parent().parent().siblings(".schedule-id").val();
|
|
ajaxLoadForAcceptanceUpdate(acceptance_status,rejection_reason,sch_id);
|
|
});
|
|
$(document).on('click','.decline-save-button',function(){
|
|
var acceptance_status="Declined";
|
|
var rejection_reason=$(this).parent().siblings(".rejection-reason-container").children(".rejection-reason").val();
|
|
var sch_id=$(this).parent().parent().parent().parent().siblings(".schedule-id").val();
|
|
if(rejection_reason==""){
|
|
alert("Please Provide a reason");
|
|
}else{
|
|
ajaxLoadForAcceptanceUpdate(acceptance_status,rejection_reason,sch_id);
|
|
}
|
|
});
|
|
function ajaxLoadForAcceptanceUpdate(acceptance_status,rejection_reason,sch_id){
|
|
$.ajax({
|
|
url:"<?php echo base_url();?>CaregiversDashboard/updateAcceptanceFromDasboard",
|
|
type:"GET",
|
|
data:{acceptance_status:acceptance_status, rejection_reason:rejection_reason, sch_id:sch_id},
|
|
success:function(data){
|
|
// alert(data);
|
|
Swal.fire({
|
|
position: 'center',
|
|
icon: 'success',
|
|
title: 'You have '+acceptance_status+' the schedule',
|
|
showConfirmButton: false,
|
|
timer: 3500
|
|
});
|
|
$("#infoSchedule").modal('hide');
|
|
location.reload();
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<!-- for accept or declination -->
|
|
|
|
<!-- for clock in & out -->
|
|
<script type="text/javascript">
|
|
$(document).on('click','.clock-in-button',function(){
|
|
var cg_id=$(this).parent().parent().siblings(".caregiver-id").val();
|
|
var pt_id=$(this).parent().parent().siblings(".patient-id").val();
|
|
var sch_id=$(this).parent().parent().siblings(".schedule-id").val();
|
|
$.ajax({
|
|
url:"<?php echo base_url();?>assessment/ajax_clock_in",
|
|
type:"GET",
|
|
data:{cg_id:cg_id,pt_id:pt_id,sch_id:sch_id},
|
|
success:function(data){
|
|
// alert(data);
|
|
Swal.fire({
|
|
position: 'center',
|
|
icon: 'success',
|
|
title: 'You have Clocked In successfully',
|
|
showConfirmButton: false,
|
|
timer: 3500
|
|
});
|
|
$("#infoSchedule").modal('hide');
|
|
location.reload();
|
|
}
|
|
});
|
|
});
|
|
$(document).on('click','.clock-out-button',function(){
|
|
var sch_id=$(this).parent().parent().siblings(".schedule-id").val();
|
|
$.ajax({
|
|
url:"<?php echo base_url();?>assessment/ajax_clock_out",
|
|
type:"GET",
|
|
data:{sch_id:sch_id},
|
|
success:function(data){
|
|
// alert(data);
|
|
Swal.fire({
|
|
position: 'center',
|
|
icon: 'success',
|
|
title: 'You have Clocked Out successfully',
|
|
showConfirmButton: false,
|
|
timer: 3500
|
|
});
|
|
$("#infoSchedule").modal('hide');
|
|
location.reload();
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
<!-- for clock in & out -->
|
|
|
|
|
|
|
|
|