forked from xurror/web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add financial activity mappings component
Add financial activity mappings component to view accounts linked to financial activities.
- Loading branch information
1 parent
af9c18b
commit 7022895
Showing
8 changed files
with
118 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/app/accounting/financial-activity-mappings/financial-activity-mappings.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 3 additions & 0 deletions
3
src/app/accounting/financial-activity-mappings/financial-activity-mappings.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
table { | ||
width: 100%; | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/accounting/financial-activity-mappings/financial-activity-mappings.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 42 additions & 0 deletions
42
src/app/accounting/financial-activity-mappings/financial-activity-mappings.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}); | ||
} | ||
|
||
} |