424 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			424 lines
		
	
	
		
			22 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
<!--sidebar end-->
 | 
						|
<!--main content start-->
 | 
						|
<?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;
 | 
						|
    }
 | 
						|
?>
 | 
						|
<style type="text/css">
 | 
						|
    .selectedTD{
 | 
						|
        background-color: skyblue !important;
 | 
						|
        cursor: pointer !important;
 | 
						|
    }
 | 
						|
    .clock_hide{display:none;}
 | 
						|
    .txt-white{color: white}
 | 
						|
</style>
 | 
						|
 | 
						|
 | 
						|
<div class="app-content content">
 | 
						|
    <section class="content-wrapper">
 | 
						|
        <div class="row">
 | 
						|
            <div class="col-12">
 | 
						|
                <div class="">
 | 
						|
                    
 | 
						|
                    <div class="col-12 ">
 | 
						|
                        <?php if($nurse->submited_for_verification=='yes' && $nurse->verification_status=='verified'){ ?>
 | 
						|
                        <div class="state-overview col-md-12" >
 | 
						|
                            <div class="clearfix">
 | 
						|
                                <div class="col-md-12 table-responsive card">
 | 
						|
                                    <div class="card-header">
 | 
						|
                                        <div class="row">
 | 
						|
                                            <div class="col-md-6">
 | 
						|
                                                <h3 class="font-weight-bold"><?php echo $page_title; ?></h3>
 | 
						|
                                            </div>
 | 
						|
                                        </div>
 | 
						|
                                    </div>
 | 
						|
                                    <table class="table table-striped table-hover table-bordered" id="schedule-DataTable">
 | 
						|
                                        <thead>
 | 
						|
                                            <tr>
 | 
						|
                                                <th><?php echo lang('Date'); ?></th>
 | 
						|
                                                <th><?php echo lang('name'); ?></th>
 | 
						|
                                                <th><?php echo lang('Start'); ?></th>
 | 
						|
                                                <th><?php echo lang('End'); ?></th>
 | 
						|
                                                <th><?php echo lang('Clock In'); ?></th>
 | 
						|
                                                <th><?php echo lang('Clock Out'); ?></th>
 | 
						|
                                                <th><?php echo lang('Status'); ?></th>
 | 
						|
                                                <th><?php echo lang('Actions'); ?></th>
 | 
						|
                                            </tr>
 | 
						|
                                        </thead>
 | 
						|
                                        <tbody>
 | 
						|
                                            <?php foreach($cgSchedule as $p){?>
 | 
						|
                                            <tr>
 | 
						|
                                                <td><?php echo  date("m/d/Y",strtotime($p->start)); ?></td>
 | 
						|
                                                <td>
 | 
						|
                                                    <?php echo $p->first_name.' '.$p->last_name; ?><br>
 | 
						|
                                                    <?php //echo date("m/d/Y, H:i:s"); ?><br>
 | 
						|
                                                    <?php //echo gmdate("Y-m-d 00:00:00"); ?><br>
 | 
						|
                                                    
 | 
						|
                                                </td>
 | 
						|
                                                <td><?php echo date("g:i A",strtotime($p->start)); ?></td>
 | 
						|
                                                <td><?php echo date("g:i A",strtotime($p->end)); ?></td>
 | 
						|
                                                <td>
 | 
						|
                                                    <?php
 | 
						|
                                                    foreach($clockInOut_info as $clock)
 | 
						|
                                                    {
 | 
						|
                                                        if($clock->schedule_id==$p->scheduleId)
 | 
						|
                                                        {
 | 
						|
                                                            if($clock->clock_in_time!=null)
 | 
						|
                                                            {
 | 
						|
                                                                ?>
 | 
						|
                                                                <span class="clock-time"><?php echo $clock->clock_in_time;?></span>
 | 
						|
                                                                <?php
 | 
						|
                                                            }
 | 
						|
                                                            else
 | 
						|
                                                            {
 | 
						|
                                                                echo "Not set";
 | 
						|
                                                            }
 | 
						|
                                                        }
 | 
						|
                                                    }
 | 
						|
                                                    ?>
 | 
						|
                                                </td>
 | 
						|
                                                <td>
 | 
						|
                                                    <?php
 | 
						|
                                                    foreach($clockInOut_info as $clock)
 | 
						|
                                                    {
 | 
						|
                                                        if($clock->schedule_id==$p->scheduleId)
 | 
						|
                                                        {
 | 
						|
                                                            if($clock->clock_out_time!=null)
 | 
						|
                                                            {
 | 
						|
                                                                ?>
 | 
						|
                                                                <span class="clock-time"><?php echo $clock->clock_out_time;?></span>
 | 
						|
                                                                <?php
 | 
						|
                                                            }
 | 
						|
                                                            else
 | 
						|
                                                            {
 | 
						|
                                                                echo "Not set";
 | 
						|
                                                            }
 | 
						|
                                                            
 | 
						|
                                                        }
 | 
						|
                                                    }
 | 
						|
                                                    ?>
 | 
						|
                                                </td>
 | 
						|
                                                <td><?php echo $p->acceptance_status; ?></td>
 | 
						|
                                                <td>
 | 
						|
                                                    <?php 
 | 
						|
                                                    if($p->acceptance_status == 'Reported'){ 
 | 
						|
                                                        ?>
 | 
						|
                                                        <a href="<?php echo base_url(); ?>assessment/view?id=<?=$p->patient_row_id?>&scheduleId=<?=$p->scheduleId?>" class="badge badge-success">View</a>
 | 
						|
                                                        <?php 
 | 
						|
                                                    }if($p->clock_status==0){
 | 
						|
                                                        ?>
 | 
						|
                                                        <a href="#" class="badge badge-warning clock_out" id="clock_out">
 | 
						|
                                                            <i class="fa fa-clock-o"></i>
 | 
						|
                                                            <?php echo lang("Clock Out");?>
 | 
						|
                                                            <span id="sch_id" hidden><?php echo $p->scheduleId;?></span>
 | 
						|
                                                        </a>
 | 
						|
                                                        <?php
 | 
						|
                                                    } 
 | 
						|
                                                    ?>
 | 
						|
                                                    <?php 
 | 
						|
                                                    if($p->acceptance_status == 'Unconfirmed'){ 
 | 
						|
                                                        ?>
 | 
						|
                                                        <a data-toggle="modal" href="#myModal" class="badge badge-info acceptDeline" attr_id="<?php echo $p->scheduleId; ?>">Accepted/Delined</a>
 | 
						|
                                                        <?php 
 | 
						|
                                                    } 
 | 
						|
                                                    ?>
 | 
						|
                                                    <?php 
 | 
						|
                                                    if($p->acceptance_status == 'Accepted'){ 
 | 
						|
                                                        if($p->clock_status!=""){
 | 
						|
                                                            if($p->clock_status==0){
 | 
						|
                                                                ?>
 | 
						|
                                                                <a href="#" class="badge badge-warning clock_out" id="clock_out">
 | 
						|
                                                                    <i class="fa fa-clock-o"></i>
 | 
						|
                                                                    <?php echo lang("Clock Out");?>
 | 
						|
                                                                    <span id="sch_id" hidden><?php echo $p->scheduleId;?></span>
 | 
						|
                                                                </a>
 | 
						|
                                                                <?php
 | 
						|
                                                            }if($p->clock_status==1){
 | 
						|
                                                                ?>
 | 
						|
                                                                <span class="badge badge-success">
 | 
						|
                                                                    <?php echo lang("Visit Done");?>
 | 
						|
                                                                </span>
 | 
						|
                                                                <?php
 | 
						|
                                                            }if($p->clock_status==0 || $p->clock_status==1){
 | 
						|
                                                                ?>
 | 
						|
                                                                <a href="<?php echo base_url(); ?>assessment?id=<?=$p->patient_row_id?>&scheduleId=<?=$p->scheduleId?>" class="badge badge-danger">
 | 
						|
                                                                    Report
 | 
						|
                                                                </a>
 | 
						|
                                                                <?php
 | 
						|
                                                            }
 | 
						|
                                                        }else{
 | 
						|
 | 
						|
                                                            ?>
 | 
						|
                                                            <a href="#" type="button" class="badge badge-info clock_in" id="clock_in">
 | 
						|
                                                                <i class="fa fa-clock-o"></i>
 | 
						|
                                                                <?php echo lang("Clock In");?>
 | 
						|
                                                                <span id="cg_id" hidden><?php echo $p->caregiver_id;?></span>
 | 
						|
                                                                <span id="pt_id" hidden><?php echo $p->patient_row_id;?></span>
 | 
						|
                                                                <span id="sch_id" hidden><?php echo $p->scheduleId;?></span>
 | 
						|
                                                            </a>
 | 
						|
                                                            <?php
 | 
						|
                                                        } 
 | 
						|
                                                    } 
 | 
						|
                                                    ?>
 | 
						|
                                                </td>
 | 
						|
                                            </tr>
 | 
						|
                                            <?php } ?>    
 | 
						|
                                        </tbody>    
 | 
						|
                                    </table>
 | 
						|
                                </div>
 | 
						|
                            </div>
 | 
						|
 | 
						|
 | 
						|
                            <div class="modal fade text-left" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
 | 
						|
                                <div class="modal-dialog">
 | 
						|
                                    <div class="modal-content">
 | 
						|
                                        <div class="modal-header">
 | 
						|
                                            <h4 class="modal-title">  <?php echo lang('Schedule'); ?></h4>
 | 
						|
                                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
 | 
						|
                                                <span aria-hidden="true">×</span>
 | 
						|
                                            </button>
 | 
						|
                                        </div>
 | 
						|
                                        <div class="modal-body">
 | 
						|
                                            <form role="form" action="<?php echo base_url(); ?>CaregiversDashboard/updateAcceptence" onsubmit="return validateForm()" class="clearfix" method="post" enctype="multipart/form-data">
 | 
						|
                                                <input type="hidden" name="scheduleId" id="scheduleIdmdl" value="">
 | 
						|
                                                <input type="hidden" name="<?php echo $this->security->get_csrf_token_name(); ?>" value="<?php echo $this->security->get_csrf_hash(); ?>" />
 | 
						|
                                                <div class="row">
 | 
						|
                                                  <div class="col-md-6">
 | 
						|
                                                      <div class="form-group">
 | 
						|
                                                      <label for="exampleInputEmail1"><?php echo lang('Please submit your decision'); ?></label>
 | 
						|
                                                          <div class="form-check">
 | 
						|
                                                              <input class="form-check-input dsType" type="radio" name="acceptance_status" id="decisionAccept" value="Accepted" checked>
 | 
						|
                                                              <label class="form-check-label" for="decisionAccept">
 | 
						|
                                                              I Accept
 | 
						|
                                                              </label>
 | 
						|
                                                          </div>
 | 
						|
                                                          <div class="form-check">
 | 
						|
                                                              <input class="form-check-input dsType" type="radio" name="acceptance_status" id="decisionReject" value="Declined">
 | 
						|
                                                              <label class="form-check-label" for="decisionReject">
 | 
						|
                                                              I Decline
 | 
						|
                                                              </label>
 | 
						|
                                                          </div>
 | 
						|
                                                      </div>
 | 
						|
                                                  </div>
 | 
						|
                                                </div>
 | 
						|
 | 
						|
                                                <div class="row" id="onlyDecline" style="display: none;">
 | 
						|
                                                <div class="col-md-6">
 | 
						|
                                                    <div class="form-group">
 | 
						|
                                                    <label for="exampleInputEmail1"><?php echo lang('Please explain a reason.'); ?></label>
 | 
						|
                                                    <textarea class="form-control" type="text" name="rejection_reason" ></textarea>
 | 
						|
                                                  </div>
 | 
						|
                                                </div>
 | 
						|
                                                </div>
 | 
						|
 | 
						|
                                                <section class="col-md-12" id="msg_rm">
 | 
						|
 | 
						|
                                                </section>
 | 
						|
 | 
						|
                                                <section class="col-md-12">
 | 
						|
                                                    <button type="submit" name="submit" class="btn btn-info pull-right"><?php echo lang('submit'); ?></button>
 | 
						|
                                                </section>
 | 
						|
                                            </form>
 | 
						|
 | 
						|
                                        </div>
 | 
						|
                                    </div><!-- /.modal-content -->
 | 
						|
                                </div><!-- /.modal-dialog -->
 | 
						|
                            </div>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
                        </div> 
 | 
						|
                        <?php } ?> 
 | 
						|
                    </div>
 | 
						|
                </div>
 | 
						|
            </div>
 | 
						|
        </div>
 | 
						|
    </section>
 | 
						|
