Charges with translations

This commit is contained in:
Jose Alberto Hernandez
2024-04-27 17:39:40 -06:00
committed by Jose Alberto Hernandez
parent 8ac82cc6a6
commit b380f7f630
56 changed files with 2139 additions and 415 deletions
@@ -47,7 +47,7 @@
<ng-container matColumnDef="chargeTimeType">
<th mat-header-cell *matHeaderCellDef> {{'labels.inputs.Collected On' | translate }} </th>
<td mat-cell *matCellDef="let charge">
{{ charge.chargeTimeType.value }}
{{ charge.chargeTimeType.value | translateCatalog }}
</td>
</ng-container>
@@ -65,7 +65,7 @@
|| charge.chargeTimeType.value === 'Specified due date' || charge.chargeTimeType.value === 'Weekly Fee')">
N/A
</span>
<button mat-icon-button color="primary" *ngIf="charge.chargeTimeType.value === 'Weekly Fee' || charge.chargeTimeType.value === 'Annual Fee'
<button mat-icon-button color="primary" *ngIf="charge.chargeTimeType.value === 'Weekly Fee' || charge.chargeTimeType.value === 'Monthly Fee' || charge.chargeTimeType.value === 'Annual Fee'
|| charge.chargeTimeType.value === 'Specified due date'" (click)="editChargeDate(charge)">
<fa-icon icon="pen"></fa-icon>
</button>
@@ -12,6 +12,7 @@ import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
import { Dates } from 'app/core/utils/dates';
import { MatTableDataSource } from '@angular/material/table';
import { TranslateService } from '@ngx-translate/core';
/**
* Savings Account Charges Step
@@ -55,8 +56,9 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
/**
* @param {MatDialog} dialog Mat Dialog
*/
constructor(public dialog: MatDialog,
private dateUtils: Dates) {}
constructor(private dialog: MatDialog,
private dateUtils: Dates,
private translateService: TranslateService) {}
ngOnInit() {
if (this.savingsAccountTemplate) {
@@ -95,14 +97,14 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
const formfields: FormfieldBase[] = [
new InputBase({
controlName: 'amount',
label: 'Amount',
label: this.translateService.instant('labels.inputs.Amount'),
value: charge.amount,
type: 'number',
required: false
}),
];
const data = {
title: 'Edit Charge Amount',
title: this.translateService.instant('labels.heading.Edit Charge Amount'),
layout: { addButtonText: 'Confirm' },
formfields: formfields
};
@@ -125,14 +127,14 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
const formfields: FormfieldBase[] = [
new DatepickerBase({
controlName: 'date',
label: 'Date',
label: this.translateService.instant('labels.inputs.Date'),
value: charge.dueDate || charge.feeOnMonthDay || '',
type: 'datetime-local',
required: false
}),
];
const data = {
title: 'Edit Charge Date',
title: this.translateService.instant('labels.heading.Edit Charge Date'),
layout: { addButtonText: 'Confirm' },
formfields: formfields
};
@@ -145,12 +147,15 @@ export class SavingsAccountChargesStepComponent implements OnInit, OnChanges {
switch (charge.chargeTimeType.value) {
case 'Specified due date':
case 'Weekly Fee':
newCharge = { ...charge, dueDate: date };
newCharge = { ...charge, dueDate: date };
break;
case 'Annual Fee':
newCharge = { ...charge, feeOnMonthDay: date };
case 'Monthly Fee':
const dateMonthDay = this.dateUtils.formatDate(response.data.value.date, 'dd MMMM');
newCharge = { ...charge, feeOnMonthDay: dateMonthDay };
break;
}
console.log(newCharge);
this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1, newCharge);
this.chargesDataSource = this.chargesDataSource.concat([]);
}
@@ -51,26 +51,26 @@
<div fxFlexFill>
<span fxFlex="40%">{{'labels.inputs.Interest Compounding Period' | translate}}:</span>
<span fxFlex="60%">{{ savingsAccount.interestCompoundingPeriodType |
find:savingsAccountProductTemplate.interestCompoundingPeriodTypeOptions:'id':'value' }}</span>
<span fxFlex="60%">{{ getCatalogTranslation(savingsAccount.interestCompoundingPeriodType |
find:savingsAccountProductTemplate.interestCompoundingPeriodTypeOptions:'id':'value') }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">{{'labels.inputs.Interest Posting Period' | translate}}:</span>
<span fxFlex="60%">{{ savingsAccount.interestPostingPeriodType |
find:savingsAccountProductTemplate.interestPostingPeriodTypeOptions:'id':'value' }}</span>
<span fxFlex="60%">{{ getCatalogTranslation(savingsAccount.interestPostingPeriodType |
find:savingsAccountProductTemplate.interestPostingPeriodTypeOptions:'id':'value') }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">{{'labels.inputs.Interest Calculated using' | translate}}:</span>
<span fxFlex="60%">{{ savingsAccount.interestCalculationType |
find:savingsAccountProductTemplate.interestCalculationTypeOptions:'id':'value' }}</span>
<span fxFlex="60%">{{ getCatalogTranslation(savingsAccount.interestCalculationType |
find:savingsAccountProductTemplate.interestCalculationTypeOptions:'id':'value') }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">{{'labels.inputs.Days in Year' | translate}}:</span>
<span fxFlex="60%">{{ savingsAccount.interestCalculationDaysInYearType |
find:savingsAccountProductTemplate.interestCalculationDaysInYearTypeOptions:'id':'value' }}</span>
<span fxFlex="60%">{{ getCatalogTranslation(savingsAccount.interestCalculationDaysInYearType |
find:savingsAccountProductTemplate.interestCalculationDaysInYearTypeOptions:'id':'value') }}</span>
</div>
<div fxFlexFill *ngIf="savingsAccount.minRequiredOpeningBalance">
@@ -85,8 +85,8 @@
<div fxFlexFill *ngIf="savingsAccount.lockinPeriodFrequency">
<span fxFlex="40%">{{'labels.inputs.Lock-in Period' | translate}}:</span>
<span fxFlex="60%">{{ savingsAccount.lockinPeriodFrequency + ' ' + (savingsAccount.lockinPeriodFrequencyType |
find:savingsAccountProductTemplate.lockinPeriodFrequencyTypeOptions:'id':'value') }}</span>
<span fxFlex="60%">{{ getCatalogTranslation(savingsAccount.lockinPeriodFrequency + ' ' + (savingsAccount.lockinPeriodFrequencyType |
find:savingsAccountProductTemplate.lockinPeriodFrequencyTypeOptions:'id':'value')) }}</span>
</div>
<div fxFlexFill>
@@ -137,7 +137,7 @@
<ng-container matColumnDef="chargeCalculationType">
<th mat-header-cell *matHeaderCellDef> {{'labels.inputs.Type' | translate}} </th>
<td mat-cell *matCellDef="let charge">
{{ charge.chargeCalculationType.value }}
{{ charge.chargeCalculationType.value | translateCatalog }}
</td>
</ng-container>
@@ -1,5 +1,6 @@
/** Angular Imports */
import { Component, Input, Output, EventEmitter } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
/**
* Savings account preview step
@@ -26,6 +27,9 @@ export class SavingsAccountPreviewStepComponent {
/** Form submission event */
@Output() submit = new EventEmitter();
constructor() { }
constructor(private translateService: TranslateService) { }
getCatalogTranslation(text: string): string {
return this.translateService.instant('labels.catalogs.' + text);
}
}
@@ -24,7 +24,7 @@
<mat-label>{{'labels.inputs.Interest Compounding Period' | translate}}</mat-label>
<mat-select formControlName="interestCompoundingPeriodType" required>
<mat-option *ngFor="let interestCompoundingPeriodType of interestCompoundingPeriodTypeData" [value]="interestCompoundingPeriodType.id">
{{ interestCompoundingPeriodType.value }}
{{ interestCompoundingPeriodType.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error>
@@ -36,7 +36,7 @@
<mat-label>{{'labels.inputs.Interest Posting Period' | translate}}</mat-label>
<mat-select formControlName="interestPostingPeriodType" required>
<mat-option *ngFor="let interestPostingPeriodType of interestPostingPeriodTypeData" [value]="interestPostingPeriodType.id">
{{ interestPostingPeriodType.value }}
{{ interestPostingPeriodType.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error>
@@ -48,7 +48,7 @@
<mat-label>{{'labels.inputs.Interest Calculated using' | translate}}</mat-label>
<mat-select formControlName="interestCalculationType" required>
<mat-option *ngFor="let interestCalculationType of interestCalculationTypeData" [value]="interestCalculationType.id">
{{ interestCalculationType.value }}
{{ interestCalculationType.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error>
@@ -60,7 +60,7 @@
<mat-label>{{'labels.inputs.Days in Year' | translate}}</mat-label>
<mat-select formControlName="interestCalculationDaysInYearType" required>
<mat-option *ngFor="let interestCalculationDaysInYearType of interestCalculationDaysInYearTypeData" [value]="interestCalculationDaysInYearType.id">
{{ interestCalculationDaysInYearType.value }}
{{ interestCalculationDaysInYearType.value | translateCatalog }}
</mat-option>
</mat-select>
<mat-error>
@@ -88,7 +88,7 @@
<mat-label>{{'labels.inputs.Type' | translate}}</mat-label>
<mat-select formControlName="lockinPeriodFrequencyType">
<mat-option *ngFor="let lockinPeriodFrequencyType of lockinPeriodFrequencyTypeData" [value]="lockinPeriodFrequencyType.id">
{{ lockinPeriodFrequencyType.value }}
{{ lockinPeriodFrequencyType.value | translateCatalog }}
</mat-option>
</mat-select>
</mat-form-field>