diff --git a/src/app/child-dev-project/attendance/edit-attendance/edit-attendance.component.ts b/src/app/child-dev-project/attendance/edit-attendance/edit-attendance.component.ts index 7fe25e7f1a..58ba70a4c3 100644 --- a/src/app/child-dev-project/attendance/edit-attendance/edit-attendance.component.ts +++ b/src/app/child-dev-project/attendance/edit-attendance/edit-attendance.component.ts @@ -90,12 +90,13 @@ export class EditAttendanceComponent const index = children.indexOf(id); children.splice(index, 1); this.attendanceForm.value.delete(id); - this.formControl.setValue([...children]); this.formControl.markAsDirty(); + this.formControl.setValue([...children]); } updateAttendanceValue(childId, property: "status" | "remarks", newValue) { - this.getAttendance(childId)[property] = newValue; this.formControl.markAsDirty(); + this.getAttendance(childId)[property] = newValue; + this.attendanceForm.setValue(this.attendanceForm.value); } } diff --git a/src/app/core/basic-datatypes/entity-array/edit-entity-array/edit-entity-array.component.html b/src/app/core/basic-datatypes/entity-array/edit-entity-array/edit-entity-array.component.html index c514aa940d..2849b1b42f 100644 --- a/src/app/core/basic-datatypes/entity-array/edit-entity-array/edit-entity-array.component.html +++ b/src/app/core/basic-datatypes/entity-array/edit-entity-array/edit-entity-array.component.html @@ -1,7 +1,7 @@ { setMonthAndYear(date: Moment, datepicker: MatDatepicker) { - this.formControl.setValue(date.toDate()); this.formControl.markAsDirty(); + this.formControl.setValue(date.toDate()); datepicker.close(); } } diff --git a/src/app/features/file/edit-file/edit-file.component.ts b/src/app/features/file/edit-file/edit-file.component.ts index 20ec726de9..e1f93ddf05 100644 --- a/src/app/features/file/edit-file/edit-file.component.ts +++ b/src/app/features/file/edit-file/edit-file.component.ts @@ -78,6 +78,7 @@ export class EditFileComponent extends EditComponent implements OnInit { // directly reset input so subsequent selections with the same name also trigger the change event this.fileUploadInput.nativeElement.value = ""; this.selectedFile = file; + this.formControl.markAsDirty(); this.formControl.setValue(file.name); } @@ -118,6 +119,7 @@ export class EditFileComponent extends EditComponent implements OnInit { } delete() { + this.formControl.markAsDirty(); this.formControl.setValue(null); this.selectedFile = undefined; // remove is only necessary if an initial value was set diff --git a/src/app/features/location/edit-location/edit-location.component.spec.ts b/src/app/features/location/edit-location/edit-location.component.spec.ts index 0399e50ff2..06f8e245d1 100644 --- a/src/app/features/location/edit-location/edit-location.component.spec.ts +++ b/src/app/features/location/edit-location/edit-location.component.spec.ts @@ -111,7 +111,7 @@ describe("EditLocationComponent", () => { await clearButton.click(); - expect(component.formControl.value).toBeNull(); + expect(component.formControl.value).toBeUndefined(); await expectAsync(input.getValue()).toBeResolvedTo(""); }); diff --git a/src/app/features/location/edit-location/edit-location.component.ts b/src/app/features/location/edit-location/edit-location.component.ts index 7a33627904..f8cb91307e 100644 --- a/src/app/features/location/edit-location/edit-location.component.ts +++ b/src/app/features/location/edit-location/edit-location.component.ts @@ -81,7 +81,8 @@ export class EditLocationComponent ); } - selectLocation(selected: GeoResult) { + selectLocation(selected?: GeoResult) { + this.formControl.markAsDirty(); this.formControl.setValue(selected); this.filteredOptions.next([]); } @@ -92,7 +93,7 @@ export class EditLocationComponent } clearInput() { - this.formControl.setValue(null); + this.selectLocation(); } private getGeoLookupResult(searchTerm) { @@ -122,7 +123,7 @@ export class EditLocationComponent ref .afterClosed() .pipe(concatMap(() => this.lookupCoordinates(marked.value[0]))) - .subscribe((res) => this.formControl.setValue(res)); + .subscribe((res) => this.selectLocation(res)); } }