2023-11-13 14:00:05 +01:00
|
|
|
import {ChangeDetectorRef, Directive, OnInit} from "@angular/core";
|
|
|
|
import {BaseComponent} from "../../../sharedComponents/base/base.component";
|
|
|
|
import {MenuItem} from "../../../sharedComponents/menu";
|
|
|
|
import {LayoutService} from "./layout.service";
|
|
|
|
|
|
|
|
@Directive()
|
|
|
|
export class SidebarBaseComponent extends BaseComponent implements OnInit {
|
|
|
|
hasSidebar: boolean = false;
|
|
|
|
hasInternalSidebar: boolean = false;
|
2024-01-09 13:16:35 +01:00
|
|
|
hasAdminMenu: boolean = false;
|
2023-11-13 14:00:05 +01:00
|
|
|
/**
|
|
|
|
* Menu Items
|
|
|
|
* */
|
|
|
|
sideBarItems: MenuItem[] = [];
|
2024-01-09 13:16:35 +01:00
|
|
|
adminMenuItems: MenuItem[] = [];
|
2023-11-13 14:00:05 +01:00
|
|
|
backItem: MenuItem = null;
|
|
|
|
|
|
|
|
protected layoutService: LayoutService;
|
|
|
|
protected cdr: ChangeDetectorRef;
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
this.subscriptions.push(this.layoutService.hasSidebar.subscribe(hasSidebar => {
|
|
|
|
this.hasSidebar = hasSidebar;
|
|
|
|
this.cdr.detectChanges();
|
|
|
|
}));
|
|
|
|
this.subscriptions.push(this.layoutService.hasInternalSidebar.subscribe(hasInternalSidebar => {
|
|
|
|
this.hasInternalSidebar = hasInternalSidebar;
|
|
|
|
this.cdr.detectChanges();
|
|
|
|
}));
|
2024-01-09 13:16:35 +01:00
|
|
|
this.subscriptions.push(this.layoutService.hasAdminMenu.subscribe(hasAdminMenu => {
|
|
|
|
this.hasAdminMenu = hasAdminMenu;
|
|
|
|
this.cdr.detectChanges();
|
|
|
|
}));
|
2023-11-13 14:00:05 +01:00
|
|
|
this.layoutService.setOpen(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public get open() {
|
|
|
|
return this.layoutService.open;
|
|
|
|
}
|
|
|
|
|
|
|
|
public get hover() {
|
|
|
|
return this.layoutService.hover;
|
|
|
|
}
|
|
|
|
}
|