/** Angular Imports */ import { Component , OnInit , ViewChild } from '@angular/core' ; import { MatPaginator } from '@angular/material/paginator' ; import { MatSort } from '@angular/material/sort' ; import { MatTableDataSource } from '@angular/material/table' ; import { Router , ActivatedRoute } from '@angular/router' ; /** Custom Services */ import { AccountingService } from '../accounting.service' ; /**
 * Provisioning entries component.
 */ @ Component ( { selector : 'mifosx-provisioning-entries' , templateUrl : './provisioning-entries.component.html' , styleUrls : [ './provisioning-entries.component.scss' ] } ) export class ProvisioningEntriesComponent implements OnInit { /** Provisioning entry data. */ provisioningEntryData : any ; /** Columns to be displayed in provisioning entries table. */ displayedColumns : string [ ] = [ 'createdUser' , 'createdDate' , 'journalEntry' , 'viewReport' , 'recreateProvisioning' , 'viewJournalEntry' ] ; /** Data source for provisioning entries table. */ dataSource : MatTableDataSource < any > ; /** Paginator for provisioning entries table. */ @ ViewChild ( MatPaginator , { static : true } ) paginator : MatPaginator ; /** Sorter for provisioning entries table. */ @ ViewChild ( MatSort , { static : true } ) sort : MatSort ; param { AccountingService } accountingService param { ActivatedRoute } route param { Router } router constructor ( private accountingService , private route , private router ) { this . route . data . subscribe ( ( data ) => { this . provisioningEntryData = data . provisioningEntries . pageItems ; } ) ; } /**
     * Sets the provisioning entries table.
     */ ngOnInit ( ) { this . setProvisioningEntries ( ) ; } /**
     * Initializes the data source, paginator and sorter for provisioning entries table.
     */ setProvisioningEntries ( ) { this . dataSource = new MatTableDataSource ( this . provisioningEntryData ) ; this . dataSource . paginator = this . paginator ; this . dataSource . sort = this . sort ; } param { string } filterValue applyFilter ( filterValue ) { this . dataSource . filter = filterValue . trim ( ) . toLowerCase ( ) ; } param { Event } $event param { string } provisioningEntryId recreateProvisioning ( $event , provisioningEntryId ) { this . accountingService . recreateProvisioningEntries ( provisioningEntryId ) . subscribe ( ( response ) => { this . router . navigate ( [ 'view' , response . resourceId ] , { relativeTo : this . route } ) ; } ) ; $event . stopPropagation ( ) ; } param { Event } $event param { number } provisioningEntryId viewJournalEntry ( $event , provisioningEntryId ) { this . router . navigate ( [ 'journal-entries/view' , provisioningEntryId ] , { relativeTo : this . route } ) ; $event . stopPropagation ( ) ; } }