2020-11-04 13:36:30 +01:00
|
|
|
import {Component, OnDestroy, OnInit} from '@angular/core';
|
|
|
|
import {TransactionService} from '../../_services/transaction.service';
|
2020-11-08 07:31:52 +01:00
|
|
|
import {Conversion, Transaction} from '../../_models';
|
2020-11-04 13:36:30 +01:00
|
|
|
import {Subject} from 'rxjs';
|
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-transactions',
|
|
|
|
templateUrl: './transactions.component.html',
|
|
|
|
styleUrls: ['./transactions.component.scss']
|
|
|
|
})
|
|
|
|
export class TransactionsComponent implements OnInit, OnDestroy {
|
|
|
|
dtOptions: DataTables.Settings = {};
|
|
|
|
dtTrigger: Subject<any> = new Subject();
|
2020-11-08 07:31:52 +01:00
|
|
|
transactions: Transaction[] = [];
|
|
|
|
conversions: Conversion[] = [];
|
2020-11-04 13:36:30 +01:00
|
|
|
transaction: Transaction;
|
2020-11-08 07:31:52 +01:00
|
|
|
conversion: Conversion;
|
2020-11-04 13:36:30 +01:00
|
|
|
|
|
|
|
constructor(private transactionService: TransactionService) { }
|
|
|
|
|
|
|
|
ngOnInit(): void {
|
|
|
|
this.dtOptions = {
|
|
|
|
pagingType: 'full_numbers',
|
|
|
|
pageLength: 5,
|
|
|
|
lengthMenu: [5, 10, 25, 50, 100],
|
|
|
|
processing: true
|
|
|
|
};
|
|
|
|
|
2020-11-08 07:31:52 +01:00
|
|
|
this.transactions = this.transactionService.transactions;
|
|
|
|
this.conversions = this.transactionService.conversions;
|
|
|
|
this.dtTrigger.next();
|
2020-11-04 13:36:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ngOnDestroy(): void {
|
|
|
|
this.dtTrigger.unsubscribe();
|
|
|
|
}
|
|
|
|
|
|
|
|
viewTransaction(transaction): void {
|
|
|
|
this.transaction = transaction;
|
|
|
|
}
|
2020-11-08 07:31:52 +01:00
|
|
|
|
|
|
|
viewConversion(conversion): void {
|
|
|
|
this.conversion = conversion;
|
|
|
|
}
|
2020-11-04 13:36:30 +01:00
|
|
|
}
|