</div>
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 <script>
 | 
						|
    $(document).ready(function () {
 | 
						|
        $('#Patient-DataTable').DataTable();
 | 
						|
        $('#schedule-DataTable').DataTable();
 | 
						|
        var calendar=$('#caregiver-calendar').fullCalendar({
 | 
						|
            header: {
 | 
						|
                left: 'prev,next today',
 | 
						|
                center: 'title',
 | 
						|
                right: 'month,agendaWeek,agendaDay'
 | 
						|
            },
 | 
						|
            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: 'CaregiversDashboard/caregiverEventDetails/',
 | 
						|
                data: {id : <?php echo $nurse->id; ?>},
 | 
						|
                error: function() {
 | 
						|
                    alert('error');
 | 
						|
                }
 | 
						|
            }
 | 
						|
            
 | 
						|
        });
 | 
						|
 | 
						|
        $(".acceptDeline").click(function(){
 | 
						|
            var schId = $(this).attr("attr_id");
 | 
						|
            $("#scheduleIdmdl").val(schId);
 | 
						|
        });
 | 
						|
 | 
						|
        $('.dsType').click(function(){
 | 
						|
 | 
						|
            var insType = $(this).val();
 | 
						|
            if(insType == 'Accepted')
 | 
						|
              {
 | 
						|
                    document.getElementById("onlyDecline").style.display = "none";
 | 
						|
                   
 | 
						|
              }
 | 
						|
              if(insType == 'Declined') 
 | 
						|
              {
 | 
						|
                    document.getElementById("onlyDecline").style.display = "block";
 | 
						|
                                  }
 | 
						|
        });
 | 
						|
 | 
						|
 | 
						|
    });
 | 
						|
