<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Sidebar</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/css/bootstrap.min.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
</head>
<?php
$pageName = basename($_SERVER['SCRIPT_NAME']);

// session_start();
                                
// if (isset($_SESSION['browser_id'])) {
//     $browserId = $_SESSION['browser_id'];
// } else {
//     // Generate a new browser ID
//     $browserId = generateUniqueBrowserId();

//     // Store the browser ID in the session for future use
//     $_SESSION['browser_id'] = $browserId;
// }

?>

<body>
    <aside id="sidebar" class="js-sidebar">
        <div class="h-100">
            <div class="sidebar-logo">
                <a href="#">
                    <?php
                    $b_id = $browserId;
                            
                                $sql = "SELECT * FROM ".$cargo." WHERE browser_id='$b_id'";
                                $result = $connection->query($sql);
                                if ($result && $result->num_rows > 0) {
                                  while ($row = $result->fetch_assoc()) {
                             
                                    $seller = $row['cargo'];
                                    echo $seller;


                            }
        
                        }
                        ?>
                        </a>
            </div>
            <ul class="sidebar-nav">
                <li class="sidebar-header">
                    Admin Elements
                </li>


                <!-- စာရင်းသွင်း -->
                <li class="sidebar-item">
                    
                    <a href="#" class="sidebar-link <?php echo ($pageName == 'product_add_new.php' ||$pageName == 'product_refill.php' ||$pageName == 'product_damage.php' ||$pageName == 'product_change.php' || $pageName == 'product_view.php' || $pageName == 'product_trans.php'|| $pageName == 'product_voucher.php') ? '' : 'collapsed'; ?>" data-bs-target="#expense" data-bs-toggle="collapse" aria-expanded="<?php echo ($pageName == 'product_add_new.php' ||$pageName == 'product_refill.php' ||$pageName == 'product_damage.php' ||$pageName == 'product_change.php' || $pageName == 'product_view.php' || $pageName == 'product_trans.php'||$pageName == 'product_trans_data.php'|| $pageName == 'product_voucher.php') ? 'true' : 'false'; ?>">
                        <i class="fa-solid fa-money-bill-trend-up"></i>
                        <b>ပစ္စည်းစာရင်း</b>
                    </a>

                    <ul id="expense" class="sidebar-dropdown list-unstyled collapse <?php echo ($pageName == 'product_add_new.php' ||$pageName == 'product_refill.php' ||$pageName == 'product_damage.php' ||$pageName == 'product_change.php' || $pageName == 'product_view.php' || $pageName == 'product_trans.php'||$pageName == 'product_trans_data.php'|| $pageName == 'product_voucher.php') ? 'show' : ''; ?>" data-bs-parent="#sidebar">
                      
                        <li class="sidebar-item">
                            <a href="product_add_new.php" class="sidebar-link <?php echo $pageName == 'product_add_new.php' ? 'active' : '';?>">
                                <i class="fa <?php echo $pageName == 'product_add_new.php' ? 'fa-solid fa-circle' : 'fa-regular fa-circle'; ?>" 
                                style="margin-left:10px;">&nbsp;အသစ်ထည့်ရန်</i>
                            </a>
                        </li>

                        <li class="sidebar-item">
                            <a href="product_refill.php" class="sidebar-link <?php echo $pageName == 'product_refill.php' ? 'active' : '';?>">
                                <i class="fa <?php echo $pageName == 'product_refill.php' ? 'fa-solid fa-circle' : 'fa-regular fa-circle'; ?>" 
                                style="margin-left:10px;">&nbsp;ပစ္စည်းဖြည့်ရန်</i>
                            </a>
                        </li>

                        <li class="sidebar-item">
                            <a href="product_damage.php" class="sidebar-link <?php echo $pageName == 'product_damage.php' ? 'active' : '';?>">
                                <i class="fa <?php echo $pageName == 'product_damage.php' ? 'fa-solid fa-circle' : 'fa-regular fa-circle'; ?>" 
                                style="margin-left:10px;">&nbsp;ပျက်စီးစားရင်း</i>
                            </a>
                        </li>

                        <li class="sidebar-item">
                            <a href="product_change.php" class="sidebar-link <?php echo $pageName == 'product_change.php' ? 'active' : '';?>">
                                <i class="fa <?php echo $pageName == 'product_change.php' ? 'fa-solid fa-circle' : 'fa-regular fa-circle'; ?>" 
                                style="margin-left:10px;">&nbsp;ဗူးကဒ်ဖာ</i>
                            </a>
                        </li>

                        <li class="sidebar-item">
                            <a href="product_trans.php" class="sidebar-link <?php echo $pageName == 'product_trans.php' ? 'active' : '';?>">
                                <i class="fa <?php echo $pageName == 'product_trans.php' ? 'fa-solid fa-circle' : 'fa-regular fa-circle'; ?>" 
                                style="margin-left:10px;">&nbsp;ပစ္စည်းပို့ရန်</i>
                            </a>
                        </li>

                        <li class="sidebar-item">
                            <a href="product_trans_data.php" class="sidebar-link <?php echo $pageName == 'product_trans_data.php' ? 'active' : '';?>">
                                <i class="fa <?php echo $pageName == 'product_trans_data.php' ? 'fa-solid fa-circle' : 'fa-regular fa-circle'; ?>" 
                                style="margin-left:10px;">&nbsp;ပစ္စည်းပို့စာရင်း</i>
                            </a>
                        </li>

                        <li class="sidebar-item">
                            <a href="product_voucher.php" class="sidebar-link <?php echo $pageName == 'product_voucher.php' ? 'active' : '';?>">
                                <i class="fa <?php echo $pageName == 'product_voucher.php' ? 'fa-solid fa-circle' : 'fa-regular fa-circle'; ?>"
                                 style="margin-left:10px;">&nbsp;ပေါင်ချာ</i>
                            </a>
                        </li>

                        <li class="sidebar-item">
                            <a href="product_view.php" class="sidebar-link <?php echo $pageName == 'product_view.php' ? 'active' : '';?>">
                                <i class="fa <?php echo $pageName == 'product_view.php' ? 'fa-solid fa-circle' : 'fa-regular fa-circle'; ?>" 
                                style="margin-left:10px;">&nbsp;ပစ္စည်းစာရင်း</i>
                            </a>
                        </li>

                    </ul>
                </li>
            </ul>
        </div>
    </aside>
</body>
</html>
