add gl mapping in the saving product,current product,rd product and also add genrate account no all three
This commit is contained in:
+6
-2
@@ -83,8 +83,12 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="sad-field">
|
<mat-form-field appearance="outline" class="sad-field">
|
||||||
<mat-label>Product Code</mat-label>
|
<mat-label>Account No</mat-label>
|
||||||
<input matInput [value]="productTemplate.productCode || ''" readonly />
|
<input
|
||||||
|
matInput
|
||||||
|
[value]="productTemplate?.previewAccountNo || currentAccountTemplate?.accountNo || 'Auto-generated'"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
@if (productTemplate.effectiveDate) {
|
@if (productTemplate.effectiveDate) {
|
||||||
|
|||||||
+8
-2
@@ -83,8 +83,14 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="rad-field">
|
<mat-form-field appearance="outline" class="rad-field">
|
||||||
<mat-label>Product Code</mat-label>
|
<mat-label>Account No</mat-label>
|
||||||
<input matInput [value]="productTemplate.productCode || ''" readonly />
|
<input
|
||||||
|
matInput
|
||||||
|
[value]="
|
||||||
|
productTemplate?.previewAccountNo || recurringDepositsAccountTemplate?.accountNo || 'Auto-generated'
|
||||||
|
"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
@if (productTemplate.effectiveDate) {
|
@if (productTemplate.effectiveDate) {
|
||||||
|
|||||||
+6
-2
@@ -82,8 +82,12 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="spd-field">
|
<mat-form-field appearance="outline" class="spd-field">
|
||||||
<mat-label>Product Code</mat-label>
|
<mat-label>GL Account (Liability)</mat-label>
|
||||||
<input matInput formControlName="productCode" readonly />
|
<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>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="spd-field" (click)="effectiveToPicker.open()">
|
<mat-form-field appearance="outline" class="spd-field" (click)="effectiveToPicker.open()">
|
||||||
|
|||||||
+11
-3
@@ -6,7 +6,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* 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 { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MatTooltip } from '@angular/material/tooltip';
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||||
@@ -30,12 +30,14 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
private formBuilder = inject(UntypedFormBuilder);
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
private dateUtils = inject(Dates);
|
private dateUtils = inject(Dates);
|
||||||
private settingsService = inject(SettingsService);
|
private settingsService = inject(SettingsService);
|
||||||
|
private cdr = inject(ChangeDetectorRef);
|
||||||
|
|
||||||
@Input() CurrentProductsTemplate: any;
|
@Input() CurrentProductsTemplate: any;
|
||||||
|
|
||||||
CurrentProductDetailsForm: UntypedFormGroup;
|
CurrentProductDetailsForm: UntypedFormGroup;
|
||||||
accountTypeData: string[] = [];
|
accountTypeData: string[] = [];
|
||||||
customerSegmentData: string[] = [];
|
customerSegmentData: string[] = [];
|
||||||
|
liabilityAccountOptions: any[] = [];
|
||||||
yesNoOptions: Array<{
|
yesNoOptions: Array<{
|
||||||
value: boolean;
|
value: boolean;
|
||||||
label: string;
|
label: string;
|
||||||
@@ -82,7 +84,7 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
customerSegment: [null],
|
customerSegment: [null],
|
||||||
productCode: [''],
|
glAccountId: [null],
|
||||||
effectiveTo: [''],
|
effectiveTo: [''],
|
||||||
endDate: [''],
|
endDate: [''],
|
||||||
introducerRequired: [false],
|
introducerRequired: [false],
|
||||||
@@ -124,6 +126,8 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
this.accountTypeData = accountTypeOptions;
|
this.accountTypeData = accountTypeOptions;
|
||||||
this.customerSegmentData = customerSegmentOptions;
|
this.customerSegmentData = customerSegmentOptions;
|
||||||
|
this.liabilityAccountOptions = template.accountingMappingOptions?.liabilityAccountOptions ?? [];
|
||||||
|
this.cdr.detectChanges();
|
||||||
if (yesNoOptions.length) {
|
if (yesNoOptions.length) {
|
||||||
this.yesNoOptions = yesNoOptions;
|
this.yesNoOptions = yesNoOptions;
|
||||||
}
|
}
|
||||||
@@ -136,7 +140,7 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
description: template.description,
|
description: template.description,
|
||||||
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
|
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
|
||||||
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
|
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
|
||||||
productCode: template.productCode ?? '',
|
glAccountId: template.glAccountId ?? null,
|
||||||
effectiveTo: this.parseDate(template.effectiveTo),
|
effectiveTo: this.parseDate(template.effectiveTo),
|
||||||
endDate: this.parseDate(template.endDate),
|
endDate: this.parseDate(template.endDate),
|
||||||
introducerRequired: template.introducerRequired === true || template.introducerRequired === 'Yes',
|
introducerRequired: template.introducerRequired === true || template.introducerRequired === 'Yes',
|
||||||
@@ -173,6 +177,10 @@ export class CurrentProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
.filter((value) => !!value);
|
.filter((value) => !!value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compareById(o1: any, o2: any): boolean {
|
||||||
|
return o1 != null && o2 != null && Number(o1) === Number(o2);
|
||||||
|
}
|
||||||
|
|
||||||
get CurrentProductDetails() {
|
get CurrentProductDetails() {
|
||||||
const formValue = { ...this.CurrentProductDetailsForm.value };
|
const formValue = { ...this.CurrentProductDetailsForm.value };
|
||||||
const dateFormat = this.settingsService.dateFormat;
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
|
|||||||
+4
-4
@@ -28,7 +28,7 @@
|
|||||||
@if (
|
@if (
|
||||||
CurrentProduct.accountType ||
|
CurrentProduct.accountType ||
|
||||||
CurrentProduct.customerSegment ||
|
CurrentProduct.customerSegment ||
|
||||||
CurrentProduct.productCode ||
|
CurrentProduct.glAccountId ||
|
||||||
CurrentProduct.effectiveTo ||
|
CurrentProduct.effectiveTo ||
|
||||||
CurrentProduct.introducerRequired !== undefined ||
|
CurrentProduct.introducerRequired !== undefined ||
|
||||||
CurrentProduct.shareLinkingEnabled !== undefined
|
CurrentProduct.shareLinkingEnabled !== undefined
|
||||||
@@ -51,10 +51,10 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (CurrentProduct.productCode) {
|
@if (CurrentProduct.glAccountId) {
|
||||||
<div class="flex-100 layout-row">
|
<div class="flex-100 layout-row">
|
||||||
<span class="flex-40">Product Code:</span>
|
<span class="flex-40">GL Account (Liability):</span>
|
||||||
<span class="flex-60">{{ CurrentProduct.productCode }}</span>
|
<span class="flex-60">{{ getGlAccountName(CurrentProduct.glAccountId) }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
@@ -205,6 +205,13 @@ export class CurrentProductPreviewStepComponent implements OnInit, OnChanges {
|
|||||||
return value === true || value === 'Yes' ? 'Yes' : 'No';
|
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 {
|
getLockinPeriodFrequencyTypeLabel(value: any): string {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 'DAYS':
|
case 'DAYS':
|
||||||
|
|||||||
+4
-4
@@ -40,7 +40,7 @@
|
|||||||
@if (
|
@if (
|
||||||
currentProduct.accountType ||
|
currentProduct.accountType ||
|
||||||
currentProduct.customerSegment ||
|
currentProduct.customerSegment ||
|
||||||
currentProduct.productCode ||
|
currentProduct.glAccountId ||
|
||||||
currentProduct.effectiveDate ||
|
currentProduct.effectiveDate ||
|
||||||
currentProduct.effectiveTo ||
|
currentProduct.effectiveTo ||
|
||||||
currentProduct.endDate ||
|
currentProduct.endDate ||
|
||||||
@@ -65,10 +65,10 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (currentProduct.productCode) {
|
@if (currentProduct.glAccountId) {
|
||||||
<div class="flex-100 layout-row">
|
<div class="flex-100 layout-row">
|
||||||
<span class="flex-40">Product Code:</span>
|
<span class="flex-40">GL Account (Liability):</span>
|
||||||
<span class="flex-60">{{ currentProduct.productCode }}</span>
|
<span class="flex-60">{{ currentProduct.glAccountName || currentProduct.glAccountId }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -88,8 +88,12 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="rdpd-field">
|
<mat-form-field appearance="outline" class="rdpd-field">
|
||||||
<mat-label>Product Code</mat-label>
|
<mat-label>GL Account (Liability)</mat-label>
|
||||||
<input matInput formControlName="productCode" readonly />
|
<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>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="rdpd-field" (click)="effectiveToPicker.open()">
|
<mat-form-field appearance="outline" class="rdpd-field" (click)="effectiveToPicker.open()">
|
||||||
|
|||||||
+11
-3
@@ -6,7 +6,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* 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 { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MatTooltip } from '@angular/material/tooltip';
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||||
@@ -28,12 +28,14 @@ export class RecurringDepositProductDetailsStepComponent implements OnInit, OnCh
|
|||||||
private formBuilder = inject(UntypedFormBuilder);
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
private dateUtils = inject(Dates);
|
private dateUtils = inject(Dates);
|
||||||
private settingsService = inject(SettingsService);
|
private settingsService = inject(SettingsService);
|
||||||
|
private cdr = inject(ChangeDetectorRef);
|
||||||
|
|
||||||
@Input() recurringDepositProductsTemplate: any;
|
@Input() recurringDepositProductsTemplate: any;
|
||||||
|
|
||||||
recurringDepositProductDetailsForm: UntypedFormGroup;
|
recurringDepositProductDetailsForm: UntypedFormGroup;
|
||||||
accountTypeData: string[] = [];
|
accountTypeData: string[] = [];
|
||||||
customerSegmentData: string[] = [];
|
customerSegmentData: string[] = [];
|
||||||
|
liabilityAccountOptions: any[] = [];
|
||||||
yesNoOptions: Array<{ value: boolean; label: string }> = [
|
yesNoOptions: Array<{ value: boolean; label: string }> = [
|
||||||
{ value: true, label: 'Yes' },
|
{ value: true, label: 'Yes' },
|
||||||
{ value: false, label: 'No' }
|
{ value: false, label: 'No' }
|
||||||
@@ -71,7 +73,7 @@ export class RecurringDepositProductDetailsStepComponent implements OnInit, OnCh
|
|||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
customerSegment: [null],
|
customerSegment: [null],
|
||||||
productCode: [''],
|
glAccountId: [null],
|
||||||
effectiveTo: [''],
|
effectiveTo: [''],
|
||||||
endDate: [''],
|
endDate: [''],
|
||||||
introducerRequired: [false],
|
introducerRequired: [false],
|
||||||
@@ -99,9 +101,15 @@ export class RecurringDepositProductDetailsStepComponent implements OnInit, OnCh
|
|||||||
return new Date(dateValue);
|
return new Date(dateValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compareById(o1: any, o2: any): boolean {
|
||||||
|
return o1 != null && o2 != null && Number(o1) === Number(o2);
|
||||||
|
}
|
||||||
|
|
||||||
private applyTemplate(template: any) {
|
private applyTemplate(template: any) {
|
||||||
this.accountTypeData = this.getOptionNames(template.accountTypeOptions);
|
this.accountTypeData = this.getOptionNames(template.accountTypeOptions);
|
||||||
this.customerSegmentData = this.getOptionNames(template.customerSegmentOptions);
|
this.customerSegmentData = this.getOptionNames(template.customerSegmentOptions);
|
||||||
|
this.liabilityAccountOptions = template.accountingMappingOptions?.liabilityAccountOptions ?? [];
|
||||||
|
this.cdr.detectChanges();
|
||||||
|
|
||||||
const isEditing = !!template.id;
|
const isEditing = !!template.id;
|
||||||
this.recurringDepositProductDetailsForm.patchValue({
|
this.recurringDepositProductDetailsForm.patchValue({
|
||||||
@@ -110,7 +118,7 @@ export class RecurringDepositProductDetailsStepComponent implements OnInit, OnCh
|
|||||||
description: template.description || '',
|
description: template.description || '',
|
||||||
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
|
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
|
||||||
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
|
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
|
||||||
productCode: template.productCode ?? '',
|
glAccountId: template.glAccountId ?? null,
|
||||||
effectiveTo: this.parseDate(template.effectiveTo),
|
effectiveTo: this.parseDate(template.effectiveTo),
|
||||||
endDate: this.parseDate(template.endDate),
|
endDate: this.parseDate(template.endDate),
|
||||||
introducerRequired: template.introducerRequired === true || template.introducerRequired === 'Yes',
|
introducerRequired: template.introducerRequired === true || template.introducerRequired === 'Yes',
|
||||||
|
|||||||
+4
-4
@@ -31,7 +31,7 @@
|
|||||||
@if (
|
@if (
|
||||||
recurringDepositProduct.accountType ||
|
recurringDepositProduct.accountType ||
|
||||||
recurringDepositProduct.customerSegment ||
|
recurringDepositProduct.customerSegment ||
|
||||||
recurringDepositProduct.productCode ||
|
recurringDepositProduct.glAccountId ||
|
||||||
recurringDepositProduct.effectiveTo ||
|
recurringDepositProduct.effectiveTo ||
|
||||||
recurringDepositProduct.introducerRequired !== undefined ||
|
recurringDepositProduct.introducerRequired !== undefined ||
|
||||||
recurringDepositProduct.shareLinkingEnabled !== undefined
|
recurringDepositProduct.shareLinkingEnabled !== undefined
|
||||||
@@ -53,10 +53,10 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (recurringDepositProduct.productCode) {
|
@if (recurringDepositProduct.glAccountId) {
|
||||||
<div class="flex-100 layout-row">
|
<div class="flex-100 layout-row">
|
||||||
<span class="flex-40">Product Code:</span>
|
<span class="flex-40">GL Account (Liability):</span>
|
||||||
<span class="flex-60">{{ recurringDepositProduct.productCode }}</span>
|
<span class="flex-60">{{ getGlAccountName(recurringDepositProduct.glAccountId) }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
@@ -121,6 +121,13 @@ export class RecurringDepositProductPreviewStepComponent implements OnInit, OnCh
|
|||||||
return found?.value || String(value);
|
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 {
|
formatGlAccountById(glAccountId: number, options: any[]): string {
|
||||||
if (!glAccountId || !Array.isArray(options)) return '-';
|
if (!glAccountId || !Array.isArray(options)) return '-';
|
||||||
const account = this.accounting.glAccountLookUp(glAccountId, options as any);
|
const account = this.accounting.glAccountLookUp(glAccountId, options as any);
|
||||||
|
|||||||
+3
-3
@@ -54,10 +54,10 @@
|
|||||||
<span class="flex-60">{{ recurringDepositProduct.customerSegment }}</span>
|
<span class="flex-60">{{ recurringDepositProduct.customerSegment }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (recurringDepositProduct.productCode) {
|
@if (recurringDepositProduct.glAccountId) {
|
||||||
<div class="flex-100 layout-row">
|
<div class="flex-100 layout-row">
|
||||||
<span class="flex-40">Product Code:</span>
|
<span class="flex-40">GL Account (Liability):</span>
|
||||||
<span class="flex-60">{{ recurringDepositProduct.productCode }}</span>
|
<span class="flex-60">{{ recurringDepositProduct.glAccountName || recurringDepositProduct.glAccountId }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (recurringDepositProduct.effectiveTo) {
|
@if (recurringDepositProduct.effectiveTo) {
|
||||||
|
|||||||
+6
-2
@@ -82,8 +82,12 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="spd-field">
|
<mat-form-field appearance="outline" class="spd-field">
|
||||||
<mat-label>Product Code</mat-label>
|
<mat-label>GL Account (Liability)</mat-label>
|
||||||
<input matInput formControlName="productCode" readonly />
|
<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>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="spd-field" (click)="effectiveToPicker.open()">
|
<mat-form-field appearance="outline" class="spd-field" (click)="effectiveToPicker.open()">
|
||||||
|
|||||||
+11
-3
@@ -6,7 +6,7 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* 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 { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MatTooltip } from '@angular/material/tooltip';
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||||
@@ -30,12 +30,14 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
private formBuilder = inject(UntypedFormBuilder);
|
private formBuilder = inject(UntypedFormBuilder);
|
||||||
private dateUtils = inject(Dates);
|
private dateUtils = inject(Dates);
|
||||||
private settingsService = inject(SettingsService);
|
private settingsService = inject(SettingsService);
|
||||||
|
private cdr = inject(ChangeDetectorRef);
|
||||||
|
|
||||||
@Input() savingProductsTemplate: any;
|
@Input() savingProductsTemplate: any;
|
||||||
|
|
||||||
savingProductDetailsForm: UntypedFormGroup;
|
savingProductDetailsForm: UntypedFormGroup;
|
||||||
accountTypeData: string[] = [];
|
accountTypeData: string[] = [];
|
||||||
customerSegmentData: string[] = [];
|
customerSegmentData: string[] = [];
|
||||||
|
liabilityAccountOptions: any[] = [];
|
||||||
yesNoOptions: Array<{
|
yesNoOptions: Array<{
|
||||||
value: boolean;
|
value: boolean;
|
||||||
label: string;
|
label: string;
|
||||||
@@ -82,7 +84,7 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
customerSegment: [null],
|
customerSegment: [null],
|
||||||
productCode: [''],
|
glAccountId: [null],
|
||||||
effectiveDate: [''],
|
effectiveDate: [''],
|
||||||
effectiveTo: [''],
|
effectiveTo: [''],
|
||||||
endDate: [''],
|
endDate: [''],
|
||||||
@@ -110,6 +112,8 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
|
|
||||||
this.accountTypeData = accountTypeOptions;
|
this.accountTypeData = accountTypeOptions;
|
||||||
this.customerSegmentData = customerSegmentOptions;
|
this.customerSegmentData = customerSegmentOptions;
|
||||||
|
this.liabilityAccountOptions = template.accountingMappingOptions?.liabilityAccountOptions ?? [];
|
||||||
|
this.cdr.detectChanges();
|
||||||
if (yesNoOptions.length) {
|
if (yesNoOptions.length) {
|
||||||
this.yesNoOptions = yesNoOptions;
|
this.yesNoOptions = yesNoOptions;
|
||||||
}
|
}
|
||||||
@@ -122,7 +126,7 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
description: template.description,
|
description: template.description,
|
||||||
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
|
accountType: template.accountType ?? this.accountTypeData[0] ?? null,
|
||||||
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
|
customerSegment: template.customerSegment ?? this.customerSegmentData[0] ?? null,
|
||||||
productCode: template.productCode ?? '',
|
glAccountId: template.glAccountId ?? null,
|
||||||
effectiveDate: template.effectiveDate ? new Date(template.effectiveDate) : '',
|
effectiveDate: template.effectiveDate ? new Date(template.effectiveDate) : '',
|
||||||
effectiveTo: template.effectiveTo ? new Date(template.effectiveTo) : '',
|
effectiveTo: template.effectiveTo ? new Date(template.effectiveTo) : '',
|
||||||
endDate: template.endDate ? new Date(template.endDate) : '',
|
endDate: template.endDate ? new Date(template.endDate) : '',
|
||||||
@@ -162,6 +166,10 @@ export class SavingProductDetailsStepComponent implements OnInit, OnChanges {
|
|||||||
.filter((value) => !!value);
|
.filter((value) => !!value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compareById(o1: any, o2: any): boolean {
|
||||||
|
return o1 != null && o2 != null && Number(o1) === Number(o2);
|
||||||
|
}
|
||||||
|
|
||||||
get savingProductDetails() {
|
get savingProductDetails() {
|
||||||
const formValue = { ...this.savingProductDetailsForm.value };
|
const formValue = { ...this.savingProductDetailsForm.value };
|
||||||
const dateFormat = this.settingsService.dateFormat;
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
|
|||||||
+4
-4
@@ -28,7 +28,7 @@
|
|||||||
@if (
|
@if (
|
||||||
savingProduct.accountType ||
|
savingProduct.accountType ||
|
||||||
savingProduct.customerSegment ||
|
savingProduct.customerSegment ||
|
||||||
savingProduct.productCode ||
|
savingProduct.glAccountId ||
|
||||||
savingProduct.effectiveTo ||
|
savingProduct.effectiveTo ||
|
||||||
savingProduct.introducerRequired !== undefined ||
|
savingProduct.introducerRequired !== undefined ||
|
||||||
savingProduct.shareLinkingEnabled !== undefined
|
savingProduct.shareLinkingEnabled !== undefined
|
||||||
@@ -51,10 +51,10 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (savingProduct.productCode) {
|
@if (savingProduct.glAccountId) {
|
||||||
<div class="flex-100 layout-row">
|
<div class="flex-100 layout-row">
|
||||||
<span class="flex-40">Product Code:</span>
|
<span class="flex-40">GL Account (Liability):</span>
|
||||||
<span class="flex-60">{{ savingProduct.productCode }}</span>
|
<span class="flex-60">{{ getGlAccountName(savingProduct.glAccountId) }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
@@ -201,6 +201,13 @@ export class SavingProductPreviewStepComponent implements OnInit, OnChanges {
|
|||||||
return this.accounting.isAccrualAccounting(this.accountingRule);
|
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 {
|
getBooleanLabel(value: any): string {
|
||||||
return value === true || value === 'Yes' ? 'Yes' : 'No';
|
return value === true || value === 'Yes' ? 'Yes' : 'No';
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -40,7 +40,7 @@
|
|||||||
@if (
|
@if (
|
||||||
savingProduct.accountType ||
|
savingProduct.accountType ||
|
||||||
savingProduct.customerSegment ||
|
savingProduct.customerSegment ||
|
||||||
savingProduct.productCode ||
|
savingProduct.glAccountId ||
|
||||||
savingProduct.effectiveDate ||
|
savingProduct.effectiveDate ||
|
||||||
savingProduct.effectiveTo ||
|
savingProduct.effectiveTo ||
|
||||||
savingProduct.endDate ||
|
savingProduct.endDate ||
|
||||||
@@ -65,10 +65,10 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (savingProduct.productCode) {
|
@if (savingProduct.glAccountId) {
|
||||||
<div class="flex-100 layout-row">
|
<div class="flex-100 layout-row">
|
||||||
<span class="flex-40">Product Code:</span>
|
<span class="flex-40">GL Account (Liability):</span>
|
||||||
<span class="flex-60">{{ savingProduct.productCode }}</span>
|
<span class="flex-60">{{ savingProduct.glAccountName || savingProduct.glAccountId }}</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -87,8 +87,12 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="sad-field">
|
<mat-form-field appearance="outline" class="sad-field">
|
||||||
<mat-label>Product Code</mat-label>
|
<mat-label>Account No</mat-label>
|
||||||
<input matInput [value]="productTemplate.productCode || ''" readonly />
|
<input
|
||||||
|
matInput
|
||||||
|
[value]="productTemplate?.previewAccountNo || savingsAccountTemplate?.accountNo || 'Auto-generated'"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
@if (productTemplate.effectiveDate) {
|
@if (productTemplate.effectiveDate) {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
export default {
|
export default {
|
||||||
'mifos_x': {
|
'mifos_x': {
|
||||||
'version': '260424',
|
'version': '260425',
|
||||||
'hash': 'fc1c5126'
|
'hash': 'fbaec185'
|
||||||
},
|
},
|
||||||
'allow_switching_backend_instance': true
|
'allow_switching_backend_instance': true
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user