<?php
	if ($this->session->userdata('permisson')==1) {
		$CI =& get_instance();
		$CI->load->library('libraryprofile');
		$CI->libraryprofile->showMenuBarManager($this->session->userdata('meno'),$this->session->userdata('priezvisko'));
		
		echo '<div id="default_container">';		
			
			echo '<div id="reservation_header">'; 
			echo '<a href="'. base_url() . 'manager/getReservations/0" class="button" style="float:left; margin-top:25px;margin-left:135px;">Zobraziť dnešný deň</a>';
			echo form_open(base_url('manager/redirectGetReservations/'),'onkeypress="return event.keyCode != 13;"');
			echo '<div class="button-group" style="float:right;">';			
			echo form_submit('submitSetRedirectDate' , 'Prejsť na', 'class="button" style="float:left; margin-top:25px; margin-right:25px"');
			echo '<input type="text" name="setRedirectDate" id="calendar2" alt="date" class="IP_calendar" title="Y-m-d" value="Vyberte"  style="float:left; margin-top:25px;margin-right:100px;">';
			echo form_close();
			echo '</div>';
			
			echo "<h3>";
				$today = strtotime("+0 day", strtotime($today));
				echo "<a href='".base_url('manager/getReservations/'.date("Y-m-d",strtotime("-1 day", $today)))."'><img  src='http://martinbendik.studenthosting.sk/pictures/prev.png' style='width:30px;vertical-align: middle;margin-right:25px'></a>";
				
				echo date("d.m.Y", $today);
				echo " - ";
				$date = strtotime("+7 day", $today);
				echo date("d.m.Y", $date);
			
				echo "<a href='".base_url('manager/getReservations/'.date("Y-m-d",strtotime("+1 day", $today)))."'><img  src='http://martinbendik.studenthosting.sk/pictures/next.png' style='width:30px;vertical-align: middle;margin-left:25px'></a>";
			echo "</h3>";
			echo '</div>';
			
			echo '<div id="reservation_body">';	
				for($i=0; $i<8; $i++){
					$date = strtotime("+".$i." day", $today);	
					echo "<a href='".base_url('manager/getReservations/'.date("Y-m-d", $date))."'>";
					if($i<>7){
						echo '<div id="reservation_body_box">';
					} else {
						echo '<div id="reservation_body_box_last">';						
					}
													
					echo date("d.m.Y", $date);
					echo '</div></a>';		
				}
			echo '</div>';
			
			echo '<div id="reservation_body_car">';
			$this->load->helper('reservations_helper');
				foreach($vehicles as $vehicle){
					echo '<a href="'.base_url("manager/showDetailVehicleActive/4/1/".$vehicle->ID_VOZ."/".date("Y-m-d",$today)).'"><div id="reservation_body_box_car">';
					echo " &nbsp ". $vehicle->Nazov ."</br> &nbsp Miest: ".$vehicle->Pocet_miest."";
					echo '</div></a>'; 
					
					for($i=0; $i<8; $i++){												
					$result = getInventoryInfoByDay($vehicle->ID_VOZ,date("Y-m-d",strtotime("+".$i." day", $today)));
					if ($result==false){						
						echo '<div id="reservation_body_box_car_inventories_not_visible">';
						echo "&nbsp";
						echo '</div>';
					} else {
						echo '<a href="'. base_url("manager/redirectInventoryDetail/".date("Y-m-d",$today)."/1/".$result->ID_INV).'">';
						if($i==7){						
						echo '<div id="reservation_body_box_car_inventories_last">';
					} elseif ($i==0) {
						echo '<div id="reservation_body_box_car_inventories_first">';						
					} else {
						echo '<div id="reservation_body_box_car_inventories">';
					}
					echo "<h10><b>";
					echo $result->Mesto;
					echo "</b></h10>";
					echo "</br>";
					 
					echo '</div>'; 
					
					echo "</a>"; 
					
					}					
					
				}	
				}			
			echo '</div>';
			
			
			
		echo '</div>';
	} else {
		redirect(base_url('main/restricted'));
	}	
?>

	
	
	


