fix: AD Sync- und Internal-Checkboxen bei der Gruppenerstellung deaktivieren

This commit is contained in:
Developer 02
2024-08-14 10:22:41 +02:00
parent 3c7f81987c
commit 2423263413
2 changed files with 9 additions and 12 deletions

View File

@@ -31,13 +31,13 @@
</div>
<div class="row">
<div [ngClass]="checkBoxBSClass(3)">
<mat-checkbox [formControl]="adSync">Ad Sync</mat-checkbox>
<mat-checkbox [disabled]="true">Ad Sync</mat-checkbox>
</div>
<div [ngClass]="checkBoxBSClass(3)">
<mat-checkbox [formControl]="internal">Internal</mat-checkbox>
<mat-checkbox [(ngModel)]="checked" [disabled]="true">Internal</mat-checkbox>
</div>
<div [ngClass]="checkBoxBSClass(2)">
<mat-checkbox [formControl]="active">Active</mat-checkbox>
<mat-checkbox [formControl]="active" [disabled]="true">Active</mat-checkbox>
</div>
<div class="col d-flex justify-content-center me-4 my-2">
<button mat-fab extended (click)="delete()">

View File

@@ -1,4 +1,4 @@
import { Component, signal } from '@angular/core';
import { Component, model, signal } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { FormControl, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
@@ -26,8 +26,6 @@ import Swal from 'sweetalert2';
export class GroupFormComponent {
readonly groupname = new FormControl('', [Validators.required]);
readonly ecmFkId = new FormControl<number>(1, [Validators.required]);
readonly adSync = new FormControl<boolean>(false);
readonly internal = new FormControl<boolean>(true);
readonly active = new FormControl<boolean>(true);
errorMessage = signal('');
@@ -36,6 +34,8 @@ export class GroupFormComponent {
public readonly buttonBSClass: string = "d-flex justify-content-center mx-1 my-2"
public readonly checkBoxBSClass: (colCount: number | undefined) => string = (colCount: number = 2) => `col-${colCount} d-flex justify-content-left mx-1 my-2`
readonly checked = model(true);
constructor(private uService: UserService, private rService: RefreshService, private gService: GroupService) {
merge(
this.groupname.statusChanges, this.groupname.valueChanges,
@@ -44,7 +44,6 @@ export class GroupFormComponent {
.subscribe(() => this.updateErrorMessage());
}
updateErrorMessage() {
if (this.groupname.hasError('required')) {
this.errorMessage.set('Wert eingeben');
@@ -58,8 +57,8 @@ export class GroupFormComponent {
this.gService.create({
name: this.groupname.value!,
ecmFkId: (this.ecmFkId.value!),
adSync: this.adSync.value!,
internal: this.internal.value!,
adSync: false,
internal: true,
active: this.active.value!
}).subscribe({
next: () => {
@@ -78,8 +77,6 @@ export class GroupFormComponent {
delete() {
this.groupname.setValue('')
this.ecmFkId.setValue(1)
this.adSync.setValue(false)
this.internal.setValue(true)
this.active.setValue(true)
}
}
}