<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<!-- Brand Logo -->
<a href="index3.html" class="brand-link">
    <img src="<?= base_url('dist/img/AdminLTELogo.png'); ?>" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
    <span class="brand-text font-weight-light">CRM Delta</span>
</a>

    <!-- Sidebar -->
    <div class="sidebar">
        <!-- Sidebar user panel (optional) -->
        <div class="user-panel mt-3 pb-3 mb-3 d-flex">
            <div class="image">
                <img src="<?= base_url('dist/img/user2-160x160.jpg'); ?>" class="img-circle elevation-2" alt="User Image">
            </div>
            <div class="info">
                <a href="#" class="d-block">Admin</a>
            </div>
        </div>

        <?php
            $sidebar_menu = [
                [
                    'name' => 'Dashboard',
                    'url' => 'index',
                    'icon' => 'fas fa-tachometer-alt',
                    'submenu' => [],
                    'submenu_url' => []
                ],
                [
                    'name' => 'Manajemen Pengguna',
                    'url' => '',
                    'icon' => 'fas fa-users-cog',
                    'submenu' => [
                        'personil', 'unit', 'akun'
                    ],
                    'submenu_url' => [
                        'manajemen_pengguna/personil','manajemen_pengguna/unit','manajemen_pengguna/akun'
                    ]
                ],
                [
                    'name' => 'Perusahaan',
                    'url' => '',
                    'icon' => 'fas fa-building',
                    'submenu' => [
                        'Profil', 'Produk'
                    ],
                    'submenu_url' => [
                        'perusahaan/profil', 'perusahaan/produk'
                    ]
                ],
                [
                    'name' => 'Pemasaran',
                    'url' => '',
                    'icon' => 'fas fa-funnel-dollar',
                    'submenu' => [
                        'Klien', 'Proyek', 'Riwayat Proyek'
                    ],
                    'submenu_url' => [
                        'pemasaran/klien','pemasaran/proyek','pemasaran/riwayat_proyek'
                    ]
                ],
                [
                    'name' => 'Admin & Proyek Keuangan',
                    'url' => '',
                    'icon' => 'fas fa-money-check-alt',
                    'submenu' => [],
                    'submenu_url' => []
                ],
                [
                    'name' => 'Pengaturan',
                    'url' => '',
                    'icon' => 'fas fa-cogs',
                    'submenu' => [],
                    'submenu_url' => []
                ],
                [
                    'name' => 'Keluar',
                    'url' => 'logout',
                    'icon' => 'fas fa-sign-out-alt',
                    'submenu' => [],
                    'submenu_url' => []
                ],
            ];
        ?>
        <!-- Sidebar Menu -->
        <nav class="mt-2">
            <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
                <?php foreach($sidebar_menu as $skey => $sm) : ?>
                <li class="nav-item">
                    <a href="<?= ($sm['url'] == '') ? '#' : base_url($sm['url']); ?>" class="nav-link <?= ($sm['name'] == 'Dashboard') ? 'active' : ''; ?>">
                        <i class="nav-icon <?= ($sm['icon'] == '') ? 'fas fa-chart-pie' : $sm['icon']; ?>"></i>
                        <p>
                            <?= $sm['name']; ?>
                            <?php if(count($sm['submenu']) > 0) : ?>
                                <i class="right fas fa-angle-left"></i>
                            <?php endif; ?>
                        </p>
                    </a>
                    <?php if(count($sm['submenu']) > 0) : ?>
                        <ul class="nav nav-treeview">
                            <?php foreach($sm['submenu'] as $smkey => $ssm) : ?>
                            <li class="nav-item <?= preg_match('#^'.$sm['submenu_url'][$smkey].'#', uri_string()) ? 'active' : ""; ?>">
                                <a href="<?= ($sm['submenu_url'][$smkey] == '') ? '#' : base_url($sm['submenu_url'][$smkey]); ?>" class="nav-link">
                                    <i class="far fa-circle nav-icon"></i>
                                    <p><?= $ssm; ?></p>
                                </a>
                            </li>
                            <?php endforeach; ?>
                        </ul>
                    <?php endif; ?>
                </li>
                <?php endforeach; ?>
            </ul>
        </nav>
        <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
</aside>