<h3>Tour Details - <?php echo $tour->tourtitle; ?></h3>

<div style="text-align:left; margin-bottom:10px;"><img src="<?php echo $tour->tourimage; ?>" style="max-width:100%;" alt="Tour Logo" /></div>
<table width="100%">
<tr>
<td width="50%">
<table width="100%" class="tablesorter">
<tr><td style="font-weight:bold;">Tour Title:</td><td><?php echo $tour->tourtitle; ?></td></tr>
<tr><td style="font-weight:bold;">Status:</td><td><?php echo TourCenterData::tourstatus($tour->status); ?></td></tr>
<tr><td style="font-weight:bold;">Start Date:</td><td><?php echo date('d.m.Y', strtotime($tour->startdate)); ?></td></tr>
<?php if($tour->enddate != '0000-00-00') { ?><tr><td style="font-weight:bold;">End Date:</td><td><?php echo date('d.m.Y', strtotime($tour->enddate)); ?></td></tr><?php } ?>
<tr><td style="font-weight:bold;">Airline Code:</td><td><?php echo $tour->airline; ?></td></tr>
<tr><td style="font-weight:bold;">Tour Start Airport:</td><td><?php echo $tour->firstdep; ?></td></tr>
<tr><td style="font-weight:bold;">Tour End Airport:</td><td><?php echo $tour->lastarr; ?></td></tr>
<tr><td style="font-weight:bold;">Number of Legs:</td><td><?php echo $tour->legnumber; ?></td></tr>
<tr><td style="font-weight:bold;">Allowed Aircraft Types:</td><td><?php echo str_replace(':',', ', $tour->allowedaircraft); ?></td></tr>
<?php if($tour->minrank != '0') { ?><tr><td style="font-weight:bold;">Required Rank:</td><td><?php echo TourCenterData::getrankname($tour->minrank); ?></td></tr><?php } ?>
<?php if($tour->maxdays != '0') { ?><tr><td style="font-weight:bold;">Max days to finish:</td><td><?php echo $tour->maxdays; ?></td></tr><?php } ?>
<?php if($tour->maxsignups != '0') { ?><tr><td style="font-weight:bold;">Max Pilots:</td><td><?php echo $tour->maxsignups; ?></td></tr><?php } ?>
<tr><td style="font-weight:bold;">Required Tours:</td><td><?php if(!$tour->requiredtours) { echo "none"; } else echo str_replace(':',', ',$tour->requiredtours); ?></td></tr>
</table>
</td>
<td valign="top" style="padding-left:20px; padding-top:30px;">
<a href="<?php echo SITE_URL ?>/admin/index.php/tourcenter">back to Tours</a><br /><br />
<strong>Options:</strong><br /><br />
<button class="{button:{icons:{primary:'ui-icon-wrench'}}}" onclick="window.location='<?php echo SITE_URL ?>/admin/index.php/tourcenter/edittour/<?php echo $tour->id; ?>';">Edit Tour</button><br /><br />
<button class="{button:{icons:{primary:'ui-icon-closethick'}}}" onclick="window.location='<?php echo SITE_URL ?>/admin/index.php/tourcenter/deletetour/<?php echo $tour->id; ?>';">Delete Tour</button>
<br /><br />
<hr />
<br /><br />
<strong>Description</strong><br />
<?php echo $tour->tourdescription; ?>
</td>
</tr>
</table>

<h3>Tour Legs</h3>
<?php if(!$legs) { echo "Tour has no Legs and should be deleted!"; } else { ?>
<table width="100%" class="tablesorter">
<thead>
<th>Leg</th>
<th>Depiaco</th>
<th>Deptime</th>
<th>Arricao</th>
<th>Arrtime</th>
<th>Edit</th>
</thead>
<?php foreach($legs as $leg) { ?>
<tr>
<td><?php echo $leg->legid ?></td>
<td><?php echo $leg->depicao ?></td>
<td><?php echo $leg->deptime ?></td>
<td><?php echo $leg->arricao ?></td>
<td><?php echo $leg->arrtime; ?></td>
<td width="15%" ><button class="{button:{icons:{primary:'ui-icon-wrench'}}}" onclick="window.location='<?php echo SITE_URL ?>/admin/index.php/tourcenter/editleg/<?php echo $leg->id; ?>';">Edit Leg</button></td>
</tr>
<?php } ?>
</table>
<?php } ?>

<h3>Pilots</h3>
<table width="100%" class="tablesorter">
<thead>
<th colspan="2">Pilot</th>
<th colspan="2">Current Position</th>
<th>On Tour Since</th>
<th>Aircraft</th>
<th>Delete</th>
</thead>
<?php if(!$signups) { echo "<tr><td colspan='8'>No pilots have signed up!</td></tr>"; } else foreach($signups as $pilot) { ?>
<tr>
<td><?php echo PilotData::GetPilotCode($pilot->pilotcode, $pilot->pilotid) ?></td>
<td><?php echo $pilot->firstname.' '.$pilot->lastname ?></td>
<td><?php echo $pilot->location ?></td>
<td><?php echo $pilot->locationname ?></td>
<td><?php echo date('d.m.Y', strtotime($pilot->startdate)); ?></td>
<td><?php echo $pilot->aircraftname; ?></td>
<td><button class="{button:{icons:{primary:'ui-icon-closethick'}}}" onclick="window.location='<?php echo SITE_URL ?>/admin/index.php/tourcenter/removepilot/<?php echo $tour->id; ?>?pilot=<?php echo $pilot->pilotid; ?>';">Remove Pilot</button></td>
</tr>
<?php } ?>
</table>