feat: add financial activity mappings component
Add financial activity mappings component to view accounts linked to financial activities.
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
<div fxLayout="row" fxLayoutAlign="end" class="container m-b-20">
|
||||
<button mat-raised-button color="primary">
|
||||
<mat-icon>add</mat-icon> Define New Mapping
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mat-elevation-z8 container">
|
||||
|
||||
<table mat-table [dataSource]="dataSource" matSort>
|
||||
|
||||
<ng-container matColumnDef="financialActivity">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Financial Activity </th>
|
||||
<td mat-cell *matCellDef="let financialActivityAccount"> {{ financialActivityAccount.financialActivityData.name }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="glAccountName">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Account Name </th>
|
||||
<td mat-cell *matCellDef="let financialActivityAccount"> {{ financialActivityAccount.glAccountData.name }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="glAccountCode">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> Account Code </th>
|
||||
<td mat-cell *matCellDef="let financialActivityAccount"> {{ financialActivityAccount.glAccountData.glCode }} </td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
<mat-paginator [pageSizeOptions]="[10, 25]" showFirstLastButtons></mat-paginator>
|
||||
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FinancialActivityMappingsComponent } from './financial-activity-mappings.component';
|
||||
|
||||
describe('FinancialActivityMappingsComponent', () => {
|
||||
let component: FinancialActivityMappingsComponent;
|
||||
let fixture: ComponentFixture<FinancialActivityMappingsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FinancialActivityMappingsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FinancialActivityMappingsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatTableDataSource, MatPaginator, MatSort } from '@angular/material';
|
||||
|
||||
import { AccountingService } from '../accounting.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-financial-activity-mappings',
|
||||
templateUrl: './financial-activity-mappings.component.html',
|
||||
styleUrls: ['./financial-activity-mappings.component.scss']
|
||||
})
|
||||
export class FinancialActivityMappingsComponent implements OnInit {
|
||||
|
||||
displayedColumns: string[] = ['financialActivity', 'glAccountName', 'glAccountCode'];
|
||||
dataSource: any;
|
||||
|
||||
@ViewChild(MatPaginator) paginator: MatPaginator;
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
|
||||
constructor(private accountingService: AccountingService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.getFinancialActivityAccounts();
|
||||
}
|
||||
|
||||
getFinancialActivityAccounts() {
|
||||
this.accountingService.getFinancialActivityAccounts().subscribe((financialActivityAccounts: any) => {
|
||||
this.dataSource = new MatTableDataSource(financialActivityAccounts);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sortingDataAccessor = (financialActivityAccount: any, property: any) => {
|
||||
switch (property) {
|
||||
case 'financialActivity': return financialActivityAccount.financialActivityData.name;
|
||||
case 'glAccountName': return financialActivityAccount.glAccountData.name;
|
||||
case 'glAccountCode': return financialActivityAccount.glAccountData.glCode;
|
||||
default: return financialActivityAccount[property];
|
||||
}
|
||||
};
|
||||
this.dataSource.sort = this.sort;
|
||||
console.log(financialActivityAccounts);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user