Skip to content

Commit 6ef471d

Browse files
Jose Alberto Hernandezalberto-art3ch
Jose Alberto Hernandez
authored andcommitted
Recurring Deposit products with i18n
1 parent 64758cb commit 6ef471d

File tree

49 files changed

+909
-744
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+909
-744
lines changed

src/app/accounting/chart-of-accounts/chart-of-accounts.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
<ng-container matColumnDef="glAccountType">
4646
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.inputs.Type" | translate}} </th>
47-
<td mat-cell *matCellDef="let glAccount"> {{ glAccount.type.value }} </td>
47+
<td mat-cell *matCellDef="let glAccount"> {{ 'labels.inputs.accounting.' + glAccount.type.value | translate }} </td>
4848
</ng-container>
4949

5050
<ng-container matColumnDef="disabled">
@@ -104,7 +104,7 @@
104104
<li class="mat-tree-node">
105105
<button mat-icon-button disabled></button>
106106
<span (click)="viewGLAccountNode(node)">
107-
<span *ngIf="node.glCode">{{ '(' + node.glCode + ')' }}</span>&nbsp;&nbsp;
107+
<span *ngIf="node.glCode" class="m-r-10">{{ '(' + node.glCode + ')' }}</span>
108108
{{ node.name }}
109109
</span>
110110
</li>
@@ -117,7 +117,7 @@
117117
<fa-icon class="mat-icon-rtl-mirror" icon="{{ nestedTreeControl.isExpanded(node) ? 'chevron-down' : 'chevron-right' }}"></fa-icon>
118118
</button>
119119
<span (click)="viewGLAccountNode(node)">
120-
<span *ngIf="node.glCode">{{ '(' + node.glCode + ')' }}</span>&nbsp;&nbsp;
120+
<span *ngIf="node.glCode" class="m-r-10">{{ '(' + node.glCode + ')' }}</span>
121121
{{ node.name }}
122122
</span>
123123
</div>
@@ -160,7 +160,7 @@
160160
</div>
161161

162162
<div fxFlex="50%">
163-
{{ glAccount.type }}
163+
{{ 'labels.inputs.accounting.' + glAccount.type | translate }}
164164
</div>
165165

166166
<div fxFlex="50%" class="header">

src/app/accounting/chart-of-accounts/create-gl-account/create-gl-account.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<mat-label>{{"labels.inputs.Account Type" | translate}}</mat-label>
1313
<mat-select required formControlName="type">
1414
<mat-option *ngFor="let accountType of accountTypeData" [value]="accountType.id">
15-
{{ accountType.value }}
15+
{{ 'labels.inputs.accounting.' + accountType.value | translate }}
1616
</mat-option>
1717
</mat-select>
1818
<mat-error *ngIf="glAccountForm.controls.type.hasError('required')">

src/app/accounting/chart-of-accounts/gl-account-tree.service.ts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { BehaviorSubject } from 'rxjs';
66

77
/** Custom Components */
88
import { GLAccountNode } from './gl-account-node.model';
9+
import { TranslateService } from '@ngx-translate/core';
10+
import { GLAccount } from 'app/shared/models/general.model';
911

1012
/**
1113
* GL Account tree service.
@@ -25,7 +27,8 @@ export class GlAccountTreeService {
2527
*/
2628
get treeData(): GLAccountNode[] { return this.treeDataChange.value; }
2729

28-
constructor() { }
30+
constructor(
31+
private translateService: TranslateService) { }
2932

