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

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

  <?= $this->section('content') ?>
  <section class="section">
      <div class="section-header">
          <h1>Tambah Data Berita</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('berita') ?>">Berita</a></div>
              <div class="breadcrumb-item">Tambah Berita</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">Tambah Data Berita</h2>
          <p class="section-lead">
              Halaman tambah 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('berita') ?>" type="button" class="btn btn-info sm">
                                  <i class="fas fa-arrow-left"></i> Kembali
                              </a>
                          </div>
                      </div>
                      <div class="card-body">
                          <form action="<?= base_url('berita') ?>" method="post" enctype="multipart/form-data"
                              autocomplete="off" class="needs-validation" novalidate="">
                              <?= csrf_field() ?>
                              <div class="form-group">
                                  <label>Judul Berita</label>
                                  <input type="text" name="judul" placeholder="Input judul berita" class="form-control"
                                      required>
                                  <div class="invalid-feedback text-danger">Masukan judul berita</div>
                              </div>
                              <div class="form-group">
                                  <label>Kategori</label>
                                  <select class="form-control select2" name="kategori" required>
                                      <option value="">
                                          <- Pilih kategori ->
                                      </option>
                                      <option value="Lokal">Lokal</option>
                                      <option value="Daerah">Daerah</option>
                                      <option value="Umum">Umum</option>
                                  </select>
                                  <div class="invalid-feedback text-danger">Pilih kategori</div>
                              </div>
                              <div class="form-group">
                                  <label>Foto</label>
                                  <input type="file" class="form-control" name="gambar"
                                      accept="image/png, image/jpg, image/jpeg" required>
                                  <div class="invalid-feedback text-danger">Pilih gambar</div>
                                  <p><small class="text-muted">Ukuran max 1024k.</small></p>
                              </div>
                              <div class="form-group">
                                  <label>Tanggal Berita</label>
                                  <input type="date" name="tanggal" placeholder="Input tanggal" class="form-control"
                                      required>
                                  <div class="invalid-feedback text-danger">Masukan tanggal berita</div>
                              </div>
                              <div class="form-group">
                                  <label>Isi Berita</label>
                                  <textarea placeholder="Masukan isi berita" rows="5" name="isi"
                                      class="summernote-simple form-control" required></textarea>
                                  <div class="invalid-feedback text-danger">Masukan isi berita</div>
                              </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() ?>