Skip to content

Commit

Permalink
alcs-1163 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
urmikgov committed Oct 6, 2023
1 parent b8af2cd commit 63cbf9d
Showing 1 changed file with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,32 @@ export class OwnerDialogComponent {
const res = await this.data.ownerService.create(createDto);
this.dialogRef.close(res);
} else {
this.markFormGroupTouched(this.form)
this.form.markAllAsTouched()
}
}

private markFormGroupTouched(formGroup: FormGroup) {
Object.values(formGroup.controls).forEach(control => {
control.markAsTouched()
})
}

async onClose() {
this.dialogRef.close();
}

async onSave() {
const document = await this.uploadPendingFile(this.pendingFile);
const updateDto: ApplicationOwnerUpdateDto = {
organizationName: this.organizationName.getRawValue(),
firstName: this.firstName.getRawValue(),
lastName: this.lastName.getRawValue(),
corporateSummaryUuid: document?.uuid,
email: this.email.getRawValue()!,
phoneNumber: this.phoneNumber.getRawValue()!,
typeCode: this.type.getRawValue()!,
};
if (this.existingUuid) {
const res = await this.data.ownerService.update(this.existingUuid, updateDto);
this.dialogRef.close(res);
if (this.form.valid) {
const document = await this.uploadPendingFile(this.pendingFile);
const updateDto: ApplicationOwnerUpdateDto = {
organizationName: this.organizationName.getRawValue(),
firstName: this.firstName.getRawValue(),
lastName: this.lastName.getRawValue(),
corporateSummaryUuid: document?.uuid,
email: this.email.getRawValue()!,
phoneNumber: this.phoneNumber.getRawValue()!,
typeCode: this.type.getRawValue()!,
};
if (this.existingUuid) {
const res = await this.data.ownerService.update(this.existingUuid, updateDto);
this.dialogRef.close(res);
}
} else {
this.form.markAllAsTouched()
}
}

Expand Down

0 comments on commit 63cbf9d

Please sign in to comment.