<?= $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>Countries</h1>
      </div>
      <div class="col-sm-6">
        <ol class="breadcrumb float-sm-right">
          <li class="breadcrumb-item"><a href="<?php echo url('/') ?>">Home</a></li>
          <li class="breadcrumb-item active">Countries</li>
        </ol>
      </div>
    </div>
  </div>
</section>

<section class="content">
  <div class="card">
    <div class="card-header with-border">
      <h3 class="card-title">List</h3>
      <div class="card-tools pull-right">
        <?php if (hasPermissions('locations_manage')): ?>
          <a href="<?php echo url('countries/add') ?>" class="btn btn-primary btn-sm"><i class="fa fa-plus pr-1"></i> Add</a>
        <?php endif ?>
      </div>
    </div>
    <div class="card-body">
      <table id="example1" class="table table-bordered table-striped">
        <thead>
          <tr>
            <th width="60">ID</th>
            <th>Name</th>
            <th width="110">Code</th>
            <th width="90">Status</th>
            <th width="140">Action</th>
          </tr>
        </thead>
        <tbody>
          <?php foreach ($countries as $row): ?>
            <tr>
              <td><?php echo $row->id ?></td>
              <td><?php echo esc($row->name) ?></td>
              <td><?php echo esc($row->code) ?></td>
              <td><?php echo $row->status ? 'Active' : 'Inactive' ?></td>
              <td>
                <a href="<?php echo url('countries/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('countries/delete/'.$row->id) ?>" class="btn btn-sm btn-danger" onclick="return confirm('Delete this country?')" data-toggle="tooltip" title="Delete"><i class="fas fa-trash"></i></a>
              </td>
            </tr>
          <?php endforeach ?>
        </tbody>
      </table>
    </div>
  </div>
</section>

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

