You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
import {
|
|
ChangeDetectionStrategy,
|
|
ChangeDetectorRef,
|
|
Component,
|
|
Inject,
|
|
OnDestroy
|
|
} from '@angular/core';
|
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
|
import { Currency } from '@prisma/client';
|
|
import { Subject } from 'rxjs';
|
|
|
|
import { DataService } from '../../../services/data.service';
|
|
import { CreateOrUpdateAccountDialogParams } from './interfaces/interfaces';
|
|
|
|
@Component({
|
|
host: { class: 'h-100' },
|
|
selector: 'gf-create-or-update-account-dialog',
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
styleUrls: ['./create-or-update-account-dialog.scss'],
|
|
templateUrl: 'create-or-update-account-dialog.html'
|
|
})
|
|
export class CreateOrUpdateAccountDialog implements OnDestroy {
|
|
public currencies: Currency[] = [];
|
|
public platforms: { id: string; name: string }[];
|
|
|
|
private unsubscribeSubject = new Subject<void>();
|
|
|
|
public constructor(
|
|
private changeDetectorRef: ChangeDetectorRef,
|
|
private dataService: DataService,
|
|
public dialogRef: MatDialogRef<CreateOrUpdateAccountDialog>,
|
|
@Inject(MAT_DIALOG_DATA) public data: CreateOrUpdateAccountDialogParams
|
|
) {}
|
|
|
|
ngOnInit() {
|
|
const { currencies, platforms } = this.dataService.fetchInfo();
|
|
|
|
this.currencies = currencies;
|
|
this.platforms = platforms;
|
|
}
|
|
|
|
public onCancel(): void {
|
|
this.dialogRef.close();
|
|
}
|
|
|
|
public ngOnDestroy() {
|
|
this.unsubscribeSubject.next();
|
|
this.unsubscribeSubject.complete();
|
|
}
|
|
}
|