refactor: Ändere die Variable sGroupId zu sGroup und passe die Methode groupsOnSelectedRows an, um das sGroup-Objekt zu verarbeiten.

This commit is contained in:
Developer 02 2024-10-31 11:37:15 +01:00
parent 91b78f4b59
commit 5f4a8e373c
2 changed files with 17 additions and 8 deletions

View File

@ -33,15 +33,15 @@ export class GroupComponent extends BasePageComponent implements AfterViewInit {
}
}
private sGroupId = null;
private sGroup: Group | null = null;
ngAfterViewInit(): void {
this.buttonVisibilityService.setVisibleOnly(this.refreshService, this.creationService, this.updateService)
this.refreshService.removeAll()
this.refreshService.add(() => {
this.groupTable.fetchData();
if (this.sGroupId)
this.userTable.fetchDataByGroupId(this.sGroupId);
if (this.sGroup)
this.userTable.fetchDataByGroupId(this.sGroup.id!);
});
this.creationService.component = GroupFormComponent
@ -53,9 +53,12 @@ export class GroupComponent extends BasePageComponent implements AfterViewInit {
groupsOnSelectedRows = (rows: GuiSelectedRow[]) => {
if (rows.length > 0) {
this.sGroupId = rows[0].source.id;
if (this.sGroupId)
this.userTable.fetchDataByGroupId(this.sGroupId);
this.sGroup = rows[0].source;
if (this.sGroup)
this.userTable.fetchDataByGroupId(this.sGroup.id!);
}
else if (rows.length == 0 && this.sGroup?.name != null) {
this.openUpdateSheet(this.sGroup);
}
}
@ -95,4 +98,12 @@ export class GroupComponent extends BasePageComponent implements AfterViewInit {
get complete_group_cols() {
return env.columnNames.group.complete
}
openUpdateSheet(user: Group): void {
/* this.dialog.open(UserUpdateFormComponent, {
width: "50rem",
data: user
}); */
alert(JSON.stringify(user))
}
}

View File

@ -40,8 +40,6 @@ export class UserComponent extends BasePageComponent implements AfterViewInit {
private sUser: any = null;
private _bottomSheet = inject(MatBottomSheet);
private readonly dialog: MatDialog = inject(MatDialog);
ngAfterViewInit(): void {