Fix: Recurring Deposit product edition using IRC ids

This commit is contained in:
Jose Alberto Hernandez
2024-02-26 13:29:41 +01:00
committed by Adam Saghy
parent 4117b45aff
commit dd1245c997
2 changed files with 16 additions and 3 deletions
@@ -111,6 +111,7 @@ export class RecurringDepositProductInterestRateChartStepComponent implements On
this.chartsDetail[i].chartSlabs.forEach((chartSlabDetail: any, j: number) => { this.chartsDetail[i].chartSlabs.forEach((chartSlabDetail: any, j: number) => {
const chartSlabInfo = this.formBuilder.group({ const chartSlabInfo = this.formBuilder.group({
id: [chartSlabDetail.id],
amountRangeFrom: [chartSlabDetail.amountRangeFrom], amountRangeFrom: [chartSlabDetail.amountRangeFrom],
amountRangeTo: [chartSlabDetail.amountRangeTo], amountRangeTo: [chartSlabDetail.amountRangeTo],
annualInterestRate: [chartSlabDetail.annualInterestRate, Validators.required], annualInterestRate: [chartSlabDetail.annualInterestRate, Validators.required],
@@ -154,6 +155,9 @@ export class RecurringDepositProductInterestRateChartStepComponent implements On
name: chartData.name, name: chartData.name,
chartSlabs: this.getChartSlabsData(chartData) chartSlabs: this.getChartSlabsData(chartData)
}; };
if (chartData.id) {
chart['id'] = chartData.id;
}
this.chartsDetail.push(chart); this.chartsDetail.push(chart);
}); });
this.recurringDepositProductInterestRateChartForm.patchValue({ this.recurringDepositProductInterestRateChartForm.patchValue({
@@ -182,6 +186,9 @@ export class RecurringDepositProductInterestRateChartStepComponent implements On
toPeriod: eachChartSlabData.toPeriod, toPeriod: eachChartSlabData.toPeriod,
incentives: this.getIncentivesData(chartSlabData) incentives: this.getIncentivesData(chartSlabData)
}; };
if (eachChartSlabData.id) {
chartSlab['id'] = eachChartSlabData.id;
}
chartSlabs.push(chartSlab); chartSlabs.push(chartSlab);
}); });
return chartSlabs; return chartSlabs;
@@ -224,6 +231,7 @@ export class RecurringDepositProductInterestRateChartStepComponent implements On
createChartForm(): UntypedFormGroup { createChartForm(): UntypedFormGroup {
return this.formBuilder.group({ return this.formBuilder.group({
'id': [null],
'name': [''], 'name': [''],
'description': [''], 'description': [''],
'fromDate': ['', Validators.required], 'fromDate': ['', Validators.required],
@@ -376,7 +384,7 @@ export class RecurringDepositProductInterestRateChartStepComponent implements On
for (const chart of recurringDepositProductInterestRateChart.charts) { for (const chart of recurringDepositProductInterestRateChart.charts) {
chart.dateFormat = dateFormat; chart.dateFormat = dateFormat;
chart.locale = locale; chart.locale = locale;
chart.fromDate = this.dateUtils.formatDate(chart.fromDate, dateFormat) || ''; chart.fromDate = this.dateUtils.formatDate(chart.fromDate, dateFormat);
chart.endDate = this.dateUtils.formatDate(chart.endDate, dateFormat) || ''; chart.endDate = this.dateUtils.formatDate(chart.endDate, dateFormat) || '';
if (chart.endDate === '') { if (chart.endDate === '') {
delete chart.endDate; delete chart.endDate;
@@ -384,6 +392,9 @@ export class RecurringDepositProductInterestRateChartStepComponent implements On
if (chart.description === '') { if (chart.description === '') {
delete chart.description; delete chart.description;
} }
if (chart.id === null) {
delete chart.id;
}
} }
return recurringDepositProductInterestRateChart; return recurringDepositProductInterestRateChart;
} }
@@ -380,8 +380,10 @@
<div fxFlexFill fxLayout="row wrap" fxLayout.lt-md="column"> <div fxFlexFill fxLayout="row wrap" fxLayout.lt-md="column">
<span fxFlex="40%">Interest on savings:</span> <span fxFlex="40%">Interest on savings:</span>
<span fxFlex="60%">{{ recurringDepositProduct.accountingMappings.interestOnSavingsAccount.name }}</span> <span fxFlex="60%">{{ recurringDepositProduct.accountingMappings.interestOnSavingsAccount.name }}</span>
<span fxFlex="40%">Write-off:</span> <span *ngIf="recurringDepositProduct.accountingMappings.writeOffAccount">
<span fxFlex="60%">{{ recurringDepositProduct.accountingMappings.writeOffAccount.name }}</span> <span fxFlex="40%">Write-off:</span>
<span fxFlex="60%">{{ recurringDepositProduct.accountingMappings.writeOffAccount.name }}</span>
</span>
</div> </div>
<h4 fxFlexFill class="mat-h4">Income</h4> <h4 fxFlexFill class="mat-h4">Income</h4>