Compare commits
10 Commits
5df5cc555a
...
968ff8349f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
968ff8349f | ||
|
|
770921011a | ||
|
|
a9bc4f90ac | ||
|
|
6e5ba82869 | ||
|
|
fb3dedadc5 | ||
|
|
8cf2183cd6 | ||
|
|
881d2ccac8 | ||
|
|
deacd1a8c6 | ||
|
|
616862391e | ||
|
|
296f29cf82 |
@@ -31,4 +31,12 @@ export class UserRepTableComponent extends BaseTableComponent<UserRep, UserRepSe
|
|||||||
error: (error: any) => { }
|
error: (error: any) => { }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public fetchByUser(id: number): void {
|
||||||
|
this.fetchData(id, undefined);
|
||||||
|
}
|
||||||
|
|
||||||
|
public fetchByGroup(id: number): void {
|
||||||
|
this.fetchData(undefined, id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ export interface UserRep {
|
|||||||
userId?: number,
|
userId?: number,
|
||||||
repGroupId?: number,
|
repGroupId?: number,
|
||||||
groupId?: number,
|
groupId?: number,
|
||||||
addedWho: string,
|
addedWho?: string,
|
||||||
repUser?: User
|
repUser?: User
|
||||||
user?: User,
|
user?: User,
|
||||||
repGroup?: Group,
|
repGroup?: Group,
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<mat-tab-group>
|
<mat-tab-group>
|
||||||
<mat-tab label="{{useRepLabel}}">
|
<mat-tab label="{{useRepLabel}}">
|
||||||
<app-user-rep-table #userReps [initData]="initWithoutData" [onSelectedRows]="userRepOnSelectedRows"></app-user-rep-table>
|
<app-user-rep-table #userReps [initData]="initWithoutData" [onSelectedRows]="repOnSelectedRows"></app-user-rep-table>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
slGroupId?: number;
|
slGroupId?: number;
|
||||||
slRepUserId?: number;
|
slRepUserId?: number;
|
||||||
slRepGroupId?: number;
|
slRepGroupId?: number;
|
||||||
slUserRepId?: number;
|
slRepId?: number;
|
||||||
|
|
||||||
initWithoutData = () => { }
|
initWithoutData = () => { }
|
||||||
|
|
||||||
@@ -59,31 +59,24 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
@ViewChild("repGroups") repGroups!: GroupTableComponent;
|
@ViewChild("repGroups") repGroups!: GroupTableComponent;
|
||||||
@ViewChild("userReps") userReps!: UserRepTableComponent;
|
@ViewChild("userReps") userReps!: UserRepTableComponent;
|
||||||
|
|
||||||
userGroupOnSelectedRows = (rows: GuiSelectedRow[], isUser: boolean = true) => {
|
userOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
if (rows.length > 0) {
|
if (rows.length > 0) {
|
||||||
if (isUser) {
|
this.useRepLabel = `Vertretungen von ${rows[0].source?.username}`
|
||||||
this.useRepLabel = `Vertretungen von ${rows[0].source?.username}`
|
this.users.safelyUnselectAll();
|
||||||
this.users.safelyUnselectAll();
|
this.userReps.fetchByUser(rows[0].source?.id);
|
||||||
this.userReps.fetchData(rows[0].source?.id)
|
this.slGroupId = undefined;
|
||||||
this.slGroupId = undefined;
|
this.slUserId = rows[0].source?.id
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
|
||||||
this.userGroupOnSelectedRows(rows, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
groupOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
groupOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
this.userGroupOnSelectedRows(rows, false);
|
if (rows.length > 0) {
|
||||||
|
this.useRepLabel = `Vertretungen von ${rows[0].source?.name}`
|
||||||
|
this.groups.safelyUnselectAll();
|
||||||
|
this.userReps.fetchByGroup(rows[0].source?.id);
|
||||||
|
this.slUserId = undefined;
|
||||||
|
this.slGroupId = rows[0].source?.id
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repUserOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
repUserOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
@@ -107,7 +100,6 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
userId: this.slUserId,
|
userId: this.slUserId,
|
||||||
groupId: this.slGroupId,
|
groupId: this.slGroupId,
|
||||||
repUserId: this.slRepUserId,
|
repUserId: this.slRepUserId,
|
||||||
addedWho: 'DEFAULT'
|
|
||||||
}
|
}
|
||||||
this.userRepService.create(newUserRep).subscribe({
|
this.userRepService.create(newUserRep).subscribe({
|
||||||
next: (response) => {
|
next: (response) => {
|
||||||
@@ -115,10 +107,10 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
|
|
||||||
this.repUsers.safelyUnselectAll()
|
this.repUsers.safelyUnselectAll()
|
||||||
this.repGroups.safelyUnselectAll()
|
this.repGroups.safelyUnselectAll()
|
||||||
if (this.slUserId != undefined)
|
if (this.slUserId)
|
||||||
this.userReps.fetchData(this.slUserId)
|
this.userReps.fetchByUser(this.slUserId)
|
||||||
if (this.slGroupId != undefined)
|
if (this.slGroupId)
|
||||||
this.userReps.fetchData(this.slGroupId)
|
this.userReps.fetchByGroup(this.slGroupId)
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
@@ -158,17 +150,16 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
userId: this.slUserId,
|
userId: this.slUserId,
|
||||||
groupId: this.slGroupId,
|
groupId: this.slGroupId,
|
||||||
repGroupId: this.slRepGroupId,
|
repGroupId: this.slRepGroupId,
|
||||||
addedWho: 'DEFAULT'
|
|
||||||
}
|
}
|
||||||
this.userRepService.create(newUserRep).subscribe({
|
this.userRepService.create(newUserRep).subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
this.slRepGroupId = undefined;
|
this.slRepGroupId = undefined;
|
||||||
this.repUsers.safelyUnselectAll()
|
this.repUsers.safelyUnselectAll()
|
||||||
this.groups.safelyUnselectAll()
|
this.groups.safelyUnselectAll()
|
||||||
if (this.slUserId != undefined)
|
if (this.slUserId)
|
||||||
this.userReps.fetchData(this.slUserId)
|
this.userReps.fetchByUser(this.slUserId)
|
||||||
if (this.slGroupId != undefined)
|
if (this.slGroupId)
|
||||||
this.userReps.fetchData(undefined, this.slGroupId)
|
this.userReps.fetchByGroup(this.slGroupId)
|
||||||
},
|
},
|
||||||
error: (error) => {
|
error: (error) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
@@ -187,11 +178,11 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
userRepOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
repOnSelectedRows = (rows: GuiSelectedRow[]) => {
|
||||||
if (rows.length == 0 && this.slUserRepId) {
|
if (rows.length == 0 && this.slRepId) {
|
||||||
this.userRepService.delete(this.slUserRepId).subscribe({
|
this.userRepService.delete(this.slRepId).subscribe({
|
||||||
next: (res) => {
|
next: (res) => {
|
||||||
this.slUserRepId = undefined;
|
this.slRepId = undefined;
|
||||||
this.userReps.safelyUnselectAll();
|
this.userReps.safelyUnselectAll();
|
||||||
if (this.slUserId != undefined)
|
if (this.slUserId != undefined)
|
||||||
this.userReps.fetchData(this.slUserId)
|
this.userReps.fetchData(this.slUserId)
|
||||||
@@ -199,7 +190,7 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
this.userReps.fetchData(undefined, this.slGroupId)
|
this.userReps.fetchData(undefined, this.slGroupId)
|
||||||
},
|
},
|
||||||
error: (err) => {
|
error: (err) => {
|
||||||
this.slUserRepId = undefined;
|
this.slRepId = undefined;
|
||||||
this.repUsers.safelyUnselectAll()
|
this.repUsers.safelyUnselectAll()
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
icon: "error",
|
icon: "error",
|
||||||
@@ -210,7 +201,7 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (rows.length > 0) {
|
else if (rows.length > 0) {
|
||||||
this.slUserRepId = rows[0].source?.id;
|
this.slRepId = rows[0].source?.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,18 +19,18 @@ namespace DigitalData.UserManager.API.Controllers
|
|||||||
{
|
{
|
||||||
return base.GetAll();
|
return base.GetAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IActionResult> GetAll(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null)
|
public async Task<IActionResult> GetAll(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return await _service.ReadAllAsync(withUser, withRepGroup, withGroup, withRepUser, userId, groupId).ThenAsync(Ok, IActionResult (m, n) =>
|
return await _service.ReadAllAsync(withUser: withUser, withRepGroup: withRepGroup, withGroup: withGroup, withRepUser: withRepUser,
|
||||||
|
userId: userId, groupId: groupId).ThenAsync(Ok, IActionResult (m, n) =>
|
||||||
{
|
{
|
||||||
_logger.LogNotice(n);
|
_logger.LogNotice(n);
|
||||||
return NotFound();
|
return NotFound();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace DigitalData.UserManager.Application.DTOs.UserRep
|
|||||||
int? UserId,
|
int? UserId,
|
||||||
int? RepGroupId,
|
int? RepGroupId,
|
||||||
int? GroupId,
|
int? GroupId,
|
||||||
int? RepUserId
|
int? RepUserId,
|
||||||
|
DateTime? ValidFrom,
|
||||||
|
DateTime? ValidTo
|
||||||
) : BaseCreateDto();
|
) : BaseCreateDto();
|
||||||
}
|
}
|
||||||
@@ -9,9 +9,11 @@ namespace DigitalData.UserManager.Application.DTOs.UserRep
|
|||||||
int? UserId,
|
int? UserId,
|
||||||
int? GroupId,
|
int? GroupId,
|
||||||
int? RepUserId,
|
int? RepUserId,
|
||||||
int? RepGroupId,
|
int? RepGroupId,
|
||||||
|
DateTime ValidFrom,
|
||||||
|
DateTime ValidTo,
|
||||||
string AddedWho,
|
string AddedWho,
|
||||||
string? ChangedWho,
|
string? ChangedWho,
|
||||||
UserReadDto? User,
|
UserReadDto? User,
|
||||||
GroupReadDto? RepGroup,
|
GroupReadDto? RepGroup,
|
||||||
GroupReadDto? Group,
|
GroupReadDto? Group,
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace DigitalData.UserManager.Application.DTOs.UserRep
|
|||||||
int? UserId,
|
int? UserId,
|
||||||
int? RepGroupId,
|
int? RepGroupId,
|
||||||
int? GroupId,
|
int? GroupId,
|
||||||
int? RepUserId
|
int? RepUserId,
|
||||||
|
DateTime? ValidFrom,
|
||||||
|
DateTime? ValidTo
|
||||||
) : BaseUpdateDto();
|
) : BaseUpdateDto();
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using DigitalData.Core.Application;
|
|
||||||
using DigitalData.Core.DTO;
|
using DigitalData.Core.DTO;
|
||||||
using DigitalData.UserManager.Application.Contracts;
|
using DigitalData.UserManager.Application.Contracts;
|
||||||
using DigitalData.UserManager.Application.DTOs.UserRep;
|
using DigitalData.UserManager.Application.DTOs.UserRep;
|
||||||
@@ -17,7 +16,7 @@ namespace DigitalData.UserManager.Application.Services
|
|||||||
|
|
||||||
public async Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null)
|
public async Task<DataResult<IEnumerable<UserRepReadDto>>> ReadAllAsync(bool withUser = false, bool withRepGroup = false, bool withGroup = false, bool withRepUser = false, int? userId = null, int? groupId = null)
|
||||||
{
|
{
|
||||||
var urs = await _repository.ReadAllAsync(withUser, withRepGroup, withGroup, withRepUser, userId, groupId);
|
var urs = await _repository.ReadAllAsync(withUser: withUser, withRepGroup: withRepGroup, withGroup: withGroup, withRepUser: withRepUser, userId: userId, groupId: groupId);
|
||||||
var urReadDTOs = _mapper.Map<IEnumerable<UserRepReadDto>>(urs);
|
var urReadDTOs = _mapper.Map<IEnumerable<UserRepReadDto>>(urs);
|
||||||
return Result.Success(urReadDTOs);
|
return Result.Success(urReadDTOs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace DigitalData.UserManager.Domain.Entities
|
namespace DigitalData.UserManager.Domain.Entities
|
||||||
{
|
{
|
||||||
@@ -18,6 +18,14 @@ namespace DigitalData.UserManager.Domain.Entities
|
|||||||
[Column("REPR_USER")]
|
[Column("REPR_USER")]
|
||||||
public int? RepUserId { get; set; }
|
public int? RepUserId { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[Column("VALID_FROM")]
|
||||||
|
public required DateTime ValidFrom { get; set; }
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
[Column("VALID_TO")]
|
||||||
|
public required DateTime ValidTo { get; set; }
|
||||||
|
|
||||||
[ForeignKey("UserId")]
|
[ForeignKey("UserId")]
|
||||||
public virtual User? User { get; set; }
|
public virtual User? User { get; set; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user