diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts index 65300c6d8..aeaa47767 100644 --- a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts +++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts @@ -1,9 +1,8 @@ -import { XRayRulesSettings } from '@ghostfolio/common/interfaces'; import { GfValueComponent } from '@ghostfolio/ui/value'; import { CommonModule } from '@angular/common'; import { Component, Inject } from '@angular/core'; -import { FormsModule } from '@angular/forms'; +import { FormControl, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MAT_DIALOG_DATA, @@ -17,21 +16,33 @@ import { RuleSettingsDialogParams } from './interfaces/interfaces'; @Component({ imports: [ CommonModule, - FormsModule, GfValueComponent, MatButtonModule, MatDialogModule, - MatSliderModule + MatSliderModule, + ReactiveFormsModule ], selector: 'gf-rule-settings-dialog', styleUrls: ['./rule-settings-dialog.scss'], templateUrl: './rule-settings-dialog.html' }) export class GfRuleSettingsDialogComponent { - public settings: XRayRulesSettings['AccountClusterRiskCurrentInvestment']; + public thresholdMaxFormControl = new FormControl( + this.data.settings.thresholdMax + ); + public thresholdMinFormControl = new FormControl( + this.data.settings.thresholdMin + ); public constructor( @Inject(MAT_DIALOG_DATA) public data: RuleSettingsDialogParams, public dialogRef: MatDialogRef ) {} + + public onSave() { + this.dialogRef.close({ + thresholdMax: this.thresholdMaxFormControl.value, + thresholdMin: this.thresholdMinFormControl.value + }); + } } diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html index 83d4e2d19..7e9f33e11 100644 --- a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html +++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.html @@ -12,14 +12,14 @@ [isPercent]="data.rule.configuration.threshold.unit === '%'" [locale]="data.locale" [precision]="2" - [value]="data.settings.thresholdMin" + [value]="thresholdMinFormControl.value" /> -
@@ -35,8 +35,8 @@ [min]="data.rule.configuration.threshold.min" [step]="data.rule.configuration.threshold.step" > - - + +
@@ -75,7 +75,7 @@ [min]="data.rule.configuration.threshold.min" [step]="data.rule.configuration.threshold.step" > - +
@@ -113,7 +113,7 @@ [min]="data.rule.configuration.threshold.min" [step]="data.rule.configuration.threshold.step" > - + Save