<?= $this->extend('admin/layout/default') ?>
<?= $this->section('content') ?>

<section class="content-header">
  <div class="container-fluid">
    <div class="row mb-2">
      <div class="col-sm-6">
        <h1>Orders</h1>
      </div>
      <div class="col-sm-6 text-right">
        <a href="<?php echo url('rewarderOrders/add') ?>" class="btn btn-primary btn-sm"><i class="fa fa-plus pr-1"></i> Add</a>
      </div>
    </div>
  </div>
</section>

<section class="content">
  <div class="card">
    <div class="card-body">
      <table id="example1" class="table table-bordered table-striped">
        <thead>
          <tr>
            <th width="70">#</th>
            <th>Shop</th>
            <th>Customer</th>
            <th width="120">Subtotal</th>
            <th width="120">Discount</th>
            <th width="120">Total</th>
            <th width="90">Points</th>
            <th width="170">Created</th>
            <th width="140">Action</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach ($rows as $row): ?>
            <tr>
              <td><?php echo $row->id ?></td>
              <td><?php echo esc($row->shop_name) ?></td>
              <td><?php echo esc($row->customer_name) ?></td>
              <td><?php echo esc($row->subtotal) ?></td>
              <td><?php echo esc($row->discount_total) ?></td>
              <td><?php echo esc($row->total) ?></td>
              <td><?php echo esc($row->points_earned) ?></td>
              <td><?php echo esc($row->created_at) ?></td>
              <td>
                <a href="<?php echo url('rewarderOrders/view/'.$row->id) ?>" class="btn btn-sm btn-default"><i class="fas fa-eye"></i></a>
                <a href="<?php echo url('rewarderOrders/delete/'.$row->id) ?>" class="btn btn-sm btn-danger" onclick="return confirm('Delete this order?')"><i class="fas fa-trash"></i></a>
              </td>
            </tr>
          <?php endforeach ?>
        </tbody>
      </table>
    </div>
  </div>
</section>

<?= $this->endSection() ?>

