<div class="cc_hubadm_content">
    
<div class="cc_hubadm_threeboxrow">
    <div class="cc_hubadm_box">
        <div class="cc_hubadm_boxtitle">Selected Hub</div>
        <div class="cc_hubadm_boxctb"><?php echo strtoupper($hub->icao); ?></div>
        <div class="cc_hubadm_boxdes"><div id="changehubbutt" class="cc_hubadm_green">Change</div> Hub</div>
    </div>
    
<div class="cc_hubadm_box">
    <div class="cc_hubadm_boxtitle">Hub Pilots <?php if($detail->pirepdays > 0 && count($pireppilots) > 0 && (PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN) || $pilotpermissions->editpireps == '1' || $pilotpermissions->editpilots == '1')) { ?><a href="<?php echo SITE_URL ?>/<?php echo $mloc ?>.php/HubOps/pirepwarnings" class="pirepwarn">(PIREP Warnings)</a><?php } ?></div>
    <div class="cc_hubadm_boxctb"><?php echo count($hubpilots); ?> <?php if($detail->pirepdays > 0 && count($pireppilots) > 0 && (PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN) || $pilotpermissions->editpireps == '1' || $pilotpermissions->editpilots == '1')) { ?><a href="<?php echo SITE_URL ?>/<?php echo $mloc ?>.php/HubOps/pirepwarnings" class="pirepwarn">(<?php echo count($pireppilots); ?>)</a><?php } ?></div>
    <?php if(PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN) || $pilotpermissions->editpilots == '1')
            { ?>
    <div class="cc_hubadm_boxdes"><a href="<?php echo SITE_URL ?>/<?php echo $mloc ?>.php/HubOps/pilots" class="cc_hubadm_green">Manage</a> Hub Pilots</div>
    <?php } ?>
    </div>
    
<div class="cc_hubadm_box">
    <div class="cc_hubadm_boxtitle">Hub PIREPs</div>
    <div class="cc_hubadm_boxctb"><?php echo $pirepcount->count; ?></div>
    <div class="cc_hubadm_boxdes"><div class="cc_hubadm_blue">+<?php echo $monthpirepcount->count; ?></div> From last month</div>
    </div>
    
<div style="clear:both;"></div>
</div>
    
<div class="cc_hubadm_box cc_hubadm_full">
    <div class="cc_hubadm_boxtitle">Last 5 PIREPs</div>
    <?php if(!$latestpireps)
{
    echo "No PIREPS found!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>Flight</th>
        <th>From</th>
        <th>To</th>
        <th>Aircraft</th>
        <th>Pilot</th>
        <th>Status</th>
        </tr>
        <?php foreach($latestpireps as $pirep) { 
        if($pirep->accepted == "0")
        {
            $status = '<span style="color:red">PENDING</span>';
        }
    else
    {
        $status = '<span style="color:green">PROCESSED</span>';
    }
        ?>
        <tr>
        <td><?php echo $pirep->code.$pirep->flightnum; ?></td>
        <td><?php echo $pirep->depicao; ?></td>
        <td><?php echo $pirep->arricao; ?></td>
        <td><?php echo $pirep->aircraftname; ?></td>
        <td><?php echo PilotData::GetPilotCode($pirep->pilcode, $pirep->pilotid); ?> - <?php echo $pirep->firstname.' '.$pirep->lastname; ?></td>
        <td><?php echo $status; ?></td>
        </tr>
        <?php } ?>
    </table>
    <?php } ?>
    <?php if(PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN) || $pilotpermissions->editpireps == '1')
            { ?>
    <div class="cc_hubadm_boxdes"><a href="<?php echo SITE_URL ?>/<?php echo $mloc ?>.php/HubOps/viewpireps" class="cc_hubadm_green">View</a> all Hub PIREPs</div>
    <?php } ?>
    </div>
    
<div class="cc_hubadm_twoboxrow">
<div class="cc_hubadm_box">
    <div class="cc_hubadm_boxtitle">New Pilots</div>
    <?php if(!$latestpilots)
{
    echo "No Pilots at this hub!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>Pilot ID</th>
        <th>Name</th>
        <th>Status</th>
        </tr>
        <?php foreach($latestpilots as $pilot) { 
        if($pilot->confirmed == "0")
        {
            $status = '<span style="color:red">PENDING</span>';
        }
    else
    {
        $status = '<span style="color:green">ACCEPTED</span>';
    }
        ?>
        <tr>
        <td><?php echo PilotData::GetPilotCode($pilot->code, $pilot->pilotid); ?></td>
        <td><?php echo $pilot->firstname.' '.$pilot->lastname; ?></td>
        <td><?php echo $status; ?></td>
        </tr>
        <?php } ?>
    </table>
    <?php } ?>
    <?php if(PilotGroups::group_has_perm(Auth::$usergroups, FULL_ADMIN) || $pilotpermissions->editpilots == '1')
            { ?>
    <div class="cc_hubadm_boxdes"><a href="<?php echo SITE_URL ?>/<?php echo $mloc ?>.php/HubOps/pilots" class="cc_hubadm_green">Manage</a> Hub Pilots</div>
    <?php } ?>
    </div>
    
