<?= $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>Service Categories</h1>
      </div>
      <div class="col-sm-6 text-right">
        <?php if (hasPermissions('shop_services_manage')): ?>
          <a href="<?php echo url('rewarderServiceCategories/add') ?>" class="btn btn-primary btn-sm"><i class="fa fa-plus pr-1"></i> Add</a>
        <?php endif ?>
      </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="60">ID</th>
            <th>Shop</th>
            <th>Name</th>
            <th width="90">Status</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->name) ?></td>
              <td><?php echo $row->status ? 'Active' : 'Inactive' ?></td>
              <td>
                <?php if (hasPermissions('shop_services_manage') || hasPermissions('shop_service_categories_view')): ?>
                  <a href="<?php echo url('rewarderServiceCategories/view/'.$row->id) ?>" class="btn btn-sm btn-default" data-toggle="tooltip" title="View"><i class="fas fa-eye"></i></a>
                <?php endif ?>
                <?php if (hasPermissions('shop_services_manage')): ?>
                  <a href="<?php echo url('rewarderServiceCategories/edit/'.$row->id) ?>" class="btn btn-sm btn-default" data-toggle="tooltip" title="Edit"><i class="fas fa-edit"></i></a>
                  <a href="<?php echo url('rewarderServiceCategories/delete/'.$row->id) ?>" class="btn btn-sm btn-danger" onclick="return confirm('Delete this category?')" data-toggle="tooltip" title="Delete"><i class="fas fa-trash"></i></a>
                <?php endif ?>
              </td>
            </tr>
          <?php endforeach ?>
        </tbody>
      </table>
    </div>
  </div>
</section>

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

