Skip to content

Commit

Permalink
feat: add financial activity mappings component
Browse files Browse the repository at this point in the history
Add financial activity mappings component to view accounts linked to
financial activities.
  • Loading branch information
abhaychawla committed Jul 28, 2018
1 parent af9c18b commit 7022895
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/app/accounting/accounting-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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' }
}
]
}
Expand Down
6 changes: 2 additions & 4 deletions src/app/accounting/accounting.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ <h4 matLine>Search Journal Entries</h4>
<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>

Expand Down
4 changes: 3 additions & 1 deletion src/app/accounting/accounting.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -26,7 +27,8 @@ import { SearchJournalEntryComponent } from './search-journal-entry/search-journ
RevertTransactionComponent,
ViewJournalEntryComponent,
CreateJournalEntryComponent,
SearchJournalEntryComponent
SearchJournalEntryComponent,
FinancialActivityMappingsComponent
],
entryComponents: [
RevertTransactionComponent,
Expand Down
4 changes: 4 additions & 0 deletions src/app/accounting/accounting.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ export class AccountingService {
return this.http.get(`/glaccounts`, { params: httpParams });
}

getFinancialActivityAccounts() {
return this.http.get('/financialactivityaccounts');
}

}
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>&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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
table {
width: 100%;
}
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();
});
});
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);
});
}

}

0 comments on commit 7022895

Please sign in to comment.