update breadcrumb and create account module

This commit is contained in:
2026-03-11 20:42:15 +03:30
parent d61a5a6250
commit 9bfbef6f64
36 changed files with 570 additions and 130 deletions
@@ -0,0 +1,10 @@
export enum ACCOUNT_TYPES {
'PARTNER',
'BUSINESS',
'SUPER_ADMIN',
'ADMIN',
'PROVIDER',
'POS',
}
export type TAccountType = keyof typeof ACCOUNT_TYPES;
+1 -1
View File
@@ -19,7 +19,7 @@ export interface RouteInfo {
meta: {
title: string;
icon?: string;
pagePath?: (params: any) => string;
pagePath?: (params?: any) => string;
};
}
+21 -9
View File
@@ -5,24 +5,36 @@ import { filter } from 'rxjs/operators';
@Injectable({ providedIn: 'root' })
export class BreadcrumbService {
private readonly _items = signal<MenuItem[]>([]);
readonly _items = signal<MenuItem[]>([]);
private router = inject(Router);
constructor() {
// Clear breadcrumb items on navigation start so previous page items don't persist.
// Components for the new route can set their own items in their lifecycle (e.g. ngOnInit).
this.router.events.pipe(filter((e) => e instanceof NavigationStart)).subscribe(() => {
this.clear();
// Clear breadcrumb items only when the path changes (not on query string changes)
let lastPath = '';
this.router.events.pipe(filter((e) => e instanceof NavigationStart)).subscribe((e) => {
const nav = e as NavigationStart;
const urlPath = nav.url.split('?')[0];
if (!lastPath || (lastPath && urlPath !== lastPath)) {
this.clear();
}
lastPath = urlPath;
});
}
get items() {
return this._items();
setItems(items: MenuItem[]) {
this._items.set(this.mapItems(items));
}
setItems(items: MenuItem[]) {
this._items.set(items);
private readonly mapItems = (items: MenuItem[]) =>
items.map((item) => ({
...item,
label: item.title || '',
}));
addItems(items: MenuItem[]) {
this._items.update((value) => ({ ...value, ...this.mapItems(items) }));
}
clear() {