Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loan Term variations including Interest Pauses #2237

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/app/core/utils/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ export class Dates {
return JSON.parse(localStorage.getItem('mifosXLanguage'));
}

calculateDiff(date1: Date, date2: Date){
return Math.floor((Date.UTC(date2.getFullYear(), date2.getMonth(), date2.getDate()) - Date.UTC(date1.getFullYear(), date1.getMonth(), date1.getDate()) ) /(1000 * 60 * 60 * 24));
}

}
3 changes: 2 additions & 1 deletion src/app/loans/loans-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ const routes: Routes = [
component: LoanTermVariationsTabComponent,
data: { title: 'Loan Term Variations', breadcrumb: 'Loan Term Variations', routeParamBreadcrumb: false },
resolve: {
loanTermVariationsData: LoanTermVariationsResolver
loanDetailsData: LoanDetailsResolver,
interestPausesData: LoanTermVariationsResolver
},
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
<div class="container">
<h3>{{ 'labels.heading.Term Variations' | translate }}</h3>
<table mat-table [dataSource]="loanTermVariationsData" *ngIf="loanTermVariationsData?.length > 0">
<table mat-table [dataSource]="loanTermVariationsData" *ngIf="loanTermVariationsData.length>0">
<ng-container matColumnDef="termType">
<th mat-header-cell *matHeaderCellDef> {{"labels.inputs.Type" | translate}} </th>
<td mat-cell *matCellDef="let item">{{ item.termType.value | translate }}</td>
</ng-container>

<ng-container matColumnDef="applicableFrom">
<th mat-header-cell *matHeaderCellDef> {{"labels.inputs.Added On" | translate}} </th>
<td mat-cell *matCellDef="let item">{{ item.termVariationApplicableFrom | dateFormat }}</td>
</ng-container>
<ng-container matColumnDef="value">
<th mat-header-cell *matHeaderCellDef> {{"labels.inputs.Value" | translate}} </th>
<td mat-cell *matCellDef="let item">{{ item.decimalValue | formatNumber }}</td>
</ng-container>

<ng-container matColumnDef="specificToInstallment">
<th mat-header-cell *matHeaderCellDef> {{"labels.inputs.Specific to Installment" | translate}} </th>
<td mat-cell *matCellDef="let item">{{ item.isSpecificToInstallment | yesNo }}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="loanDTermVariationsColumns"></tr>
<tr mat-row *matRowDef="let row; columns: loanDTermVariationsColumns;"></tr>
</table>

<h3 class="m-t-20">{{ 'labels.heading.Interest Pauses' | translate }}</h3>
<table mat-table class="m-t-20" [dataSource]="interestPausesData" *ngIf="interestPausesData?.length > 0">
<ng-container matColumnDef="row">
<th mat-header-cell *matHeaderCellDef>#</th>
<td mat-cell *matCellDef="let item; let idx = index">{{ idx + 1 }}</td>
</ng-container>

<ng-container matColumnDef="id">
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Id' | translate }}</th>
<td mat-cell *matCellDef="let item">{{ item.id }}</td>
</ng-container>

<ng-container matColumnDef="startDate">
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Start Date' | translate }}</th>
<td mat-cell *matCellDef="let item">{{ item.startDate | dateFormat }}</td>
Expand All @@ -21,14 +40,19 @@ <h3>{{ 'labels.heading.Term Variations' | translate }}</h3>
<td mat-cell *matCellDef="let item">{{ item.endDate | dateFormat }}</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="loanTermVariationsColumns"></tr>
<tr mat-row *matRowDef="let row; columns: loanTermVariationsColumns"></tr>
<ng-container matColumnDef="days">
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Days' | translate }}</th>
<td mat-cell *matCellDef="let item">{{ item.days | formatNumber }}</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="interestPausesColumns"></tr>
<tr mat-row *matRowDef="let row; columns: interestPausesColumns"></tr>
</table>

<div class="alert" [hidden]="loanTermVariationsData?.length > 0">
<div class="alert" [hidden]="interestPausesData?.length > 0">
<div class="message">
<i class="fa fa-exclamation-circle alert-check"></i>
{{ 'labels.text.No data found' | translate }}
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Dates } from 'app/core/utils/dates';