3033
/**
3134
* Builds the chart of accounts tree and emits the value.
@@ -41,19 +44,22 @@ export class GlAccountTreeService {
4144
* @param {any} glAccountData Chart of accounts data.
4245
* @returns {GLAccountNode[]} Chart of accounts tree nodes.
4346
*/
44-
buildGLAccountTree(glAccountData: any): GLAccountNode[] {
47+
buildGLAccountTree(glAccountData: GLAccount[]): GLAccountNode[] {
4548
const glAccountTree: GLAccountNode[] = [];
4649

4750
// Header nodes
48-
glAccountTree.push(new GLAccountNode('GL ACCOUNTS'));
49-
glAccountTree[0].children.push(new GLAccountNode('ASSET'));
50-
glAccountTree[0].children.push(new GLAccountNode('EQUITY'));
51-
glAccountTree[0].children.push(new GLAccountNode('EXPENSE'));
52-
glAccountTree[0].children.push(new GLAccountNode('INCOME'));
53-
glAccountTree[0].children.push(new GLAccountNode('LIABILITY'));
51+
glAccountTree.push(new GLAccountNode('ACCOUNTS'));
52+
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.ASSET')));
53+
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.EQUITY')));
54+
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.EXPENSE')));
55+
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.INCOME')));
56+
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.LIABILITY')));
5457

5558
// Sort by parent id (so that child nodes can be added properly)
56-
glAccountData.sort((glAccountOne: any, glAccountTwo: any) => {
59+
if (!glAccountData[0].parentId) {
60+
glAccountData[0].parentId = 0;
61+
}
62+
glAccountData.sort((glAccountOne: GLAccount, glAccountTwo: GLAccount) => {
5763
if (!glAccountOne.parentId) {
5864
glAccountOne.parentId = 0;
5965
}
@@ -72,6 +78,7 @@ export class GlAccountTreeService {
7278
// and rest as children to respective parent nodes.
7379
for (const glAccount of glAccountData) {
7480
if (glAccount.parentId === 0) {
81+
console.log(glAccount.type.value);
7582
if (glAccount.type.value === 'ASSET') {
7683
glAccountTree[0].children[0].children.push(glAccounts[glAccount.id]);
7784
} else if (glAccount.type.value === 'EQUITY') {

src/app/accounting/chart-of-accounts/view-gl-account/view-gl-account.component.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</div>
4343

4444
<div fxFlex="50%">
45-
{{ glAccount.type?.value }}
45+
{{ 'labels.inputs.accounting.' + glAccount.type?.value | translate }}
4646
</div>
4747

4848
<div fxFlex="50%" class="header">
@@ -99,6 +99,9 @@
9999

100100
</mat-card-content>
101101

102+
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
103+
<button type="button" color="primary" mat-raised-button (click)="goBack()">{{ "labels.buttons.Back" | translate}}</button>
104+
</mat-card-actions>
102105
</mat-card>
103106

104107
</div>

src/app/accounting/chart-of-accounts/view-gl-account/view-gl-account.component.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dial
88

99
/** Custom Services */
1010
import { AccountingService } from '../../accounting.service';
11+
import { Location } from '@angular/common';
1112

1213
/**
1314
* View gl account component.
@@ -32,7 +33,8 @@ export class ViewGlAccountComponent implements OnInit {
3233
constructor(private accountingService: AccountingService,
3334
private route: ActivatedRoute,
3435
private router: Router,
35-
public dialog: MatDialog) {
36+
private dialog: MatDialog,
37+
private location: Location) {
3638
this.route.data.subscribe((data: { glAccountAndChartOfAccountsTemplate: any }) => {
3739
this.glAccount = data.glAccountAndChartOfAccountsTemplate;
3840
});
@@ -68,4 +70,8 @@ export class ViewGlAccountComponent implements OnInit {
6870
});
6971
}
7072

73+
goBack(): void {
74+
this.location.back();
75+
}
76+
7177
}

src/app/core/utils/dates.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export class Dates {
2121
return datePipe.transform(timestamp, dateFormat);
2222
}
2323

24+
public formatDateAsString(value: Date, dateFormat: string): string {
25+
return moment(value).format(dateFormat);
26+
}
27+
2428
public parseDate(value: any): Date {
2529
if (value instanceof Array) {
2630
return moment(value.join('-'), 'YYYY-MM-DD').toDate();

src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.html

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,67 @@ <h1 mat-dialog-title>{{ title }}</h1>
33
<div mat-dialog-content [formGroup]="depositProductIncentiveForm" fxLayout="column">
44

55
<mat-form-field>
6-
<mat-label>Attribute</mat-label>
6+
<mat-label>{{'labels.inputs.Attribute' | translate}}</mat-label>
77
<mat-select formControlName="attributeName" required>
88
<mat-option *ngFor="let attributeName of attributeNameData" [value]="attributeName.id">
99
{{ attributeName.value }}
1010
</mat-option>
1111
</mat-select>
1212
<mat-error>
13-
Attribute is <strong>required</strong>
13+
{{'labels.inputs.Attribute' | translate}} {{'labels.commons.is' | translate}} <strong>{{'labels.commons.required' | translate}}</strong>
1414
</mat-error>
1515
</mat-form-field>
1616

1717
<mat-form-field>
18-
<mat-label>Condition</mat-label>
18+
<mat-label>{{'labels.inputs.Condition' | translate}}</mat-label>
1919
<mat-select formControlName="conditionType" required>
2020
<mat-option *ngFor="let conditionType of conditionTypeData" [value]="conditionType.id">
2121
{{ conditionType.value }}
2222
</mat-option>
2323
</mat-select>
2424
<mat-error>
25-
Condition is <strong>required</strong>
25+
{{'labels.inputs.Condition' | translate}} {{'labels.commons.is' | translate}} <strong>{{'labels.commons.required' | translate}}</strong>
2626
</mat-error>
2727
</mat-form-field>
2828

2929
<mat-form-field *ngIf="depositProductIncentiveForm.value.attributeName">
30-
<mat-label>Value</mat-label>
30+
<mat-label>{{'labels.inputs.Value' | translate}}</mat-label>
3131
<mat-select formControlName="attributeValue" *ngIf="depositProductIncentiveForm.value.attributeName !== 3" required>
3232
<mat-option *ngFor="let attributeValue of attributeValueData" [value]="attributeValue.id">
3333
{{ attributeValue.name }}
3434
</mat-option>
3535
</mat-select>
3636
<input type="number" matInput formControlName="attributeValue" *ngIf="depositProductIncentiveForm.value.attributeName === 3" required>
3737
<mat-error>
38-
Value is <strong>required</strong>
38+
{{'labels.inputs.Value' | translate}} {{'labels.commons.is' | translate}} <strong>{{'labels.commons.required' | translate}}</strong>
3939
</mat-error>
4040
</mat-form-field>
4141

4242
<mat-form-field>
43-
<mat-label>Type</mat-label>
43+
<mat-label>{{'labels.inputs.Type' | translate}}</mat-label>
4444
<mat-select formControlName="incentiveType" required>
4545
<mat-option *ngFor="let incentiveType of incentiveTypeData" [value]="incentiveType.id">
4646
{{ incentiveType.value }}
4747
</mat-option>
4848
</mat-select>
4949
<mat-error>
50-
Type is <strong>required</strong>
50+
{{'labels.inputs.Type' | translate}} {{'labels.commons.is' | translate}} <strong>{{'labels.commons.required' | translate}}</strong>
5151
</mat-error>
5252
</mat-form-field>
5353

5454
<mat-form-field>
55-
<mat-label>Interest</mat-label>
55+
<mat-label>{{'labels.inputs.Interest' | translate}}</mat-label>
5656
<input type="number" matInput formControlName="amount" required>
5757
<mat-error>
58-
Interest is <strong>required</strong>
58+
{{'labels.inputs.Interest' | translate}} {{'labels.commons.is' | translate}} <strong>{{'labels.commons.required' | translate}}</strong>
5959
</mat-error>
6060
</mat-form-field>
6161

6262
</div>
6363

6464
<mat-dialog-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="2%">
65-
<button mat-raised-button mat-dialog-close> Cancel </button>
66-
<button mat-raised-button color="primary" [mat-dialog-close]="{ data: depositProductIncentiveForm }" [disabled]="!depositProductIncentiveForm.valid || depositProductIncentiveForm.pristine">{{ layout.addButtonText }}</button>
65+
<button mat-raised-button mat-dialog-close> {{'labels.buttons.Cancel' | translate}} </button>
66+
<button mat-raised-button color="primary" [mat-dialog-close]="{ data: depositProductIncentiveForm }" [disabled]="!depositProductIncentiveForm.valid || depositProductIncentiveForm.pristine">
67+
{{'labels.buttons.' + layout.addButtonText | translate }}
68+
</button>
6769
</mat-dialog-actions>

src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, OnInit, Inject } from '@angular/core';
22
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
33
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
4+
import { TranslateService } from '@ngx-translate/core';
45

56
@Component({
67
selector: 'mifosx-deposit-product-incentive-form-dialog',
@@ -27,7 +28,8 @@ export class DepositProductIncentiveFormDialogComponent implements OnInit {
2728

2829
constructor(public dialogRef: MatDialogRef<DepositProductIncentiveFormDialogComponent>,
2930
@Inject(MAT_DIALOG_DATA) public data: any,
30-
private formBuilder: UntypedFormBuilder) {
31+
private formBuilder: UntypedFormBuilder,
32+
private translateService: TranslateService) {
3133
this.createDepositProductIncentiveForm();
3234
this.setConditionalControls();
3335
this.layout = { ...this.layout, ...data.layout };
@@ -56,8 +58,7 @@ export class DepositProductIncentiveFormDialogComponent implements OnInit {
5658
'entityType': this.data.entityType
5759
});
5860
}
59-
60-
this.title = `Incentives: ${this.entityTypeData.find((entityType: any) => this.depositProductIncentiveForm.get('entityType').value === entityType.id).value} Attributes`;
61+
this.title = this.translateService.instant('labels.heading.Incentives');
6162
}
6263

6364
setConditionalControls() {

src/app/products/fixed-deposit-products/fixed-deposit-product-stepper/fixed-deposit-product-interest-rate-chart-step/fixed-deposit-product-interest-rate-chart-step.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ <h4 fxFlex="13%" class="mat-h3">Interest Rate Chart<i class='fas fa-question'
6666
</div>
6767

6868
<div fxFlex="100%" *ngIf="chart.value.chartSlabs.length === 0">
69-
<h3 class="mat-h3">It's required to add at least one Slab</h3>
69+
<h3 class="mat-h3">It is required to add at least one Slab</h3>
7070
</div>
7171

7272
<table fxFlex="98%" class="mat-elevation-z1" mat-table [dataSource]="chart.value.chartSlabs"

src/app/products/products.component.html

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<mat-icon matListIcon>
1414
<fa-icon icon="briefcase" size="sm"></fa-icon>
1515
</mat-icon>
16-
<h4 matLine>Loan Products</h4>
17-
<p matLine>Add new loan product or modify or inactivate loan product</p>
16+
<h4 matLine>{{'labels.heading.Loan Products' | translate}}</h4>
17+
<p matLine>{{'labels.text.Add new loan product or modify or inactivate loan product' | translate}}</p>
1818
</mat-list-item>
1919
</div>
2020

@@ -23,8 +23,8 @@ <h4 matLine>Loan Products</h4>
2323
<mat-icon matListIcon>
2424
<fa-icon icon="briefcase" size="sm"></fa-icon>
2525
</mat-icon>
26-
<h4 matLine>Savings Products</h4>
27-
<p matLine>Add new savings product or modify or inactivate savings product</p>
26+
<h4 matLine>{{'labels.heading.Savings Products' | translate}}</h4>
27+
<p matLine>{{'labels.text.Add new savings product or modify or inactivate savings product' | translate}}</p>
2828
</mat-list-item>
2929
</div>
3030

@@ -33,8 +33,8 @@ <h4 matLine>Savings Products</h4>
3333
<mat-icon matListIcon>
3434
<fa-icon icon="briefcase" size="sm"></fa-icon>
3535
</mat-icon>
36-
<h4 matLine>Share Products</h4>
37-
<p matLine>Add new share product or modify or inactivate share product</p>
36+
<h4 matLine>{{'labels.heading.Share Products' | translate}}</h4>
37+
<p matLine>{{'labels.text.Add new share product or modify or inactivate share product' | translate}}</p>
3838
</mat-list-item>
3939
</div>
4040

@@ -43,25 +43,25 @@ <h4 matLine>Share Products</h4>
4343
<mat-icon matListIcon>
4444
<fa-icon icon="money-bill-alt" size="sm"></fa-icon>
4545
</mat-icon>
46-
<h4 matLine>Charges</h4>
47-
<p matLine>Define charges/penalties for loan products, savings and deposit products</p>
46+
<h4 matLine>{{'labels.heading.Charges' | translate}}</h4>
47+
<p matLine>{{'labels.text.Define charges/penalties for loan products, savings and deposit products' | translate}}</p>
4848
</mat-list-item>
4949
</div>
5050

5151
<mat-list-item [routerLink]="['collaterals']">
5252
<mat-icon matListIcon>
5353
<fa-icon icon="money-bill-alt" size="sm"></fa-icon>
5454
</mat-icon>
55-
<h4 matLine>Collateral Management</h4>
56-
<p matLine>Define collaterals for Collateral Management</p>
55+
<h4 matLine>{{'labels.heading.Collateral Management' | translate}}</h4>
56+
<p matLine>{{'labels.text.Define collaterals for Collateral Management' | translate}}</p>
5757
</mat-list-item>
5858

5959
<mat-list-item [routerLink]="['delinquency-bucket-configurations']" *mifosxHasPermission="'READ_DELINQUENCY_BUCKET'">
6060
<mat-icon matListIcon>
6161
<fa-icon icon="briefcase" size="sm"></fa-icon>
6262
</mat-icon>
63-
<h4 matLine>Delinquency Buckets</h4>
64-
<p matLine>Define delinquency day ranges and bucket set for loan products</p>
63+
<h4 matLine>{{'labels.heading.Delinquency Buckets' | translate}}</h4>
64+
<p matLine>{{'labels.text.Define delinquency day ranges and bucket set for loan products' | translate}}</p>
6565
</mat-list-item>
6666

6767
</mat-nav-list>
@@ -76,17 +76,17 @@ <h4 matLine>Delinquency Buckets</h4>
7676
<mat-icon matListIcon>
7777
<fa-icon icon="random" size="sm"></fa-icon>
7878
</mat-icon>
79-
<h4 matLine>Products Mix</h4>
80-
<p matLine>Defines rules for taking multiple rules</p>
79+
<h4 matLine>{{'labels.heading.Products Mix' | translate}}</h4>
80+
<p matLine>{{'labels.text.Defines rules for taking multiple rules' | translate}}</p>
8181
</mat-list-item>
8282

8383
<div #fixedDepositProducts>
8484
<mat-list-item [routerLink]="['fixed-deposit-products']" *mifosxHasPermission="'READ_FIXEDDEPOSITPRODUCT'">
8585
<mat-icon matListIcon>
8686
<fa-icon icon="briefcase" size="sm"></fa-icon>
8787
</mat-icon>
88-
<h4 matLine>Fixed Deposit Products</h4>
89-
<p matLine>Add, modify or inactivate a Fixed deposit product</p>
88+
<h4 matLine>{{'labels.heading.Fixed Deposit Products' | translate}}</h4>
89+
<p matLine>{{'labels.text.Add, modify or inactivate a Fixed deposit product' | translate}}</p>
9090
</mat-list-item>
9191
</div>
9292

@@ -95,25 +95,25 @@ <h4 matLine>Fixed Deposit Products</h4>
9595
<mat-icon matListIcon>
9696
<fa-icon icon="briefcase" size="sm"></fa-icon>
9797
</mat-icon>
98-
<h4 matLine>Recurring Deposit Products</h4>
99-
<p matLine>Add, modify or inactivate a Recurring Deposit product</p>
98+
<h4 matLine>{{'labels.heading.Recurring Deposit Products' | translate}}</h4>
99+
<p matLine>{{'labels.text.Add, modify or inactivate a Recurring Deposit product' | translate}}</p>
100100
</mat-list-item>
101101
</div>
102102

103103
<mat-list-item [routerLink]="['tax-configurations']" *mifosxHasPermission="'READ_TAXGROUP'">
104104
<mat-icon matListIcon>
105105
<fa-icon icon="cogs" size="sm"></fa-icon>
106106
</mat-icon>
107-
<h4 matLine>Manage Tax Configurations</h4>
108-
<p matLine>Define Tax components and Tax groups</p>
107+
<h4 matLine>{{'labels.heading.Manage Tax Configurations' | translate}}</h4>
108+
<p matLine>{{'labels.text.Define Tax components and Tax groups' | translate}}</p>
109109
</mat-list-item>
110110

111111
<mat-list-item [routerLink]="['floating-rates']" *mifosxHasPermission="'READ_FLOATINGRATE'">
112112
<mat-icon matListIcon>
113113
<fa-icon icon="money-bill-alt" size="sm"></fa-icon>
114114
</mat-icon>
115-
<h4 matLine>Floating Rates</h4>
116-
<p matLine>Define floating rates for loan products</p>
115+
<h4 matLine>{{'labels.heading.Floating Rates' | translate}}</h4>
116+
<p matLine>{{'labels.text.Define floating rates for loan products' | translate}}</p>
117117
</mat-list-item>
118118

119119
</mat-nav-list>

0 commit comments

Comments
 (0)