<?= $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>Ledger</h1>
      </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="90">Points</th>
            <th>User</th>
            <th>Shop</th>
            <th width="90">Order</th>
            <th>Description</th>
            <th width="170">Created</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach ($rows as $row): ?>
            <tr>
              <td><?php echo esc($row->points_delta) ?></td>
              <td><?php echo esc($row->user_name) ?> <span class="text-muted">(<?php echo esc($row->user_username ?? $row->user_email) ?>)</span></td>
              <td><?php echo esc($row->shop_name) ?></td>
              <td><?php echo esc($row->order_id) ?></td>
              <td><?php echo esc($row->description) ?></td>
              <td><?php echo esc($row->created_at) ?></td>
            </tr>
          <?php endforeach ?>
        </tbody>
      </table>
    </div>
  </div>
</section>

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

