<?= $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>View Discount</h1>
      </div>
      <div class="col-sm-6 text-right">
        <?php if (hasPermissions('shop_discounts_manage')): ?>
          <a href="<?php echo url('rewarderDiscounts/edit/'.$discount->id) ?>" class="btn btn-primary btn-sm"><i class="fas fa-edit pr-1"></i> Edit</a>
        <?php endif ?>
      </div>
    </div>
  </div>
</section>

<section class="content">
  <div class="card">
    <div class="card-body">
      <table class="table table-bordered">
        <tbody>
          <tr>
            <th width="220">ID</th>
            <td><?php echo $discount->id ?></td>
          </tr>
          <tr>
            <th>Shop</th>
            <td><?php echo esc($shopName) ?></td>
          </tr>
          <tr>
            <th>Applies To</th>
            <td><?php echo esc($discount->applies_to) ?></td>
          </tr>
          <tr>
            <th>Target</th>
            <td><?php echo esc($targetName) ?></td>
          </tr>
          <tr>
            <th>Discount Type</th>
            <td><?php echo esc($discount->discount_type) ?></td>
          </tr>
          <tr>
            <th>Value</th>
            <td><?php echo esc($discount->value) ?></td>
          </tr>
          <tr>
            <th>Min Amount</th>
            <td><?php echo $discount->min_amount !== null && $discount->min_amount !== '' ? esc($discount->min_amount) : '-' ?></td>
          </tr>
          <tr>
            <th>Start At</th>
            <td><?php echo $discount->start_at !== null && $discount->start_at !== '' ? esc($discount->start_at) : '-' ?></td>
          </tr>
          <tr>
            <th>End At</th>
            <td><?php echo $discount->end_at !== null && $discount->end_at !== '' ? esc($discount->end_at) : '-' ?></td>
          </tr>
          <tr>
            <th>Status</th>
            <td><?php echo $discount->status ? 'Active' : 'Inactive' ?></td>
          </tr>
          <tr>
            <th>Created At</th>
            <td><?php echo esc($discount->created_at) ?></td>
          </tr>
          <tr>
            <th>Updated At</th>
            <td><?php echo esc($discount->updated_at) ?></td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="card-footer">
      <a href="<?php echo url('rewarderDiscounts') ?>" class="btn btn-flat btn-danger">Back</a>
    </div>
  </div>
</section>

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

