Skip to content

Web-110: Fix Gsim creation to include all selected clients #2410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,6 @@ <h4 fxFlex="98%" class="mat-h4">{{ 'labels.inputs.Loan Schedule' | translate }}<
<input type="number" matInput formControlName="fixedEmiAmount" />
</mat-form-field>

<mat-form-field fxFlex="48%">
<mat-label>{{ 'labels.inputs.Balloon Repayment Amount' | translate }}</mat-label>
<input type="number" matInput formControlName="balloonRepaymentAmount" />
</mat-form-field>

<h4 fxFlex="98%" class="mat-h4">{{ 'labels.heading.Interest Calculations' | translate }}</h4>

<mat-form-field fxFlex="48%">
Expand Down Expand Up @@ -474,6 +469,13 @@ <h4 fxFlex="98%" class="mat-h4">
<span fxFlex="60%">{{ loansAccountTermsData.interestRecalculationData.recalculationRestFrequencyInterval }}</span>
</div>

<div fxFlexFill>
<span fxFlex="40%"
><b>{{ 'labels.inputs.Enable income capitalization' | translate }}</b></span
>
<span fxFlex="60%">{{ enableIncomeCapitalization | yesNo }}</span>
</div>

<ng-container *ngIf="multiDisburseLoan">
<mat-divider fxFlex="98%"></mat-divider>
<div fxFlexFill *ngIf="allowAddDisbursementDetails()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
currency: Currency;

productEnableDownPayment = false;
enableIncomeCapitalization = false;
isProgressive = false;

