<?php
    include('session.php');
?>

<!DOCTYPE html>
<html>
<head>
    <style>
.menu_left {
    height: 100vh;        /* full screen height */
    overflow-y: auto;     /* vertical scrollbar */
    overflow-x: hidden;   /* hide horizontal scroll */
}
</style>

<style>
.toggle-arrow {
    transition: transform 0.3s ease;
    margin-left: auto;   /* push to far right */
    padding-right: 20px; /* fine tune distance from edge */
}

.menu--link[aria-expanded="true"] .toggle-arrow {
    transform: rotate(180deg);
}

</style>

</head>

   <body>
        <div class="menu-container">
        <div class="left_section menu_left" id="js-menu">
            <div class="left_section">
                <ul id="accordionMenu">
                    <li class="menu--item">
                        <a href="dashboard-cms.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                            <i class="fa-solid fa-gauge menu--icon"></i>
                            <span class="menu--label">Dashboard</span>
                        </a>
                    </li>
                    
                    <li class="menu--item">
                        <a class="menu--link d-flex align-items-center" data-bs-toggle="collapse" href="#newEntryMenu" role="button">
                            <i class="fa-solid fa-file-circle-plus menu--icon"></i>
                            <span class="menu--label">New Entry</span>
                            <i class="fa-solid fa-chevron-right toggle-arrow"></i>
                        </a>
                    
                        <div class="collapse" id="newEntryMenu" data-bs-parent="#accordionMenu">
                        
                           <?php
                                $sql = "SELECT Prefix, Company FROM $tblcompany";
                                $result = mysqli_query($conn, $sql);
                                
                                while ($row = mysqli_fetch_assoc($result)) {
                                    $companyName = $row['Prefix'];
                                ?>
                                    <a href="new-records.php?id=<?php echo $companyName ;?>" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                        <i class="fa-solid fa-building menu--icon"></i>
                                        <span class="menu--label"><?php echo $companyName; ?></span>
                                    </a>
                                <?php
                                }
                                ?>
                        </div>
                    </li>
                    
                    <li class="menu--item">
                        <a class="menu--link d-flex align-items-center" data-bs-toggle="collapse" href="#StockRecords" role="button">
                            <i class="fa-solid fa-boxes-stacked menu--icon"></i>
                            <span class="menu--label">Stock Records</span>
                            <i class="fa-solid fa-chevron-right toggle-arrow"></i>
                        </a>
                        <div class="collapse" id="StockRecords" data-bs-parent="#accordionMenu">
                            <a href="#" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-tags menu--icon"></i>
                                <span class="menu--label">Production</span>
                            </a>
                             <a href="#" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-tags menu--icon"></i>
                                <span class="menu--label">Return</span>
                            </a>
                        </div>
                    </li>
                    
                    <li class="menu--item">
                        <a class="menu--link d-flex align-items-center" data-bs-toggle="collapse" href="#Reports" role="button">
                            <i class="fa-solid fa-file-lines menu--icon"></i>
                            <span class="menu--label">Reports</span>
                            <i class="fa-solid fa-chevron-right toggle-arrow"></i>
                        </a>
                        <div class="collapse" id="Reports" data-bs-parent="#accordionMenu">
                            <a href="rep-prod-details.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                            <i class="fa-solid fa-tags menu--icon"></i>
                            <span class="menu--label">Products</span>
                        </a>
                        <a href="rep-daily-stock.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                            <i class="fa-solid fa-history menu--icon"></i>
                            <span class="menu--label">Daily Stocks</span>
                        </a>
                        <a href="rep-monthly-stock.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                            <i class="fa-solid fa-history menu--icon"></i>
                            <span class="menu--label">Monthly Stocks</span>
                        </a>
                        </div>
                    </li>
                    
                    <li class="menu--item">
                        <a class="menu--link d-flex align-items-center" data-bs-toggle="collapse" href="#Settings" role="button">
                            <i class="fa-solid fa-gear menu--icon"></i>
                            <span class="menu--label">Settings</span>
                            <i class="fa-solid fa-chevron-right toggle-arrow"></i>
                        </a>
                        <div class="collapse" id="Settings" data-bs-parent="#accordionMenu">
                            <a href="prod-details.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-tags menu--icon"></i>
                                <span class="menu--label">Products</span>
                            </a>
                            <a href="prod-size.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-ruler-combined menu--icon"></i>
                                <span class="menu--label">Product Size</span>
                            </a>
                            <a href="prod-type.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-warehouse menu--icon"></i>
                                <span class="menu--label">Product Type</span>
                            </a>
                            <a href="company.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-building menu--icon"></i>
                                <span class="menu--label">Company Details</span>
                            </a>
                            <a href="locations.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-location-dot menu--icon"></i>
                                <span class="menu--label">Location Details</span>
                            </a>
                            <a href="#" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-cogs menu--icon"></i>
                                <span class="menu--label">Machinery</span>
                            </a>
                            <a href="#" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-truck menu--icon"></i>
                                <span class="menu--label">Vehicles</span>
                            </a>
                            <a href="#" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-car-side menu--icon"></i>
                                <span class="menu--label">Drivers</span>
                            </a>
                            <a href="workers.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-hard-hat menu--icon"></i>
                                <span class="menu--label">Workers</span>
                            </a>
                            <a href="users.php" class="menu--link" data-bs-toggle="tooltip" data-bs-placement="right">
                                <i class="fa-solid fa-user-circle menu--icon"></i>
                                <span class="menu--label">Users</span>
                            </a>
                        </div>
                    </li>

            </div>
        </div>
    </div>
   </body>

</html>
