Enable or Disable DownPayment at Loan account level
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
b5990af9e2
commit
272922caed
+9
-7
@@ -2,13 +2,10 @@
|
||||
|
||||
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
|
||||
|
||||
<mat-form-field fxFlex="48%">
|
||||
<mat-label>{{"labels.inputs.Principal" | translate}} {{currencyDisplaySymbol}}</mat-label>
|
||||
<input type="number" matInput formControlName="principalAmount">
|
||||
<mat-error *ngIf="loansAccountTermsForm.controls.principalAmount.hasError('required')">
|
||||
{{"labels.inputs.Principal" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mifosx-input-amount fxFlex="48%" *ngIf="currency" [currency]="currency" [isRequired]="true"
|
||||
[inputFormControl]="loansAccountTermsForm.controls.principalAmount"
|
||||
[inputLabel]="'Principal'">
|
||||
</mifosx-input-amount>
|
||||
|
||||
<h4 fxFlex="98%" class="mat-h4">{{"labels.heading.Term Options" | translate}} <i class="fas fa-question" matTooltip="The loan term parameter in loan accounts
|
||||
is the default-calculated field based on the number of repayments and repaid every value entered by the user"></i></h4>
|
||||
@@ -106,6 +103,11 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-checkbox fxFlex="73%" labelPosition="before" formControlName="enableDownPayment" matTooltip="Leave this checkbox checked if the loan has Down Payment, A Down Payment is
|
||||
a sum a buyer pays upfront when purchasing a good. It represents a percentage of the total purchase price, and the balance is usually financed" class="margin-b" *ngIf="productEnableDownPayment">
|
||||
{{'labels.inputs.Enable Down Payment' | translate}}
|
||||
</mat-checkbox>
|
||||
|
||||
<h4 fxFlex="98%" class="mat-h4">{{"labels.inputs.Nominal interest rate" | translate}}</h4>
|
||||
|
||||
<ng-container *ngIf="!loansAccountTermsData?.isLoanProductLinkedToFloatingRate">
|
||||
|
||||
+20
-7
@@ -12,6 +12,7 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen
|
||||
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
import { CodeName, OptionData } from 'app/shared/models/option-data.model';
|
||||
|
||||
/**
|
||||
@@ -63,7 +64,6 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
clientActiveLoanData: any;
|
||||
/** Multi Disbursement Data */
|
||||
disbursementDataSource: {}[] = [];
|
||||
currencyDisplaySymbol = '$';
|
||||
/** Loan repayment strategies */
|
||||
transactionProcessingStrategyOptions: any = [];
|
||||
repaymentStrategyDisabled = false;
|
||||
@@ -85,11 +85,12 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
pristine = true;
|
||||
|
||||
loanId: any = null;
|
||||
|
||||
loanScheduleType: OptionData | null = null;
|
||||
loanProduct: LoanProduct | null = null;
|
||||
|
||||
interestRateFrequencyTypeData: any[] = [];
|
||||
currency: Currency;
|
||||
|
||||
productEnableDownPayment = false;
|
||||
|
||||
/**
|
||||
* Create Loans Account Terms Form
|
||||
@@ -108,19 +109,19 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
*/
|
||||
ngOnChanges() {
|
||||
if (this.loansAccountProductTemplate) {
|
||||
this.currency = this.loansAccountProductTemplate.currency;
|
||||
|
||||
this.loansAccountTermsData = this.loansAccountProductTemplate;
|
||||
this.currencyDisplaySymbol = this.loansAccountTermsData.currency.displaySymbol;
|
||||
if (this.loanId != null && this.loansAccountTemplate.accountNo) {
|
||||
this.loansAccountTermsData = this.loansAccountTemplate;
|
||||
}
|
||||
this.productEnableDownPayment = this.loansAccountTermsData.product.enableDownPayment;
|
||||
|
||||
if (this.loansAccountTermsData.product) {
|
||||
this.loanProduct = this.loansAccountTermsData.product;
|
||||
}
|
||||
|
||||
this.interestRateFrequencyTypeData = this.loansAccountTermsData.interestRateFrequencyTypeOptions;
|
||||
console.log(this.loansAccountTermsData);
|
||||
console.log(this.loanProduct);
|
||||
|
||||
this.loansAccountTermsForm.patchValue({
|
||||
'principalAmount': this.loansAccountTermsData.principal,
|
||||
@@ -167,6 +168,10 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
this.loansAccountTermsForm.addControl('enableInstallmentLevelDelinquency', new UntypedFormControl(this.loansAccountTermsData.enableInstallmentLevelDelinquency || this.loanProduct.enableInstallmentLevelDelinquency));
|
||||
}
|
||||
this.collateralDataSource = this.loansAccountTermsData.collateral || [];
|
||||
if (this.productEnableDownPayment) {
|
||||
const enableDownPayment = (this.loansAccountTermsData['enableDownPayment'] === false) ? false : true;
|
||||
this.loansAccountTermsForm.addControl('enableDownPayment', new UntypedFormControl(enableDownPayment));
|
||||
}
|
||||
|
||||
const allowAttributeOverrides = this.loansAccountTermsData.product.allowAttributeOverrides;
|
||||
if (!allowAttributeOverrides.repaymentEvery) {
|
||||
@@ -318,7 +323,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
|
||||
hasFixedLength(): boolean {
|
||||
if (this.loansAccountTermsData) {
|
||||
return this.loansAccountTermsData.product.fixedLength ? true : false;
|
||||
return this.loansAccountTermsData.product?.fixedLength ? true : false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -529,6 +534,14 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
|
||||
return true;
|
||||
}
|
||||
|
||||
isDownPaymentEnabled(): boolean {
|
||||
console.log(this.loanProduct);
|
||||
if (!this.loanProduct || !this.loanProduct.delinquencyBucket) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns loans account terms form value.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user