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..7fd615e64 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 @@ -3,7 +3,7 @@ import { GfValueComponent } from '@ghostfolio/ui/value'; import { CommonModule } from '@angular/common'; import { Component, Inject } from '@angular/core'; -import { FormsModule } from '@angular/forms'; +import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MAT_DIALOG_DATA, @@ -17,21 +17,31 @@ 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 settingsForm = new FormGroup({ + thresholdMax: new FormControl(this.data.settings?.thresholdMax ?? null), + thresholdMin: new FormControl(this.data.settings?.thresholdMin ?? null) + }); public constructor( @Inject(MAT_DIALOG_DATA) public data: RuleSettingsDialogParams, public dialogRef: MatDialogRef ) {} + + public onSave() { + this.dialogRef.close({ + ...this.data.settings, + ...this.settingsForm.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..9db5feb57 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 @@ -1,138 +1,139 @@
{{ data.categoryName }} › {{ data.rule.name }}
-
- @if ( - data.rule.configuration.thresholdMin && data.rule.configuration.thresholdMax - ) { -
-
- Threshold range: - - - - -
-
- - - - - - +
+
+ @if ( + data.rule.configuration.thresholdMin && data.rule.configuration.thresholdMax + ) { +
+
+ Threshold range: + + - + +
+
+ + + + + + +
-
- } @else { -
-
- Threshold Min: - -
-
- - - - - + } @else { +
+
+ Threshold Min: + +
+
+ + + + + +
-
-
-
- Threshold Max: - -
-
- - - - - +
+
+ Threshold Max: + +
+
+ + + + + +
-
- } -
+ } +
-
- - -
+
+ + +
+