From 01bc5a442547ad44a32ed1750fda352ac933e038 Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Thu, 31 Oct 2024 15:54:53 +0100 Subject: [PATCH] fix(user-rep.component): geordnete Assgiment-Ereignisse und -Anfragen --- .../user-representation.component.html | 2 +- .../user-representation.component.ts | 55 ++++++++++++------- .../PublishProfiles/IISProfile1.pubxml | 19 +++++++ .../DTOs/UserRep/UserRepReadDto.cs | 6 +- 4 files changed, 57 insertions(+), 25 deletions(-) create mode 100644 DigitalData.UserManager.API/Properties/PublishProfiles/IISProfile1.pubxml diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.html b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.html index 9b1892d..c921dcd 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.html +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.html @@ -8,7 +8,7 @@ - + diff --git a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.ts b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.ts index e0c9dcb..03e6e5f 100644 --- a/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.ts +++ b/DigitalData.UserManager.API/ClientApp/user_manager_ui/src/app/pages/user-representation/user-representation.component.ts @@ -22,11 +22,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af useRepLabel: string = ""; groupColumns: Array; groupRepCols: Array; - slUserId: null | number = null; - slRepUserId: null | number = null; - slRepGroupId: null | number = null; - slRightGroupId: null | number = null; - slUserRepId: null | number = null; + slUserId?: number; + slGroupId?: number; + slRepUserId?: number; + slRepGroupId?: number; + slUserRepId?: number; initWithoutData = () => { } @@ -61,17 +61,19 @@ export class UserRepresentationComponent extends BasePageComponent implements Af userGroupOnSelectedRows = (rows: GuiSelectedRow[], isUser: boolean = true) => { if (rows.length > 0) { - this.users.safelyUnselectAll(); - 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 = rows[0].source?.id + this.slUserId = undefined; + this.slGroupId = rows[0].source?.id } } } @@ -86,11 +88,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af repUserOnSelectedRows = (rows: GuiSelectedRow[]) => { if (rows.length == 0 && this.slRepUserId) { - if (!this.slUserId) { + if (!this.slUserId && !this.slGroupId) { Swal.fire({ icon: "error", title: "Oops...", - text: "Bitte wählen Sie den Benutzer!", + text: "Bitte wählen Sie den Benutzer oder die Gruppe!", }); } else if (!this.slRepUserId) { @@ -103,15 +105,20 @@ export class UserRepresentationComponent extends BasePageComponent implements Af else { var newUserRep: UserRep = { userId: this.slUserId, + groupId: this.slGroupId, repUserId: this.slRepUserId, addedWho: 'DEFAULT' } this.userRepService.create(newUserRep).subscribe({ next: (response) => { - this.slRepUserId = null; + this.slRepUserId = undefined; + this.repUsers.safelyUnselectAll() - if (this.slUserId != null) + this.repGroups.safelyUnselectAll() + if (this.slUserId != undefined) this.userReps.fetchData(this.slUserId) + if (this.slGroupId != undefined) + this.userReps.fetchData(this.slGroupId) }, error: (error) => { Swal.fire({ @@ -123,7 +130,7 @@ export class UserRepresentationComponent extends BasePageComponent implements Af }); } - this.slRepUserId = null; + this.slRepUserId = undefined; } else if (rows.length > 0) { this.slRepUserId = rows[0].source?.id; @@ -132,11 +139,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af repGroupOnSelectedRows = (rows: GuiSelectedRow[]) => { if (rows.length == 0 && this.slRepGroupId) { - if (!this.slUserId) { + if (!this.slUserId && !this.slGroupId) { Swal.fire({ icon: "error", title: "Oops...", - text: "Bitte wählen Sie den Benutzer!", + text: "Bitte wählen Sie den Benutzer oder die Gruppe!", }); } else if (!this.slRepGroupId) { @@ -149,15 +156,19 @@ export class UserRepresentationComponent extends BasePageComponent implements Af else { var newUserRep = { userId: this.slUserId, + groupId: this.slGroupId, repGroupId: this.slRepGroupId, addedWho: 'DEFAULT' } this.userRepService.create(newUserRep).subscribe({ next: (res) => { - this.slRepGroupId = null; + this.slRepGroupId = undefined; this.repUsers.safelyUnselectAll() - if (this.slUserId != null) + this.groups.safelyUnselectAll() + if (this.slUserId != undefined) this.userReps.fetchData(this.slUserId) + if (this.slGroupId != undefined) + this.userReps.fetchData(undefined, this.slGroupId) }, error: (error) => { Swal.fire({ @@ -169,7 +180,7 @@ export class UserRepresentationComponent extends BasePageComponent implements Af }); } - this.slRepGroupId = null; + this.slRepGroupId = undefined; } else if (rows.length > 0) { this.slRepGroupId = rows[0].source?.id; @@ -180,13 +191,15 @@ export class UserRepresentationComponent extends BasePageComponent implements Af if (rows.length == 0 && this.slUserRepId) { this.userRepService.delete(this.slUserRepId).subscribe({ next: (res) => { - this.slUserRepId = null; + this.slUserRepId = undefined; this.userReps.safelyUnselectAll(); - if (this.slUserId != null) + if (this.slUserId != undefined) this.userReps.fetchData(this.slUserId) + if (this.slGroupId != undefined) + this.userReps.fetchData(undefined, this.slGroupId) }, error: (err) => { - this.slUserRepId = null; + this.slUserRepId = undefined; this.repUsers.safelyUnselectAll() Swal.fire({ icon: "error", diff --git a/DigitalData.UserManager.API/Properties/PublishProfiles/IISProfile1.pubxml b/DigitalData.UserManager.API/Properties/PublishProfiles/IISProfile1.pubxml new file mode 100644 index 0000000..af0bc04 --- /dev/null +++ b/DigitalData.UserManager.API/Properties/PublishProfiles/IISProfile1.pubxml @@ -0,0 +1,19 @@ + + + + + Package + Release + Any CPU + + true + false + 07ccd651-647c-49f7-9715-30cebc13710d + P:\Install .Net\0 DD - Smart UP\DD-UserManager\Web\${Version}\$(Version).zip + true + UserManager.API + <_TargetId>IISWebDeployPackage + + \ No newline at end of file diff --git a/DigitalData.UserManager.Application/DTOs/UserRep/UserRepReadDto.cs b/DigitalData.UserManager.Application/DTOs/UserRep/UserRepReadDto.cs index 449fe3b..d4228a4 100644 --- a/DigitalData.UserManager.Application/DTOs/UserRep/UserRepReadDto.cs +++ b/DigitalData.UserManager.Application/DTOs/UserRep/UserRepReadDto.cs @@ -7,11 +7,11 @@ namespace DigitalData.UserManager.Application.DTOs.UserRep public record UserRepReadDto( int Id, int? UserId, - int? RepGroupId, int? GroupId, - string AddedWho, - string ChangedWho, int? RepUserId, + int? RepGroupId, + string AddedWho, + string ChangedWho, UserReadDto? User, GroupReadDto? RepGroup, GroupReadDto? Group,