  <?= $this->extend('layout/admin') ?>

  <?= $this->section('title') ?>
  <title>USER &mdash; KUA WAY BUNGUR</title>
  <?= $this->endSection() ?>

  <?= $this->section('content') ?>
  <section class="section">
      <div class="section-header">
          <h1>Edit Data User</h1>

          <div class="section-header-breadcrumb">
              <div class="breadcrumb-item active"><a href="<?= base_url('dashboard') ?>">Dashboard</a></div>
              <div class="breadcrumb-item active"><a href="<?= base_url('user') ?>">User</a></div>
              <div class="breadcrumb-item">Edit User</div>
          </div>
      </div>
      <?php if (session()->getFlashdata('error')) : ?>
      <div class="alert alert-danger alert-dismissible show fade">
          <div class="alert-body">
              <button class="close" data-dismiss="alert">X</button>
              <b>Error !</b>
              <?= session()->getFlashdata('error') ?>
          </div>
      </div>
      <?php endif; ?>

      <div class="section-body">
          <h2 class="section-title">Edit Data User</h2>
          <p class="section-lead">
              Halaman edit data.
          </p>

          <div class="row">
              <div class="col-12 col-md-12 col-lg-12">
                  <div class="card">

                      <div class="card-header">
                          <div class="section-header-button">
                              <a href="<?= base_url('user') ?>" type="button" class="btn btn-info sm">
                                  <i class="fas fa-arrow-left"></i> Kembali
                              </a>
                          </div>
                      </div>
                      <div class="card-body table-responsive">
                          <form action="<?= base_url('user/' . $user->id_admin) ?>" method="post"
                              enctype="multipart/form-data" autocomplete="off" class="needs-validation" novalidate="">
                              <?= csrf_field() ?>
                              <input type="hidden" name="_method" value="PUT">
                              <div class="form-group">
                                  <label>Nama</label>
                                  <input type="text" name="nama_admin" value="<?= $user->nama_admin ?>"
                                      class="form-control" required>
                                  <div class="invalid-feedback text-danger">Masukan nama</div>
                              </div>
                              <div class="form-group">
                                  <label>Email</label>
                                  <input type="email" name="email_admin" value="<?= $user->email_admin ?>"
                                      class="form-control" required>
                                  <div class="invalid-feedback text-danger">Masukan email</div>
                              </div>
                              <div class="form-group">
                                  <label>Password</label>
                                  <input type="password" name="password_admin" class="form-control" required></input>
                                  <div class="invalid-feedback text-danger">Masukan password</div>
                                  <small class="text-muted font-italic">*Minimal 6 karakter</small>
                              </div>
                              <div class="form-group">
                                  <label>Foto</label>
                                  <input type="file" class="form-control" name="gambar_admin"
                                      accept="image/png, image/gif, image/jpeg" required>
                                  <div class="invalid-feedback text-danger">Pilih gambar</div>
                                  <small class="text-muted font-italic">*Maksimal ukuran 1024k</small>
                              </div>
                              <div class="text-right">
                                  <button type="reset" class="btn btn-secondary">Reset</button>
                                  <button type="submit" class="btn btn-primary"><i class="fas fa-paper-plane"></i>
                                      Simpan</button>

                              </div>
                          </form>
                      </div>

                  </div>
              </div>
  </section>
  <?= $this->endSection() ?>