</script>  
 | 
						|
<!--main content end-->
 | 
						|
<!--footer start-->
 | 
						|
<?php
 | 
						|
if(isset($_SESSION['UpdateAlert'])){
 | 
						|
?>
 | 
						|
<script>
 | 
						|
    $(function(){
 | 
						|
        Swal.fire({
 | 
						|
          position: 'center',
 | 
						|
          icon: 'success',
 | 
						|
          title: '<?php echo $_SESSION['UpdateAlert']; ?>',
 | 
						|
          showConfirmButton: false,
 | 
						|
          timer: 2000
 | 
						|
        })
 | 
						|
    })
 | 
						|
</script>
 | 
						|
<?php
 | 
						|
}
 | 
						|
?>
 | 
						|
<?php
 | 
						|
if(isset($_SESSION['UpdateFail'])){
 | 
						|
?>
 | 
						|
<script>
 | 
						|
    $(function(){
 | 
						|
        Swal.fire({
 | 
						|
          position: 'center',
 | 
						|
          icon: 'error',
 | 
						|
          title: '<?php echo $_SESSION['UpdateFail']; ?>',
 | 
						|
          showConfirmButton: false,
 | 
						|
          timer: 2000
 | 
						|
        })
 | 
						|
    })
 | 
						|
</script>
 | 
						|
<?php
 | 
						|
}
 | 
						|
