@@ -4,6 +4,7 @@ import {RouterLink} from '@angular/router';
4
4
import { TooltipModule } from 'primeng/tooltip' ;
5
5
import { SplitButtonModule } from 'primeng/splitbutton' ;
6
6
import { PanelMenuModule } from 'primeng/panelmenu' ;
7
+ import { OverlayPanelModule } from 'primeng/overlaypanel' ;
7
8
import { MenuItem } from 'primeng/api' ;
8
9
import { AppConfig } from '@configs' ;
9
10
import { AuthService } from '@core/auth' ;
@@ -21,6 +22,7 @@ import {ApiService, TenantService} from '@core/services';
21
22
TooltipModule ,
22
23
SplitButtonModule ,
23
24
PanelMenuModule ,
25
+ OverlayPanelModule ,
24
26
] ,
25
27
} )
26
28
export class SidebarComponent implements OnInit {
@@ -30,7 +32,8 @@ export class SidebarComponent implements OnInit {
30
32
public companyName ?: string ;
31
33
public userRole ?: string | null ;
32
34
public userFullName ?: string ;
33
- public accountMenuItems : MenuItem [ ] ;
35
+ public profileMenuItems : MenuItem [ ] ;
36
+ public accountingMenuItems : MenuItem [ ] ;
34
37
35
38
constructor (
36
39
private authService : AuthService ,
@@ -40,7 +43,7 @@ export class SidebarComponent implements OnInit {
40
43
this . isAuthenticated = false ;
41
44
this . isOpened = false ;
42
45
this . isLoading = false ;
43
- this . accountMenuItems = [
46
+ this . profileMenuItems = [
44
47
{
45
48
label : 'User name' ,
46
49
icon : 'bi bi-person-circle' ,
@@ -59,25 +62,46 @@ export class SidebarComponent implements OnInit {
59
62
] ,
60
63
} ,
61
64
] ;
65
+
66
+ this . accountingMenuItems = [
67
+ {
68
+ label : 'Accounting' ,
69
+ icon : 'bi bi-journal-text h1' ,
70
+ items : [
71
+ {
72
+ label : 'Payroll Management' ,
73
+ // command: () => this.openAccountUrl(),
74
+ } ,
75
+ {
76
+ label : 'Payments' ,
77
+ // command: () => this.logout(),
78
+ } ,
79
+ {
80
+ label : 'Invoices' ,
81
+ // command: () => this.logout(),
82
+ } ,
83
+ ] ,
84
+ } ,
85
+ ] ;
62
86
}
63
87
64
88
ngOnInit ( ) : void {
65
89
this . authService . onUserDataChanged ( ) . subscribe ( ( userData ) => {
66
90
this . userFullName = userData ?. getFullName ( ) ;
67
91
this . userRole = this . authService . getUserRoleName ( ) ;
68
- this . accountMenuItems [ 0 ] . label = this . userFullName ;
92
+ this . profileMenuItems [ 0 ] . label = this . userFullName ;
69
93
this . fetchTenantData ( ) ;
70
94
} ) ;
71
95
}
72
96
73
97
private fetchTenantData ( ) {
74
98
this . apiService . getTenant ( ) . subscribe ( ( result ) => {
75
- if ( result . isError ) {
99
+ if ( result . isError || ! result . data ) {
76
100
return ;
77
101
}
78
102
79
- this . tenantService . setTenantData ( result . data ! ) ;
80
- this . companyName = result . data ! . displayName ;
103
+ this . tenantService . setTenantData ( result . data ) ;
104
+ this . companyName = result . data . displayName ;
81
105
} ) ;
82
106
}
83
107
0 commit comments