Skip to content

Commit 0b4f7eb

Browse files
committed
added accounting routes, enhanced sidebar
1 parent d19dcbc commit 0b4f7eb

File tree

7 files changed

+96
-13
lines changed

7 files changed

+96
-13
lines changed

src/Client/Logistics.OfficeApp/src/app/app.routes.ts

+7
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ export const APP_ROUTES: Routes = [
5656
breadcrumb: 'Customers',
5757
},
5858
},
59+
{
60+
path: 'accounting',
61+
loadChildren: () => import('./pages/accounting').then((m) => m.ACCOUNTING_ROUTES),
62+
data: {
63+
breadcrumb: '',
64+
},
65+
},
5966
{
6067
path: '**',
6168
redirectTo: '404',

src/Client/Logistics.OfficeApp/src/app/layout/sidebar/sidebar.component.html

+33-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<img src="assets/images/logo.svg" class="img-fluid" height="40" alt="logo" />
44
<span class="h4" *ngIf="isOpened">{{companyName}}</span>
55
</a>
6-
<ul class="nav nav-pills nav-flush flex-column mb-auto text-center">
6+
7+
<ul class="nav flex-column mb-auto">
78
<li>
89
<a class="nav-link border-bottom" [routerLink]="['/home']">
910
<i class="bi bi-house-door h1" pTooltip="Home"></i>
@@ -40,6 +41,27 @@
4041
<span class="ms-2" *ngIf="isOpened">Customers</span>
4142
</a>
4243
</li>
44+
<li class="nav-item">
45+
<!-- <a class="nav-link border-bottom">
46+
<i class="bi bi-journal-text h1"></i>
47+
<span class="ms-2" *ngIf="isOpened">Accounting</span>
48+
</a> -->
49+
50+
<p-panelMenu *ngIf="isOpened else accountingIcon" [model]="accountingMenuItems"></p-panelMenu>
51+
<ng-template #accountingIcon>
52+
<p-overlayPanel #accountingPanel>
53+
<div *ngFor="let item of accountingMenuItems[0].items">
54+
<button *ngIf="!item.separator" class="p-button p-button-text p-button-secondary" (click)="item?.command({})" role="none">
55+
{{item.label}}
56+
</button>
57+
</div>
58+
</p-overlayPanel>
59+
<div class="text-center">
60+
<i (click)="accountingPanel.toggle($event)" class="bi bi-journal-text h1" pTooltip="Accounting" role="presentation"></i>
61+
</div>
62+
</ng-template>
63+
64+
</li>
4365
<li class="nav-item">
4466
<a class="nav-link border-bottom">
4567
<i *ngIf="isOpened else rightArrowIcon" class="bi bi-arrow-left h1" (click)="toggle()" pTooltip="Minimize menu" role="presentation"></i>
@@ -55,10 +77,17 @@
5577
Role: <span class="fw-bold">{{userRole}}</span>
5678
</div>
5779

58-
<p-panelMenu *ngIf="isOpened else accountIcon" [model]="accountMenuItems"></p-panelMenu>
59-
<ng-template #accountIcon>
80+
<p-panelMenu *ngIf="isOpened else profileIcon" [model]="profileMenuItems"></p-panelMenu>
81+
<ng-template #profileIcon>
82+
<p-overlayPanel #profilePanel>
83+
<div *ngFor="let item of profileMenuItems[0].items">
84+
<button *ngIf="!item.separator" class="p-button p-button-text p-button-secondary" (click)="item?.command({})" role="none">
85+
{{item.label}}
86+
</button>
87+
</div>
88+
</p-overlayPanel>
6089
<div class="text-center">
61-
<i (click)="toggle()" class="bi bi-person-circle h1" pTooltip="Account" role="presentation"></i>
90+
<i (click)="profilePanel.toggle($event)" class="bi bi-person-circle h1" pTooltip="Account" role="presentation"></i>
6291
</div>
6392
</ng-template>
6493
</div>

src/Client/Logistics.OfficeApp/src/app/layout/sidebar/sidebar.component.scss

+24
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,27 @@
2727
display: flex;
2828
align-items: center;
2929
}
30+
31+
:host ::ng-deep .p-panelmenu-header-content {
32+
background-color: transparent;
33+
}
34+
35+
:host ::ng-deep .p-panelmenu-content {
36+
background-color: transparent;
37+
}
38+
39+
:host ::ng-deep .p-menuitem-link {
40+
text-decoration: none;
41+
}
42+
43+
:host ::ng-deep .p-panelmenu-header chevronrighticon {
44+
order: 2;
45+
}
46+
47+
:host ::ng-deep .p-panelmenu-header chevrondownicon {
48+
order: 2;
49+
}
50+
51+
:host ::ng-deep .p-panelmenu-header .p-menuitem-text {
52+
order: 1;
53+
}

