|
|
|
@ -5,11 +5,12 @@ import { |
|
|
|
ChangeDetectorRef, |
|
|
|
Component, |
|
|
|
CUSTOM_ELEMENTS_SCHEMA, |
|
|
|
DestroyRef, |
|
|
|
inject, |
|
|
|
OnDestroy, |
|
|
|
OnInit, |
|
|
|
signal |
|
|
|
} from '@angular/core'; |
|
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
|
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core'; |
|
|
|
@ -24,7 +25,6 @@ import { MatInputModule } from '@angular/material/input'; |
|
|
|
import { IonIcon } from '@ionic/angular/standalone'; |
|
|
|
import { addIcons } from 'ionicons'; |
|
|
|
import { calendarClearOutline, refreshOutline } from 'ionicons/icons'; |
|
|
|
import { Subject, takeUntil } from 'rxjs'; |
|
|
|
|
|
|
|
import { HistoricalMarketDataEditorDialogParams } from './interfaces/interfaces'; |
|
|
|
|
|
|
|
@ -46,17 +46,15 @@ import { HistoricalMarketDataEditorDialogParams } from './interfaces/interfaces' |
|
|
|
styleUrls: ['./historical-market-data-editor-dialog.scss'], |
|
|
|
templateUrl: 'historical-market-data-editor-dialog.html' |
|
|
|
}) |
|
|
|
export class GfHistoricalMarketDataEditorDialogComponent |
|
|
|
implements OnDestroy, OnInit |
|
|
|
{ |
|
|
|
export class GfHistoricalMarketDataEditorDialogComponent implements OnInit { |
|
|
|
public readonly data = |
|
|
|
inject<HistoricalMarketDataEditorDialogParams>(MAT_DIALOG_DATA); |
|
|
|
|
|
|
|
protected readonly marketPrice = signal(this.data.marketPrice); |
|
|
|
|
|
|
|
private readonly destroyRef = inject(DestroyRef); |
|
|
|
private readonly locale = |
|
|
|
this.data.user.settings.locale ?? inject<string>(MAT_DATE_LOCALE); |
|
|
|
private readonly unsubscribeSubject = new Subject<void>(); |
|
|
|
|
|
|
|
public constructor( |
|
|
|
private adminService: AdminService, |
|
|
|
@ -83,7 +81,7 @@ export class GfHistoricalMarketDataEditorDialogComponent |
|
|
|
dateString: this.data.dateString, |
|
|
|
symbol: this.data.symbol |
|
|
|
}) |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
|
.subscribe(({ marketPrice }) => { |
|
|
|
this.marketPrice.set(marketPrice); |
|
|
|
|
|
|
|
@ -109,14 +107,9 @@ export class GfHistoricalMarketDataEditorDialogComponent |
|
|
|
}, |
|
|
|
symbol: this.data.symbol |
|
|
|
}) |
|
|
|
.pipe(takeUntil(this.unsubscribeSubject)) |
|
|
|
.pipe(takeUntilDestroyed(this.destroyRef)) |
|
|
|
.subscribe(() => { |
|
|
|
this.dialogRef.close({ withRefresh: true }); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnDestroy() { |
|
|
|
this.unsubscribeSubject.next(); |
|
|
|
this.unsubscribeSubject.complete(); |
|
|
|
} |
|
|
|
} |
|
|
|
|