<?php
$current = basename($_SERVER['PHP_SELF']);
?>

<div class="sidebar">
    <div class="brand-box">
        <div class="brand-logo">
            <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2" color="white">
                <path stroke-linecap="round" stroke-linejoin="round" d="M12 8c-2.5 0-4 1.2-4 2.5S9.5 13 12 13s4 1.2 4 2.5S14.5 18 12 18m0-10V6m0 12v-2"/>
            </svg>
        </div>
        <div>
            <p class="brand-title">Tabungan App</p>
            <p class="brand-subtitle">Sistem Pengelola Saldo</p>
        </div>
    </div>

    <div class="menu-title">Menu Utama</div>

    <?php if ($_SESSION['role'] == 'admin'): ?>

        <a href="/tabungan-app/admin/dashboard.php" class="<?= $current == 'dashboard.php' ? 'active' : ''; ?>">
            <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round" d="M3 12l2-2 4 4 8-8 4 4"/>
            </svg>
            Dashboard
        </a>

        <a href="/tabungan-app/admin/users.php" class="<?= in_array($current, ['users.php','user_tambah.php','user_edit.php','user_hapus.php']) ? 'active' : ''; ?>">
            <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round" d="M17 20h5V4H2v16h5m10 0v-2a4 4 0 00-4-4H11a4 4 0 00-4 4v2m10 0H7m10-10a4 4 0 11-8 0 4 4 0 018 0z"/>
            </svg>
            Management User
        </a>

        <a href="/tabungan-app/admin/transaksi.php" class="<?= in_array($current, ['transaksi.php','transaksi_konfirmasi.php','transaksi_tolak.php']) ? 'active' : ''; ?>">
            <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round" d="M17 9V7a5 5 0 00-10 0v2M5 9h14l-1 10H6L5 9z"/>
            </svg>
            Data Setoran
        </a>

        <a href="/tabungan-app/admin/withdrawals.php" class="<?= in_array($current, ['withdrawals.php','withdrawal_konfirmasi.php','withdrawal_tolak.php']) ? 'active' : ''; ?>">
            <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round" d="M4 7h16M4 12h10M4 17h16"/>
            </svg>
            Data Penarikan
        </a>

        <a href="/tabungan-app/admin/grafik.php" class="<?= $current == 'grafik.php' ? 'active' : ''; ?>">
            <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round" d="M7 17V9m5 8V5m5 12v-4"/>
            </svg>
            Grafik
        </a>


    <?php else: ?>

        <a href="/tabungan-app/client/dashboard.php" class="<?= $current == 'dashboard.php' ? 'active' : ''; ?>">
            <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round" d="M3 12l2-2 4 4 8-8 4 4"/>
            </svg>
            Dashboard
        </a>
        
        <a href="/tabungan-app/client/riwayat_setoran.php" class="<?= $current == 'riwayat_setoran.php' ? 'active' : ''; ?>">
    <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
        <path stroke-linecap="round" stroke-linejoin="round" d="M12 3v12m0 0l-4-4m4 4l4-4M5 21h14"/>
    </svg>
    Riwayat Setoran
</a>

<a href="/tabungan-app/client/riwayat_penarikan.php" class="<?= $current == 'riwayat_penarikan.php' ? 'active' : ''; ?>">
    <svg class="menu-icon" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
        <path stroke-linecap="round" stroke-linejoin="round" d="M12 21V9m0 0l4 4m-4-4l-4 4M5 3h14"/>
    </svg>
    Riwayat Penarikan
</a>

    <?php endif; ?>
</div>