refactor(user-representation.component): Aktualisiert, um als unbegrenzt zu speichern.
This commit is contained in:
parent
7e05123fbf
commit
ff6ebf300c
@ -71,18 +71,20 @@ export class RepCreateFormComponent implements OnInit {
|
||||
const validFrom = this.range.value.start;
|
||||
const validTo = this.range.value.end;
|
||||
|
||||
if (!validFrom || !validTo) {
|
||||
if ((!validFrom || !validTo) && !this.termless) {
|
||||
Swal.fire({
|
||||
icon: "error",
|
||||
title: "Oops...",
|
||||
text: "Bitte geben Sie einen gültigen Datumsbereich ein!",
|
||||
text: "Bitte geben Sie einen gültigen Datumsbereich ein oder wählen Sie unbefristet!",
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this.userRep.validFrom = validFrom!;
|
||||
this.userRep.validTo = validTo!;
|
||||
if (!this.termless) {
|
||||
this.userRep.validFrom = validFrom!;
|
||||
this.userRep.validTo = validTo!;
|
||||
}
|
||||
|
||||
this.userRepService.create(this.userRep).subscribe({
|
||||
next: (res) => {
|
||||
@ -94,4 +96,4 @@ export class RepCreateFormComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,9 +103,7 @@ export class UserRepresentationComponent extends BasePageComponent implements Af
|
||||
var newUserRep: UserRep = {
|
||||
userId: this.slUserId,
|
||||
groupId: this.slGroupId,
|
||||
repUserId: this.slRepUserId,
|
||||
validFrom: new Date(),
|
||||
validTo: new Date(new Date().setDate(new Date().getDate() + 7))
|
||||
repUserId: this.slRepUserId
|
||||
}
|
||||
|
||||
this.openCreateSheet(newUserRep, res => {
|
||||
|
||||
@ -31,7 +31,6 @@ namespace DigitalData.UserManager.Application.Services
|
||||
//date range control
|
||||
: (createDto.ValidFrom > createDto.ValidTo)
|
||||
? Result.Fail<int>().Notice(LogLevel.None, Flag.DataIntegrityIssue, _localizer[Key.InvalidDateRange])
|
||||
: await base.CreateAsync(createDto);
|
||||
|
||||
: await base.CreateAsync(createDto);
|
||||
}
|
||||
}
|
||||
@ -18,13 +18,11 @@ namespace DigitalData.UserManager.Domain.Entities
|
||||
[Column("REPR_USER")]
|
||||
public int? RepUserId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("VALID_FROM")]
|
||||
public required DateTime? ValidFrom { get; set; }
|
||||
public DateTime? ValidFrom { get; set; }
|
||||
|
||||
[Required]
|
||||
[Column("VALID_TO")]
|
||||
public required DateTime? ValidTo { get; set; }
|
||||
public DateTime? ValidTo { get; set; }
|
||||
|
||||
[ForeignKey("UserId")]
|
||||
public virtual User? User { get; set; }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user