You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { TransactionLogService } from '../shared/services/transaction-log.service';
|
|
import { CommonModule } from '@angular/common';
|
|
import { TranslateModule } from '@ngx-translate/core';
|
|
import { ExcelExportService } from '../shared/services/excel-export.service';
|
|
import { TRANSACTION_LOGS_FILE_NAME } from '../utils/app.constants';
|
|
|
|
interface TransactionLog {
|
|
logId: number;
|
|
porOrgacode: string;
|
|
drMbmbkmsnumber: string;
|
|
crMbmbkmsnumber: string;
|
|
crPcaglacode: string;
|
|
drPcaGlacode: string;
|
|
ppmPymdcode: string;
|
|
sgtGntrdate: string;
|
|
sgtGntrcreateat: string;
|
|
channelCode: string;
|
|
transactionID: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
@Component({
|
|
selector: 'app-transaction-logs',
|
|
templateUrl: './transaction-logs.component.html',
|
|
providers: [TransactionLogService],
|
|
imports:[CommonModule, TranslateModule]
|
|
})
|
|
export class TransactionLogsComponent implements OnInit {
|
|
|
|
logs: TransactionLog[] = [];
|
|
isLoading = false;
|
|
errorMessage: string = '';
|
|
|
|
constructor(
|
|
private transactionLogService: TransactionLogService,
|
|
private excelExportService: ExcelExportService
|
|
) {}
|
|
|
|
ngOnInit(): void {
|
|
this.loadLogs();
|
|
}
|
|
|
|
loadLogs() {
|
|
this.isLoading = true;
|
|
this.errorMessage = '';
|
|
|
|
this.transactionLogService.getTransactionLogs().subscribe({
|
|
next: (res) => {
|
|
this.logs = res;
|
|
this.isLoading = false;
|
|
},
|
|
error: (err) => {
|
|
console.error('Failed to load transaction logs', err);
|
|
this.errorMessage = 'Failed to load transaction logs. Please try again.';
|
|
this.isLoading = false;
|
|
}
|
|
});
|
|
}
|
|
|
|
exportDataInExcel(){
|
|
this.excelExportService.exportExcel(this.logs, TRANSACTION_LOGS_FILE_NAME)
|
|
}
|
|
} |