<?php
///////////////////////////////////////////////
///  PilotAwardsSystem v2.0 by php-mods.eu  ///
///            Author php-mods.eu           ///
///            Packed at 8/12/2019          ///
///     Copyright (c) 2019, php-mods.eu     ///
///////////////////////////////////////////////

?>
<h3>Auto Awards Issue Reports</h3>
<table id="tabledlist" class="tablesorter">
    <thead>
        <tr>
            <th width="5%"><b>ID</b></th>
            <th width="20%"><b>Date</b></th>
            <th width="20%"><b>Run By</b></th>
            <th width="20%" align="center"><b>Type</b></th>
            <th width="15%" align="center"><b>Total Awards</b></th>
            <th width="20%"></th>
        </tr>
    </thead>
<tbody>
<?php
if(!$reports) {
    echo '<tr><td colspan="6" align="center"><center>There are no any auto awards reports!</center></td></tr>';
} else {
foreach($reports as $report) {
    $data = unserialize($report->data);
    if($data['run_by'] != 0) $run_by = AwardData::pilot_info($data['run_by']);?>
<tr>
    <td><?php echo $report->id; ?></td>
    <td><?php echo $report->datetime_run; ?></td>
    <td><?php if($data['run_by'] != 0) {echo PilotData::getPilotCode($run_by->code, $run_by->pilotid).' - '.$run_by->firstname.' '.$run_by->lastname;} else {echo 'SYSTEM';} ?></td>
    <td align="center"><?php echo $data['type']; ?></td>
    <td align="center"><?php echo $data['total_awards_issued']; ?></td>
    <td><a href="<?php echo SITE_URL; ?>/admin/index.php/Awards/report_details/<?php echo $report->id; ?>" class="button">View Report</a></td>
</tr>
<?php } } ?>
</tbody>
</table><br />