fix activities validation

This commit is contained in:
Daniel Appelgren
2021-11-12 14:17:33 +01:00
parent 71e145f082
commit 4c1f5b1942
4 changed files with 42 additions and 42 deletions

View File

@@ -14,8 +14,8 @@
[uiMaxLength]="2000"
[uiMinLength]="1"
[uiRequired]="true"
[uiValidationMessage]="activityFormGroup.get('description')?.errors?.required"
[uiInvalid]="activityFormGroup.get('description')?.touched && !!activityFormGroup.get('description')?.errors?.required"
[uiValidationMessage]="activityFormGroup.get('whatHasBeenDone')?.errors?.required"
[uiInvalid]="activityFormGroup.get('whatHasBeenDone')?.touched && !!activityFormGroup.get('whatHasBeenDone')?.errors?.required"
></ui-textarea>
</div>
<!-- TODO: If something is required at the top of the form it will be hard to see when at the bottom and clicking next -->

View File

@@ -31,11 +31,11 @@ export class SlutredovisningFormStep1Component implements OnInit {
private changeDetectionRef: ChangeDetectorRef
) {}
private clearActivities(): void {
private _clearActivities(): void {
this.activitiesFormArray.clear();
}
private addActivityToForm(activity: Activity): void {
private _addActivityToForm(activity: Activity): void {
this.activitiesFormArray.push(
new FormGroup({
name: new FormControl(activity.name),
@@ -54,8 +54,8 @@ export class SlutredovisningFormStep1Component implements OnInit {
.getAllChosenActivities(this.genomforandereferens)
.pipe(take(1))
.subscribe(activities => {
this.clearActivities();
activities.forEach(activity => this.addActivityToForm(activity));
this._clearActivities();
activities.forEach(activity => this._addActivityToForm(activity));
});
}
}

View File

@@ -37,4 +37,4 @@
</footer>
</ng-template>
</div>
<pre>{{slutredovisning$|async|json}}</pre>
<!--<pre>{{slutredovisning$|async|json}}</pre>-->

View File

@@ -51,43 +51,43 @@
</ng-template>
</div>
<h2>Step 0 valueChanges:</h2>
<pre>
{{ step0FormGroup.valueChanges | async | json}}
</pre
>
<h2>Step 1 valueChanges:</h2>
<pre>
{{ step1FormGroup.valueChanges | async | json}}
</pre
>
<h2>Step 2 valueChanges:</h2>
<pre>
{{ step2FormGroup.valueChanges | async | json}}
</pre
>
<!-- <h2>Step 0 valueChanges:</h2>-->
<!-- <pre>-->
<!-- {{ step0FormGroup.valueChanges | async | json}}-->
<!-- </pre-->
<!-- >-->
<!-- <h2>Step 1 valueChanges:</h2>-->
<!-- <pre>-->
<!-- {{ step1FormGroup.valueChanges | async | json}}-->
<!-- </pre-->
<!-- >-->
<!-- <h2>Step 2 valueChanges:</h2>-->
<!-- <pre>-->
<!-- {{ step2FormGroup.valueChanges | async | json}}-->
<!-- </pre-->
<!-- >-->
<h2>Step 0 data:</h2>
<pre>
{{step0FormData$ | async | json}}
</pre
>
<!-- <h2>Step 0 data:</h2>-->
<!-- <pre>-->
<!-- {{step0FormData$ | async | json}}-->
<!-- </pre-->
<!-- >-->
<h2>Step 1 data:</h2>
<pre>
{{step1FormData$ | async | json}}
</pre
>
<h2>Step 2 data:</h2>
<pre>
{{step2FormData$ | async | json}}
</pre
>
<h2>slutredovisningFormData$ data:</h2>
<pre>
{{slutredovisningFormData$ | async | json}}
</pre
>
<!-- <h2>Step 1 data:</h2>-->
<!-- <pre>-->
<!-- {{step1FormData$ | async | json}}-->
<!-- </pre-->
<!-- >-->
<!-- <h2>Step 2 data:</h2>-->
<!-- <pre>-->
<!-- {{step2FormData$ | async | json}}-->
<!-- </pre-->
<!-- >-->
<!-- <h2>slutredovisningFormData$ data:</h2>-->
<!-- <pre>-->
<!-- {{slutredovisningFormData$ | async | json}}-->
<!-- </pre-->
<!-- >-->
</msfa-report-layout>
</msfa-layout>
<ng-template #skeletonRef>