<?= $this->session->flashdata('pesan'); ?>
<div class="card">
    <div class="card-header d-flex justify-content-between align-items-center w-100">
        <h3 class="card-title mb-1" style="margin-top: 5px;">Halaman Tambah Berita</h3>
    </div>
    <div class="col-lg-6 mt-2 ml-2 mb-4">
        <form action="<?= base_url('Berita/tambah_aksi') ?>" method="POST" enctype="multipart/form-data">
            <div class="form-group">
                <label>Gambar</label>
                <input type="file" name="gambar" class="form-control" value="<?= set_value('gambar') ?>">
                <?= form_error('gambar', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Judul</label>
                <textarea name="judul" class="form-control" value="<?= set_value('judul') ?>" placeholder="Input Judul"></textarea>
                <?= form_error('judul', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Deskripsi Singkat</label>
                <textarea name="deskripsi" class="form-control" value="<?= set_value('deskripsi') ?>" placeholder="Input Deskripsi"></textarea>
                <?= form_error('deskripsi', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <div class="form-group">
                <label>Tanggal</label>
                <input type="text" id="tanggal" name="tanggal" class="form-control" value="<?= set_value('tanggal') ?>" placeholder="Input Tanggal">
                <?= form_error('tanggal', '<div class="text-small text-danger">', '</div>'); ?>
            </div>
            <a href="<?= base_url('berita') ?>" class="btn btn-danger btn-sm">
                <i class="fas fa-solid fa-angle-left"></i> Kembali
            </a>
            <button type="submit" class="btn btn-primary btn-sm"><i class="fas fa-save"></i> Simpan </button>
        </form>
    </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
<script>
    flatpickr("#tanggal", {
        enableTime: true,
        dateFormat: "d/m/Y H:i:S", // hasil: 2025/06/15 14:30
        time_24hr: true,
        enableSeconds: true
    });
</script>