<?= $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>Edit Wallet</h1>
      </div>
    </div>
  </div>
</section>

<section class="content">
<?php echo form_open('rewarderWallets/update/'.$wallet->user_id, ['class' => 'form-validate', 'autocomplete' => 'off']); ?>
  <div class="card">
    <div class="card-body">
      <div class="form-group">
        <label>Customer</label>
        <input type="text" class="form-control" value="<?php echo esc($user->name) ?> (<?php echo esc($user->username ?? $user->email) ?>)" disabled>
      </div>
      <div class="form-group">
        <label>Points</label>
        <input type="number" min="0" class="form-control" name="points_balance" value="<?php echo esc($wallet->points_balance) ?>" required>
      </div>
    </div>
    <div class="card-footer">
      <div class="row">
        <div class="col"><a href="<?php echo url('rewarderWallets') ?>" class="btn btn-flat btn-danger" onclick="return confirm('Leave without saving?')">Cancel</a></div>
        <div class="col text-right"><button type="submit" class="btn btn-flat btn-primary">Save</button></div>
      </div>
    </div>
  </div>
<?php echo form_close(); ?>
</section>

<?= $this->endSection() ?>
<?= $this->section('js') ?>
<script>
  $(document).ready(function() {
    $('.form-validate').validate();
  });
</script>
<?= $this->endSection() ?>

