refactor: streamline state initialization across stores using defaultBaseStateData
- Replaced individual state properties (loading, error, entity, initialized, isRefreshing) with a spread of defaultBaseStateData in various entity stores including AccountStore, BusinessActivityStore, ConsumerComplexStore, PosStore, and others. - Updated imports to include defaultBaseStateData in relevant store files. - Enhanced consistency in state management across multiple stores. feat: add partner profile management components and services - Introduced PartnerProfileFormComponent and PartnerResetPasswordCardComponent for profile editing and password reset functionalities. - Created ProfileService to handle API interactions for partner profile management. - Added routes and constants for partner profile API and navigation. - Implemented UI components for displaying and editing partner profile information in single.component.html and single.component.ts.
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
</p-button>
|
||||
|
||||
<div class="">
|
||||
<p-menu #menu [model]="profileMenuItems" [popup]="true" />
|
||||
<p-menu #menu [model]="profileMenuItems()" [popup]="true" />
|
||||
<p-button (click)="menu.toggle($event)" icon="pi pi-user" text severity="contrast" size="large" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,7 @@ export class AppTopbar {
|
||||
@Input() centerTemplate?: TemplateRef<any> | null = null;
|
||||
@Input() endTemplate?: TemplateRef<any> | null = null;
|
||||
|
||||
constructor(public layoutService: LayoutService) {}
|
||||
readonly layoutService = inject(LayoutService);
|
||||
private authService: AuthService = inject(AuthService);
|
||||
|
||||
readonly logo = images.logo;
|
||||
@@ -34,20 +34,20 @@ export class AppTopbar {
|
||||
this.layoutService.layoutConfig.update((state) => ({ ...state, darkTheme: !state.darkTheme }));
|
||||
}
|
||||
|
||||
username = computed(() => this.authService.currentAccount()?.username || 'کاربر ناشناس');
|
||||
panelTitle = computed(
|
||||
() => this.layoutService.panelInfo()?.title || 'پنل مدیریت صورتحسابهای مالیاتی',
|
||||
);
|
||||
readonly username = computed(() => this.authService.currentAccount()?.username || 'کاربر ناشناس');
|
||||
readonly profilePageRoute = computed(() => this.layoutService.profilePageRoute());
|
||||
readonly panelTitle = computed(() => this.layoutService.panelInfo()?.title);
|
||||
|
||||
logout = () => {
|
||||
readonly logout = () => {
|
||||
this.authService.logout();
|
||||
};
|
||||
|
||||
profileMenuItems: MenuItem[] = [
|
||||
profileMenuItems = computed<MenuItem[]>(() => [
|
||||
{
|
||||
label: this.username(),
|
||||
icon: 'pi pi-user',
|
||||
disabled: true,
|
||||
disabled: !this.profilePageRoute(),
|
||||
routerLink: this.profilePageRoute(),
|
||||
},
|
||||
{
|
||||
label: 'راهنمای سامانه',
|
||||
@@ -59,5 +59,5 @@ export class AppTopbar {
|
||||
icon: 'pi pi-sign-out',
|
||||
command: this.logout,
|
||||
},
|
||||
];
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ interface LayoutState {
|
||||
menuHoverActive?: boolean;
|
||||
isFixedContentSize?: boolean;
|
||||
isFullPage?: boolean;
|
||||
profilePageRoute?: string;
|
||||
}
|
||||
|
||||
interface MenuChangeEvent {
|
||||
@@ -51,6 +52,7 @@ export class LayoutService {
|
||||
menuHoverActive: false,
|
||||
isFixedContentSize: true,
|
||||
isFullPage: false,
|
||||
profilePageRoute: '',
|
||||
};
|
||||
|
||||
layoutConfig = signal<layoutConfig>(this._config);
|
||||
@@ -68,7 +70,7 @@ export class LayoutService {
|
||||
public menuItems = signal<MenuItem[]>([]);
|
||||
|
||||
public panelInfo = signal<IPanelInfo>({
|
||||
title: 'پنل مدیریت صورتحسابهای مالیاتی',
|
||||
title: '',
|
||||
});
|
||||
|
||||
menuSource$ = this.menuSource.asObservable();
|
||||
@@ -95,6 +97,7 @@ export class LayoutService {
|
||||
|
||||
isFixedContentSize = computed(() => this.layoutState().isFixedContentSize);
|
||||
isFullPage = computed(() => this.layoutState().isFullPage);
|
||||
profilePageRoute = computed(() => this.layoutState().profilePageRoute || '');
|
||||
|
||||
transitionComplete = signal<boolean>(false);
|
||||
|
||||
@@ -264,4 +267,10 @@ export class LayoutService {
|
||||
setTopbarEndSlot(tpl: TemplateRef<any> | null) {
|
||||
this.topbarEndSlot.next(tpl);
|
||||
}
|
||||
setProfilePageRoute(route: string) {
|
||||
this.layoutState.update((prev) => ({
|
||||
...prev,
|
||||
profilePageRoute: route,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user