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

<?= $this->section('content') ?>
<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <div>
            <h1 class="h3 mb-1 text-gray-800 fw-bold">Import Excel Progres</h1>
            <p class="mb-0 text-muted">Upload file evaluasi RENJA format resmi untuk mengisi progres</p>
        </div>
        <a href="<?= base_url('opd_kinerja/dashboard') ?>" class="btn btn-secondary shadow-sm">
            <i class="fas fa-arrow-left me-1"></i> Kembali
        </a>
    </div>

    <?php if(session()->getFlashdata('success')): ?>
        <div class="alert alert-success alert-dismissible fade show shadow-sm border-0 border-start border-success border-4" role="alert">
            <i class="fas fa-check-circle me-2"></i> <?= session()->getFlashdata('success') ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>

    <?php if(session()->getFlashdata('error')): ?>
        <div class="alert alert-danger alert-dismissible fade show shadow-sm border-0 border-start border-danger border-4" role="alert">
            <i class="fas fa-times-circle me-2"></i> <?= session()->getFlashdata('error') ?>
            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
        </div>
    <?php endif; ?>

    <div class="card shadow-sm border-0 mb-4 rounded-3">
        <div class="card-body">
            <form action="<?= base_url('opd_kinerja/import_excel') ?>" method="post" enctype="multipart/form-data">
                <div class="row">
                    <div class="col-md-6">
                        <div class="mb-3">
                            <label for="tahun" class="form-label fw-bold text-secondary">Tahun <span class="text-danger">*</span></label>
                            <input type="number" class="form-control" id="tahun" name="tahun" value="<?= date('Y') ?>" required>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="mb-3">
                            <label for="triwulan" class="form-label fw-bold text-secondary">Triwulan <span class="text-danger">*</span></label>
                            <select class="form-select" id="triwulan" name="triwulan" required>
                                <option value="1">Triwulan 1</option>
                                <option value="2">Triwulan 2</option>
                                <option value="3">Triwulan 3</option>
                                <option value="4">Triwulan 4</option>
                            </select>
                        </div>
                    </div>
                </div>

                <div class="mb-3">
                    <label for="file_excel" class="form-label fw-bold text-secondary">File Excel Evaluasi RENJA <span class="text-danger">*</span></label>
                    <input type="file" class="form-control" id="file_excel" name="file_excel" accept=".xlsx,.xls" required>
                    <div class="form-text">Format: xlsx/xls. Sistem membaca baris Program/Kegiatan/Sub Kegiatan dan kolom realisasi per triwulan.</div>
                </div>

                <div class="alert alert-info">
                    <div class="fw-bold mb-1">Yang akan diisi otomatis</div>
                    <div class="small text-muted">Master Program/Kegiatan/Sub Kegiatan, Target (Kinerja & Anggaran), dan Realisasi Triwulan terpilih.</div>
                </div>

                <hr>
                <div class="d-flex justify-content-end">
                    <button type="submit" class="btn btn-primary px-4">
                        <i class="fas fa-upload me-1"></i> Upload & Proses
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<?= $this->endSection() ?>