?>
 | 
						|
 | 
						|
 | 
						|
<!-- for clock in and out of caregiver -->
 | 
						|
<script>
 | 
						|
    $(document).ready(function(){
 | 
						|
        $("#schedule-DataTable").on('click',".clock_in",function(){
 | 
						|
            var cg_id=$(this).children("#cg_id").html();
 | 
						|
            var pt_id=$(this).children("#pt_id").html();
 | 
						|
            var sch_id=$(this).children("#sch_id").html();
 | 
						|
            $.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},
 | 
						|
                dataType: "json",
 | 
						|
                success:function(data){
 | 
						|
                    // console.log(data);
 | 
						|
                    if(data==0){
 | 
						|
                        Swal.fire({
 | 
						|
                            position: 'center',
 | 
						|
                            icon: 'error',
 | 
						|
                            title: 'Something Went Wrong! or already clocked In! Try Again later',
 | 
						|
                            showConfirmButton: false,
 | 
						|
                            timer: 3500
 | 
						|
                        });
 | 
						|
                    }
 | 
						|
                    if(data==1){
 | 
						|
                        Swal.fire({
 | 
						|
                            position: 'center',
 | 
						|
                            icon: 'success',
 | 
						|
                            title: 'Clocked in successfully',
 | 
						|
                            showConfirmButton: false,
 | 
						|
                            timer: 3500
 | 
						|
                        });
 | 
						|
                        location.reload();
 | 
						|
                        // $("#clock_in").attr("disabled","");
 | 
						|
                        // $("#clock_out").removeAttr("disabled");
 | 
						|
                        // $("#clock_in").addClass("clock_hide");
 | 
						|
                        // $("#clock_out").removeClass("clock_hide");
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            });
 | 
						|
        });
 | 
						|
        $("#schedule-DataTable").on('click',".clock_out",function(){
 | 
						|
            var sch_id=$(this).children("#sch_id").html();
 | 
						|
            $.ajax({
 | 
						|
                url:"<?php echo base_url()?>assessment/ajax_clock_out",
 | 
						|
                type:"GET",
 | 
						|
                data:{sch_id:sch_id},
 | 
						|
                dataType: "json",
 | 
						|
                success:function(data){
 | 
						|
                    // console.log(data);
 | 
						|
                    if(data==0){
 | 
						|
                        Swal.fire({
 | 
						|
                            position: 'center',
 | 
						|
                            icon: 'error',
 | 
						|
                            title: 'Something Went Wrong! Try Again later',
 | 
						|
                            showConfirmButton: false,
 | 
						|
                            timer: 3500
 | 
						|
                        });
 | 
						|
                    }
 | 
						|
                    if(data==1){
 | 
						|
                        Swal.fire({
 | 
						|
                            position: 'center',
 | 
						|
                            icon: 'success',
 | 
						|
                            title: 'Clocked out successfully',
 | 
						|
                            showConfirmButton: false,
 | 
						|
                            timer: 3500
 | 
						|
                        });
 | 
						|
                        location.reload();
 | 
						|
                        // $("#clock_out").attr("disabled","");
 | 
						|
                        // $("#clock_out").addClass("clock_hide");
 | 
						|
                        // $("#clock_success").removeClass("clock_hide");
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            });
 | 
						|
        });
 | 
						|
    });
 | 
						|
</script>
 | 
						|
<!-- for clock in and out of caregiver ending here -->
 | 
						|
 | 
						|
<!-- for clock in and out time show-->
 | 
						|
<script>
 | 
						|
    var abc=$('.clock-time');
 | 
						|
    $.each(abc, function (index, item) {
 | 
						|
        var date = new Date($(item).text());
 | 
						|
        var offsetInMs = ((date.getTimezoneOffset() * 60) * 1000);
 | 
						|
        var localtime = new Date(date - offsetInMs);
 | 
						|
        $(item).text(localtime.toLocaleString());
 | 
						|
    });
 | 
						|
</script>
 | 
						|
<!-- for clock in and out time show ending here-->
 | 
						|
 |