Mise à jour articles et produits
This commit is contained in:
@@ -11,7 +11,7 @@ import { MatToolbarModule } from '@angular/material/toolbar';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
||||
import { User } from 'src/app/core/models';
|
||||
import { Menu, User } from 'src/app/core/models';
|
||||
import { UserService } from 'src/app/core/services';
|
||||
import { MenuItems, ShowAuthedDirective, AccordionAnchorDirective, AccordionLinkDirective, AccordionDirective } from 'src/app/components/shared';
|
||||
//import { SpinnerComponent } from 'src/app/components/shared';
|
||||
@@ -43,10 +43,12 @@ export class FullComponent implements OnInit, OnDestroy {
|
||||
private _mobileQueryListener: () => void;
|
||||
mobileQuery: MediaQueryList;
|
||||
currentUser: User = {} as User;
|
||||
showQCMMenu = false;
|
||||
today: number = Date.now();
|
||||
siteLink = 'https://www.rampeur.com';
|
||||
author = 'Solide Apps';
|
||||
siteLink = 'https://www.adastra-cbd.com';
|
||||
author = 'Ad Astra';
|
||||
links: Menu[] = [];
|
||||
visibleMenu: string[] = ['products', 'page'];
|
||||
//visibleMenu: string[] = ['products'];
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
@@ -65,10 +67,29 @@ export class FullComponent implements OnInit, OnDestroy {
|
||||
this._currentUser = user$.subscribe(
|
||||
(userData) => {
|
||||
this.currentUser = userData;
|
||||
if (this.currentUser.role === 'Admin') {
|
||||
//this.links = this.menuItems.getMenuItemsAdmin();
|
||||
this.links = this.menuItems.getMenuItems();
|
||||
} else {
|
||||
this.links = this.menuItems.getMenuItems();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
getMenuItems(): Menu[] {
|
||||
return this.links;
|
||||
}
|
||||
|
||||
isVisibleMenu(state: string): boolean {
|
||||
const indexOf: number = this.visibleMenu.indexOf(state);
|
||||
if (indexOf !== -1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this._currentUser.unsubscribe();
|
||||
this.mobileQuery.removeListener(this._mobileQueryListener);
|
||||
@@ -78,8 +99,13 @@ export class FullComponent implements OnInit, OnDestroy {
|
||||
window.open('https://github.com/rampeur', '_blank');
|
||||
}
|
||||
|
||||
toggleShowQCMMenu() {
|
||||
this.showQCMMenu = !this.showQCMMenu;
|
||||
toggleShowMenu(state: string) {
|
||||
const indexOf: number = this.visibleMenu.indexOf(state);
|
||||
if (indexOf !== -1) {
|
||||
this.visibleMenu.splice(indexOf, 1);
|
||||
} else {
|
||||
this.visibleMenu.push(state);
|
||||
}
|
||||
}
|
||||
|
||||
logout() {
|
||||
|
||||
Reference in New Issue
Block a user