<?= $this->extend('admin/layout/default') ?>
<?= $this->section('content') ?>
<section class="content-header">
  <div class="container-fluid">
    <h1>Add Tax Group</h1>
  </div>
</section>
<section class="content">
  <div class="card">
    <div class="card-body">
      <?= form_open('taxGroups/save', ['method' => 'post']) ?>
        <div class="form-group">
          <label>Name</label>
          <input type="text" name="name" class="form-control" required>
        </div>
        <div class="form-group">
          <label>Description</label>
          <textarea name="description" class="form-control" rows="3"></textarea>
        </div>
        <div class="form-group">
          <label>Taxes</label>
          <div class="row">
            <?php foreach ($taxes as $t): ?>
              <div class="col-sm-4">
                <div class="form-check">
                  <input class="form-check-input" type="checkbox" id="tax<?= $t->id ?>" name="tax_ids[]" value="<?= $t->id ?>">
                  <label class="form-check-label" for="tax<?= $t->id ?>">
                    <?= esc($t->name) ?> (<?= $t->rate_type === 'PERCENT' ? number_format($t->rate, 2).'%' : number_format($t->rate, 2) ?>)
                  </label>
                </div>
              </div>
            <?php endforeach ?>
          </div>
        </div>
        <div class="form-group">
          <label>Status</label>
          <select name="status" class="form-control">
            <option value="1">Active</option>
            <option value="0">Inactive</option>
          </select>
        </div>
        <button type="submit" class="btn btn-primary">Submit</button>
      <?= form_close() ?>
    </div>
  </div>
</section>
<?= $this->endSection() ?>

