|
|
@ -7,7 +7,8 @@ import { |
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
inject, |
|
|
inject, |
|
|
OnDestroy, |
|
|
OnDestroy, |
|
|
OnInit |
|
|
OnInit, |
|
|
|
|
|
signal |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
@ -51,6 +52,8 @@ export class GfHistoricalMarketDataEditorDialogComponent |
|
|
public readonly data = |
|
|
public readonly data = |
|
|
inject<HistoricalMarketDataEditorDialogParams>(MAT_DIALOG_DATA); |
|
|
inject<HistoricalMarketDataEditorDialogParams>(MAT_DIALOG_DATA); |
|
|
|
|
|
|
|
|
|
|
|
protected readonly marketPrice = signal(this.data.marketPrice); |
|
|
|
|
|
|
|
|
private readonly locale = |
|
|
private readonly locale = |
|
|
this.data.user.settings.locale ?? inject<string>(MAT_DATE_LOCALE); |
|
|
this.data.user.settings.locale ?? inject<string>(MAT_DATE_LOCALE); |
|
|
private readonly unsubscribeSubject = new Subject<void>(); |
|
|
private readonly unsubscribeSubject = new Subject<void>(); |
|
|
@ -82,14 +85,14 @@ export class GfHistoricalMarketDataEditorDialogComponent |
|
|
}) |
|
|
}) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
.subscribe(({ marketPrice }) => { |
|
|
.subscribe(({ marketPrice }) => { |
|
|
this.data.marketPrice = marketPrice; |
|
|
this.marketPrice.set(marketPrice); |
|
|
|
|
|
|
|
|
this.changeDetectorRef.markForCheck(); |
|
|
this.changeDetectorRef.markForCheck(); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public onUpdate() { |
|
|
public onUpdate() { |
|
|
if (this.data.marketPrice === undefined) { |
|
|
if (this.marketPrice() === undefined) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -100,7 +103,7 @@ export class GfHistoricalMarketDataEditorDialogComponent |
|
|
marketData: [ |
|
|
marketData: [ |
|
|
{ |
|
|
{ |
|
|
date: this.data.dateString, |
|
|
date: this.data.dateString, |
|
|
marketPrice: this.data.marketPrice |
|
|
marketPrice: this.marketPrice() |
|
|
} |
|
|
} |
|
|
] |
|
|
] |
|
|
}, |
|
|
}, |
|
|
|