<?php
	include ('common/connection.php');
	$tna_id=base64_decode($_REQUEST['Lid']);
	 $tna="select * from employee_master where SLN='".$tna_id."'"; 
	$tna_query=mysqli_query($con,$tna);
	$tna_fetch=mysqli_fetch_array($tna_query);
	$name=$tna_fetch['First_Name']." ".$tna_fetch['Last_Name'];
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Buurtzorg  | Daily TNA Roster</title>
  
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <?php include("headerlink.php"); ?>
  
 <script src="js/vendor/jquery-1.12.4.min.js"></script>
 <script src="js/bootstrap.min.js"></script>
<link href='packages/core/main.css' rel='stylesheet' />
<link href='packages/daygrid/main.css' rel='stylesheet' />
<link href='packages/timegrid/main.css' rel='stylesheet' />
<script src='packages/core/main.js'></script>
<script src='packages/interaction/main.js'></script>
<script src='packages/daygrid/main.js'></script>
<script src='packages/timegrid/main.js'></script>

<script type="text/javascript" src="lib/jquery.mousewheel.pack.js"></script>

<script type="text/javascript" src="source/jquery.fancybox.pack.js?v=2.1.5"></script>
<link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css" media="screen" />

<script>

  document.addEventListener('DOMContentLoaded', function() {
    var calendarEl = document.getElementById('calendar');

    var calendar = new FullCalendar.Calendar(calendarEl, {
      plugins: [ 'interaction', 'dayGrid', 'timeGrid' ],
      header: {
        left: 'prev,,next',
        center: 'title',
        right: 'dayGridMonth,timeGridWeek,timeGridDay'
      },
	  dateClick: function(info) {
    var select_date=info.dateStr;
	var pid=Patient;
	//alert(pid);
	
	$.fancybox({
	
		    minWidth	: 700,
			minHeight	: 400,
			fitToView	: false,
			width		: '70%',
			height		: '50%',
			autoSize	: false,
			closeClick	: false,
			openEffect	: 'elastic',
			closeEffect	: 'elastic',
			padding: 10,
		   prevEffect: 'fade',
		    nextEffect: 'fade',
			type: 'iframe',
		scrolling: 'no',
		href: 'view-tna-roster-plan.php?d='+select_date+'&tid=<?php echo $tna_id;?>',
		/*'afterClose':function () {
				href: '../mycart/registration_success.php',
			  }, */
			  'afterClose': function() {
				
				window.location.href="daily-tna-roster.php?Lid=<?php echo base64_encode($tna_id); ?>";
		}
	});
	
	
	
	},
      defaultDate: '<?php echo date('Y-m-d'); ?>',
      navLinks: true, // can click day/week names to navigate views
      selectable: true,
      selectMirror: true,
      select: function(arg) {
       // var title = prompt('Event Title:');
       /* if (title) {
          calendar.addEvent({
            title: title,
            start: arg.start,
            end: arg.end,
            allDay: arg.allDay
          })
        }*/
		
		

  

  
        calendar.unselect()
      },
      editable: true,
      eventLimit: true, // allow "more" link when too many events
      events: [
			 <?php
			$getdata=mysqli_query($con,"select * from roster_master where TNA_Name='".$tna_id."' and Active='0'");
			while($fetch_data=mysqli_fetch_array($getdata))
			{
			$fetch_data['Patient_Id'];
			$patient="select * from patient_master where Patient_Id='".$fetch_data['Patient_Id']."' order by Patient_Name asc";
			$patient_query=mysqli_query($con,$patient);
			$patient_fetch=mysqli_fetch_array($patient_query);
			
			$edit_sql=mysqli_fetch_array(mysqli_query($con,"select * from roster_master where TNA_Name='".$tna_id."' and Treatment_Service_Date='".$fetch_data['Treatment_Service_Date']."' and Active='0'"));
			if($edit_sql['Offday']==0)
			{
			?>
        {
          title: '<?php echo $patient_fetch['Patient_Name'] ?><?php echo '\r\n'; ?><?php echo date('h:i a',strtotime($fetch_data['Duty_Hour_Start_Time']))."-".date('h:i a',strtotime($fetch_data['To_Time'])); ?>',
          start: '<?php echo $fetch_data['Treatment_Service_Date']; ?>'
		 
        },
        <?php
		}
		else if($edit_sql['Offday']==1)
		{
		?>
        {
          title: 'OFF DAY',
          start: '<?php echo $fetch_data['Treatment_Service_Date']; ?>'
		 
        },
        <?php
		}
		else if($edit_sql['Offday']==2)
		{
		?>
        {
          title: 'LEAVE',
          start: '<?php echo $fetch_data['Treatment_Service_Date']; ?>'
		 
        },
		<?php
		}
		else if($edit_sql['Offday']==3)
		{
		?>
        {
          title: 'NIGHT OFF',
          start: '<?php echo $fetch_data['Treatment_Service_Date']; ?>'
		 
        },
		<?php
		}
		}
		?>
      ]
    });

    calendar.render();
  });

