Use of account currency display symbol (#1724)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2023-03-28 22:55:00 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 9a4e4a0f8f
commit 6af25660d9
16 changed files with 81 additions and 69 deletions
@@ -58,7 +58,7 @@
<ng-template matStepLabel>REPAYMENT SCHEDULE</ng-template> <ng-template matStepLabel>REPAYMENT SCHEDULE</ng-template>
<mifosx-loans-account-schedule-step #loanAccountSchedule [loansAccountTemplate]="loansAccountTemplate" <mifosx-loans-account-schedule-step #loanAccountSchedule [loansAccountTemplate]="loansAccountTemplate"
[loansAccountProductTemplate]="loansAccountProductTemplate" [loansAccount]="loansAccount"> [loansAccountProductTemplate]="loansAccountProductTemplate" [loansAccount]="loansAccount" [currencyCode]="currencyCode">
</mifosx-loans-account-schedule-step> </mifosx-loans-account-schedule-step>
</mat-step> </mat-step>
@@ -41,6 +41,8 @@ export class CreateLoansAccountComponent implements OnInit {
/** Principal Amount */ /** Principal Amount */
principal: any; principal: any;
datatables: any = []; datatables: any = [];
/** Currency Code */
currencyCode: string;
/** /**
* Sets loans account create form. * Sets loans account create form.
@@ -70,6 +72,7 @@ export class CreateLoansAccountComponent implements OnInit {
*/ */
setTemplate($event: any) { setTemplate($event: any) {
this.loansAccountProductTemplate = $event; this.loansAccountProductTemplate = $event;
this.currencyCode = this.loansAccountProductTemplate.currency.code;
const clientId = this.loansAccountTemplate.clientId; const clientId = this.loansAccountTemplate.clientId;
this.clientService.getCollateralTemplate(clientId).subscribe((response: any) => { this.clientService.getCollateralTemplate(clientId).subscribe((response: any) => {
this.collateralOptions = response; this.collateralOptions = response;
@@ -57,7 +57,8 @@
<ng-template matStepLabel>REPAYMENT SCHEDULE</ng-template> <ng-template matStepLabel>REPAYMENT SCHEDULE</ng-template>
<mifosx-loans-account-schedule-step [loansAccountTemplate]="loansAccountAndTemplate" <mifosx-loans-account-schedule-step [loansAccountTemplate]="loansAccountAndTemplate"
[loansAccountProductTemplate]="loansAccountProductTemplate" [loansAccount]="loansAccount"> [loansAccountProductTemplate]="loansAccountProductTemplate" [loansAccount]="loansAccount"
[currencyCode]="currencyCode">
</mifosx-loans-account-schedule-step> </mifosx-loans-account-schedule-step>
</mat-step> </mat-step>
@@ -30,6 +30,8 @@ export class EditLoansAccountComponent implements OnInit {
collateralOptions: any; collateralOptions: any;
/** Loan Id */ /** Loan Id */
loanId: any; loanId: any;
/** Currency Code */
currencyCode: string;
/** /**
* Sets loans account edit form. * Sets loans account edit form.
@@ -60,6 +62,7 @@ export class EditLoansAccountComponent implements OnInit {
*/ */
setTemplate($event: any) { setTemplate($event: any) {
this.loansAccountProductTemplate = $event; this.loansAccountProductTemplate = $event;
this.currencyCode = this.loansAccountProductTemplate.currency.code;
if (this.loansAccountProductTemplate.loanProductId) { if (this.loansAccountProductTemplate.loanProductId) {
this.loansService.getLoansCollateralTemplateResource(this.loansAccountProductTemplate.loanProductId).subscribe((response: any) => { this.loansService.getLoansCollateralTemplateResource(this.loansAccountProductTemplate.loanProductId).subscribe((response: any) => {
this.collateralOptions = response.loanCollateralOptions; this.collateralOptions = response.loanCollateralOptions;
@@ -4,7 +4,10 @@
Repayment Info Repayment Info
</a> </a>
<mifosx-repayment-schedule-tab fxFlex="100%" [repaymentScheduleDetails]="repaymentScheduleDetails"></mifosx-repayment-schedule-tab> <mifosx-repayment-schedule-tab fxFlex="100%"
[repaymentScheduleDetails]="repaymentScheduleDetails"
[currencyCode]="currencyCode">
</mifosx-repayment-schedule-tab>
</div> </div>
@@ -10,6 +10,8 @@ import { SettingsService } from 'app/settings/settings.service';
}) })
export class LoansAccountScheduleStepComponent implements OnInit { export class LoansAccountScheduleStepComponent implements OnInit {
/** Currency Code */
@Input() currencyCode: string;
/** Loans Account Template */ /** Loans Account Template */
@Input() loansAccountTemplate: any; @Input() loansAccountTemplate: any;
/** Loans Account Product Template */ /** Loans Account Product Template */
@@ -32,26 +32,26 @@
<ng-container matColumnDef="due"> <ng-container matColumnDef="due">
<th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Due </th> <th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Due </th>
<td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.currency.displaySymbol }} {{ charge.amount| <td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.amount |
number }} </td> currency:charge.currency.code:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="paid"> <ng-container matColumnDef="paid">
<th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Paid </th> <th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Paid </th>
<td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.currency.displaySymbol }}{{ charge.amountPaid| <td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.amountPaid |
number }} </td> currency:charge.currency.code:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="waived"> <ng-container matColumnDef="waived">
<th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Waived </th> <th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Waived </th>
<td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.currency.displaySymbol }}{{ charge.amountWaived| <td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.amountWaived |
number }} </td> currency:charge.currency.code:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="outstanding"> <ng-container matColumnDef="outstanding">
<th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Outstanding </th> <th mat-header-cell class="r-amount" *matHeaderCellDef mat-sort-header> Outstanding </th>
<td mat-cell class="r-amount" *matCellDef="let charge"> {{ charge.currency.displaySymbol }}{{ <td mat-cell class="r-amount" *matCellDef="let charge"> {{charge.amountOutstanding |
charge.amountOutstanding| formatNumber }} </td> currency:charge.currency.code:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
@@ -36,37 +36,37 @@
<ng-container matColumnDef="Original"> <ng-container matColumnDef="Original">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Original </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Original </th>
<td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.original | currency }} </td> <td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.original | currency:currencyCode:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="Paid"> <ng-container matColumnDef="Paid">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Paid </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Paid </th>
<td mat-cell class="r-amount amount-minus" *matCellDef="let ele"> {{ ele.paid | currency }} </td> <td mat-cell class="r-amount amount-minus" *matCellDef="let ele"> {{ ele.paid | currency:currencyCode:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="Adjustments"> <ng-container matColumnDef="Adjustments">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Credit Adjustments </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Credit Adjustments </th>
<td mat-cell class="r-amount amount-plus" *matCellDef="let ele"> {{ ele.adjustment | currency }} </td> <td mat-cell class="r-amount amount-plus" *matCellDef="let ele"> {{ ele.adjustment | currency:currencyCode:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="Waived"> <ng-container matColumnDef="Waived">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Waived </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Waived </th>
<td mat-cell class="r-amount amount-minus" *matCellDef="let ele"> {{ ele.waived | currency }} </td> <td mat-cell class="r-amount amount-minus" *matCellDef="let ele"> {{ ele.waived | currency:currencyCode:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="Written Off"> <ng-container matColumnDef="Written Off">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Written Off </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Written Off </th>
<td mat-cell class="r-amount amount-minus" *matCellDef="let ele"> {{ ele.writtenOff | currency }} </td> <td mat-cell class="r-amount amount-minus" *matCellDef="let ele"> {{ ele.writtenOff | currency:currencyCode:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="Outstanding"> <ng-container matColumnDef="Outstanding">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Outstanding </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Outstanding </th>
<td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.outstanding | currency }} </td> <td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.outstanding | currency:currencyCode:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="Over Due"> <ng-container matColumnDef="Over Due">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Over Due </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Over Due </th>
<td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.overdue | currency }} </td> <td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.overdue | currency:currencyCode:'symbol-narrow':'1.2-2' }} </td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="loanSummaryColumns"></tr> <tr mat-header-row *matHeaderRowDef="loanSummaryColumns"></tr>
@@ -193,17 +193,17 @@
<div fxFlexFill> <div fxFlexFill>
<span fxFlex="50%">Proposed Amount:</span> <span fxFlex="50%">Proposed Amount:</span>
<span fxFlex="50%">{{ loanDetails.proposedPrincipal | currency}}</span> <span fxFlex="50%">{{ loanDetails.proposedPrincipal | currency:currencyCode:'symbol-narrow':'1.2-2'}}</span>
</div> </div>
<div fxFlexFill *ngIf="showApprovedAmountBasedOnStatus()"> <div fxFlexFill *ngIf="showApprovedAmountBasedOnStatus()">
<span fxFlex="50%">Approved Amount:</span> <span fxFlex="50%">Approved Amount:</span>
<span fxFlex="50%">{{ loanDetails.approvedPrincipal | currency }}</span> <span fxFlex="50%">{{ loanDetails.approvedPrincipal | currency:currencyCode:'symbol-narrow':'1.2-2' }}</span>
</div> </div>
<div fxFlexFill *ngIf="showDisbursedAmountBasedOnStatus()"> <div fxFlexFill *ngIf="showDisbursedAmountBasedOnStatus()">
<span fxFlex="50%">Disburse Amount:</span> <span fxFlex="50%">Disburse Amount:</span>
<span fxFlex="50%">{{ loanDetails.principal | currency }}</span> <span fxFlex="50%">{{ loanDetails.principal | currency:currencyCode:'symbol-narrow':'1.2-2' }}</span>
</div> </div>
<div fxFlexFill> <div fxFlexFill>
@@ -9,6 +9,8 @@ import { MatTableDataSource } from '@angular/material/table';
}) })
export class GeneralTabComponent implements OnInit { export class GeneralTabComponent implements OnInit {
/** Currency Code */
currencyCode: string;
loanDetails: any; loanDetails: any;
status: any; status: any;
loanSummaryColumns: string[] = ['Empty', 'Original', 'Paid', 'Waived', 'Written Off', 'Outstanding', 'Over Due']; loanSummaryColumns: string[] = ['Empty', 'Original', 'Paid', 'Waived', 'Written Off', 'Outstanding', 'Over Due'];
@@ -35,6 +37,7 @@ export class GeneralTabComponent implements OnInit {
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.parent.data.subscribe((data: { loanDetailsData: any, }) => { this.route.parent.data.subscribe((data: { loanDetailsData: any, }) => {
this.loanDetails = data.loanDetailsData; this.loanDetails = data.loanDetailsData;
this.currencyCode = this.loanDetails.currency.code;
if (this.loanDetails.transactions) { if (this.loanDetails.transactions) {
this.loanDetails.transactions.some((transaction: any) => { this.loanDetails.transactions.some((transaction: any) => {
if (transaction.type.code === 'loanTransactionType.chargeback') { if (transaction.type.code === 'loanTransactionType.chargeback') {
@@ -67,7 +70,6 @@ export class GeneralTabComponent implements OnInit {
'writtenOff': this.loanDetails.summary.principalWrittenOff, 'writtenOff': this.loanDetails.summary.principalWrittenOff,
'outstanding': this.loanDetails.summary.principalOutstanding, 'outstanding': this.loanDetails.summary.principalOutstanding,
'overdue': this.loanDetails.summary.principalOverdue, 'overdue': this.loanDetails.summary.principalOverdue,
}, },
{ {
'property': 'Interest', 'property': 'Interest',
@@ -32,11 +32,11 @@
</span> </span>
<span class="loans-overview" <span class="loans-overview"
*ngIf="loanDetailsData.delinquent && loanDetailsData.delinquent.pastDueDays > 0"> *ngIf="loanDetailsData.delinquent && loanDetailsData.delinquent.pastDueDays > 0">
Past Due Days : {{loanDetailsData?.delinquent.pastDueDays | formatNumber}}<br /> Past Due Days : {{loanDetailsData?.delinquent.pastDueDays | formatNumber }}<br />
</span> </span>
<span class="loans-overview" *ngIf="loanDetailsData.delinquent && loanDetailsData.delinquent.delinquentDays > 0 <span class="loans-overview" *ngIf="loanDetailsData.delinquent && loanDetailsData.delinquent.delinquentDays > 0
&& loanDetailsData.delinquent.pastDueDays != loanDetailsData.delinquent.delinquentDays"> && loanDetailsData.delinquent.pastDueDays != loanDetailsData.delinquent.delinquentDays">
Delinquent Days : {{loanDetailsData?.delinquent.delinquentDays | formatNumber}} Delinquent Days : {{loanDetailsData?.delinquent.delinquentDays | formatNumber }}
</span> </span>
</div> </div>
</div> </div>
@@ -46,14 +46,14 @@
<span>Current Balance: {{loanDetailsData.currency.displaySymbol}} <span>Current Balance: {{loanDetailsData.currency.displaySymbol}}
{{loanDetailsData.summary.totalOutstanding | formatNumber}}</span><br> {{loanDetailsData.summary.totalOutstanding | formatNumber}}</span><br>
<div *ngIf="loanDisplayArrearsDelinquency < 2"> <div *ngIf="loanDisplayArrearsDelinquency < 2">
<span *ngIf="loanDetailsData.inArrears">Arrears By: {{loanDetailsData.summary.totalOverdue | formatNumber}} <span *ngIf="loanDetailsData.inArrears">Arrears By: {{loanDetailsData.summary.totalOverdue | currency:currencyCode:'symbol-narrow':'1.2-2' }}
<span *ngIf="!(loanDetailsData.summary.totalOverdue>=0)">Not Provided</span> <span *ngIf="!(loanDetailsData.summary.totalOverdue>=0)">Not Provided</span>
</span><br> </span><br>
<span *ngIf="loanDetailsData.inArrears">Arrears Since: {{loanDetailsData.summary.overdueSinceDate | <span *ngIf="loanDetailsData.inArrears">Arrears Since: {{loanDetailsData.summary.overdueSinceDate |
dateFormat}} dateFormat}}
</span> </span>
<span *ngIf="loanDetailsData.totalOverpaid && loanDetailsData.totalOverpaid > 0"> <span *ngIf="loanDetailsData.totalOverpaid && loanDetailsData.totalOverpaid > 0">
Overpaid By: {{loanDetailsData.currency.displaySymbol}} {{loanDetailsData.totalOverpaid | formatNumber}} Overpaid By: {{loanDetailsData.currency.displaySymbol}} {{loanDetailsData.totalOverpaid | formatNumber }}
</span> </span>
</div> </div>
</div> </div>
@@ -43,56 +43,56 @@
<ng-container matColumnDef="principalDue"> <ng-container matColumnDef="principalDue">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Principal Due </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Principal Due </th>
<td mat-cell class="check r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.principalDue | formatNumber }} </td> <td mat-cell class="check r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.principalDue | formatNumber }} </td>
<td mat-footer-cell class="check r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPrincipalExpected | currency }}</b> </td> <td mat-footer-cell class="check r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPrincipalExpected | currency:currencyCode:'symbol-narrow':'1.2-2' }}</b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="interest"> <ng-container matColumnDef="interest">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Interest </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Interest </th>
<td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.interestOriginalDue | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.interestOriginalDue | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalInterestCharged | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalInterestCharged | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="fees"> <ng-container matColumnDef="fees">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Fees </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Fees </th>
<td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.feeChargesDue | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.feeChargesDue | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalFeeChargesCharged | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalFeeChargesCharged | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="penalties"> <ng-container matColumnDef="penalties">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Penalties </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Penalties </th>
<td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.penaltyChargesDue | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.penaltyChargesDue | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPenaltyChargesCharged | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPenaltyChargesCharged | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="due"> <ng-container matColumnDef="due">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Due </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Due </th>
<td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalDueForPeriod | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalDueForPeriod | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalRepaymentExpected | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalRepaymentExpected | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="paid"> <ng-container matColumnDef="paid">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Paid </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Paid </th>
<td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalPaidForPeriod | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalPaidForPeriod | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalRepayment | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalRepayment | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="inadvance"> <ng-container matColumnDef="inadvance">
<th mat-header-cell class="r-amount" *matHeaderCellDef> In advance </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> In advance </th>
<td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalPaidInAdvanceForPeriod | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalPaidInAdvanceForPeriod | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPaidInAdvance | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPaidInAdvance | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="late"> <ng-container matColumnDef="late">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Late </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Late </th>
<td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalPaidLateForPeriod | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalPaidLateForPeriod | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPaidLate | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPaidLate | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container *ngIf="isWaived"> <ng-container *ngIf="isWaived">
<ng-container matColumnDef="waived"> <ng-container matColumnDef="waived">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Waived </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Waived </th>
<td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalWaivedForPeriod | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele" [ngClass]="installmentStyle(ele)"> {{ ele.totalWaivedForPeriod | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalWaived | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalWaived | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
</ng-container> </ng-container>
@@ -107,7 +107,7 @@
<ng-container matColumnDef="outstanding"> <ng-container matColumnDef="outstanding">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Outstanding </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Outstanding </th>
<td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.totalOutstandingForPeriod | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.totalOutstandingForPeriod | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalOutstanding | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalOutstanding | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="header"> <ng-container matColumnDef="header">
@@ -159,19 +159,19 @@
<ng-container matColumnDef="principalDue"> <ng-container matColumnDef="principalDue">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Principal Due </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Principal Due </th>
<td mat-cell class="check r-amount" *matCellDef="let ele"> {{ ele.principalDue | formatNumber }} </td> <td mat-cell class="check r-amount" *matCellDef="let ele"> {{ ele.principalDue | formatNumber }} </td>
<td mat-footer-cell class="check r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPrincipalExpected | currency }}</b> </td> <td mat-footer-cell class="check r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalPrincipalExpected | currency:currencyCode:'symbol-narrow':'1.2-2' }}</b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="interest"> <ng-container matColumnDef="interest">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Interest </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Interest </th>
<td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.interestOriginalDue | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.interestOriginalDue | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalInterestCharged | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalInterestCharged | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="fees"> <ng-container matColumnDef="fees">
<th mat-header-cell class="r-amount" *matHeaderCellDef> Fees </th> <th mat-header-cell class="r-amount" *matHeaderCellDef> Fees </th>
<td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.feeChargesDue | formatNumber}} </td> <td mat-cell class="r-amount" *matCellDef="let ele"> {{ ele.feeChargesDue | formatNumber}} </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalFeeChargesCharged | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalFeeChargesCharged | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="due"> <ng-container matColumnDef="due">
@@ -184,7 +184,7 @@
<b>{{ ele.totalDueForPeriod | formatNumber}}</b> <b>{{ ele.totalDueForPeriod | formatNumber}}</b>
</span> </span>
</td> </td>
<td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalRepaymentExpected | currency }} </b> </td> <td mat-footer-cell class="r-amount" *matFooterCellDef> <b> {{ repaymentScheduleDetails.totalRepaymentExpected | currency:currencyCode:'symbol-narrow':'1.2-2' }} </b> </td>
</ng-container> </ng-container>
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
@@ -8,6 +8,8 @@ import { ActivatedRoute } from '@angular/router';
}) })
export class RepaymentScheduleTabComponent implements OnInit { export class RepaymentScheduleTabComponent implements OnInit {
/** Currency Code */
@Input() currencyCode: string;
/** Loan Repayment Schedule to be Edited */ /** Loan Repayment Schedule to be Edited */
@Input() forEditing = false; @Input() forEditing = false;
/** Loan Repayment Schedule Details Data */ /** Loan Repayment Schedule Details Data */
@@ -30,6 +32,9 @@ export class RepaymentScheduleTabComponent implements OnInit {
*/ */
constructor(private route: ActivatedRoute) { constructor(private route: ActivatedRoute) {
this.route.parent.data.subscribe((data: { loanDetailsData: any }) => { this.route.parent.data.subscribe((data: { loanDetailsData: any }) => {
if (data.loanDetailsData) {
this.currencyCode = data.loanDetailsData.currency.code;
}
this.loanDetailsDataRepaymentSchedule = data.loanDetailsData ? data.loanDetailsData.repaymentSchedule : []; this.loanDetailsDataRepaymentSchedule = data.loanDetailsData ? data.loanDetailsData.repaymentSchedule : [];
}); });
} }
@@ -123,9 +123,9 @@ export class EditChargeComponent implements OnInit {
} }
} }
if (this.chargeData.taxGroup) { if (this.chargeData.taxGroup) {
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: this.chargeData.taxGroup.id, disabled: true }, Validators.required)); this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: this.chargeData.taxGroup.id }, Validators.required));
} else { } else {
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: '', disabled: true })); this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: '' }));
} }
} }
@@ -46,22 +46,22 @@
<ng-container matColumnDef="due"> <ng-container matColumnDef="due">
<th mat-header-cell *matHeaderCellDef> Due </th> <th mat-header-cell *matHeaderCellDef> Due </th>
<td mat-cell *matCellDef="let charge"> {{charge.currency.displaySymbol}}&nbsp;{{charge.amount}} </td> <td mat-cell *matCellDef="let charge"> {{charge.amount | currency:charge.currency.code:'symbol-narrow':'1.2-2'}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="paid"> <ng-container matColumnDef="paid">
<th mat-header-cell *matHeaderCellDef> Paid </th> <th mat-header-cell *matHeaderCellDef> Paid </th>
<td mat-cell *matCellDef="let charge"> {{charge.currency.displaySymbol}}&nbsp;{{charge.amountPaid}} </td> <td mat-cell *matCellDef="let charge"> {{charge.amountPaid | currency:charge.currency.code:'symbol-narrow':'1.2-2'}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="waived"> <ng-container matColumnDef="waived">
<th mat-header-cell *matHeaderCellDef> Waived </th> <th mat-header-cell *matHeaderCellDef> Waived </th>
<td mat-cell *matCellDef="let charge"> {{charge.currency.displaySymbol}}&nbsp;{{charge.amountWaived}} </td> <td mat-cell *matCellDef="let charge"> {{charge.amountWaived | currency:charge.currency.code:'symbol-narrow':'1.2-2'}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="outstanding"> <ng-container matColumnDef="outstanding">
<th mat-header-cell *matHeaderCellDef> Outstanding </th> <th mat-header-cell *matHeaderCellDef> Outstanding </th>
<td mat-cell *matCellDef="let charge"> {{charge.currency.displaySymbol}}&nbsp;{{charge.amountOutstanding}} </td> <td mat-cell *matCellDef="let charge"> {{charge.amountOutstanding | currency:charge.currency.code:'symbol-narrow':'1.2-2'}} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
@@ -81,46 +81,38 @@
<tbody> <tbody>
<tr *ngIf="savingsAccountData.summary.totalWithdrawals"> <tr *ngIf="savingsAccountData.summary.totalWithdrawals">
<td>Total Withdrawls</td> <td>Total Withdrawls</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.summary.totalWithdrawals | <td>{{savingsAccountData.summary.totalWithdrawals | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
number}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.summary.totalWithdrawalFees"> <tr *ngIf="savingsAccountData.summary.totalWithdrawalFees">
<td>Withdrawals Fees</td> <td>Withdrawals Fees</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.summary.totalWithdrawalFees | <td>{{savingsAccountData.summary.totalWithdrawalFees | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
number}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.summary.totalAnnualFees"> <tr *ngIf="savingsAccountData.summary.totalAnnualFees">
<td>Annual Fees</td> <td>Annual Fees</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.summary.totalAnnualFees | <td>{{savingsAccountData.summary.totalAnnualFees | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
number}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.summary.totalInterestEarned >= 0"> <tr *ngIf="savingsAccountData.summary.totalInterestEarned >= 0">
<td>Interest Earned</td> <td>Interest Earned</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.summary.totalInterestEarned | <td>{{savingsAccountData.summary.totalInterestEarned | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
number}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.summary.totalInterestPosted"> <tr *ngIf="savingsAccountData.summary.totalInterestPosted">
<td>Interest Posted</td> <td>Interest Posted</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.summary.totalInterestPosted | <td>{{savingsAccountData.summary.totalInterestPosted | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
number}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.summary.interestNotPosted >= 0"> <tr *ngIf="savingsAccountData.summary.interestNotPosted >= 0">
<td>Interest Earned Not Posted</td> <td>Interest Earned Not Posted</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.summary.interestNotPosted | <td>{{savingsAccountData.summary.interestNotPosted | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
number}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.summary.totalOverdraftInterestDerived"> <tr *ngIf="savingsAccountData.summary.totalOverdraftInterestDerived">
<td>Interest On Overdraft</td> <td>Interest On Overdraft</td>
<td> <td>
{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.summary.totalOverdraftInterestDerived {{savingsAccountData.summary.totalOverdraftInterestDerived | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
| formatNumber}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.summary.interestNotPosted < 0"> <tr *ngIf="savingsAccountData.summary.interestNotPosted < 0">
<td>Overdraft Interest Not Posted</td> <td>Overdraft Interest Not Posted</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.summary.interestNotPosted | <td>{{savingsAccountData.summary.interestNotPosted | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
number}}</td>
</tr> </tr>
<tr> <tr *ngIf="savingsAccountData.nominalAnnualInterestRate">
<td>Nominal Interest Rate</td> <td>Nominal Interest Rate</td>
<td>{{savingsAccountData.nominalAnnualInterestRate | formatNumber}} %</td> <td>{{savingsAccountData.nominalAnnualInterestRate | formatNumber}} %</td>
</tr> </tr>
@@ -142,8 +134,7 @@
</tr> </tr>
<tr *ngIf="savingsAccountData.withdrawalFee"> <tr *ngIf="savingsAccountData.withdrawalFee">
<td>Withdrawal Fee</td> <td>Withdrawal Fee</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.withdrawalFee.amount | <td>{{savingsAccountData.withdrawalFee.amount | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
number}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.lastActiveTransactionDate"> <tr *ngIf="savingsAccountData.lastActiveTransactionDate">
<td>Last Active Transaction Date</td> <td>Last Active Transaction Date</td>
@@ -167,16 +158,16 @@
</tr> </tr>
<tr *ngIf="savingsAccountData.annualFee"> <tr *ngIf="savingsAccountData.annualFee">
<td>Annual Fee</td> <td>Annual Fee</td>
<td>{{savingsAccountData.currency.displaySymbol}}&nbsp;{{savingsAccountData.annualFee.amount | formatNumber}} <td>{{savingsAccountData.annualFee.amount | currency:currencyCode:'symbol-narrow':'1.2-2'}}
</td> </td>
</tr> </tr>
<tr *ngIf="savingsAccountData.allowOverdraft"> <tr *ngIf="savingsAccountData.allowOverdraft">
<td>Over Draft Limit</td> <td>Over Draft Limit</td>
<td>{{savingsAccountData.overdraftLimit | formatNumber}}</td> <td>{{savingsAccountData.overdraftLimit | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.allowOverdraft"> <tr *ngIf="savingsAccountData.allowOverdraft">
<td>Min Overdraft Required for Interest Calculation</td> <td>Min Overdraft Required for Interest Calculation</td>
<td>{{savingsAccountData.minOverdraftForInterestCalculation | formatNumber}}</td> <td>{{savingsAccountData.minOverdraftForInterestCalculation | currency:currencyCode:'symbol-narrow':'1.2-2'}}</td>
</tr> </tr>
<tr *ngIf="savingsAccountData.minBalanceForInterestCalculation"> <tr *ngIf="savingsAccountData.minBalanceForInterestCalculation">
<td>Min Balance Required for Interest Calculation</td> <td>Min Balance Required for Interest Calculation</td>
@@ -196,7 +187,7 @@
</tr> </tr>
<tr *ngIf="savingsAccountData.onHoldFunds"> <tr *ngIf="savingsAccountData.onHoldFunds">
<td>On Hold Funds</td> <td>On Hold Funds</td>
<td><a *mifosxHasPermission="'READ_SAVINGSACCOUNT'">{{savingsAccountData.onHoldFunds | formatNumber}}</a></td> <td><a *mifosxHasPermission="'READ_SAVINGSACCOUNT'">{{savingsAccountData.onHoldFunds | currency:currencyCode:'symbol-narrow':'1.2-2'}}</a></td>
</tr> </tr>
<tr *ngIf="savingsAccountData.withHoldTax"> <tr *ngIf="savingsAccountData.withHoldTax">
<td>Withhold Tax Group</td> <td>Withhold Tax Group</td>
@@ -34,6 +34,7 @@ export class SavingsAccountViewComponent implements OnInit {
entityType: string; entityType: string;
isActive = false; isActive = false;
currencyCode: string;
/** /**
* Fetches savings account data from `resolve` * Fetches savings account data from `resolve`
@@ -47,6 +48,7 @@ export class SavingsAccountViewComponent implements OnInit {
public dialog: MatDialog) { public dialog: MatDialog) {
this.route.data.subscribe((data: { savingsAccountData: any, savingsDatatables: any }) => { this.route.data.subscribe((data: { savingsAccountData: any, savingsDatatables: any }) => {
this.savingsAccountData = data.savingsAccountData; this.savingsAccountData = data.savingsAccountData;
this.currencyCode = this.savingsAccountData.currency.code;
this.savingsDatatables = data.savingsDatatables; this.savingsDatatables = data.savingsDatatables;
}); });
if (this.router.url.includes('clients')) { if (this.router.url.includes('clients')) {