fix
This commit is contained in:
@@ -7,6 +7,7 @@ import { Component, Inject, ElementRef, OnInit, Renderer2, HostListener, OnDestr
|
||||
// app
|
||||
import { ROUTES } from './sidebar-items';
|
||||
import { AuthService } from 'src/app/core/service/auth.service';
|
||||
import { AccountCategoryService } from '../../services/account.category.service';
|
||||
import { RouteInfo } from './sidebar.metadata';
|
||||
|
||||
@Component({
|
||||
@@ -33,7 +34,8 @@ export class SidebarComponent implements OnInit, OnDestroy {
|
||||
private renderer: Renderer2,
|
||||
public elementRef: ElementRef,
|
||||
private authService: AuthService,
|
||||
private router: Router
|
||||
private router: Router,
|
||||
private accountCategoryService: AccountCategoryService,
|
||||
) {
|
||||
this.elementRef.nativeElement.closest('body');
|
||||
this.routerObj = this.router.events.subscribe((event) => {
|
||||
@@ -79,6 +81,26 @@ export class SidebarComponent implements OnInit, OnDestroy {
|
||||
this.userImg = this.authService.currentUserValue.img;
|
||||
this.userType = 'Admin';
|
||||
this.sidebarItems = ROUTES.filter((sidebarItem) => sidebarItem);
|
||||
|
||||
this.accountCategoryService
|
||||
.getCategories()
|
||||
.subscribe(categories => {
|
||||
var accounts = this.sidebarItems.filter(x => x.id === 'accounts');
|
||||
for (var category of categories) {
|
||||
accounts[0].submenu.push({
|
||||
path: '/account-category/' + category.id,
|
||||
title: category.name!,
|
||||
iconType: '',
|
||||
icon: '',
|
||||
class: 'ml-menu',
|
||||
groupTitle: false,
|
||||
badge: '',
|
||||
badgeClass: '',
|
||||
submenu: [],
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// this.sidebarItems = ROUTES.filter((sidebarItem) => sidebarItem);
|
||||
|
||||
Reference in New Issue
Block a user