Skip to content

Commit

Permalink
feat: view financial activity mapping component
Browse files Browse the repository at this point in the history
Add view financial activity mapping component.
  • Loading branch information
abhaychawla committed Jul 28, 2018
1 parent 69161a3 commit 8ebfd61
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 6 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 @@ -9,6 +9,7 @@ import { CreateJournalEntryComponent } from './create-journal-entry/create-journ
import { SearchJournalEntryComponent } from './search-journal-entry/search-journal-entry.component';
import { FinancialActivityMappingsComponent } from './financial-activity-mappings/financial-activity-mappings.component';
import { CreateFinancialActivityMappingComponent } from './financial-activity-mappings/create-financial-activity-mapping/create-financial-activity-mapping.component';
import { ViewFinancialActivityMappingComponent } from './financial-activity-mappings/view-financial-activity-mapping/view-financial-activity-mapping.component';

const routes: Routes = [
Route.withShell([
Expand Down Expand Up @@ -58,6 +59,11 @@ const routes: Routes = [
path: 'create',
component: CreateFinancialActivityMappingComponent,
data: { title: extract('Create Financial Activity Mapping'), breadcrumb: 'Create' },
},
{
path: 'view/:id',
component: ViewFinancialActivityMappingComponent,
data: {title: extract('View Financial Activity Mapping'), routeParamBreadcrumb: 'id' }
}
]
}
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 @@ -13,6 +13,7 @@ import { CreateJournalEntryComponent } from './create-journal-entry/create-journ
import { SearchJournalEntryComponent } from './search-journal-entry/search-journal-entry.component';
import { FinancialActivityMappingsComponent } from './financial-activity-mappings/financial-activity-mappings.component';
import { CreateFinancialActivityMappingComponent } from './financial-activity-mappings/create-financial-activity-mapping/create-financial-activity-mapping.component';
import { ViewFinancialActivityMappingComponent } from './financial-activity-mappings/view-financial-activity-mapping/view-financial-activity-mapping.component';

@NgModule({
imports: [
Expand All @@ -31,7 +32,8 @@ import { CreateFinancialActivityMappingComponent } from './financial-activity-ma
CreateJournalEntryComponent,
SearchJournalEntryComponent,
FinancialActivityMappingsComponent,
CreateFinancialActivityMappingComponent
CreateFinancialActivityMappingComponent,
ViewFinancialActivityMappingComponent
],
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 @@ -83,4 +83,8 @@ export class AccountingService {
return this.http.post('/financialactivityaccounts', financialActivityAccount);
}

getFinancialActivityAccount(financialActivityAccountId: number) {
return this.http.get(`/financialactivityaccounts/${financialActivityAccountId}`);
}

}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.container {
width: 37rem;
max-width: 37rem;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';

import { AccountingService } from '../../accounting.service';

Expand All @@ -16,7 +17,8 @@ export class CreateFinancialActivityMappingComponent implements OnInit {
financialActivityData: any;

constructor(private formBuider: FormBuilder,
private accountingService: AccountingService) { }
private accountingService: AccountingService,
private router: Router) { }

ngOnInit() {
this.createFinancialActivityMappingForm();
Expand Down Expand Up @@ -57,8 +59,8 @@ export class CreateFinancialActivityMappingComponent implements OnInit {

submit() {
this.accountingService.createFinancialActivityAccount(this.financialActivityMappingForm.value)
.subscribe(response => {
console.log(response);
.subscribe((response: any) => {
this.router.navigate(['/accounting/financial-activity-mappings/view', response.resourceId]);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [routerLink]="['/accounting/financial-activity-mappings/view', row.id]"></tr>

</table>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" class="container m-b-20">
<button mat-raised-button color="primary">
<mat-icon>edit</mat-icon>&nbsp;&nbsp;Edit
</button>
<button mat-raised-button color="warn">
<mat-icon>delete</mat-icon>&nbsp;&nbsp;Delete
</button>
</div>

<div class="container">

<mat-card>

<mat-card-content>

<div fxLayout="row wrap" class="content">

<div fxFlex="50%" class="header">
Financial Activity
</div>

<div fxFlex="50%">
{{ financialActivityAccountData?.financialActivityData.name }}
</div>

<div fxFlex="50%" class="header">
Account Name
</div>

<div fxFlex="50%">
{{ financialActivityAccountData?.glAccountData.name }}
</div>

</div>

</mat-card-content>

</mat-card>

</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.container {
max-width: 37rem;
}

.content {
div {
margin: 1rem 0;
word-wrap: break-word;
}

.header {
font-weight: 500;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ViewFinancialActivityMappingComponent } from './view-financial-activity-mapping.component';

describe('ViewFinancialActivityMappingComponent', () => {
let component: ViewFinancialActivityMappingComponent;
let fixture: ComponentFixture<ViewFinancialActivityMappingComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewFinancialActivityMappingComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ViewFinancialActivityMappingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AccountingService } from '../../accounting.service';

@Component({
selector: 'mifosx-view-financial-activity-mapping',
templateUrl: './view-financial-activity-mapping.component.html',
styleUrls: ['./view-financial-activity-mapping.component.scss']
})
export class ViewFinancialActivityMappingComponent implements OnInit {

financialActivityAccountId: any;
financialActivityAccountData: any;

constructor(private route: ActivatedRoute,
private accountingService: AccountingService) { }

ngOnInit() {
this.financialActivityAccountId = this.route.snapshot.paramMap.get('id');
this.getFinancialActivityAccount();
}

getFinancialActivityAccount() {
this.accountingService.getFinancialActivityAccount(this.financialActivityAccountId)
.subscribe((financialActivityAccountData: any) => {
this.financialActivityAccountData = financialActivityAccountData;
console.log(financialActivityAccountData);
});
}

}

0 comments on commit 8ebfd61

Please sign in to comment.