diff --git a/src/app/loans/loans-routing.module.ts b/src/app/loans/loans-routing.module.ts index ab5f49923..fd326c230 100644 --- a/src/app/loans/loans-routing.module.ts +++ b/src/app/loans/loans-routing.module.ts @@ -22,6 +22,7 @@ import { LoanDetailsChargesResolver } from './common-resolvers/loan-details-char import { OverdueChargesTabComponent } from './loans-view/overdue-charges-tab/overdue-charges-tab.component'; import { OriginalScheduleTabComponent } from './loans-view/original-schedule-tab/original-schedule-tab.component'; import { RepaymentScheduleTabComponent } from './loans-view/repayment-schedule-tab/repayment-schedule-tab.component'; +import { TransactiosTabComponent } from './loans-view/transactios-tab/transactios-tab.component'; const routes: Routes = [ { @@ -68,6 +69,14 @@ const routes: Routes = [ loanDetailsAssociationData: LoanDetailsChargesResolver } }, + { + path: 'transactions', + component: TransactiosTabComponent, + data: { title: extract('Transactions'), breadcrumb: 'Transactions', routeParamBreadcrumb: false }, + resolve: { + loanDetailsAssociationData: LoanDetailsChargesResolver + } + }, { path: 'overdue-charges', component: OverdueChargesTabComponent, diff --git a/src/app/loans/loans-view/loans-view.component.html b/src/app/loans/loans-view/loans-view.component.html index 5c1c8ba07..0fc0ea88b 100644 --- a/src/app/loans/loans-view/loans-view.component.html +++ b/src/app/loans/loans-view/loans-view.component.html @@ -66,6 +66,11 @@ Repayment Schedule + + + Transactions + + Overdue Charges diff --git a/src/app/loans/loans-view/transactios-tab/transactios-tab.component.html b/src/app/loans/loans-view/transactios-tab/transactios-tab.component.html new file mode 100644 index 000000000..189a205d9 --- /dev/null +++ b/src/app/loans/loans-view/transactios-tab/transactios-tab.component.html @@ -0,0 +1,108 @@ +
+ +
+ Hide Accruals + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Date {{ ele.id }} Office {{ ele.officeName }} Transaction Date {{ ele.date | date }} Transaction Type {{ ele.type.value }} Amount {{ ele.amount | number }} Breakdown {{ ele.principalPortion | number }} {{ ele.interestPortion | number }} {{ ele.feeChargesPortion | number }} {{ ele.penaltyChargesPortion | number }} Loan Balance {{ ele.outstandingLoanBalance | number }} + + + + + + + Principal Interest Fees Penalties
+ +
diff --git a/src/app/loans/loans-view/transactios-tab/transactios-tab.component.scss b/src/app/loans/loans-view/transactios-tab/transactios-tab.component.scss new file mode 100644 index 000000000..747d2b7e1 --- /dev/null +++ b/src/app/loans/loans-view/transactios-tab/transactios-tab.component.scss @@ -0,0 +1,22 @@ +table { + width: 100%; + margin: 3% 0%; +} + +.container { + padding-bottom: 2%; +} + +.transaction-buttons { + margin-right: 5%; + padding-top: 5%; +} + +.strike { + text-decoration: line-through; + color: red; +} + +.accruals { + padding-top: 1%; +} diff --git a/src/app/loans/loans-view/transactios-tab/transactios-tab.component.spec.ts b/src/app/loans/loans-view/transactios-tab/transactios-tab.component.spec.ts new file mode 100644 index 000000000..2b683721a --- /dev/null +++ b/src/app/loans/loans-view/transactios-tab/transactios-tab.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TransactiosTabComponent } from './transactios-tab.component'; + +describe('TransactiosTabComponent', () => { + let component: TransactiosTabComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TransactiosTabComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TransactiosTabComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/loans/loans-view/transactios-tab/transactios-tab.component.ts b/src/app/loans/loans-view/transactios-tab/transactios-tab.component.ts new file mode 100644 index 000000000..28f880bbb --- /dev/null +++ b/src/app/loans/loans-view/transactios-tab/transactios-tab.component.ts @@ -0,0 +1,54 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import {FormControl} from '@angular/forms'; + +@Component({ + selector: 'mifosx-transactios-tab', + templateUrl: './transactios-tab.component.html', + styleUrls: ['./transactios-tab.component.scss'] +}) +export class TransactiosTabComponent implements OnInit { + + /** Loan Details Data */ + transactions: any; + showTransactions: any; + tempTransaction: any; + /** Columns to be displayed in original schedule table. */ + displayedColumns: string[] = ['id', 'office', 'transactionDate', 'transactionType', 'amount', 'principal', 'interest', 'fee', 'penalties', 'loanBalance', 'actions']; + hideAccrualsParam: FormControl; + + /** + * Retrieves the loans with associations data from `resolve`. + * @param {ActivatedRoute} route Activated Route. + */ + constructor(private route: ActivatedRoute) { + this.route.data.subscribe(( data: { loanDetailsAssociationData: any }) => { + this.transactions = data.loanDetailsAssociationData.transactions; + this.tempTransaction = data.loanDetailsAssociationData.transactions; + }); + } + + ngOnInit() { + this.hideAccrualsParam = new FormControl(false); + this.tempTransaction.forEach((element: any) => { + if (element.type.accrual) { + this.tempTransaction = this.removeItem(this.tempTransaction, element); + } + }); + this.showTransactions = this.transactions; + } + + hideAccruals() { + if (!this.hideAccrualsParam.value) { + this.showTransactions = this.tempTransaction; + } else { + this.showTransactions = this.transactions; + } + } + + removeItem(arr: any, item: any) { + console.log('item: ', item); + return arr.filter((f: any) => f !== item); + } + +} diff --git a/src/app/loans/loans.module.ts b/src/app/loans/loans.module.ts index a815b0031..f40497915 100644 --- a/src/app/loans/loans.module.ts +++ b/src/app/loans/loans.module.ts @@ -18,6 +18,7 @@ import { ChargesTabComponent } from './loans-view/charges-tab/charges-tab.compon import { OverdueChargesTabComponent } from './loans-view/overdue-charges-tab/overdue-charges-tab.component'; import { OriginalScheduleTabComponent } from './loans-view/original-schedule-tab/original-schedule-tab.component'; import { RepaymentScheduleTabComponent } from './loans-view/repayment-schedule-tab/repayment-schedule-tab.component'; +import { TransactiosTabComponent } from './loans-view/transactios-tab/transactios-tab.component'; /** * Loans Module @@ -36,6 +37,7 @@ import { RepaymentScheduleTabComponent } from './loans-view/repayment-schedule-t OverdueChargesTabComponent, OriginalScheduleTabComponent, RepaymentScheduleTabComponent, + TransactiosTabComponent, ], providers: [DatePipe], })