src/Client/Logistics.OfficeApp/src/app/layout/sidebar/sidebar.component.ts

+30-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {RouterLink} from '@angular/router';
44
import {TooltipModule} from 'primeng/tooltip';
55
import {SplitButtonModule} from 'primeng/splitbutton';
66
import {PanelMenuModule} from 'primeng/panelmenu';
7+
import {OverlayPanelModule} from 'primeng/overlaypanel';
78
import {MenuItem} from 'primeng/api';
89
import {AppConfig} from '@configs';
910
import {AuthService} from '@core/auth';
@@ -21,6 +22,7 @@ import {ApiService, TenantService} from '@core/services';
2122
TooltipModule,
2223
SplitButtonModule,
2324
PanelMenuModule,
25+
OverlayPanelModule,
2426
],
2527
})
2628
export class SidebarComponent implements OnInit {
@@ -30,7 +32,8 @@ export class SidebarComponent implements OnInit {
3032
public companyName?: string;
3133
public userRole?: string | null;
3234
public userFullName?: string;
33-
public accountMenuItems: MenuItem[];
35+
public profileMenuItems: MenuItem[];
36+
public accountingMenuItems: MenuItem[];
3437

3538
constructor(
3639
private authService: AuthService,
@@ -40,7 +43,7 @@ export class SidebarComponent implements OnInit {
4043
this.isAuthenticated = false;
4144
this.isOpened = false;
4245
this.isLoading = false;
43-
this.accountMenuItems = [
46+
this.profileMenuItems = [
4447
{
4548
label: 'User name',
4649
icon: 'bi bi-person-circle',
@@ -59,25 +62,46 @@ export class SidebarComponent implements OnInit {
5962
],
6063
},
6164
];
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+
];
6286
}
6387

6488
ngOnInit(): void {
6589
this.authService.onUserDataChanged().subscribe((userData) => {
6690
this.userFullName = userData?.getFullName();
6791
this.userRole = this.authService.getUserRoleName();
68-
this.accountMenuItems[0].label = this.userFullName;
92+
this.profileMenuItems[0].label = this.userFullName;
6993
this.fetchTenantData();
7094
});
7195
}
7296

7397
private fetchTenantData() {
7498
this.apiService.getTenant().subscribe((result) => {
75-
if (result.isError) {
99+
if (result.isError || !result.data) {
76100
return;
77101
}
78102

79-
this.tenantService.setTenantData(result.data!);
80-
this.companyName = result.data!.displayName;
103+
this.tenantService.setTenantData(result.data);
104+
this.companyName = result.data.displayName;
81105
});
82106
}
83107

Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './accounting.routes';

src/Client/Logistics.OfficeApp/src/app/pages/home/components/notifications-panel/notifications-panel.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p-card>
22
<ng-template pTemplate="header">
33
<div class="ps-3 pt-3 pb-1 h4">
4-
<i class="bi bi-bell" pBadge [badgeDisabled]="!notifications.length" [value]="getUnreadNotificationsCount()"></i>
4+
<i class="bi bi-bell" pBadge [value]="getUnreadNotificationsCount()"></i>
55
<span class="ms-3">Notifications</span>
66
</div>
77
<hr class="w-100 m-0" />

src/Client/Logistics.OfficeApp/src/app/pages/home/components/notifications-panel/notifications-panel.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ export class NotificationsPanelComponent implements OnInit, OnDestroy {
102102
}
103103

104104
getUnreadNotificationsCount(): string {
105-
console.log(this.notifications.filter((i) => !i.isRead).length);
106-
107105
return this.notifications.filter((i) => !i.isRead).length.toString();
108106
}
109107

0 commit comments

Comments
 (0)