<div class="cc_hubadm_box"><div class="cc_hubadm_boxtitle">Top Aircraft Types</div>
    <?php if(!$topaircraft)
{
    echo "No Aircraft Statistics available!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>#</th>
        <th>Flights</th>
        <th>Type</th>
        </tr>
        <?php $i = "1"; foreach($topaircraft as $acft) { ?>
        <tr>
        <td><?php echo $i; ?></td>
        <td><?php echo $acft->routesflown; ?></td>
        <td><?php echo $acft->aircraftname; ?></td>
        </tr>
        <?php $i++; } ?>
    </table>
    <?php } ?>
    </div>
<div style="clear:both;"></div>
</div>
    
<div class="cc_hubadm_twoboxrow">
    
<div class="cc_hubadm_box"><div class="cc_hubadm_boxtitle">Top Pilots by Flights (Alltime)</div>
     <?php if(!$topflightpilots)
{
    echo "No Statistics available!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>#</th>
        <th>Flights</th>
        <th>Pilot</th>
        </tr>
        <?php $i = "1"; foreach($topflightpilots as $pil) { ?>
        <tr>
        <td><?php echo $i; ?></td>
        <td><?php echo $pil->routesflown; ?></td>
        <td><?php echo $pil->firstname.' '.$pil->lastname; ?></td>
        </tr>
        <?php $i++; } ?>
    </table>
    <?php } ?>
    </div>
    
<div class="cc_hubadm_box"><div class="cc_hubadm_boxtitle">Top Pilots by Flights (Month)</div>
    <?php if(!$topflightpilotsmonth)
{
    echo "No Statistics available!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>#</th>
        <th>Flights</th>
        <th>Pilot</th>
        </tr>
        <?php $i = "1"; foreach($topflightpilotsmonth as $pil) { ?>
        <tr>
        <td><?php echo $i; ?></td>
        <td><?php echo $pil->routesflown; ?></td>
        <td><?php echo $pil->firstname.' '.$pil->lastname; ?></td>
        </tr>
        <?php $i++; } ?>
    </table>
    <?php } ?>
    </div>
<div style="clear:both;"></div>
</div>
    
    
<div class="cc_hubadm_twoboxrow">
    
<div class="cc_hubadm_box"><div class="cc_hubadm_boxtitle">Top Pilots by Hours HH:mm (Alltime)</div>
    <?php if(!$tophourpilots)
{
    echo "No Statistics available!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>#</th>
        <th>Time</th>
        <th>Pilot</th>
        </tr>
        <?php $i = "1"; foreach($tophourpilots as $pil) { ?>
        <tr>
        <td><?php echo $i; ?></td>
        <td><?php echo explode(':', $pil->totaltime)[0].":".explode(':', $pil->totaltime)[1]; ?></td>
        <td><?php echo $pil->firstname.' '.$pil->lastname; ?></td>
        </tr>
        <?php $i++; } ?>
    </table>
    <?php } ?>
    </div>
    
<div class="cc_hubadm_box"><div class="cc_hubadm_boxtitle">Top Pilots by Hours HH:mm (Month)</div>
    <?php if(!$tophourpilotsmonth)
{
    echo "No Statistics available!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>#</th>
        <th>Time</th>
        <th>Pilot</th>
        </tr>
        <?php $i = "1"; foreach($tophourpilotsmonth as $pil) { ?>
        <tr>
        <td><?php echo $i; ?></td>
        <td><?php echo explode(':', $pil->totaltime)[0].":".explode(':', $pil->totaltime)[1]; ?></td>
        <td><?php echo $pil->firstname.' '.$pil->lastname; ?></td>
        </tr>
        <?php $i++; } ?>
    </table>
    <?php } ?>
    </div>
<div style="clear:both;"></div>
</div>
    

<div class="cc_hubadm_twoboxrow">
    
<div class="cc_hubadm_box"><div class="cc_hubadm_boxtitle">Top Landings (Alltime)</div>
    <?php if(!$toplandingrates)
{
    echo "No Statistics available!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>#</th>
        <th>V/S</th>
        <th>A/C</th>
        <th>Airport</th>
        <th>Pilot</th>
        </tr>
        <?php $i = "1"; foreach($toplandingrates as $pil) { ?>
        <tr>
        <td><?php echo $i; ?></td>
        <td><?php echo $pil->landingrate; ?> ft/min</td>
        <td><?php echo $pil->acicao; ?></td>
        <td><?php echo $pil->arricao; ?></td>
        <td><?php echo $pil->firstname.' '.$pil->lastname; ?></td>
        </tr>
        <?php $i++; } ?>
    </table>
    <?php } ?>
    </div>
    
<div class="cc_hubadm_box"><div class="cc_hubadm_boxtitle">Top Landings (Month)</div>
    <?php if(!$toplandingratesmonth)
{
    echo "No Statistics available!";
} else { ?>
    <table class="cc_hubadm_tablea">
    <tr>
        <th>#</th>
        <th>V/S</th>
        <th>A/C</th>
        <th>Airport</th>
        <th>Pilot</th>
        </tr>
        <?php $i = "1"; foreach($toplandingratesmonth as $pil) { ?>
        <tr>
        <td><?php echo $i; ?></td>
        <td><?php echo $pil->landingrate; ?> ft/min</td>
        <td><?php echo $pil->acicao; ?></td>
        <td><?php echo $pil->arricao; ?></td>
        <td><?php echo $pil->firstname.' '.$pil->lastname; ?></td>
        </tr>
        <?php $i++; } ?>
    </table>
    <?php } ?>
    </div>
<div style="clear:both;"></div>
</div>
    

    
</div>

<div style="clear:both;"></div>