<?php

$menuOptions ="";


$currentURI = $_SERVER['REQUEST_URI'];

// Extract the page name from the URI
$currentPage = basename($currentURI);

// If the current page is a directory index file (e.g., index.php), remove it from the URI
$currentPage = str_replace('index.php', '', $currentPage);

// Remove any query parameters from the URI
$currentPage = strtok($currentPage, '?');

$id=$this->Session->read('Auth.User.id');
$role=$this->Session->read('Auth.User.role');	
$modules=subadminmodule;
$flags = [];

if($role!='admin'){
    foreach ($modules as $module) {
        $flags[$module] = false;
    }

    $modulenames=$this->Session->read('Auth.User.modules');	
    
    $modulesarray = explode(',', $modulenames);
    foreach ($modulesarray as $moduleName) {
        if (array_key_exists($moduleName, $flags)) {
            $flags[$moduleName] = true;
        }
    }
}else{
    foreach ($modules as $module) {
        $flags[$module] = true;
    }
}

if (!empty($this->Session->read('Auth.User.role'))) {

    
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . ($currentPage == 'home' ? 'active' : '') . '" href="home">Dashboard</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item' . (empty($flags['location_management']) ? ' hidden' : '') . '">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['create_location', 'location_list', 'view_location', 'edit_location']) ? 'active' : '') . '" href="location_list">Location&nbsp;Management</a>
        </h6>
    </li>';
    
    $menuOptions .= '<li class="nav-item' . (empty($flags['subadmin_management']) ? ' hidden' : '') . '">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['create_subadmin', 'subadmin_list', 'edit_subadmin']) ? 'active' : '') . '" href="subadmin_list">Subadmin&nbsp;Management</a>
        </h6>
    </li>';
    
    $menuOptions .= '<li class="nav-item' . (empty($flags['cashier_management']) ? ' hidden' : '') . '">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['create_cashier', 'cashier_list', 'edit_cashier']) ? 'active' : '') . '" href="cashier_list">Cashier&nbsp;Management</a>
        </h6>
    </li>';
    
    //kds
    $kdsPages = [
        'kds' => ['KDS', ['create_kds', 'kds']],
        'kds_users' => ['Users', ['kds_users','create_kds_users','edit_kds_users']],
        'kds_reports' => ['Report', ['kds_reports']],
    ];
    
    // Build the list of all inventory pages for matching
    $allkdsPages = [];
    foreach ($kdsPages as $kdsdetails) {
        if (is_array($kdsdetails)) {
            $allkdsPages = array_merge($allkdsPages, $kdsdetails[1]);
        }
    }
    
    // Determine if any inventory page is active
    $kdsActive = in_array($currentPage, $allkdsPages);
    $kdsDisplayStyle = $kdsActive ? 'block' : 'none';
    
    // Render Inventory Management menu
    $menuOptions .= '<li class="nav-item ' . (empty($flags['kds_management']) ? ' hidden' : '') . '" style="cursor:pointer;">';
    $menuOptions .= '<h6 class="menu-title" onclick="togglekds()">KDS Management</h6>';
    $menuOptions .= '<ul class="nav flex-column kds-submenu" style="display:' . $kdsDisplayStyle . ';">';
    
    foreach ($kdsPages as $page => $kdsdetails) {
        $label = is_array($kdsdetails) ? $kdsdetails[0] : $kdsdetails;
        $isActive = in_array($currentPage, is_array($kdsdetails) ? $kdsdetails[1] : [$page]) ? ' active' : '';
        $menuOptions .= '<li class="nav-item"><a class="nav-link' . $isActive . '" href="' . $page . '">' . $label . '</a></li>';
    }
    
    $menuOptions .= '</ul></li>';
    
    // $menuOptions .= '<li class="nav-item' . (empty($flags['kds_management']) ? ' hidden' : '') . '">
    //     <h6 class="menu-title">
    //         <a class="' . (in_array($currentPage, ['create_kds', 'kds']) ? 'active' : '') . '" href="kds">KDS&nbsp;Management</a>
    //     </h6>
    // </li>';
    
    $menuOptions .= '<li class="nav-item' . (empty($flags['card_management']) ? ' hidden' : '') . '">
        <h6 class="menu-title">
            <a class="' . ($currentPage == 'card_list' ? 'active' : '') . '" href="card_list">Card&nbsp;Management</a>
        </h6>
    </li>';
    
    // Define all current catalogue pages
    $allCataloguePages = [
        'category_list', 'create_category', 'edit_category', 'view_category',
        'subcategory_list', 'create_subcategory', 'edit_subcategory', 'view_subcategory',
        'tax_list', 'create_tax', 'edit_tax',
        'unit_list', 'create_unit', 'edit_unit',
        'unit_mapping', 'create_unit_mapping', 'edit_unit_mapping',
        'product_list', 'create_product', 'edit_product', 'view_product', 'product_recipe', 'product_modifier',
        'store_category', 'manage_store_category', 'store_products', 'manage_store_products',
        'modifiers', 'create_modifier', 'edit_modifiers', 'view_modifier', 'modifier_recipe',
        'modifiers_group', 'create_modifiers_group', 'edit_modifier_group', 'view_modifiers_group',
        'offers', 'create_offers', 'view_offer'
    ];
    
    // Show or hide catalogue submenu based on currentPage
    $catalogueActive = in_array($currentPage, $allCataloguePages);
    $catalogueDisplayStyle = $catalogueActive ? 'block' : 'none';
    
    // Define visible sub-menu items
    $cataloguePages = [
        'category_list' => ['Category List', ['category_list', 'create_category', 'edit_category', 'view_category']],
        'store_category' => ['Store Categories', ['store_category', 'manage_store_category']],
        'subcategory_list' => ['Sub Category List', ['subcategory_list', 'create_subcategory', 'edit_subcategory', 'view_subcategory']],
        'unit_list' => ['Units', ['unit_list', 'create_unit', 'edit_unit']],
        'unit_mapping' => ['Unit Mapping', ['unit_mapping', 'create_unit_mapping', 'edit_unit_mapping']],
        'tax_list' => ['Taxes', ['tax_list', 'create_tax', 'edit_tax']],
		'outlet_tax_list' => ['Outlet Tax Overrides', ['outlet_tax_list', 'save_outlet_tax', 'delete_outlet_tax']],
        'product_list' => ['Product List', ['product_list', 'create_product', 'edit_product', 'view_product', 'product_recipe', 'product_modifier']],
        'store_products' => ['Store Products', ['store_products', 'manage_store_products']],
        'modifiers' => ['Modifiers', ['modifiers', 'create_modifier', 'edit_modifiers', 'view_modifier', 'modifier_recipe']],
        'modifiers_group' => ['Modifiers Group', ['modifiers_group', 'create_modifiers_group', 'edit_modifier_group', 'view_modifiers_group']],
        'offers' => ['Offers', ['offers', 'create_offers', 'view_offer']],
    ];
    
    // Build menu HTML
    $menuOptions .= '<li class="nav-item ' . (empty($flags['catalogue_management']) ? ' hidden' : '') . '" style="cursor:pointer;">';
    $menuOptions .= '<h6 class="menu-title" onclick="togglecatalog()">Catalogue&nbspManagement</h6>';
    $menuOptions .= '<ul class="nav flex-column catalog-submenu" style="display:' . $catalogueDisplayStyle . ';">';
    
    foreach ($cataloguePages as $link => [$label, $relatedPages]) {
        $isActive = in_array($currentPage, $relatedPages) ? ' active' : '';
        $menuOptions .= '<li class="nav-item"><a class="nav-link' . $isActive . '" href="' . $link . '">' . $label . '</a></li>';
    }
    
    $menuOptions .= '</ul></li>';
    
    $inventoryPages = [
        'inv_category_list' => ['Category List', ['inv_category_list', 'inv_create_category', 'inv_edit_category', 'inv_view_category']],
        'inv_subcategory_list' => ['Sub Category List', ['inv_subcategory_list', 'inv_create_subcategory', 'inv_edit_subcategory', 'inv_view_subcategory']],
        'sku_list' => ['SKUs', ['sku_list', 'create_sku', 'edit_sku', 'view_sku']],
        'semifinished_list' => ['Semi-Finished', ['semifinished_list', 'create_semifinished', 'edit_semifinished', 'view_semifinished', 'add_recipe']],
		'recipe_integrity' => ['Recipe Integrity', ['recipe_integrity', 'create_missing_ingredient']], 
        'vendor_list' => ['Vendors', ['vendor_list', 'create_vendor', 'edit_vendor', 'view_vendor', 'map_vendor_with_sku']],
        'internal_indent_list' => ['Internal Indent', ['internal_indent_list', 'create_internal_indent', 'edit_internal_indent', 'view_internal_indent']],
        'po_list' => ['Purchase Order', ['po_list', 'create_po', 'edit_po', 'view_po']],
        'services' => ['Services', ['services', 'add_service', 'edit_service']],
        'service_po_list' => ['Service Purchase Order', ['service_po_list', 'create_service_po', 'edit_service_po', 'view_service_po']],
        'stockin' => ['Stockin', ['stockin']],
        'auditstock' => ['SKU Audit', ['auditstock', 'create_audit_stock', 'view_audit']],
        // 'semi_auditstock' => ['Semifinished Audit', ['semi_auditstock', 'semi_create_audit_stock', 'semi_view_audit']],
        'stock_damage' => ['SKU Damage', ['stock_damage', 'create_damage', 'edit_damage', 'view_damage']],
        // 'semi_stock_damage' => ['Semifinished Damage', ['semi_stock_damage', 'semi_create_damage', 'semi_edit_damage', 'semi_view_damage']],
    ];
    //    'stock_damage' => ['Damage', ['stock_damage', 'create_damage', 'edit_damage', 'view_damage']],
    
    if ($role === 'admin') {
        $inventoryPages['stock_transfer'] = ['Stock Transfer', ['stock_transfer', 'create_stock_tranfer', 'view_stock_transfer']];
    }
    
    // Build the list of all inventory pages for matching
    $allInventoryPages = [];
    foreach ($inventoryPages as $details) {
        if (is_array($details)) {
            $allInventoryPages = array_merge($allInventoryPages, $details[1]);
        }
    }
    
    // Determine if any inventory page is active
    $inventoryActive = in_array($currentPage, $allInventoryPages);
    $inventoryDisplayStyle = $inventoryActive ? 'block' : 'none';
    
    // Render Inventory Management menu
    $menuOptions .= '<li class="nav-item ' . (empty($flags['inventory_management']) ? ' hidden' : '') . '" style="cursor:pointer;">';
    $menuOptions .= '<h6 class="menu-title" onclick="toggleinventory()">Inventory&nbsp;Management</h6>';
    $menuOptions .= '<ul class="nav flex-column inventory-submenu" style="display:' . $inventoryDisplayStyle . ';">';
    
    foreach ($inventoryPages as $page => $details) {
        $label = is_array($details) ? $details[0] : $details;
        $isActive = in_array($currentPage, is_array($details) ? $details[1] : [$page]) ? ' active' : '';
        $menuOptions .= '<li class="nav-item"><a class="nav-link' . $isActive . '" href="' . $page . '">' . $label . '</a></li>';
    }
    
    $menuOptions .= '</ul></li>';
    
    $menuOptions .= '<li class="nav-item' . (empty($flags['purchase_head_management']) ? ' hidden' : '') . '">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['po_approve_list','view_approve_po']) ? 'active' : '') . '" href="po_approve_list">Purchase&nbsp;Approval</a>
        </h6>
    </li>';
    
    
    $indentPages = [
        'indent' => ['Indent', ['indent', 'approve_indent', 'process_indent']],
        'grn' => ['GRN', ['grn']],
    ];
    
    // Build the list of all inventory pages for matching
    $allIndentPages = [];
    foreach ($indentPages as $details) {
        if (is_array($details)) {
            $allIndentPages = array_merge($allIndentPages, $details[1]);
        }
    }
    
    // Determine if any inventory page is active
    $indentActive = in_array($currentPage, $allIndentPages);
    $indentDisplayStyle = $indentActive ? 'block' : 'none';
    
    // Render Inventory Management menu
    $menuOptions .= '<li class="nav-item ' . (empty($flags['indent_management']) ? ' hidden' : '') . '" style="cursor:pointer;">';
    $menuOptions .= '<h6 class="menu-title" onclick="toggleindent()">Outlet&nbsp;Management</h6>';
    $menuOptions .= '<ul class="nav flex-column indent-submenu" style="display:' . $indentDisplayStyle . ';">';
    
    foreach ($indentPages as $page => $details) {
        $label = is_array($details) ? $details[0] : $details;
        $isActive = in_array($currentPage, is_array($details) ? $details[1] : [$page]) ? ' active' : '';
        $menuOptions .= '<li class="nav-item"><a class="nav-link' . $isActive . '" href="' . $page . '">' . $label . '</a></li>';
    }
    
    $menuOptions .= '</ul></li>';
    
    
    // Table Management
    if (!empty($flags['table_management'])) {
        $active = in_array($currentPage, ['create_table', 'table_list', 'edit_table']) ? 'active' : '';
        $menuOptions .= '<li class="nav-item"><h6 class="menu-title"><a class="' . $active . '" href="table_list">Table Management</a></h6></li>';
    }
    
    // Waiter Management
    if (!empty($flags['waiter_management'])) {
        $active = in_array($currentPage, ['create_waiter', 'waiter_list', 'edit_waiter']) ? 'active' : '';
        $menuOptions .= '<li class="nav-item"><h6 class="menu-title"><a class="' . $active . '" href="waiter_list">Waiter Management</a></h6></li>';
    }
    
    // Coupon Management
    if (!empty($flags['coupon_management'])) {
        $active = in_array($currentPage, ['create_coupon', 'coupon_list', 'edit_coupon']) ? 'active' : '';
        $menuOptions .= '<li class="nav-item"><h6 class="menu-title"><a class="' . $active . '" href="coupon_list">Coupon Management</a></h6></li>';
    }
    
    
    $reportPages = [
        'dsr_report' => 'DSR Report',
        'wallet_report' => 'Wallet Report',
        'transaction_report' => 'Transaction Report',
        'item_sale_report' => 'Item Sale Report',
        'discount_report' => 'Discount Report',
        'bill_wise_summary' => 'Bill Wise Summary',
        'hourly_sales' => 'Hourly Sales',
        'bill_cancel' => 'Bill Cancel Report',
        'void_order' => 'Void Order Report',
        'wallet_history' => 'Wallet History',
        'card_report' => 'Card History',
        'stock_level' => 'DC Stock Level',
        // 'kitchen_stock_level' => 'Kitchen Stock Level',
        'purchaseorder_report' => 'Purchase Order Report',
        'purchase_item_ledger' => 'Purchase Item Ledger Report',
        'complimentary_detail' => 'Complimentary Report',
        'reprint_report' => 'Reprint Report',
        'bill_kot_delete_report' => 'Bill & KOT Delete Report',
        'removed_service_charges_report' => 'Removed Service Charges Report',
        'kot_detail_report' => 'KOT Detail Report',
        'bill_item_detail_report' => 'Bill Item Report',
        'bill_wise_sales_report' => 'Bill Wise Sales Report',
        'vendor_wise_purchase_report' => 'Vendor Wise Purchase Report',
        'po_report_v2' => 'PO Report V2',
        'service_po_report' => 'Service Puchase Order Report',
        'item_wise_purchase_report' => 'Item Wise Purchase Report',
		'purchase_classification' => 'CAPEX/OPEX Classification'
    ];
    
    $reportActive = in_array($currentPage, array_keys($reportPages));
    $submenuDisplayStyle = $reportActive ? 'block' : 'none';
    $menuOptions .= '<li class="nav-item ' . (empty($flags['report_management']) ? ' hidden' : '') . '" style="cursor:pointer;">';
    $menuOptions .= '<h6 class="menu-title" onclick="toggleReports()">Report&nbspManagement</h6>';
    $menuOptions .= '<ul class="nav flex-column report-submenu" style="display:' . $submenuDisplayStyle . ';">';
    
    foreach ($reportPages as $page => $label) {
        $isActive = ($currentPage == $page) ? ' active' : '';
        $menuOptions .= '<li class="nav-item"><a class="nav-link' . $isActive . '" href="' . $page . '">' . $label . '</a></li>';
    }
    $menuOptions .= '</ul></li>';
    
}else{
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['indent', 'create_indent', 'edit_indent', 'view_indent']) ? 'active' : '') . '" href="indent">Indent</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['stockin']) ? 'active' : '') . '" href="stockin">Stock IN</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['grn_history']) ? 'active' : '') . '" href="grn_history">GRN History</a>
        </h6>
    </li>';
    
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['po_grn_history']) ? 'active' : '') . '" href="po_grn_history">PO GRN History</a>
        </h6>
    </li>';
	
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['po_report_v2']) ? 'active' : '') . '" href="po_report_v2">PO Report V2</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['imprest']) ? 'active' : '') . '" href="imprest">Imprest</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['auditstock', 'create_audit_stock', 'view_audit']) ? 'active' : '') . '" href="auditstock">SKU Audit</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['semi_auditstock','semi_create_audit_stock', 'semi_view_audit']) ? 'active' : '') . '" href="semi_auditstock">Semifinished Audit</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['stock_damage','create_damage', 'edit_damage', 'view_damage']) ? 'active' : '') . '" href="stock_damage">SKU Damage</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['semi_stock_damage','semi_create_damage', 'semi_edit_damage', 'semi_view_damage']) ? 'active' : '') . '" href="semi_stock_damage">Semifinished Damage</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['direct_purchase','view_direct_purchase', 'create_direct_purchase']) ? 'active' : '') . '" href="direct_purchase">Direct Purchase</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['stock_level']) ? 'active' : '') . '" href="stock_level">Semifinished&nbspStock&nbspLevel</a>
        </h6>
    </li>';
    $menuOptions .= '<li class="nav-item">
        <h6 class="menu-title">
            <a class="' . (in_array($currentPage, ['sku_stock_level']) ? 'active' : '') . '" href="sku_stock_level">SKU Stock Level</a>
        </h6>
    </li>';
    // $menuOptions = $menuOptions.'<li class="nav-item ' . (($currentPage == 'card_report' || $currentPage == 'wallet_report' || $currentPage == 'transaction_report' || $currentPage == 'dsr_report' || $currentPage == 'wallet_history' || $currentPage == 'item_sale_report' || $currentPage == 'sku_stocks' || $currentPage == 'semifinished_stocks' || $currentPage == 'stock_level' || $currentPage == 'semi_stock_level') ? '' : 'hiddenreport') . '"  ><a class="nav-link ' . (($currentPage == 'semi_stock_level') ? ' active' : '') . '" href="semi_stock_level">DC&nbspSemifinished&nbspStock&nbspLevel</a></li>';
    // $menuOptions = $menuOptions.'<li class="nav-item ' . (($currentPage == 'card_report' || $currentPage == 'wallet_report' || $currentPage == 'transaction_report' || $currentPage == 'dsr_report' || $currentPage == 'wallet_history' || $currentPage == 'item_sale_report' || $currentPage == 'sku_stocks' || $currentPage == 'semifinished_stocks' || $currentPage == 'stock_level' || $currentPage == 'semi_stock_level') ? '' : 'hiddenreport') . '"  ><a class="nav-link ' . (($currentPage == 'sku_stocks') ? ' active' : '') . '" href="sku_stocks">SKU Stock</a></li>';
    // $menuOptions = $menuOptions.'<li class="nav-item ' . (($currentPage == 'card_report' || $currentPage == 'wallet_report' || $currentPage == 'transaction_report' || $currentPage == 'dsr_report' || $currentPage == 'wallet_history' || $currentPage == 'item_sale_report' || $currentPage == 'sku_stocks' || $currentPage == 'semifinished_stocks' || $currentPage == 'stock_level' || $currentPage == 'semi_stock_level') ? '' : 'hiddenreport') . '"  ><a class="nav-link ' . (($currentPage == 'semifinished_stocks') ? ' active' : '') . '" href="semifinished_stocks">Semifinished Stock</a></li>';
    // $menuOptions = $menuOptions.'<li class="nav-item ' .  (empty($flags['booking_management']) ? ' hidden' : '') .'"><h6 class="menu-title"><a class="' . (($currentPage == 'booking_list' || $currentPage == 'create_booking') ? ' active' : '') . '" href="booking_list">Booking Management</a></h6></li>';
}
$menuOptions .= '<li class="nav-item">
    <h6 class="menu-title">
        <a href="'.$this->Html->url(['controller' => 'dashboard', 'action' => 'logout']).'">Logout</a>
    </h6>
