<!-- Blank Header -->
<div class="content-header">
    <div class="header-section">
        <h1>
            <i class="gi gi-airplane"></i><Strong>Flight Booking</Strong><br><small><?php echo SITE_NAME ?> | Flight Operations &copy; <?php echo date("Y"); ?></small>
        </h1>
    </div>
</div>
<ol class="breadcrumb breadcrumb-top">
  <li><a href="<?php echo SITE_URL; ?>/index.php"><i class="fa fa-home"></i></a></li>
  <li><a href="<?php echo SITE_URL; ?>/index.php/Schedules">Flight Operations</a></li>
  <li>Flight Details</li>
</ol>
<!-- END Blank Header -->
<div class="row">
	<div class="col-md-12">
		<a href="Javascript::void(0);" class="widget widget-hover-effect1">
			<div class="widget-simple">
			<h2 class="widget-content animation-pullDown text-center">
				<span class="label label-primary"><?php echo $schedule->code;?><?php echo $schedule->flightnum;?></span>
				<small><p class="text-muted"><?php echo $schedule->depicao;?> <Strong><i class="fa fa-plane"></i></Strong> 
				<?php echo $schedule->arricao; ?></p></small>
			</h2>
			</div>
		</a>
	</div>
</div>

<div class="row">
	
	
	<div class="col-md-4">
		<div class="block">
			<div class="block-title">
				<h3><strong>Schedule</strong> Information</h3>
			</div>
			<p>
				Departure Time : <Strong><?php echo $schedule->deptime;?></Strong> IST (<?php echo $schedule->depicao; ?>)<br>
				Arrival Time : <Strong><?php echo $schedule->arrtime;?></Strong> IST (<?php echo $schedule->arricao; ?>)<br>
			</p>
		</div>
	</div>
	
	<div class="col-md-4">
		<div class="block">
			<div class="block-title">
				<h3><strong>AIS</strong> (Airport Information Service)</h3>
			</div>
			<a href="<?php echo SITE_URL; ?>/index.php/airports/get_airport?icao=<?php echo $schedule->depicao;?>" class="btn btn-block btn-success"><?php echo $schedule->depicao;?></></a>
			<a href="<?php echo SITE_URL; ?>/index.php/airports/get_airport?icao=<?php echo $schedule->arricao;?>" class="btn btn-block btn-warning"><?php echo $schedule->arricao;?></></a>
			<br>
		</div>
		
	</div>
	
	<div class="col-md-4">
		<div class="block">
			<div class="block-title">
				<h3><strong>Schedule </strong> Comparision</h3>
				<?php $icao = $schedule->depicao;
	$params = array(
           'depicao'   => $icao,
           'accepted'  => '1'
          );
	$pireps = PIREPData::findPIREPS($params, 1);
	$deppirep = $pireps[0];
	$params = array(
           'arricao'   => $icao,
           'accepted'  => '1'
          );
	$pireps = PIREPData::findPIREPS($params, 1);
	$arrpirep = $pireps[0];
	?>
<?php $initialdep = substr($deppirep->firstname,0,1); ?>
<?php $initialarr = substr($arrpirep->firstname,0,1); ?>
			</div>
			<p>
			    Average Landing Rate : &nbsp; &nbsp; <span class="label label-success"><?php echo $arrpirep->landingrate;?></span> FPM<br>
				Average Flight Time  :  &nbsp; &nbsp; <span class="label label-warning"><?php echo $arrpirep->flighttime; ?></span> Hrs
			</p>
		</div>
	</div>
	
</div>

<div class="row">
	<div class="col-md-12">
		<div class="block">
		    <!-- Example Title -->
		    <div class="block-title">
		        <h2><i class="gi gi-google_maps"></i> Schedule Route</h2>
		    </div>
		    <!-- END Example Title -->
		
		    <!-- Example Content -->
		    
		    <p>
		    	<h4 class="text-muted text-center"><Small></><?php echo $schedule->depname. ' <i class="fa fa-paper-plane"></i> ' .$schedule->arrname; ?></></Small></h4>
		    	<?php
		    	Template::Show('route_map.php')
		    	?>
		    </p>
		    <!-- END Example Content -->
		</div>
	</div>
</div>	


<div class="row">
	<div class="col-md-4">
	  <a class="btn btn-block btn-warning" href="<?php echo SITE_URL; ?>/index.php/schedules">Go Back</a>
    
    <script>
      function goBack() {
      window.history.back();
      }
    </script>
	</div>
	<div class="col-md-4">
		
		<p>
		<?php
			# Don't allow overlapping bids and a bid exists
			if(Config::Get('DISABLE_SCHED_ON_BID') == true && $schedule->bidid != 0)
			{
			?>
			<a onclick="snackbar()" id="<?php echo $schedule->id; ?>" class="addbid btn btn-block btn-primary"
			href="<?php echo actionurl('/schedules/addbid');?>" class="btn btn-block btn-primary">Add </a> <?php
			}
			else
			{
			if (Auth::LoggedIn())
			{
			?>
			<a onclick="snackbar()" id="<?php echo $schedule->id; ?>" class="addbid btn btn-block btn-primary"
			href="<?php echo url('/schedules/addbid');?>">Book Flight</a>
			<?php
			}
			}
		?>
		</p>
		
		
  <div id="snackbar"><strong>Success!</strong> Bid Added</div>
		
	</div>
	<div class="col-md-4">
	  <a class="btn btn-block btn-success" href="<?php echo SITE_URL; ?>/index.php/schedules">Look up another flight!</a>
   </div>
</div>


