Recurring Deposit products with i18n
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
64758cb847
commit
6ef471d7c0
@@ -44,7 +44,7 @@
|
||||
|
||||
<ng-container matColumnDef="glAccountType">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{"labels.inputs.Type" | translate}} </th>
|
||||
<td mat-cell *matCellDef="let glAccount"> {{ glAccount.type.value }} </td>
|
||||
<td mat-cell *matCellDef="let glAccount"> {{ 'labels.inputs.accounting.' + glAccount.type.value | translate }} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="disabled">
|
||||
@@ -104,7 +104,7 @@
|
||||
<li class="mat-tree-node">
|
||||
<button mat-icon-button disabled></button>
|
||||
<span (click)="viewGLAccountNode(node)">
|
||||
<span *ngIf="node.glCode">{{ '(' + node.glCode + ')' }}</span>
|
||||
<span *ngIf="node.glCode" class="m-r-10">{{ '(' + node.glCode + ')' }}</span>
|
||||
{{ node.name }}
|
||||
</span>
|
||||
</li>
|
||||
@@ -117,7 +117,7 @@
|
||||
<fa-icon class="mat-icon-rtl-mirror" icon="{{ nestedTreeControl.isExpanded(node) ? 'chevron-down' : 'chevron-right' }}"></fa-icon>
|
||||
</button>
|
||||
<span (click)="viewGLAccountNode(node)">
|
||||
<span *ngIf="node.glCode">{{ '(' + node.glCode + ')' }}</span>
|
||||
<span *ngIf="node.glCode" class="m-r-10">{{ '(' + node.glCode + ')' }}</span>
|
||||
{{ node.name }}
|
||||
</span>
|
||||
</div>
|
||||
@@ -160,7 +160,7 @@
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ glAccount.type }}
|
||||
{{ 'labels.inputs.accounting.' + glAccount.type | translate }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
<mat-label>{{"labels.inputs.Account Type" | translate}}</mat-label>
|
||||
<mat-select required formControlName="type">
|
||||
<mat-option *ngFor="let accountType of accountTypeData" [value]="accountType.id">
|
||||
{{ accountType.value }}
|
||||
{{ 'labels.inputs.accounting.' + accountType.value | translate }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="glAccountForm.controls.type.hasError('required')">
|
||||
|
||||
@@ -6,6 +6,8 @@ import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
/** Custom Components */
|
||||
import { GLAccountNode } from './gl-account-node.model';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { GLAccount } from 'app/shared/models/general.model';
|
||||
|
||||
/**
|
||||
* GL Account tree service.
|
||||
@@ -25,7 +27,8 @@ export class GlAccountTreeService {
|
||||
*/
|
||||
get treeData(): GLAccountNode[] { return this.treeDataChange.value; }
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private translateService: TranslateService) { }
|
||||
|
||||
/**
|
||||
* Builds the chart of accounts tree and emits the value.
|
||||
@@ -41,19 +44,22 @@ export class GlAccountTreeService {
|
||||
* @param {any} glAccountData Chart of accounts data.
|
||||
* @returns {GLAccountNode[]} Chart of accounts tree nodes.
|
||||
*/
|
||||
buildGLAccountTree(glAccountData: any): GLAccountNode[] {
|
||||
buildGLAccountTree(glAccountData: GLAccount[]): GLAccountNode[] {
|
||||
const glAccountTree: GLAccountNode[] = [];
|
||||
|
||||
// Header nodes
|
||||
glAccountTree.push(new GLAccountNode('GL ACCOUNTS'));
|
||||
glAccountTree[0].children.push(new GLAccountNode('ASSET'));
|
||||
glAccountTree[0].children.push(new GLAccountNode('EQUITY'));
|
||||
glAccountTree[0].children.push(new GLAccountNode('EXPENSE'));
|
||||
glAccountTree[0].children.push(new GLAccountNode('INCOME'));
|
||||
glAccountTree[0].children.push(new GLAccountNode('LIABILITY'));
|
||||
glAccountTree.push(new GLAccountNode('ACCOUNTS'));
|
||||
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.ASSET')));
|
||||
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.EQUITY')));
|
||||
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.EXPENSE')));
|
||||
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.INCOME')));
|
||||
glAccountTree[0].children.push(new GLAccountNode(this.translateService.instant('labels.inputs.accounting.LIABILITY')));
|
||||
|
||||
// Sort by parent id (so that child nodes can be added properly)
|
||||
glAccountData.sort((glAccountOne: any, glAccountTwo: any) => {
|
||||
if (!glAccountData[0].parentId) {
|
||||
glAccountData[0].parentId = 0;
|
||||
}
|
||||
glAccountData.sort((glAccountOne: GLAccount, glAccountTwo: GLAccount) => {
|
||||
if (!glAccountOne.parentId) {
|
||||
glAccountOne.parentId = 0;
|
||||
}
|
||||
@@ -72,6 +78,7 @@ export class GlAccountTreeService {
|
||||
// and rest as children to respective parent nodes.
|
||||
for (const glAccount of glAccountData) {
|
||||
if (glAccount.parentId === 0) {
|
||||
console.log(glAccount.type.value);
|
||||
if (glAccount.type.value === 'ASSET') {
|
||||
glAccountTree[0].children[0].children.push(glAccounts[glAccount.id]);
|
||||
} else if (glAccount.type.value === 'EQUITY') {
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ glAccount.type?.value }}
|
||||
{{ 'labels.inputs.accounting.' + glAccount.type?.value | translate }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="header">
|
||||
@@ -99,6 +99,9 @@
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||
<button type="button" color="primary" mat-raised-button (click)="goBack()">{{ "labels.buttons.Back" | translate}}</button>
|
||||
</mat-card-actions>
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dial
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../../accounting.service';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
/**
|
||||
* View gl account component.
|
||||
@@ -32,7 +33,8 @@ export class ViewGlAccountComponent implements OnInit {
|
||||
constructor(private accountingService: AccountingService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
public dialog: MatDialog) {
|
||||
private dialog: MatDialog,
|
||||
private location: Location) {
|
||||
this.route.data.subscribe((data: { glAccountAndChartOfAccountsTemplate: any }) => {
|
||||
this.glAccount = data.glAccountAndChartOfAccountsTemplate;
|
||||
});
|
||||
@@ -68,4 +70,8 @@ export class ViewGlAccountComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
goBack(): void {
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user