<h3>Transfer Aircraft</h3>

<table width="100%" class="tablesorter">
<thead>
<tr>
<th>Aicraft Type</th>
<th>Registration</th>
<th>Current Location</th>
<th>Transfer To</th>
<th>Confirm</th>
</tr>
</thead>
<?php
if($aircrafts)
foreach($aircrafts as $data)
{
	$aircraftloc = FlightSearchData::getaircraftlocation($data->id);
	$aircraftstrandcheck = FlightSearchData::getstarndedschedulesaircraft($data->id, $aircraftloc);
	if(!$aircraftloc)
	{
	$aircraftloc = "No Landing Recorded";
	}
?>
<tr>
<td><?php echo $data->icao ?></td>
<td><?php echo $data->registration ?></td>
<td>
<?php echo $aircraftloc ?> <?php echo FlightSearchData::getairportname($aircraftloc) ?><?php if(!$aircraftstrandcheck && $aircraftloc != "No Landing Recorded") { ?> <br />
<font color="#CC0000">Aircraft has no scheduled flights from Location!</font><?php } ?></td>
<form id="<?php echo $data->id ?>" name="<?php echo $data->id ?>" action="<?php echo adminurl('/flightsearch/transferaircraft'); ?>" method="post">
<td><select name="newlocation">
<?php if($airports)
foreach($airports as $apt)
{ 
if(!$apt->depicao)
{ continue; }?>
<option value="<?php echo $apt->depicao ?>" <?php echo $sel1 ?>><?php echo $apt->depicao ?> - <?php echo $apt->depname ?></option>
<?php } ?>
</select></td>
<td>
<input type="hidden" name="aircraftid" value="<?php echo $data->id ?>" />
<input type="submit" value="Transfer Aircraft" /></td>
</form>
</tr>
<?php } ?>
</table>

<script>
$(document).ready(function(){
    $(this).scrollTop(0);
});
</script>