This commit is contained in:
2023-06-17 14:16:09 +03:00
parent 62178f1f32
commit 7ae5d3bc81
180 changed files with 12932 additions and 192 deletions
@@ -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);