<?= $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>Tax Settings</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">Tax Settings</li>
        </ol>
      </div>
    </div>
  </div>
</section>
<section class="content">
  <div class="row">
    <div class="col-sm-3">
      <?= $this->include('admin/settings/sidebar'); ?>
    </div>
    <div class="col-sm-9">
      <div class="card">
        <div class="card-header with-border">
          <h3 class="card-title">Subscription Tax Settings</h3>
        </div>
        <?= form_open('settings/taxUpdate', ['method' => 'post']) ?>
        <div class="card-body">
          <div class="form-group">
            <label>Tax Inclusive Pricing</label>
            <select name="subscription_tax_inclusive" class="form-control">
              <option value="1" <?= setting('subscription_tax_inclusive') ? 'selected' : '' ?>>Yes (Tax Included)</option>
              <option value="0" <?= !setting('subscription_tax_inclusive') ? 'selected' : '' ?>>No (Add Tax Separately)</option>
            </select>
          </div>
          <div class="form-group">
            <label>Subscription Tax Group</label>
            <select name="subscription_tax_group_id" class="form-control">
              <option value="">-- None --</option>
              <?php foreach ($groups as $g): ?>
                <option value="<?= $g->id ?>" <?= (int) setting('subscription_tax_group_id') === (int) $g->id ? 'selected' : '' ?>><?= esc($g->name) ?></option>
              <?php endforeach ?>
            </select>
            <small class="text-muted">Choose which tax group applies to subscription purchases.</small>
          </div>
        </div>
        <div class="card-footer">
          <button type="submit" class="btn btn-primary">Save</button>
        </div>
        <?= form_close() ?>
      </div>
    </div>
  </div>
</section>
<?= $this->endSection() ?>

