Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-level Menu #37

Open
dalevaldez09 opened this issue Aug 23, 2022 · 8 comments
Open

Multi-level Menu #37

dalevaldez09 opened this issue Aug 23, 2022 · 8 comments

Comments

@dalevaldez09
Copy link

dalevaldez09 commented Aug 23, 2022

How to implement multi-level side bar menu? Need up to 3 level

@erdkse
Copy link
Owner

erdkse commented Aug 23, 2022

Hey, @dalevaldez09 you need to expand the menu-item component. I can do it as well but it will take some time since I have other things to do.

@dalevaldez09
Copy link
Author

dalevaldez09 commented Aug 24, 2022

I'm having a hard time displaying the 3rd level menus, 1st level will collapse

<!--Level 1-->
<a (click)="handleMainMenuAction();"
   class="nav-link"
   [ngClass]="{active: isMainActive || isOneOfChildrenActive}">
  <img [src]="'../../../assets/img/nxpert-icons/'+ menuItem.icon +'.svg'"
       class="nav-icon"
       alt="User Image" />
  <p>
    {{ menuItem.name | translate }}
    <i *ngIf="isExpandable && menuItem.children.length > 0"
       class="right fas fa-angle-left"></i>
  </p>
</a>
<!--Level 2-->
<ul class="nav nav-treeview" *ngFor="let item of menuItem.children">
  <li class="nav-item" *ngIf="appService.hasAccess(item.menuCode)">
    <a [routerLink]="item.path"
       [routerLinkActive]="'active'"
       class="nav-link"
       (click)="handleMainMenuAction();">
      <img [src]="'../../../assets/img/nxpert-icons/'+ item.icon +'.svg'"
           class="nav-icon" />
      <p>
        {{ item.name | translate }}
        <i *ngIf="item.children != undefined ? item.children.length > 0 : false"
           class="right fas fa-angle-left"></i>
      </p>
    </a>
    <!--Level 3-->
    <ul class="nav nav-treeview" *ngFor="let sub of item.children">
      <li class="nav-item" *ngIf="appService.hasAccess(sub.menuCode)">
        <a [routerLink]="sub.path"
           [routerLinkActive]="'active'"
           class="nav-link">
          <img [src]="'../../../assets/img/nxpert-icons/'+ sub.icon +'.svg'"
               class="nav-icon" />
          <p>
            {{ sub.name | translate }}
          </p>
        </a>
      </li>
    </ul>
  </li>
</ul>

@erdkse
Copy link
Owner

erdkse commented Sep 19, 2022

hey @dalevaldez09 , I started working on this

@olayaherrera
Copy link

Did you manage to add a third menu?

@olayaherrera
Copy link

olayaherrera commented Feb 10, 2023

`<ng-container *ngIf="!menuItem.subOpciones">
 <a
  (click)="handleMainMenuAction()"
  class="nav-link"
  [ngClass]="{active: isMainActive || isOneOfChildrenActive}"
>
  <i class="nav-icon {{ menuItem.iconClasses }}"></i>
  <p>{{ menuItem.nombre }}
    <i
      *ngIf="isExpandable && menuItem.subOpciones.length > 0"
      class="right fas fa-angle-right"
      [@rotate]="isMenuExtended"
    ></i>
  </p>
</a>

</ng-container>
<ng-container *ngIf="menuItem.subOpciones && menuItem.subOpciones.length > 0">
<a
  (click)="handleMainMenuAction()"
  class="nav-link"
  [ngClass]="{active: isMainActive || isOneOfChildrenActive}"
>
  <i class="nav-icon {{ menuItem.iconClasses }}"></i>
  <p> {{menuItem.subOpciones.length}} {{ menuItem.nombre }}
    <i
      *ngIf="isExpandable && menuItem.subOpciones.length > 0"
      class="right fas fa-angle-right"
      [@rotate]="isMenuExtended"
    ></i>
  </p>
</a>
<ul class="nav nav-treeview"  *ngFor="let item of menuItem.subOpciones; index as i" [@openClose]="isMenuExtended">
  <li class="nav-item">
    <a *ngIf="!item.subOpciones"
      [routerLink]="item.url"
      [routerLinkActive]="'active'"
      class="nav-link"
    >
    <i class="nav-icon {{ item.iconClasses }}"></i>
      <p><small>{{i + 1}} {{ item.nombre }}</small></p>
    </a>
    <ng-container *ngIf=" item.subOpciones  ">
       <app-menu-item
         *ngFor="let itemSub of menuItem.subOpciones"
         [menuItem]="itemSub"
       ></app-menu-item>

    </ng-container>
   </li>
</ul>
</ng-container>
`

@Tallman1400
Copy link

Tallman1400 commented Mar 20, 2023

menu.txt

A more complete version
With the ability to enable or disable items
Resolve bug of Previous post

@erdkse
Copy link
Owner

erdkse commented Mar 20, 2023

hey @Tallman1400 , if you create a PR that would be better, would you like to consider it?

@lzuhuo
Copy link

lzuhuo commented Jun 15, 2023

Hey @erdkse . Some updates about 3rd level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants