Skip to content

Commit

Permalink
allow user to input existing reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
ckouder committed Jun 11, 2024
1 parent 644fc7d commit 32b4263
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/app/models/dg-predictor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,23 @@ export class ThermodynamicalFeasibilityRequest {
}

private createReactionKeggIDFormControl() {
return new FormGroup<ReactionFormControl>({
const formGroup = new FormGroup<ReactionFormControl>({
type: new FormControl("keggId"),
moleculeNumber: new FormControl("", [Validators.required]),
moleculeInchiOrSmiles: new FormControl("", [Validators.required]),
moleculeNumber: new FormControl("", []),
moleculeInchiOrSmiles: new FormControl("", []),
reactionKeggId: new FormControl("", [Validators.required]),
});

formGroup.controls["moleculeInchiOrSmiles"]?.valueChanges.subscribe((value) => {
if (value) {
formGroup.controls["moleculeNumber"]?.addValidators([Validators.required]);
} else {
formGroup.controls["moleculeNumber"]?.clearValidators();
}
formGroup.controls["moleculeNumber"]?.updateValueAndValidity();
});

return formGroup;
}

private clearAllInputHelper(form: FormGroup | FormArray) {
Expand Down

0 comments on commit 32b4263

Please sign in to comment.