Introduce a new type of ACTUAL during calculation of days in year

This commit is contained in:
Jose Alberto Hernandez
2025-03-20 11:18:47 -05:00
parent 0b8dd0e3ff
commit 319ce8057a
27 changed files with 345 additions and 147 deletions
@@ -496,6 +496,11 @@
<span fxFlex="53%">{{ loanProduct.daysInYearType?.value | translateKey: 'catalogs' }}</span>
</div>
<div fxFlexFill *ngIf="isAdvancedPaymentAllocation && loanProduct.daysInYearCustomStrategy">
<span fxFlex="47%">{{ 'labels.inputs.Days in year custom strategy' | translate }}:</span>
<span fxFlex="53%">{{ loanProduct.daysInYearCustomStrategy.value | translateKey: 'catalogs' }}</span>
</div>
<div fxFlexFill>
<span fxFlex="47%">{{ 'labels.inputs.Days in month' | translate }}:</span>
<span fxFlex="53%">{{ loanProduct.daysInMonthType?.value | translateKey: 'catalogs' }}</span>
@@ -275,6 +275,13 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
this.loanProductsTemplate.daysInYearTypeOptions
);
this.loanProduct.daysInYearType = optionValue;
if (this.isAdvancedPaymentAllocation && this.loanProduct.daysInYearType.id == 1) {
optionValue = this.optionDataLookUp(
this.loanProduct.daysInYearCustomStrategy,
this.loanProductsTemplate.daysInYearCustomStrategyOptions
);
}
this.loanProduct.daysInYearCustomStrategy = optionValue;
optionValue = this.optionDataLookUp(
this.loanProduct.interestRateFrequencyType,
this.loanProductsTemplate.interestRateFrequencyTypeOptions
@@ -1,4 +1,6 @@
.container {
max-width: 86rem;
width: 96%;
padding-bottom: 30px;
}
@@ -1,3 +1,5 @@
.container {
max-width: 86rem;
width: 96%;
padding-bottom: 30px;
}
@@ -330,6 +330,21 @@
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="48%" *ngIf="useDaysInYearCustomStrategy">
<mat-label>{{ 'labels.inputs.Days in year custom strategy' | translate }}</mat-label>
<mat-select
matTooltip="{{ 'tooltips.To calculate interest' | translate }}"
formControlName="daysInYearCustomStrategy"
>
<mat-option
*ngFor="let daysInYearCustomStrategy of daysInYearCustomStrategyOptions"
[value]="daysInYearCustomStrategy.id"
>
{{ daysInYearCustomStrategy.value | translateKey: 'catalogs' }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="48%">
<mat-label>{{ 'labels.inputs.Days in month' | translate }}</mat-label>
<mat-select
@@ -45,6 +45,8 @@ export class LoanProductSettingsStepComponent implements OnInit {
useDueForRepaymentsConfigurations = false;
rescheduleStrategyTypeDisabled = false;
chargeOffBehaviourData: StringEnumOptionData[] = [];
daysInYearCustomStrategyOptions: OptionData[] = [];
useDaysInYearCustomStrategy = false;
/** Values to Days for Repayments */
defaultConfigValues: GlobalConfiguration[] = [];
@@ -88,8 +90,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
this.loanScheduleTypeData = this.loanProductsTemplate.loanScheduleTypeOptions;
this.loanScheduleProcessingTypeData = this.loanProductsTemplate.loanScheduleProcessingTypeOptions;
this.chargeOffBehaviourData = this.loanProductsTemplate.chargeOffBehaviourOptions;
// this.useDueForRepaymentsConfigurations = (!this.loanProduct.dueDaysForRepaymentEvent && !this.loanProduct.overDueDaysForRepaymentEvent);
this.daysInYearCustomStrategyOptions = this.loanProductsTemplate.daysInYearCustomStrategyOptions;
const transactionProcessingStrategyCode: string =
this.loanProductsTemplate.transactionProcessingStrategyCode || this.transactionProcessingStrategyData[0].code;
@@ -319,6 +320,23 @@ export class LoanProductSettingsStepComponent implements OnInit {
setConditionalControls() {
const allowAttributeOverrides = this.loanProductSettingsForm.get('allowAttributeOverrides');
this.loanProductSettingsForm.get('daysInYearType').valueChanges.subscribe((daysInYearType: any) => {
if (this.isAdvancedTransactionProcessingStrategy) {
this.useDaysInYearCustomStrategy = daysInYearType == 1;
if (this.useDaysInYearCustomStrategy) {
const daysInYearCustomStrategy: string = this.loanProductsTemplate.daysInYearCustomStrategy?.id
? this.loanProductsTemplate.daysInYearCustomStrategy.id
: '';
this.loanProductSettingsForm.addControl(
'daysInYearCustomStrategy',
new UntypedFormControl(daysInYearCustomStrategy, Validators.required)
);
} else {
this.loanProductSettingsForm.removeControl('daysInYearCustomStrategy');
}
}
});
this.loanProductSettingsForm
.get('interestCalculationPeriodType')
.valueChanges.subscribe((interestCalculationPeriodType: any) => {
@@ -696,6 +714,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
if (productSettings['delinquencyBucketId'] === '') {
productSettings['delinquencyBucketId'] = null;
}
console.log(productSettings);
return productSettings;
}
@@ -52,6 +52,7 @@ export interface LoanProduct {
paymentAllocation?: PaymentAllocation[];
creditAllocation?: CreditAllocation[];
daysInMonthType: OptionData;
daysInYearCustomStrategy?: OptionData;
daysInYearType: OptionData;
isInterestRecalculationEnabled: boolean;
interestRecalculationData?: InterestRecalculationData;
@@ -1,6 +1,6 @@
.product-card {
margin: 0 auto;
max-width: 80rem;
max-width: 90rem;
width: 90%;
padding: 0;