update code current account ,saving account and rd account

This commit is contained in:
Nitesh Yadav
2026-04-27 11:20:36 +05:30
79 changed files with 8604 additions and 2933 deletions
@@ -82,8 +82,12 @@
</mat-form-field>
<mat-form-field appearance="outline" class="spd-field">
<mat-label>Product Code</mat-label>
<input matInput formControlName="productCode" readonly />
<mat-label>GL Account (Liability)</mat-label>
<mat-select formControlName="glAccountId" [compareWith]="compareById">
@for (account of liabilityAccountOptions; track account.id) {
<mat-option [value]="account.id">{{ account.name }} ({{ account.glCode }})</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" class="spd-field" (click)="effectiveToPicker.open()">
@@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Component, OnInit, OnChanges, Input, SimpleChanges, inject } from '@angular/core';
import { Component, OnInit, OnChanges, Input, SimpleChanges, inject, ChangeDetectorRef } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
import { MatTooltip } from '@angular/material/tooltip';
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
@@ -30,12 +30,14 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
private formBuilder = inject(UntypedFormBuilder);
private dateUtils = inject(Dates);
private settingsService = inject(SettingsService);
private cdr = inject(ChangeDetectorRef);
@Input() CurrentProductsTemplate: any;
CurrentProductDetailsForm: UntypedFormGroup;
accountTypeData: string[] = [];
customerSegmentData: string[] = [];
liabilityAccountOptions: any[] = [];
yesNoOptions: Array<{
value: boolean;
label: string;
@@ -82,7 +84,7 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
Validators.required
],
customerSegment: [null],
productCode: [''],
glAccountId: [null],
effectiveTo: [''],
endDate: [''],
introducerRequired: [false],
@@ -124,6 +126,8 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
this.accountTypeData = accountTypeOptions;
this.customerSegmentData = customerSegmentOptions;
this.liabilityAccountOptions = template.accountingMappingOptions?.liabilityAccountOptions ?? [];
this.cdr.detectChanges();
if (yesNoOptions.length) {
this.yesNoOptions = yesNoOptions;
}
@@ -136,7 +140,7 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
description: template.description,
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
productCode: template.productCode ?? '',
glAccountId: template.glAccountId ?? null,
effectiveTo: this.parseDate(template.effectiveTo),
endDate: this.parseDate(template.endDate),
introducerRequired: template.introducerRequired === true || template.introducerRequired === 'Yes',
@@ -173,6 +177,10 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
.filter((value) => !!value);
}
compareById(o1: any, o2: any): boolean {
return o1 != null && o2 != null && Number(o1) === Number(o2);
}
get CurrentProductDetails() {
const formValue = { ...this.CurrentProductDetailsForm.value };
const dateFormat = this.settingsService.dateFormat;
@@ -28,7 +28,7 @@
@if (
CurrentProduct.accountType ||
CurrentProduct.customerSegment ||
CurrentProduct.productCode ||
CurrentProduct.glAccountId ||
CurrentProduct.effectiveTo ||
CurrentProduct.introducerRequired !== undefined ||
CurrentProduct.shareLinkingEnabled !== undefined
@@ -51,10 +51,10 @@
</div>
}
@if (CurrentProduct.productCode) {
@if (CurrentProduct.glAccountId) {
<div class="flex-100 layout-row">
<span class="flex-40">Product Code:</span>
<span class="flex-60">{{ CurrentProduct.productCode }}</span>
<span class="flex-40">GL Account (Liability):</span>
<span class="flex-60">{{ getGlAccountName(CurrentProduct.glAccountId) }}</span>
</div>
}
@@ -205,6 +205,13 @@ export class CurrentProductPreviewStepComponent implements OnInit, OnChanges {
return value === true || value === 'Yes' ? 'Yes' : 'No';
}
getGlAccountName(id: any): string {
if (!id) return '';
const accounts = this.CurrentProductsTemplate?.accountingMappingOptions?.liabilityAccountOptions ?? [];
const found = accounts.find((a: any) => a.id === id || a.id === +id);
return found ? `${found.name} (${found.glCode})` : String(id);
}
getLockinPeriodFrequencyTypeLabel(value: any): string {
switch (value) {
case 'DAYS':
@@ -40,7 +40,7 @@
@if (
currentProduct.accountType ||
currentProduct.customerSegment ||
currentProduct.productCode ||
currentProduct.glAccountId ||
currentProduct.effectiveDate ||
currentProduct.effectiveTo ||
currentProduct.endDate ||
@@ -65,10 +65,10 @@
</div>
}
@if (currentProduct.productCode) {
@if (currentProduct.glAccountId) {
<div class="flex-100 layout-row">
<span class="flex-40">Product Code:</span>
<span class="flex-60">{{ currentProduct.productCode }}</span>
<span class="flex-40">GL Account (Liability):</span>
<span class="flex-60">{{ currentProduct.glAccountName || currentProduct.glAccountId }}</span>
</div>
}
@@ -51,6 +51,10 @@ export class RecurringDepositProductCurrencyStepComponent implements OnInit {
this.recurringDepositProductsTemplate.currency?.decimalPlaces ??
2,
dormancyAlert: this.recurringDepositProductsTemplate.dormancyAlert ?? false,
isDormancyTrackingActive: this.recurringDepositProductsTemplate.isDormancyTrackingActive ?? false,
daysToInactive: this.recurringDepositProductsTemplate.daysToInactive ?? 30,
daysToDormancy: this.recurringDepositProductsTemplate.daysToDormancy ?? 60,
daysToEscheat: this.recurringDepositProductsTemplate.daysToEscheat ?? 90,
balanceSwapOption: this.recurringDepositProductsTemplate.balanceSwapOption ?? false,
msme: this.recurringDepositProductsTemplate.msme ?? false,
nominationFacility: this.recurringDepositProductsTemplate.nominationFacility ?? false,
@@ -72,6 +76,10 @@ export class RecurringDepositProductCurrencyStepComponent implements OnInit {
]
],
dormancyAlert: [false],
isDormancyTrackingActive: [false],
daysToInactive: [30],
daysToDormancy: [60],
daysToEscheat: [90],
balanceSwapOption: [false],
msme: [false],
nominationFacility: [false],
@@ -81,7 +89,7 @@ export class RecurringDepositProductCurrencyStepComponent implements OnInit {
get recurringDepositProductCurrency() {
const formValue = this.recurringDepositProductCurrencyForm.value;
return {
const result: any = {
currencyCode: formValue.currencyCode,
digitsAfterDecimal: formValue.digitsAfterDecimal,
dormancyAlert: formValue.dormancyAlert,
@@ -90,5 +98,11 @@ export class RecurringDepositProductCurrencyStepComponent implements OnInit {
nominationFacility: formValue.nominationFacility,
autoDebitFacility: formValue.autoDebitFacility
};
if (formValue.dormancyAlert) {
result.daysToInactive = formValue.daysToInactive;
result.daysToDormancy = formValue.daysToDormancy;
result.daysToEscheat = formValue.daysToEscheat;
}
return result;
}
}
@@ -88,8 +88,12 @@
</mat-form-field>
<mat-form-field appearance="outline" class="rdpd-field">
<mat-label>Product Code</mat-label>
<input matInput formControlName="productCode" readonly />
<mat-label>GL Account (Liability)</mat-label>
<mat-select formControlName="glAccountId" [compareWith]="compareById">
@for (account of liabilityAccountOptions; track account.id) {
<mat-option [value]="account.id">{{ account.name }} ({{ account.glCode }})</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" class="rdpd-field" (click)="effectiveToPicker.open()">
@@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Component, OnInit, OnChanges, Input, SimpleChanges, inject } from '@angular/core';
import { Component, OnInit, OnChanges, Input, SimpleChanges, inject, ChangeDetectorRef } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
import { MatTooltip } from '@angular/material/tooltip';
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
@@ -28,12 +28,14 @@ export class RecurringDepositProductDetailsStepComponent implements OnInit, OnCh
private formBuilder = inject(UntypedFormBuilder);
private dateUtils = inject(Dates);
private settingsService = inject(SettingsService);
private cdr = inject(ChangeDetectorRef);
@Input() recurringDepositProductsTemplate: any;
recurringDepositProductDetailsForm: UntypedFormGroup;
accountTypeData: string[] = [];
customerSegmentData: string[] = [];
liabilityAccountOptions: any[] = [];
yesNoOptions: Array<{ value: boolean; label: string }> = [
{ value: true, label: 'Yes' },
{ value: false, label: 'No' }
@@ -71,7 +73,7 @@ export class RecurringDepositProductDetailsStepComponent implements OnInit, OnCh
Validators.required
],
customerSegment: [null],
productCode: [''],
glAccountId: [null],
effectiveTo: [''],
endDate: [''],
introducerRequired: [false],
@@ -99,9 +101,15 @@ export class RecurringDepositProductDetailsStepComponent implements OnInit, OnCh
return new Date(dateValue);
}
compareById(o1: any, o2: any): boolean {
return o1 != null && o2 != null && Number(o1) === Number(o2);
}
private applyTemplate(template: any) {
this.accountTypeData = this.getOptionNames(template.accountTypeOptions);
this.customerSegmentData = this.getOptionNames(template.customerSegmentOptions);
this.liabilityAccountOptions = template.accountingMappingOptions?.liabilityAccountOptions ?? [];
this.cdr.detectChanges();
const isEditing = !!template.id;
this.recurringDepositProductDetailsForm.patchValue({
@@ -110,7 +118,7 @@ export class RecurringDepositProductDetailsStepComponent implements OnInit, OnCh
description: template.description || '',
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
productCode: template.productCode ?? '',
glAccountId: template.glAccountId ?? null,
effectiveTo: this.parseDate(template.effectiveTo),
endDate: this.parseDate(template.endDate),
introducerRequired: template.introducerRequired === true || template.introducerRequired === 'Yes',
@@ -31,7 +31,7 @@
@if (
recurringDepositProduct.accountType ||
recurringDepositProduct.customerSegment ||
recurringDepositProduct.productCode ||
recurringDepositProduct.glAccountId ||
recurringDepositProduct.effectiveTo ||
recurringDepositProduct.introducerRequired !== undefined ||
recurringDepositProduct.shareLinkingEnabled !== undefined
@@ -53,10 +53,10 @@
</div>
}
@if (recurringDepositProduct.productCode) {
@if (recurringDepositProduct.glAccountId) {
<div class="flex-100 layout-row">
<span class="flex-40">Product Code:</span>
<span class="flex-60">{{ recurringDepositProduct.productCode }}</span>
<span class="flex-40">GL Account (Liability):</span>
<span class="flex-60">{{ getGlAccountName(recurringDepositProduct.glAccountId) }}</span>
</div>
}
@@ -121,6 +121,13 @@ export class RecurringDepositProductPreviewStepComponent implements OnInit, OnCh
return found?.value || String(value);
}
getGlAccountName(id: any): string {
if (!id) return '';
const accounts = this.recurringDepositProductsTemplate?.accountingMappingOptions?.liabilityAccountOptions ?? [];
const found = accounts.find((a: any) => a.id === id || a.id === +id);
return found ? `${found.name} (${found.glCode})` : String(id);
}
formatGlAccountById(glAccountId: number, options: any[]): string {
if (!glAccountId || !Array.isArray(options)) return '-';
const account = this.accounting.glAccountLookUp(glAccountId, options as any);
@@ -54,10 +54,10 @@
<span class="flex-60">{{ recurringDepositProduct.customerSegment }}</span>
</div>
}
@if (recurringDepositProduct.productCode) {
@if (recurringDepositProduct.glAccountId) {
<div class="flex-100 layout-row">
<span class="flex-40">Product Code:</span>
<span class="flex-60">{{ recurringDepositProduct.productCode }}</span>
<span class="flex-40">GL Account (Liability):</span>
<span class="flex-60">{{ recurringDepositProduct.glAccountName || recurringDepositProduct.glAccountId }}</span>
</div>
}
@if (recurringDepositProduct.effectiveTo) {
@@ -82,8 +82,12 @@
</mat-form-field>
<mat-form-field appearance="outline" class="spd-field">
<mat-label>Product Code</mat-label>
<input matInput formControlName="productCode" readonly />
<mat-label>GL Account (Liability)</mat-label>
<mat-select formControlName="glAccountId" [compareWith]="compareById">
@for (account of liabilityAccountOptions; track account.id) {
<mat-option [value]="account.id">{{ account.name }} ({{ account.glCode }})</mat-option>
}
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" class="spd-field" (click)="effectiveToPicker.open()">
@@ -6,7 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
import { Component, OnInit, OnChanges, Input, SimpleChanges, inject } from '@angular/core';
import { Component, OnInit, OnChanges, Input, SimpleChanges, inject, ChangeDetectorRef } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
import { MatTooltip } from '@angular/material/tooltip';
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
@@ -30,12 +30,14 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
private formBuilder = inject(UntypedFormBuilder);
private dateUtils = inject(Dates);
private settingsService = inject(SettingsService);
private cdr = inject(ChangeDetectorRef);
@Input() savingProductsTemplate: any;
savingProductDetailsForm: UntypedFormGroup;
accountTypeData: string[] = [];
customerSegmentData: string[] = [];
liabilityAccountOptions: any[] = [];
yesNoOptions: Array<{
value: boolean;
label: string;
@@ -82,7 +84,7 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
Validators.required
],
customerSegment: [null],
productCode: [''],
glAccountId: [null],
effectiveDate: [''],
effectiveTo: [''],
endDate: [''],
@@ -110,6 +112,8 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
this.accountTypeData = accountTypeOptions;
this.customerSegmentData = customerSegmentOptions;
this.liabilityAccountOptions = template.accountingMappingOptions?.liabilityAccountOptions ?? [];
this.cdr.detectChanges();
if (yesNoOptions.length) {
this.yesNoOptions = yesNoOptions;
}
@@ -122,7 +126,7 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
description: template.description,
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
productCode: template.productCode ?? '',
glAccountId: template.glAccountId ?? null,
effectiveDate: template.effectiveDate ? new Date(template.effectiveDate) : '',
effectiveTo: template.effectiveTo ? new Date(template.effectiveTo) : '',
endDate: template.endDate ? new Date(template.endDate) : '',
@@ -162,6 +166,10 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
.filter((value) => !!value);
}
compareById(o1: any, o2: any): boolean {
return o1 != null && o2 != null && Number(o1) === Number(o2);
}
get savingProductDetails() {
const formValue = { ...this.savingProductDetailsForm.value };
const dateFormat = this.settingsService.dateFormat;
@@ -28,7 +28,7 @@
@if (
savingProduct.accountType ||
savingProduct.customerSegment ||
savingProduct.productCode ||
savingProduct.glAccountId ||
savingProduct.effectiveTo ||
savingProduct.introducerRequired !== undefined ||
savingProduct.shareLinkingEnabled !== undefined
@@ -51,10 +51,10 @@
</div>
}
@if (savingProduct.productCode) {
@if (savingProduct.glAccountId) {
<div class="flex-100 layout-row">
<span class="flex-40">Product Code:</span>
<span class="flex-60">{{ savingProduct.productCode }}</span>
<span class="flex-40">GL Account (Liability):</span>
<span class="flex-60">{{ getGlAccountName(savingProduct.glAccountId) }}</span>
</div>
}
@@ -201,6 +201,13 @@ export class SavingProductPreviewStepComponent implements OnInit, OnChanges {
return this.accounting.isAccrualAccounting(this.accountingRule);
}
getGlAccountName(id: any): string {
if (!id) return '';
const accounts = this.savingProductsTemplate?.accountingMappingOptions?.liabilityAccountOptions ?? [];
const found = accounts.find((a: any) => a.id === id || a.id === +id);
return found ? `${found.name} (${found.glCode})` : String(id);
}
getBooleanLabel(value: any): string {
return value === true || value === 'Yes' ? 'Yes' : 'No';
}
@@ -40,7 +40,7 @@
@if (
savingProduct.accountType ||
savingProduct.customerSegment ||
savingProduct.productCode ||
savingProduct.glAccountId ||
savingProduct.effectiveDate ||
savingProduct.effectiveTo ||
savingProduct.endDate ||
@@ -65,10 +65,10 @@
</div>
}
@if (savingProduct.productCode) {
@if (savingProduct.glAccountId) {
<div class="flex-100 layout-row">
<span class="flex-40">Product Code:</span>
<span class="flex-60">{{ savingProduct.productCode }}</span>
<span class="flex-40">GL Account (Liability):</span>
<span class="flex-60">{{ savingProduct.glAccountName || savingProduct.glAccountId }}</span>
</div>
}