feat: add financial activity mappings component

Add financial activity mappings component to view accounts linked to
financial activities.
This commit is contained in:
abhay_1806
2018-07-28 20:18:01 +05:30
committed by Abhay Chawla
parent af9c18b532
commit 7022895a3b
8 changed files with 118 additions and 5 deletions
@@ -7,6 +7,7 @@ import { FrequentPostingsComponent } from './frequent-postings/frequent-postings
import { ViewTransactionComponent } from './view-transaction/view-transaction.component';
import { CreateJournalEntryComponent } from './create-journal-entry/create-journal-entry.component';
import { SearchJournalEntryComponent } from './search-journal-entry/search-journal-entry.component';
import { FinancialActivityMappingsComponent } from './financial-activity-mappings/financial-activity-mappings.component';
const routes: Routes = [
Route.withShell([
@@ -43,6 +44,11 @@ const routes: Routes = [
path: 'journal-entries/create',
component: CreateJournalEntryComponent,
data: { title: extract('Create Journal Entry'), breadcrumb: 'Create Journal Entry' }
},
{
path: 'financial-activity-mappings',
component: FinancialActivityMappingsComponent,
data: { title: extract('Financial Activity Mappings'), breadcrumb: 'Financial Activity Mappings' }
}
]
}
+2 -4
View File
@@ -24,11 +24,9 @@
<p matLine>Advanced search option for journal entries</p>
</mat-list-item>
<mat-list-item>
<mat-list-item [routerLink]="['/accounting/financial-activity-mappings']">
<mat-icon matListIcon>link</mat-icon>
<a matLine href="https://www.google.com">
Accounts Linked to Financial Activities
</a>
<h4 matLine>Accounts Linked to Financial Activities</h4>
<p matLine>List of Financial Activities and GL Account Mappings</p>
</mat-list-item>
+3 -1
View File
@@ -11,6 +11,7 @@ import { RevertTransactionComponent } from './revert-transaction/revert-transact
import { ViewJournalEntryComponent } from './view-journal-entry/view-journal-entry.component';
import { CreateJournalEntryComponent } from './create-journal-entry/create-journal-entry.component';
import { SearchJournalEntryComponent } from './search-journal-entry/search-journal-entry.component';
import { FinancialActivityMappingsComponent } from './financial-activity-mappings/financial-activity-mappings.component';
@NgModule({
imports: [
@@ -26,7 +27,8 @@ import { SearchJournalEntryComponent } from './search-journal-entry/search-journ
RevertTransactionComponent,
ViewJournalEntryComponent,
CreateJournalEntryComponent,
SearchJournalEntryComponent
SearchJournalEntryComponent,
FinancialActivityMappingsComponent
],
entryComponents: [
RevertTransactionComponent,
+4
View File
@@ -71,4 +71,8 @@ export class AccountingService {
return this.http.get(`/glaccounts`, { params: httpParams });
}
getFinancialActivityAccounts() {
return this.http.get('/financialactivityaccounts');
}
}
@@ -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>&nbsp;&nbsp;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>
@@ -0,0 +1,3 @@
table {
width: 100%;
}
@@ -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();
});
});
@@ -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);
});
}
}