</li><br><br>';


?>

<div class="main-menu-inner">
                <!-- LOGO -->
                <div class="topbar-left" style="padding: 10px;">
                    <a href="" class="logo">
                        <center><span>
                            <?php echo $this->Html->link($this->Html->image('../assets/images/logo.png',array('height' => '70px')), '#', array('escape'=>false, 'class'=>'toggle', 'data-toggle'=>'dropdown')); ?>
                        </span></center>

                    </a>
                </div>
                <!--end logo // --> 
                <div class="menu-body slimscroll" style="overflow:scroll">                    
                    <div  class="">
                        <div class="title-box">
                            <h6 class="menu-title"><?php echo $leftMenuTitle; ?></h6>       
                        </div>
                        <ul class="nav">
                            <?php echo $menuOptions; ?>

                            
                            
                        </ul>
                    </div><!-- end Analytic -->
                    

                    
                    
                </div><!--end menu-body-->
</div><!-- end main-menu-inner-->
<style>
    .active {
    text-decoration: underline;
}
.menu-body .nav-item ul li {
    margin: 0 !important;
}
.hidden {
    display: none!important;
}

</style>

<script>
function toggleReports() {
    const submenu = document.querySelector('.report-submenu');
    if (submenu) {
        submenu.style.display = submenu.style.display === 'none' ? 'block' : 'none';
    }
}
function toggleinventory() {
    const invsubmenu = document.querySelector('.inventory-submenu');
    if (invsubmenu) {
        invsubmenu.style.display = invsubmenu.style.display === 'none' ? 'block' : 'none';
    }
}
function togglecatalog() {
    const catalogsubmenu = document.querySelector('.catalog-submenu');
    if (catalogsubmenu) {
        catalogsubmenu.style.display = catalogsubmenu.style.display === 'none' ? 'block' : 'none';
    }
}
function toggleindent() {
    const indentsubmenu = document.querySelector('.indent-submenu');
    if (indentsubmenu) {
        indentsubmenu.style.display = indentsubmenu.style.display === 'none' ? 'block' : 'none';
    }
}
function togglekds() {
    const kdssubmenu = document.querySelector('.kds-submenu');
    if (kdssubmenu) {
        kdssubmenu.style.display = kdssubmenu.style.display === 'none' ? 'block' : 'none';
    }
}

</script>

