check all change left with format make it look nice
This commit is contained in:
@@ -17,8 +17,11 @@
|
|||||||
<div class="font-bold text-white">
|
<div class="font-bold text-white">
|
||||||
{{currentUserName}}
|
{{currentUserName}}
|
||||||
</div>
|
</div>
|
||||||
<button (click)="onToggle()" type="button">
|
<p-menu #menu [model]="items" [popup]="true"></p-menu>
|
||||||
<svg data-p-icon="angle-down" [size]="20"></svg>
|
<button pButton variant="text" variant="outlined" (click)="menu.toggle($event)">
|
||||||
</button>
|
<svg data-p-icon="bars"></svg>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -3,17 +3,21 @@ import { Subscription } from 'rxjs'
|
|||||||
import { Component, EventEmitter, Output, OnInit, OnDestroy, inject, signal } from '@angular/core';
|
import { Component, EventEmitter, Output, OnInit, OnDestroy, inject, signal } from '@angular/core';
|
||||||
import { Router, RouterModule } from '@angular/router';
|
import { Router, RouterModule } from '@angular/router';
|
||||||
import { Utils } from '../shares';
|
import { Utils } from '../shares';
|
||||||
import { AngleDown } from '@primeicons/angular/angle-down';
|
import { Bars } from '@primeicons/angular/bars';
|
||||||
import { SidebarModule } from 'primeng/sidebar';
|
|
||||||
|
import { MenuModule } from 'primeng/menu';
|
||||||
|
import { ButtonModule } from 'primeng/button';
|
||||||
|
import { MenuItem } from 'primeng/api';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-nav-toolbar',
|
selector: 'app-nav-toolbar',
|
||||||
imports: [RouterModule, AngleDown, SidebarModule],
|
imports: [RouterModule, Bars, MenuModule, ButtonModule],
|
||||||
templateUrl: './nav-toolbar.component.html',
|
templateUrl: './nav-toolbar.component.html',
|
||||||
styleUrls: ['./nav-toolbar.component.css']
|
styleUrls: ['./nav-toolbar.component.css']
|
||||||
})
|
})
|
||||||
export class NavToolarComponent implements OnInit, OnDestroy {
|
export class NavToolarComponent implements OnInit, OnDestroy {
|
||||||
isExpanded = false;
|
isExpanded = false;
|
||||||
|
items: MenuItem[] | undefined;
|
||||||
isAuth = signal(false);
|
isAuth = signal(false);
|
||||||
isAdmin = signal(false);
|
isAdmin = signal(false);
|
||||||
currentUserName = "";
|
currentUserName = "";
|
||||||
@@ -31,11 +35,65 @@ export class NavToolarComponent implements OnInit, OnDestroy {
|
|||||||
if (currentUser.firstName != '') {
|
if (currentUser.firstName != '') {
|
||||||
this.isAuth.set(Utils.getIsAuth());
|
this.isAuth.set(Utils.getIsAuth());
|
||||||
this.isAdmin.set(Utils.getIsAdmin());
|
this.isAdmin.set(Utils.getIsAdmin());
|
||||||
|
this.initValue();
|
||||||
this.currentUserName = currentUser.firstName + ' ' + currentUser.lastName;
|
this.currentUserName = currentUser.firstName + ' ' + currentUser.lastName;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.initValue();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initValue(): void {
|
||||||
|
this.items = [
|
||||||
|
{
|
||||||
|
label: 'Concession Validation',
|
||||||
|
icon: 'pi pi-user-edit',
|
||||||
|
command: () => {
|
||||||
|
this.router.navigate(['/concessionvalidation']);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Report',
|
||||||
|
icon: 'pi pi-user-edit',
|
||||||
|
command: () => {
|
||||||
|
this.router.navigate(['/app-concessionvalidation-report']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
if (this.isAdmin() == true) {
|
||||||
|
this.items.push({
|
||||||
|
label: 'Admin User',
|
||||||
|
icon: 'pi pi-user-edit',
|
||||||
|
command: () => {
|
||||||
|
this.router.navigate(['/adminuser']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.items.push({
|
||||||
|
label: 'Concession Type',
|
||||||
|
icon: 'pi pi-user-edit',
|
||||||
|
command: () => {
|
||||||
|
this.router.navigate(['/concessiontype']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.items.push({
|
||||||
|
label: 'Validation Point',
|
||||||
|
icon: 'pi pi-user-edit',
|
||||||
|
command: () => {
|
||||||
|
this.router.navigate(['/validationpoint']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.items.push({
|
||||||
|
label: 'Logout',
|
||||||
|
icon: 'pi pi-user-edit',
|
||||||
|
command: () => {
|
||||||
|
this.authService.logout();
|
||||||
|
this.router.navigate(['/login']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
if (this.authSubscription) {
|
if (this.authSubscription) {
|
||||||
this.authSubscription.unsubscribe();
|
this.authSubscription.unsubscribe();
|
||||||
|
|||||||
Reference in New Issue
Block a user