refactor(user-representation.component): Aktualisiert, um als unbegrenzt zu speichern.

This commit is contained in:
Developer 02
2024-11-11 14:09:10 +01:00
parent 7e05123fbf
commit ff6ebf300c
4 changed files with 11 additions and 14 deletions

View File

@@ -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 {
}
});
}
}
}

View File

@@ -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 => {