/**
Expand Down Expand Up @@ -128,6 +129,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
this.loansAccountTermsData = this.loansAccountTemplate;
}
this.productEnableDownPayment = this.loansAccountTermsData.product.enableDownPayment;
this.enableIncomeCapitalization = this.loansAccountTermsData.product.enableIncomeCapitalization;
this.isProgressive =
this.loansAccountTermsData.loanScheduleType.code == LoanProducts.LOAN_SCHEDULE_TYPE_PROGRESSIVE;
if (this.loansAccountTermsData.product) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,21 @@ <h3>{{ 'labels.heading.Loan Details' | translate }}</h3>
<span fxFlex="50%">{{ loanDetails.chargeOffBehaviour.value | translateKey: 'catalogs' }}</span>
</div>

<div fxFlexFill>
<span fxFlex="50%"> {{ 'labels.inputs.Enable income capitalization' | translate }}</span>
<span fxFlex="50%"> {{ loanDetails.enableIncomeCapitalization | yesNo }} </span>
</div>

<div fxFlexFill *ngIf="loanDetails.enableIncomeCapitalization">
<span fxFlex="50%"> {{ 'labels.inputs.Income capitalization calculation type' | translate }}</span>
<span fxFlex="50%"> {{ loanDetails.capitalizedIncomeCalculationType?.value | translateKey: 'catalogs' }} </span>
</div>

<div fxFlexFill *ngIf="loanDetails.enableIncomeCapitalization">
<span fxFlex="50%"> {{ 'labels.inputs.Income capitalization strategy' | translate }}</span>
<span fxFlex="50%"> {{ loanDetails.capitalizedIncomeStrategy?.value | translateKey: 'catalogs' }} </span>
</div>

<div fxFlexFill>
<span fxFlex="50%"> {{ 'labels.inputs.Grace: On Principal Payment' | translate }}</span>
<span fxFlex="50%"> {{ loanDetails.graceOnPrincipalPayment }} </span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,27 @@ <h3 class="mat-h3" fxFlexFill>{{ 'labels.inputs.Overdue Charges' | translate }}<
</table>
</div>

<div fxFlexFill *ngIf="isAdvancedPaymentAllocation" fxLayout="row wrap" fxLayout.lt-md="column">
<h3 class="mat-h3" fxFlexFill>{{ 'labels.inputs.Income capitalization' | translate }}</h3>

<mat-divider [inset]="true"></mat-divider>

<div fxFlexFill>
<span fxFlex="47%">{{ 'labels.inputs.Enable income capitalization' | translate }}:</span>
<span fxFlex="53%">{{ loanProduct.enableIncomeCapitalization | yesNo }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.enableIncomeCapitalization">
<span fxFlex="47%">{{ 'labels.inputs.Income capitalization calculation type' | translate }}:</span>
<span fxFlex="53%">{{ loanProduct.capitalizedIncomeCalculationType?.value | translateKey: 'catalogs' }}</span>
</div>

<div fxFlexFill *ngIf="loanProduct.enableIncomeCapitalization">
<span fxFlex="47%">{{ 'labels.inputs.Income capitalization strategy' | translate }}:</span>
<span fxFlex="53%">{{ loanProduct.capitalizedIncomeStrategy?.value | translateKey: 'catalogs' }}</span>
</div>
</div>

<h3 class="mat-h3" fxFlexFill>{{ 'labels.heading.Accounting' | translate }}</h3>

<mat-divider [inset]="true"></mat-divider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,25 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
this.loanProductsTemplate.daysInYearTypeOptions
);
this.loanProduct.daysInYearType = optionValue;
if (this.isAdvancedPaymentAllocation && this.loanProduct.daysInYearType.id == 1) {
if (this.isAdvancedPaymentAllocation && this.loanProduct.daysInYearType?.id == 1) {
optionValue = this.optionDataLookUp(
this.loanProduct.daysInYearCustomStrategy,
this.loanProductsTemplate.daysInYearCustomStrategyOptions
);
}
this.loanProduct.daysInYearCustomStrategy = optionValue;
if (this.isAdvancedPaymentAllocation && this.loanProduct.enableIncomeCapitalization) {
optionValue = this.optionDataLookUp(
this.loanProduct.capitalizedIncomeCalculationType,
this.loanProductsTemplate.capitalizedIncomeCalculationTypeOptions
);
this.loanProduct.capitalizedIncomeCalculationType = optionValue;
optionValue = this.optionDataLookUp(
this.loanProduct.capitalizedIncomeStrategy,
this.loanProductsTemplate.capitalizedIncomeStrategyOptions
);
this.loanProduct.capitalizedIncomeStrategy = optionValue;
}
optionValue = this.optionDataLookUp(
this.loanProduct.interestRateFrequencyType,
this.loanProductsTemplate.interestRateFrequencyTypeOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@
</mifosx-loan-product-charges-step>
</mat-step>

<mat-step *ngIf="isAdvancedPaymentStrategy" [stepControl]="loanIncomeCapitalizationForm" completed>
<ng-template matStepLabel>{{ 'labels.inputs.INCOME CAPITALIZATION' | translate }}</ng-template>

<mifosx-loan-product-capitalized-income-step
[capitalizedIncome]="capitalizedIncome"
[capitalizedIncomeCalculationTypeOptions]="loanProductsTemplate.capitalizedIncomeCalculationTypeOptions"
[capitalizedIncomeStrategyOptions]="loanProductsTemplate.capitalizedIncomeStrategyOptions"
(setCapitalizedIncome)="setCapitalizedIncome($event)"
>
</mifosx-loan-product-capitalized-income-step>

<mifosx-stepper-buttons></mifosx-stepper-buttons>
</mat-step>

<mat-step [stepControl]="loanProductAccountingForm">
<ng-template matStepLabel>{{ 'labels.inputs.ACCOUNTING' | translate }}</ng-template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ import { LoanProducts } from '../loan-products';
import {
AdvancedPaymentAllocation,
AdvancedPaymentStrategy,
CapitalizedIncome,
PaymentAllocation
} from '../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
import { Accounting } from 'app/core/utils/accounting';
import { StringEnumOptionData } from '../../../shared/models/option-data.model';
import { LoanProductCapitalizedIncomeStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-capitalized-income-step.component';

@Component({
selector: 'mifosx-create-loan-product',
Expand All @@ -33,6 +35,8 @@ export class CreateLoanProductComponent implements OnInit {
loanProductCurrencyStep: LoanProductCurrencyStepComponent;
@ViewChild(LoanProductInterestRefundStepComponent, { static: true })
loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
@ViewChild(LoanProductCapitalizedIncomeStepComponent, { static: true })
loanProductCapitalizedIncomeStep: LoanProductCapitalizedIncomeStepComponent;
@ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent;
@ViewChild(LoanProductSettingsStepComponent, { static: true })
loanProductSettingsStep: LoanProductSettingsStepComponent;
Expand All @@ -51,6 +55,8 @@ export class CreateLoanProductComponent implements OnInit {
advancedPaymentAllocations: AdvancedPaymentAllocation[] = [];
advancedCreditAllocations: AdvancedPaymentAllocation[] = [];

capitalizedIncome: CapitalizedIncome | null = null;

/**
* @param {ActivatedRoute} route Activated Route.
* @param {ProductsService} productsService Product Service.
Expand Down Expand Up @@ -105,6 +111,19 @@ export class CreateLoanProductComponent implements OnInit {

advancePaymentStrategy(value: string) {
this.isAdvancedPaymentStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(value);
if (this.isAdvancedPaymentStrategy) {
if (this.loanProductsTemplate.enableIncomeCapitalization) {
this.capitalizedIncome = {
enableIncomeCapitalization: true,
incomeCapitalizationCalculationType: this.loanProductsTemplate.capitalizedIncomeCalculationTypeOptions[0],
incomeCapitalizationStrategy: this.loanProductsTemplate.capitalizedIncomeStrategyOptions[0]
};
} else {
this.capitalizedIncome = {
enableIncomeCapitalization: false
};
}
}
}

buildAdvancedPaymentAllocation(): void {
Expand All @@ -125,6 +144,12 @@ export class CreateLoanProductComponent implements OnInit {
this.supportedInterestRefundTypes = supportedInterestRefundTypes;
}

setCapitalizedIncome(capitalizedIncome: CapitalizedIncome): void {
if (this.isAdvancedPaymentStrategy) {
this.capitalizedIncome = capitalizedIncome;
}
}

get loanProductSettingsForm() {
return this.loanProductSettingsStep.loanProductSettingsForm;
}
Expand All @@ -133,6 +158,12 @@ export class CreateLoanProductComponent implements OnInit {
return this.loanProductAccountingStep.loanProductAccountingForm;
}

get loanIncomeCapitalizationForm() {
if (this.loanProductCapitalizedIncomeStep != null) {
return this.loanProductCapitalizedIncomeStep.loanIncomeCapitalizationForm;
}
}

get loanProductFormValid() {
return (
this.loanProductDetailsForm.valid &&
Expand All @@ -156,6 +187,13 @@ export class CreateLoanProductComponent implements OnInit {
loanProduct['paymentAllocation'] = this.paymentAllocation;
loanProduct['creditAllocation'] = this.creditAllocation;
loanProduct['supportedInterestRefundTypes'] = this.supportedInterestRefundTypes;
if (this.capitalizedIncome != null) {
loanProduct['enableIncomeCapitalization'] = this.capitalizedIncome.enableIncomeCapitalization;
if (this.capitalizedIncome.enableIncomeCapitalization) {
loanProduct['capitalizedIncomeCalculationType'] = this.capitalizedIncome.incomeCapitalizationCalculationType;
loanProduct['capitalizedIncomeStrategy'] = this.capitalizedIncome.incomeCapitalizationStrategy;
}
}
}
return loanProduct;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
(supportedInterestRefundTypes)="setSupportedInterestRefundTypes($event)"
>
</mifosx-loan-product-interest-refund-step>

<mifosx-stepper-buttons></mifosx-stepper-buttons>
</mat-step>

<mat-step *ngIf="isAdvancedPaymentStrategy" completed>
Expand Down Expand Up @@ -91,6 +93,20 @@
</mifosx-loan-product-charges-step>
</mat-step>

<mat-step *ngIf="isAdvancedPaymentStrategy" [stepControl]="loanIncomeCapitalizationForm" completed>
<ng-template matStepLabel>{{ 'labels.inputs.INCOME CAPITALIZATION' | translate }}</ng-template>

<mifosx-loan-product-capitalized-income-step
[capitalizedIncome]="capitalizedIncome"
[capitalizedIncomeCalculationTypeOptions]="loanProductAndTemplate.capitalizedIncomeCalculationTypeOptions"
[capitalizedIncomeStrategyOptions]="loanProductAndTemplate.capitalizedIncomeStrategyOptions"
(setCapitalizedIncome)="setCapitalizedIncome($event)"
>
</mifosx-loan-product-capitalized-income-step>

<mifosx-stepper-buttons></mifosx-stepper-buttons>
</mat-step>

<mat-step [stepControl]="loanProductAccountingForm" completed>
<ng-template matStepLabel>{{ 'labels.inputs.ACCOUNTING' | translate }}</ng-template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ import {
AdvancedCreditAllocation,
AdvancedPaymentAllocation,
AdvancedPaymentStrategy,
CapitalizedIncome,
CreditAllocation,
PaymentAllocation
} from '../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
import { Accounting } from 'app/core/utils/accounting';
import { LoanProductInterestRefundStepComponent } from '../loan-product-stepper/loan-product-interest-refund-step/loan-product-interest-refund-step.component';
import { StringEnumOptionData } from '../../../shared/models/option-data.model';
import { LoanProductCapitalizedIncomeStepComponent } from '../loan-product-stepper/loan-product-capitalized-income-step/loan-product-capitalized-income-step.component';

@Component({
selector: 'mifosx-edit-loan-product',
Expand All @@ -36,6 +38,8 @@ export class EditLoanProductComponent implements OnInit {
loanProductCurrencyStep: LoanProductCurrencyStepComponent;
@ViewChild(LoanProductInterestRefundStepComponent, { static: true })
loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
@ViewChild(LoanProductCapitalizedIncomeStepComponent, { static: true })
loanProductCapitalizedIncomeStep: LoanProductCapitalizedIncomeStepComponent;
@ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent;
@ViewChild(LoanProductSettingsStepComponent, { static: true })
loanProductSettingsStep: LoanProductSettingsStepComponent;
Expand All @@ -55,6 +59,8 @@ export class EditLoanProductComponent implements OnInit {
advancedCreditAllocations: AdvancedCreditAllocation[] = [];
supportedInterestRefundTypes: StringEnumOptionData[] = [];

capitalizedIncome: CapitalizedIncome | null = null;

/**
* @param {ActivatedRoute} route Activated Route.
* @param {ProductsService} productsService Product Service.
Expand Down Expand Up @@ -90,6 +96,17 @@ export class EditLoanProductComponent implements OnInit {
this.paymentAllocation = this.loanProductAndTemplate.paymentAllocation;
this.creditAllocation = this.loanProductAndTemplate.creditAllocation;
this.supportedInterestRefundTypes = this.loanProductAndTemplate.supportedInterestRefundTypes;
if (this.loanProductAndTemplate.enableIncomeCapitalization) {
this.capitalizedIncome = {
enableIncomeCapitalization: true,
incomeCapitalizationCalculationType: this.loanProductAndTemplate.capitalizedIncomeCalculationType.id,
incomeCapitalizationStrategy: this.loanProductAndTemplate.capitalizedIncomeStrategy.id
};
} else {
this.capitalizedIncome = {
enableIncomeCapitalization: false
};
}
}
}

Expand All @@ -115,6 +132,12 @@ export class EditLoanProductComponent implements OnInit {
}
}

get loanIncomeCapitalizationForm() {
if (this.loanProductCapitalizedIncomeStep != null) {
return this.loanProductCapitalizedIncomeStep.loanIncomeCapitalizationForm;
}
}

advancePaymentStrategy(value: string): void {
this.isAdvancedPaymentStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(value);
}
Expand Down Expand Up @@ -146,6 +169,12 @@ export class EditLoanProductComponent implements OnInit {
this.wasPaymentAllocationChanged = value;
}

setCapitalizedIncome(capitalizedIncome: CapitalizedIncome): void {
if (this.isAdvancedPaymentStrategy) {
this.capitalizedIncome = capitalizedIncome;
}
}

get loanProductAccountingForm() {
return this.loanProductAccountingStep.loanProductAccountingForm;
}
Expand Down Expand Up @@ -184,6 +213,13 @@ export class EditLoanProductComponent implements OnInit {
loanProduct['paymentAllocation'] = this.paymentAllocation;
loanProduct['creditAllocation'] = this.creditAllocation;
loanProduct['supportedInterestRefundTypes'] = this.supportedInterestRefundTypes;
if (this.capitalizedIncome != null) {
loanProduct['enableIncomeCapitalization'] = this.capitalizedIncome.enableIncomeCapitalization;
if (this.capitalizedIncome.enableIncomeCapitalization) {
loanProduct['capitalizedIncomeCalculationType'] = this.capitalizedIncome.incomeCapitalizationCalculationType;
loanProduct['capitalizedIncomeStrategy'] = this.capitalizedIncome.incomeCapitalizationStrategy;
}
}
}
return loanProduct;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<form [formGroup]="loanIncomeCapitalizationForm">
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
<mat-checkbox fxFlex="98%" labelPosition="before" formControlName="enableIncomeCapitalization">
{{ 'labels.inputs.Enable income capitalization' | translate }}
</mat-checkbox>

<mat-form-field fxFlex="48%" *ngIf="enableIncomeCapitalization">
<mat-label>{{ 'labels.inputs.Income capitalization calculation type' | translate }}</mat-label>
<mat-select formControlName="incomeCapitalizationCalculationType" required>
<mat-option
*ngFor="let capitalizedIncomeCalculationType of capitalizedIncomeCalculationTypeOptions"
[value]="capitalizedIncomeCalculationType.id"
>
{{ capitalizedIncomeCalculationType.value | translateKey: 'catalogs' }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field fxFlex="48%" *ngIf="enableIncomeCapitalization">
<mat-label>{{ 'labels.inputs.Income capitalization strategy' | translate }}</mat-label>
<mat-select formControlName="incomeCapitalizationStrategy" required>
<mat-option
*ngFor="let capitalizedIncomeStrategy of capitalizedIncomeStrategyOptions"
[value]="capitalizedIncomeStrategy.id"
>
{{ capitalizedIncomeStrategy.value | translateKey: 'catalogs' }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</form>
Loading