<?= $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>Taxes</h1>
      </div>
      <div class="col-sm-6">
        <ol class="breadcrumb float-sm-right">
          <li class="breadcrumb-item"><a href="<?= url('/') ?>">Home</a></li>
          <li class="breadcrumb-item active">Taxes</li>
        </ol>
      </div>
    </div>
  </div>
</section>
<section class="content">
  <div class="card">
    <div class="card-header with-border">
      <a href="<?= url('taxes/add') ?>" class="btn btn-primary btn-sm">Add Tax</a>
      <a href="<?= url('taxGroups') ?>" class="btn btn-secondary btn-sm">Manage Groups</a>
    </div>
    <div class="card-body">
      <table class="table table-bordered table-striped">
        <thead>
          <tr>
            <th>ID</th>
            <th>Name</th>
            <th>Rate Type</th>
            <th>Rate</th>
            <th>Status</th>
            <th>Actions</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach ($rows as $r): ?>
            <tr>
              <td><?= $r->id ?></td>
              <td><?= esc($r->name) ?></td>
              <td><?= esc($r->rate_type) ?></td>
              <td><?= number_format($r->rate, 2) ?></td>
              <td><?= $r->status ? 'Active' : 'Inactive' ?></td>
              <td>
                <a href="<?= url('taxes/edit/'.$r->id) ?>" class="btn btn-warning btn-xs">Edit</a>
                <a href="<?= url('taxes/delete/'.$r->id) ?>" class="btn btn-danger btn-xs" onclick="return confirm('Delete tax?')">Delete</a>
              </td>
            </tr>
          <?php endforeach ?>
        </tbody>
      </table>
    </div>
  </div>
</section>
<?= $this->endSection() ?>

