refactor: redundante Funktion entfernen und Logik zur Verarbeitung ausgewählter Zeilen in UserRepresentationComponent konsolidieren
This commit is contained in:
parent
5df5cc555a
commit
296f29cf82
@ -59,31 +59,24 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
||||
@ViewChild("repGroups") repGroups!: GroupTableComponent;
|
||||
@ViewChild("userReps") userReps!: UserRepTableComponent;
|
||||
|
||||
userGroupOnSelectedRows = (rows: GuiSelectedRow[], isUser: boolean = true) => {
|
||||
userOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||
if (rows.length > 0) {
|
||||
if (isUser) {
|
||||
this.useRepLabel = `Vertretungen von ${rows[0].source?.username}`
|
||||
this.users.safelyUnselectAll();
|
||||
this.userReps.fetchData(rows[0].source?.id)
|
||||
this.slGroupId = undefined;
|
||||
this.slUserId = rows[0].source?.id
|
||||
}
|
||||
else {
|
||||
this.useRepLabel = `Vertretungen von ${rows[0].source?.name}`
|
||||
this.groups.safelyUnselectAll();
|
||||
this.userReps.fetchData(undefined, rows[0].source?.id)
|
||||
this.slUserId = undefined;
|
||||
this.slGroupId = rows[0].source?.id
|
||||
}
|
||||
this.useRepLabel = `Vertretungen von ${rows[0].source?.username}`
|
||||
this.users.safelyUnselectAll();
|
||||
this.userReps.fetchData(rows[0].source?.id)
|
||||
this.slGroupId = undefined;
|
||||
this.slUserId = rows[0].source?.id
|
||||
}
|
||||
}
|
||||
|
||||
userOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||
this.userGroupOnSelectedRows(rows, true);
|
||||
}
|
||||
|
||||
groupOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||
this.userGroupOnSelectedRows(rows, false);
|
||||
if (rows.length > 0) {
|
||||
this.useRepLabel = `Vertretungen von ${rows[0].source?.name}`
|
||||
this.groups.safelyUnselectAll();
|
||||
this.userReps.fetchData(undefined, rows[0].source?.id)
|
||||
this.slUserId = undefined;
|
||||
this.slGroupId = rows[0].source?.id
|
||||
}
|
||||
}
|
||||
|
||||
repUserOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||
@ -213,4 +206,4 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
||||
this.slUserRepId = rows[0].source?.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user