2026-03-11 20:42:15 +03:30
|
|
|
import { BreadcrumbService } from '@/core/services';
|
|
|
|
|
import { AppCardComponent, KeyValueComponent } from '@/shared/components';
|
|
|
|
|
import { Component, computed, effect, inject, signal } from '@angular/core';
|
|
|
|
|
import { ActivatedRoute } from '@angular/router';
|
|
|
|
|
import { UsersComponent } from '../components/accounts/list.component';
|
|
|
|
|
import { UserAccountFormComponent } from '../components/form.component';
|
|
|
|
|
import { usersNamedRoutes } from '../constants';
|
|
|
|
|
import { UserStore } from '../store/user.store';
|
2025-12-04 23:34:00 +03:30
|
|
|
|
|
|
|
|
@Component({
|
2026-03-11 20:42:15 +03:30
|
|
|
selector: 'superAdmin-user',
|
2025-12-04 23:34:00 +03:30
|
|
|
templateUrl: './single.component.html',
|
2026-03-11 20:42:15 +03:30
|
|
|
imports: [AppCardComponent, KeyValueComponent, UserAccountFormComponent, UsersComponent],
|
2025-12-04 23:34:00 +03:30
|
|
|
})
|
|
|
|
|
export class UserComponent {
|
2026-03-11 20:42:15 +03:30
|
|
|
private readonly store = inject(UserStore);
|
|
|
|
|
private readonly route = inject(ActivatedRoute);
|
|
|
|
|
private readonly breadcrumbService = inject(BreadcrumbService);
|
|
|
|
|
|
|
|
|
|
readonly userId = signal<string>(this.route.snapshot.paramMap.get('userId')!);
|
|
|
|
|
editMode = signal<boolean>(false);
|
|
|
|
|
|
|
|
|
|
readonly loading = computed(() => this.store.loading());
|
|
|
|
|
readonly user = computed(() => this.store.entity());
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
effect(() => {
|
|
|
|
|
if (this.user()?.id) {
|
|
|
|
|
this.setBreadcrumb();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async getData() {
|
|
|
|
|
await this.store.getData(this.userId());
|
|
|
|
|
this.setBreadcrumb();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.getData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setBreadcrumb() {
|
|
|
|
|
this.breadcrumbService.setItems([
|
|
|
|
|
{
|
|
|
|
|
...usersNamedRoutes.users.meta,
|
|
|
|
|
routerLink: usersNamedRoutes.users.meta.pagePath!(),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: this.user()?.fullname,
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
}
|
2025-12-04 23:34:00 +03:30
|
|
|
}
|