add gl mapping in the saving product,current product,rd product and also add genrate account no all three

This commit is contained in:
Nitesh Yadav
2026-04-26 02:11:28 +05:30
parent fbaec18552
commit 5fb25edca5
19 changed files with 117 additions and 46 deletions
@@ -83,8 +83,12 @@
</mat-form-field>
<mat-form-field appearance="outline" class="sad-field">
<mat-label>Product Code</mat-label>
<input matInput [value]="productTemplate.productCode || ''" readonly />
<mat-label>Account No</mat-label>
<input
matInput
[value]="productTemplate?.previewAccountNo || currentAccountTemplate?.accountNo || 'Auto-generated'"
readonly
/>
</mat-form-field>
@if (productTemplate.effectiveDate) {
@@ -83,8 +83,14 @@
</mat-form-field>
<mat-form-field appearance="outline" class="rad-field">
<mat-label>Product Code</mat-label>
<input matInput [value]="productTemplate.productCode || ''" readonly />
<mat-label>Account No</mat-label>
<input
matInput
[value]="
productTemplate?.previewAccountNo || recurringDepositsAccountTemplate?.accountNo || 'Auto-generated'
"
readonly
/>
</mat-form-field>
@if (productTemplate.effectiveDate) {
@@ -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>
}
@@ -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>
}
@@ -87,8 +87,12 @@
</mat-form-field>
<mat-form-field appearance="outline" class="sad-field">
<mat-label>Product Code</mat-label>
<input matInput [value]="productTemplate.productCode || ''" readonly />
<mat-label>Account No</mat-label>
<input
matInput
[value]="productTemplate?.previewAccountNo || savingsAccountTemplate?.accountNo || 'Auto-generated'"
readonly
/>
</mat-form-field>
@if (productTemplate.effectiveDate) {
+2 -2
View File
@@ -9,8 +9,8 @@
/* tslint:disable */
export default {
'mifos_x': {
'version': '260424',
'hash': 'fc1c5126'
'version': '260425',
'hash': 'fbaec185'
},
'allow_switching_backend_instance': true
};