import { Component, ElementRef, OnInit } from '@angular/core'; import { EitService } from 'src/app/eit/services/eit.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { ServiceService } from '../service/service.service'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.scss'], }) export class HomeComponent implements OnInit { public direction: any; public transactions: any = []; public selectedTransaction: any; public dateTo: any; public dateFrom: any; public transactionDetails; constructor(public cs: CommonService, private elementRef: ElementRef, public trServcice: ServiceService, public ts: TranslatorService, public eitService: EitService) { } ngOnInit() { this.getPendingTransaction(); this.direction = TranslatorService.getCurrentLanguageName(); } getPendingTransaction() { this.cs.startLoading(); this.trServcice.getPendingRequests({ }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { this.cs.stopLoading(); this.transactions = response['GetPendingReqFunctionsList']; }) } getPendingRequestDetails() { this.cs.startLoading(); this.trServcice.getPendingRequestDetails({ 'P_FUNCTION_ID': this.selectedTransaction.FUNCTION_ID, 'P_CREATION_DATE_FROM': "/Date(" + Date.parse(this.dateFrom) + '+0300' + ")/", 'P_CREATION_DATE_TO': "/Date(" + Date.parse(this.dateTo) + '+0300' + ")/", 'P_PAGE_NUM': 1, 'P_PAGE_LIMIT': 20, }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { this.cs.stopLoading(); this.transactionDetails = response['GetPendingReqDetailsList']; }) } isValid() { if (this.selectedTransaction && this.dateFrom && this.dateTo) return true; else return false } }