|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import { GfValueComponent } from '@ghostfolio/ui/value'; |
|
|
|
|
|
|
|
import { ChangeDetectionStrategy, Component, Inject } from '@angular/core'; |
|
|
|
import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; |
|
|
|
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms'; |
|
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
|
import { |
|
|
|
@ -26,20 +26,21 @@ import { RuleSettingsDialogParams } from './interfaces/interfaces'; |
|
|
|
templateUrl: './rule-settings-dialog.html' |
|
|
|
}) |
|
|
|
export class GfRuleSettingsDialogComponent { |
|
|
|
public settingsForm: FormGroup; |
|
|
|
protected readonly settingsForm: FormGroup; |
|
|
|
|
|
|
|
public constructor( |
|
|
|
@Inject(MAT_DIALOG_DATA) public data: RuleSettingsDialogParams, |
|
|
|
public dialogRef: MatDialogRef<GfRuleSettingsDialogComponent>, |
|
|
|
private formBuilder: FormBuilder |
|
|
|
) { |
|
|
|
protected readonly data = inject<RuleSettingsDialogParams>(MAT_DIALOG_DATA); |
|
|
|
protected readonly dialogRef = |
|
|
|
inject<MatDialogRef<GfRuleSettingsDialogComponent>>(MatDialogRef); |
|
|
|
private readonly formBuilder = inject(FormBuilder); |
|
|
|
|
|
|
|
public constructor() { |
|
|
|
this.settingsForm = this.formBuilder.group({ |
|
|
|
thresholdMax: [this.data.settings.thresholdMax], |
|
|
|
thresholdMin: [this.data.settings.thresholdMin] |
|
|
|
thresholdMax: [this.data.settings?.thresholdMax], |
|
|
|
thresholdMin: [this.data.settings?.thresholdMin] |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public onSubmit() { |
|
|
|
protected onSubmit() { |
|
|
|
this.dialogRef.close({ |
|
|
|
...this.data.settings, |
|
|
|
thresholdMax: this.settingsForm.get('thresholdMax')?.value, |
|
|
|
|