@Component({
selector: 'mifosx-loan-term-variations-tab',
Expand All @@ -10,12 +11,22 @@ export class LoanTermVariationsTabComponent {

/** Loan Term Variation Data */
loanTermVariationsData: any[] = [];
loanTermVariationsColumns: string[] = ['row', 'id', 'startDate', 'endDate'];
loanDTermVariationsColumns: string[] = ['termType', 'applicableFrom', 'value', 'specificToInstallment'];
/** Interest Pauses Data */
interestPausesData: any[] = [];
interestPausesColumns: string[] = ['row', 'startDate', 'endDate', 'days'];

constructor(private route: ActivatedRoute) {
this.loanTermVariationsData = [];
this.route.data.subscribe((data: { loanTermVariationsData: any, }) => {
this.loanTermVariationsData = data.loanTermVariationsData;
constructor(private route: ActivatedRoute,
private dates: Dates
) {
this.interestPausesData = [];
this.route.data.subscribe((data: { loanDetailsData: any, interestPausesData: any }) => {
this.loanTermVariationsData = data.loanDetailsData.loanTermVariations;
this.interestPausesData = [];
data.interestPausesData?.forEach((item: any) => {
item.days = dates.calculateDiff(new Date(item.startDate), new Date(item.endDate));
this.interestPausesData.push(item);
});
});
}
}
1 change: 1 addition & 0 deletions src/assets/translations/cs-CS.json
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@
"Installment Amount Variations": "Variace výše splátek",
"Interest Calculations": "Výpočty úroků",
"Interest Details": "Podrobnosti o zájmu",
"Interest Pauses": "Úrokové pauzy",
"Interest Rate Chart": "Graf úrokových sazeb",
"Interest Rate Charts": "Grafy úrokových sazeb",
"Interest Recalculation": "Přepočet úroků",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "Variationen der Ratenbeträge",
"Interest Calculations": "Zinsberechnungen",
"Interest Details": "Interessendetails",
"Interest Pauses": "Zinspausen",
"Interest Rate Chart": "Zinsdiagramm",
"Interest Rate Charts": "Zinsdiagramme",
"Interest Recalculation": "Neuberechnung der Zinsen",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@
"Installment Amount Variations": "Installment Amount Variations",
"Interest Calculations": "Interest Calculations",
"Interest Details": "Interest Details",
"Interest Pauses": "Interest Pauses",
"Interest Rate Chart": "Interest Rate Chart",
"Interest Rate Charts": "Interest Rate Charts",
"Interest Recalculation": "Interest Recalculation",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@
"Installment Amount Variations": "Variaciones en el monto de la cuota",
"Interest Calculations": "Cálculos de intereses",
"Interest Details": "Detalles de interés",
"Interest Pauses": "Pausa de interés",
"Interest Rate Chart": "Gráfico de tasas de interés",
"Interest Rate Charts": "Gráficos de tasas de interés",
"Interest Recalculation": "Recálculo de intereses",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "Variations du montant des versements",
"Interest Calculations": "Calculs d'intérêts",
"Interest Details": "Détails des intérêts",
"Interest Pauses": "Pauses d'intérêt",
"Interest Rate Chart": "Graphique des taux d'intérêt",
"Interest Rate Charts": "Graphiques des taux d'intérêt",
"Interest Recalculation": "Recalcul des intérêts",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "Variazioni dell'importo della rata",
"Interest Calculations": "Calcoli degli interessi",
"Interest Details": "Dettagli sugli interessi",
"Interest Pauses": "Pause di interesse",
"Interest Rate Chart": "Grafico dei tassi di interesse",
"Interest Rate Charts": "Grafici dei tassi di interesse",
"Interest Recalculation": "Ricalcolo degli interessi",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/ko-KO.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "할부금액 변동",
"Interest Calculations": "이자 계산",
"Interest Details": "이자 세부정보",
"Interest Pauses": "관심 일시중지",
"Interest Rate Chart": "금리 차트",
"Interest Rate Charts": "금리 차트",
"Interest Recalculation": "이자 재계산",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/lt-LT.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "Įmokos dydžio svyravimai",
"Interest Calculations": "Palūkanų skaičiavimas",
"Interest Details": "Susidomėjimo detalės",
"Interest Pauses": "Susidomėjimo pauzės",
"Interest Rate Chart": "Palūkanų normų diagrama",
"Interest Rate Charts": "Palūkanų normų diagramos",
"Interest Recalculation": "Palūkanų perskaičiavimas",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/lv-LV.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "Iemaksas summas variācijas",
"Interest Calculations": "Procentu aprēķini",
"Interest Details": "Sīkāka informācija par interesēm",
"Interest Pauses": "Interešu pauzes",
"Interest Rate Chart": "Procentu likmju diagramma",
"Interest Rate Charts": "Procentu likmju diagrammas",
"Interest Recalculation": "Procentu pārrēķins",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/ne-NE.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "किस्ता रकम भिन्नताहरू",
"Interest Calculations": "ब्याज गणना",
"Interest Details": "ब्याज विवरण",
"Interest Pauses": "ब्याज रोकिन्छ",
"Interest Rate Chart": "ब्याज दर चार्ट",
"Interest Rate Charts": "ब्याज दर चार्टहरू",
"Interest Recalculation": "ब्याज पुन: गणना",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/pt-PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "Variações no valor da parcela",
"Interest Calculations": "Cálculos de juros",
"Interest Details": "Detalhes de interesse",
"Interest Pauses": "Pausas de interesse",
"Interest Rate Chart": "Gráfico de taxas de juros",
"Interest Rate Charts": "Gráficos de taxas de juros",
"Interest Recalculation": "Recálculo de juros",
Expand Down
1 change: 1 addition & 0 deletions src/assets/translations/sw-SW.json
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@
"Installment Amount Variations": "Tofauti za Kiasi cha Ufungaji",
"Interest Calculations": "Mahesabu ya riba",
"Interest Details": "Maelezo ya Maslahi",
"Interest Pauses": "Maslahi Yasitisha",
"Interest Rate Chart": "Chati ya Kiwango cha Riba",
"Interest Rate Charts": "Chati za Kiwango cha Riba",
"Interest Recalculation": "Uhesabuji wa Maslahi",
Expand Down
Loading