<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Sari Rasa | Dashboard</title>

    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/css/adminlte.min.css">

    <style>
        /* Custom Emerald Theme */
        .main-sidebar {
            background-color: #065f46 !important;
        }

        /* Emerald Gelap */
        .nav-pills .nav-link.active,
        .btn-emerald {
            background-color: #10b981 !important;
            /* Emerald Standar */
            color: white !important;
        }

        .brand-link {
            border-bottom: 1px solid #059669 !important;
        }

        .sidebar-dark-primary .nav-sidebar>.nav-item>.nav-link.active {
            background-color: #10b981 !important;
        }

        .content-wrapper {
            background-color: #f0fdf4;
        }

        /* Tambahkan di layout/main.php */
        .bg-emerald {
            background-color: #10b981 !important;
            color: white !important;
        }

        .card-emerald.card-outline {
            border-top: 3px solid #10b981 !important;
        }

        .border-emerald {
            border-color: #10b981 !important;
        }

        .text-emerald {
            color: #10b981 !important;
        }

        @media print {

            /* Sembunyikan elemen UI bawaan saat cetak */
            .main-sidebar,
            .main-header,
            .card-tools,
            .info-box,
            .btn,
            .main-footer {
                display: none !important;
            }

            .content-wrapper {
                margin-left: 0 !important;
                background-color: white !important;
            }

            .card {
                border: none !important;
                box-shadow: none !important;
            }

            /* Tampilkan elemen khusus cetak (Kop Surat & Tanda Tangan) */
            .print-only {
                display: block !important;
            }

            /* Hilangkan warna background header tabel agar hemat tinta */
            .table thead th {
                background-color: white !important;
                color: black !important;
                border-color: black !important;
            }

            .table td,
            .table th {
                border-color: black !important;
            }
        }

        /* Background hijau sangat muda */
    </style>
</head>

<body class="hold-transition sidebar-mini">
    <div class="wrapper">

        <nav class="main-header navbar navbar-expand navbar-white navbar-light">
            <ul class="navbar-nav">
                <li class="nav-item">
                    <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
                </li>
            </ul>
        </nav>

        <aside class="main-sidebar sidebar-dark-primary elevation-4">
            <a href="#" class="brand-link">
                <span class="brand-text font-weight-light pl-3"><b>SARI RASA</b> Pupuk</span>
            </a>
            <div class="user-panel mt-3 pb-3 mb-3 d-flex border-bottom border-emerald">
                <div class="image pt-1">
                    <i class="fas fa-user-circle fa-2x text-light"></i>
                </div>
                <div class="info">
                    <a href="#" class="d-block text-white text-bold"><?= session()->get('nama_lengkap') ?></a>
                    <span class="badge badge-warning text-uppercase"><?= session()->get('role') ?></span>
                </div>
            </div>
            <div class="sidebar">
                <nav class="mt-2">
                    <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu">
                        <li class="nav-item">
                            <a href="<?= base_url('/') ?>" class="nav-link">
                                <i class="nav-icon fas fa-tachometer-alt"></i>
                                <p>Dashboard</p>
                            </a>
                        </li>
                        <li class="nav-header">MANAJEMEN DATA</li>
                        <li class="nav-item">
                            <a href="<?= base_url('petani') ?>" class="nav-link">
                                <i class="nav-icon fas fa-users"></i>
                                <p>Data Petani</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="<?= base_url('pupuk') ?>" class="nav-link">
                                <i class="nav-icon fas fa-leaf"></i>
                                <p>Stok Pupuk</p>
                            </a>
                        </li>
                        <li class="nav-item">
                            <a href="<?= base_url('alokasi') ?>" class="nav-link">
                                <i class="nav-icon fas fa-clipboard-list"></i>
                                <p>Alokasi e-RDKK</p>
                            </a>
                        </li>
                        <li class="nav-header">TRANSAKSI</li>
                        <li class="nav-item">
                            <a href="<?= base_url('transaksi') ?>" class="nav-link">
                                <i class="nav-icon fas fa-shopping-cart"></i>
                                <p>Penebusan Pupuk</p>
                            </a>
                        </li>
                        <li class="nav-header">AKUN & SISTEM</li>


                        <li class="nav-item">
                            <a href="<?= base_url('user') ?>" class="nav-link">
                                <i class="nav-icon fas fa-users-cog"></i>
                                <p>Manajemen Pengguna</p>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a href="<?= base_url('keuangan') ?>" class="nav-link">
                                <i class="nav-icon fas fa-wallet"></i>
                                <p>Laporan Keuangan</p>
                            </a>
                        </li>

                        <li class="nav-item">
                            <a href="<?= base_url('alokasi/cetak') ?>" target="_blank" class="nav-link">
                                <i class="nav-icon fas fa-file-contract"></i>
                                <p>Laporan Alokasi (e-RDKK)</p>
                            </a>
                        </li>
                    </ul>

                    <li class="nav-header">AKUN</li>
                    <li class="nav-item">
                        <a href="<?= base_url('auth/logout') ?>" class="nav-link text-danger" onclick="return confirm('Yakin ingin keluar dari sistem?')">
                            <i class="nav-icon fas fa-sign-out-alt"></i>
                            <p>Keluar (Logout)</p>
                        </a>
                    </li>
                </nav>
            </div>
        </aside>

        <div class="content-wrapper">
            <section class="content-header">
                <div class="container-fluid">
                    <h1><?= $title ?? 'Sistem Informasi' ?></h1>
                </div>
            </section>

            <section class="content">
                <div class="container-fluid">
                    <?php if (session()->getFlashdata('success')) : ?>
                        <div class="alert alert-success alert-dismissible fade show shadow-sm" role="alert">
                            <i class="icon fas fa-check-circle"></i>
                            <?= session()->getFlashdata('success') ?>
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                    <?php endif; ?>

                    <?php if (session()->getFlashdata('error')) : ?>
                        <div class="alert alert-danger alert-dismissible fade show shadow-sm" role="alert">
                            <i class="icon fas fa-ban"></i>
                            <?= session()->getFlashdata('error') ?>
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                    <?php endif; ?>
                    <?= $this->renderSection('content') ?>
                </div>
            </section>
        </div>

        <footer class="main-footer">
            <div class="float-right d-none d-sm-inline">v1.0</div>
            <strong>Copyright &copy; 2026 Kelompok Tani Sari Rasa.</strong>
        </footer>
    </div>

    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/admin-lte@3.2/dist/js/adminlte.min.js"></script>
</body>

</html>