<div class="navigation-container">
  <ul>
    <!-- Always display the "My Workstation" menu -->
    <ng-container id="parent-menu" *ngFor="let menu of menuNetDataList">
      <li
        class="dropdown-submenu"
        (mouseover)="menuOver(menu, $event)"
        *ngIf="!selectedParentMenu || menu.menuCode === 'Home' || (selectedParentMenu && selectedParentMenu.menuCode == 'Home')"
      >
        <a href="javascript:void(0);" class="menu-group" [class.active]="isActive(true)" (click)="navigate(menu)">
          {{ menu.text }}
        </a>
      </li>
    </ng-container>
    <!-- If a menu is selected, display its submenu -->
    <ng-container id="children-menu" *ngFor="let menu of menuNetDataList">
      <li
        class="dropdown-submenu"
        (mouseover)="menuOver(menu, $event)"
        *ngIf="menu.rootFlag && selectedParentMenu && menu.menuCode == selectedParentMenu.menuCode && menu.menuCode !== 'Home'"
      >
        <!-- <a href="javascript:void(0);" class="menu-group" [class.active]="isActive(true)" (click)="navigate(menu)">
          {{ menu.text }}
        </a> -->
        <ul *ngIf="menu.children && menu.children.length > 0">
          <li *ngFor="let child of menu.children">
            <ng-container *ngIf="child.children && child.children.length > 0">
              <a nz-dropdown [nzDropdownMenu]="childMenu">
                {{ child.text }}
                <span nz-icon nzType="down"></span>
              </a>
              <nz-dropdown-menu #childMenu="nzDropdownMenu">
                <ul nz-menu nzSelectable>
                  <li nz-menu-item *ngFor="let subItem of child.children" (click)="navigate(subItem)">
                    {{ subItem.text }}
                  </li>
                </ul>
              </nz-dropdown-menu>
            </ng-container>
            <ng-container *ngIf="!child.children || child.children.length === 0">
              <a href="javascript:void(0);" (click)="navigate(child)">{{ child.text }}</a>
            </ng-container>
          </li>
        </ul>
      </li>
    </ng-container>
  </ul>
</div>
