<?= $this->extend('layout/template') ?>
<?= $this->section('content') ?>

<div class="container-fluid">

    <!-- HEADER -->
    <div class="d-flex justify-content-between align-items-center mb-3">
        <div>
            <h4 class="font-weight-bold mb-1">
                <i class="fas fa-plus-circle text-primary mr-2"></i>
                Tambah Ruang Baca
            </h4>
            <small class="text-muted">
                Tambahkan buku atau artikel baru ke ruang baca
            </small>
        </div>

        <a href="<?= base_url('ruang_baca') ?>" class="btn btn-secondary shadow-sm">
            <i class="fas fa-arrow-left mr-1"></i>
            Kembali
        </a>
    </div>

    <!-- FORM -->
    <div class="card shadow-sm border-0">
        <div class="card-body">

            <form action="<?= base_url('ruang_baca/store') ?>" method="post" enctype="multipart/form-data">

                <?= csrf_field(); ?>

                <div class="row">

                    <div class="col-md-6">

                        <div class="form-group">
                            <label>Jenis</label>
                            <select name="jenis" id="jenis" class="form-control" required>
                                <option value="">-- Pilih Jenis --</option>
                                <option value="buku">Buku</option>
                                <option value="artikel">Artikel</option>
                            </select>
                        </div>

                        <div class="form-group">
                            <label>Judul</label>
                            <input type="text" name="judul" class="form-control" placeholder="Judul buku / artikel" required>
                        </div>

                        <div class="form-group">
                            <label>Penulis</label>
                            <input type="text" name="penulis" class="form-control" placeholder="Nama penulis" required>
                        </div>

                    </div>

                    <div class="col-md-6">

                        <div class="form-group">
                            <label>Kategori</label>
                            <select name="kategori" class="form-control">
                                <option value="">-- Pilih Kategori --</option>
                                <option>Pelajaran</option>
                                <option>Novel</option>
                                <option>Agama</option>
                                <option>Komputer</option>
                                <option>Ilmiah</option>
                                <option>Ensiklopedia</option>
                                <option>Lainnya</option>
                            </select>
                        </div>

                        <div class="form-group">
                            <label>File PDF</label>
                            <div class="custom-file">
                                <input type="file" name="file_pdf" class="custom-file-input" id="file_pdf" accept="application/pdf" required>
                                <label class="custom-file-label" for="file_pdf">Pilih file PDF</label>
                            </div>
                            <small class="text-muted">
                                <i class="fas fa-info-circle mr-1"></i>
                                Hanya file dengan format PDF yang diizinkan.
                            </small>
                        </div>

                    </div>

                </div>

                <div class="border-top pt-3">

                    <button class="btn btn-primary">
                        <i class="fas fa-save mr-1"></i>
                        Simpan
                    </button>

                    <a href="<?= base_url('ruang_baca') ?>" class="btn btn-secondary">
                        Batal
                    </a>

                </div>

            </form>

        </div>
    </div>

</div>

<script src="<?= base_url('plugins/bs-custom-file-input/bs-custom-file-input.min.js') ?>"></script>
<script>
$(document).ready(function () {
    bsCustomFileInput.init();
});
</script>

<?= $this->endSection() ?>
