<?php
$this->show('codeshare/codeshare_header.php');
// Pending things
/*
 1. Update & Delete feature for all codeshare flights
 2. Update & Delete feature for all Codeshare airlines
 3. Front End for Codeshare Flight!

*/

if(count($airlines) == 0) {
  ?>
    <div class="alert alert-danger">
      <strong>
        Hey!
      </strong>
      You haven't added any codeshare airlines yet! Go to the <a href="<?php echo adminurl('/CodeShare_admin/newairline'); ?>"> wizard </a> now!
    </div>
  <?php
} else {
?>
<div class="table">
  <table class="table table-responsive table-hover">
    <thead>
      <th>#</th>
      <th>Logo</th>
      <th>Name</th>
      <th>ICAO</th>
      <th>Status</th>
      <th>Options</th>
    </thead>
    <tbody>
<?php
  $i = 1;
  foreach ($airlines as $airline) {
    ?>
      <tr>
        <td><?php echo $i; ?></td>
        <td><img src="<?php echo $airline->image; ?>" style="width: 150px; height: auto;" ></td>
        <td><a href="<?php echo adminurl('codeshare_admin/viewairline'); ?>/<?php echo $airline->icao; ?>" class="btn btn-primary"><?php echo $airline->name; ?></a></td>
        <td><?php echo $airline->icao; ?></td>
        <td><?php if($airline->active == 1) { echo "<span class='label label-success'>ACTIVE</span>"; } else { "<span class='label label-danger'>INACTIVE</span>"; }?></td>
        <td><a href="<?php echo adminurl('/CodeShare_admin/editairline/'); ?><?php echo $airline->id; ?>" class="btn btn-xs btn-success">Edit</a></td>
      </tr>
    <?php
    $i++;
  }
}
?>
    </tbody>
  </table>
</div>
