<?php
require_once __DIR__ . "/../includes/currency_helper.php"; // helper included
?>

<div class="sidebar">

    <div class="sidebar-header">
        <h2></h2>
        <p></p>
    </div>

    <!-- Accounts Section -->
    <div class="sidebar-section">
        <h3>Accounts</h3>

        <?php foreach ($accounts as $acc): ?>
            <div class="account-box">
                <b>
                    Number:
                    <?= htmlspecialchars($acc['account_number']) ?>
                </b>
                <br>

                <b>
                    Name:
                    <?= htmlspecialchars($user['first_name'] . ' ' . $user['last_name']) ?>
                </b>
                <br>

                Balance:
                <?= formatCurrency($acc['balance'], $acc['currency']) ?>
            </div>
        <?php endforeach; ?>
    </div>

    <!-- Menu Section -->
    <div class="sidebar-section">
        <h3>Menu</h3>

        <a href="/user/dashboard.php">
            🏠 Dashboard
        </a>

        <!-- Transfer Disabled if Suspended -->
        <?php if (($user['status'] ?? '') !== 'suspended'): ?>
            <a href="/transfer/initiate_transfer.php">
                💸 Fund Transfer
            </a>
        <?php else: ?>
            <span style="
                display: block;
                padding: 12px 0;
                color: #999;
                cursor: not-allowed;
                opacity: 0.7;
                font-weight: 500;
            ">
                💸 Fund Transfer (Disabled)
            </span>
        <?php endif; ?>

        <a href="/user/transaction_history.php">
            📄 Transactions
        </a>

        <a href="/user/profile.php">
            👤 Profile
        </a>

        <a href="/user/notifications.php">
            🔔 Notifications
        </a>

        <a href="/auth/logout.php">
            🚪 Logout
        </a>
    </div>

</div>