</script>
</head>

<body>

<?php include("left-menu.php"); ?>
    
 
    <div class="all-content-wrapper">
        
        
       <?php include("header-menu.php"); ?> 


                
       <div class="col-lg-12 col-md-6 col-sm-6 col-xs-12" style="padding:30px 15px 0px;">
          <div class="sparkline9-list mt-b-30 res-mg-t-30 analysis-progrebar-ctn">
          
        <h3 style="margin:0 0 15px 13px">
        Daily Roster Plan for TNA - <?php echo $name; ?>
       </h3>
     </section>
        <input type="hidden" id="Patient" value="<?php echo $patient_id; ?>">
		
     <div id='calendar'></div>
   
    <!-- Main content -->
  
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
  <div class="footer-copyright-area">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="footer-copy-right">
                            <p>Copyright © 2019. All rights reserved.</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
 
 
</div>
 </div>
   <!-- jquery
		============================================ -->
    <script src="js/vendor/jquery-1.12.4.min.js"></script>
    <!-- bootstrap JS
		============================================ -->
    <script src="js/bootstrap.min.js"></script>
    <!-- wow JS
		============================================ -->
    <script src="js/wow.min.js"></script>
    <!-- price-slider JS
		============================================ -->
    <script src="js/jquery-price-slider.js"></script>
    <!-- meanmenu JS
		============================================ -->
    <script src="js/jquery.meanmenu.js"></script>
    <!-- owl.carousel JS
		============================================ -->
    <script src="js/owl.carousel.min.js"></script>
    <!-- sticky JS
		============================================ -->
    <script src="js/jquery.sticky.js"></script>
    <!-- scrollUp JS
		============================================ -->
    <script src="js/jquery.scrollUp.min.js"></script>
    
    
    
    <!-- datepicker JS
		============================================ -->
    <script src="js/datepicker/jquery-ui.min.js"></script>
    <script src="js/datepicker/datepicker-active.js"></script>
    
    
    
    <!-- data table JS
		============================================ -->
    <script src="js/data-table/bootstrap-table.js"></script>
    <script src="js/data-table/tableExport.js"></script>
    <script src="js/data-table/data-table-active.js"></script>
    <script src="js/data-table/bootstrap-table-editable.js"></script>
    <script src="js/data-table/bootstrap-editable.js"></script>
    <script src="js/data-table/bootstrap-table-resizable.js"></script>
    <script src="js/data-table/colResizable-1.5.source.js"></script>
    <script src="js/data-table/bootstrap-table-export.js"></script>
    
    
    
    <!-- mCustomScrollbar JS
		============================================ -->
    <script src="js/scrollbar/jquery.mCustomScrollbar.concat.min.js"></script>
    <script src="js/scrollbar/mCustomScrollbar-active.js"></script>
    <!-- metisMenu JS
		============================================ -->
    <script src="js/metisMenu/metisMenu.min.js"></script>
    <script src="js/metisMenu/metisMenu-active.js"></script>
    <!-- peity JS
		============================================ -->
    <script src="js/peity/jquery.peity.min.js"></script>
    <script src="js/peity/peity-active.js"></script>
    <!-- sparkline JS
		============================================ -->
    <script src="js/sparkline/jquery.sparkline.min.js"></script>
    <script src="js/sparkline/sparkline-active.js"></script>
    <!-- tab JS
		============================================ -->
    <script src="js/tab.js"></script>
    <!-- plugins JS
		============================================ -->
    <script src="js/plugins.js"></script>
    <!-- main JS
		============================================ -->
    <script src="js/main.js"></script>
    <!-- tawk chat JS
		============================================ -->
        
         <script>
$(document).ready(function() {
   $("body").tooltip({ 
   	selector: '[data-toggle=tooltip]' 
	 });
});
 
</script>
<!------------------------Fancybox---------------------------------->
 
 <script type="text/javascript" src="lib/jquery.mousewheel.pack.js"></script>

<script type="text/javascript" src="source/jquery.fancybox.pack.js?v=2.1.5"></script>
	<link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css" media="screen" />

<style type="text/css">
	.fancybox-custom .fancybox-skin {
		box-shadow: 0 0 50px #222;
	}
</style> 
<script>
$(document).ready(function() {
	$(".various5").fancybox({
		maxWidth	: 380,
		maxHeight	: 410,
		fitToView	: true,
		width		: '100%',
		height		: '100%',
		autoSize	: false,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none',
		
		
		
		
	});
	
 
});

</script>
</body>
</html>
