fix: Loan product charge-off reasons accounting mappings
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
d04890fd3f
commit
c9ff1438a3
+1
-1
@@ -256,7 +256,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
|||||||
optionData = {
|
optionData = {
|
||||||
id: o.id,
|
id: o.id,
|
||||||
code: o.code,
|
code: o.code,
|
||||||
value: o.value
|
value: o.value || o.name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -61,16 +61,12 @@ export class EditLoanProductComponent implements OnInit {
|
|||||||
private advancedPaymentStrategy: AdvancedPaymentStrategy) {
|
private advancedPaymentStrategy: AdvancedPaymentStrategy) {
|
||||||
this.route.data.subscribe((data: { loanProductAndTemplate: any, configurations: any }) => {
|
this.route.data.subscribe((data: { loanProductAndTemplate: any, configurations: any }) => {
|
||||||
this.loanProductAndTemplate = data.loanProductAndTemplate;
|
this.loanProductAndTemplate = data.loanProductAndTemplate;
|
||||||
console.log(this.loanProductAndTemplate);
|
|
||||||
const assetAccountData = this.loanProductAndTemplate.accountingMappingOptions.assetAccountOptions || [];
|
const assetAccountData = this.loanProductAndTemplate.accountingMappingOptions.assetAccountOptions || [];
|
||||||
const liabilityAccountData = this.loanProductAndTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
const liabilityAccountData = this.loanProductAndTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||||
this.loanProductAndTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
|
this.loanProductAndTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
|
||||||
|
|
||||||
this.itemsByDefault = loanProducts.setItemsByDefault(data.configurations);
|
this.itemsByDefault = loanProducts.setItemsByDefault(data.configurations);
|
||||||
this.loanProductAndTemplate['itemsByDefault'] = this.itemsByDefault;
|
this.loanProductAndTemplate['itemsByDefault'] = this.itemsByDefault;
|
||||||
// this.loanProductAndTemplate = loanProducts.updateLoanProductDefaults(this.loanProductAndTemplate, true);
|
|
||||||
|
|
||||||
console.log(this.loanProductAndTemplate);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -302,7 +302,7 @@
|
|||||||
>
|
>
|
||||||
<fa-icon icon="edit"></fa-icon>
|
<fa-icon icon="edit"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="warn" (click)="delete(paymentChannelToFundSourceMappings, i)">
|
<button mat-icon-button color="warn" (click)="delete('PaymentFundSource', paymentChannelToFundSourceMappings, i)">
|
||||||
<fa-icon icon="trash"></fa-icon>
|
<fa-icon icon="trash"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -353,7 +353,7 @@
|
|||||||
<button mat-icon-button color="primary" (click)="edit('FeesIncome', feeToIncomeAccountMappings, i)">
|
<button mat-icon-button color="primary" (click)="edit('FeesIncome', feeToIncomeAccountMappings, i)">
|
||||||
<fa-icon icon="edit"></fa-icon>
|
<fa-icon icon="edit"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="warn" (click)="delete(feeToIncomeAccountMappings, i)">
|
<button mat-icon-button color="warn" (click)="delete('FeesIncome', feeToIncomeAccountMappings, i)">
|
||||||
<fa-icon icon="trash"></fa-icon>
|
<fa-icon icon="trash"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -410,7 +410,7 @@
|
|||||||
>
|
>
|
||||||
<fa-icon icon="edit"></fa-icon>
|
<fa-icon icon="edit"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="warn" (click)="delete(penaltyToIncomeAccountMappings, i)">
|
<button mat-icon-button color="warn" (click)="delete('PenaltyIncome', penaltyToIncomeAccountMappings, i)">
|
||||||
<fa-icon icon="trash"></fa-icon>
|
<fa-icon icon="trash"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
@@ -429,6 +429,7 @@
|
|||||||
type="button"
|
type="button"
|
||||||
mat-raised-button
|
mat-raised-button
|
||||||
color="primary"
|
color="primary"
|
||||||
|
[disabled]="!allowAddChargeOffReasonExpense"
|
||||||
(click)="add('ChargeOffReasonExpense', chargeOffReasonToExpenseAccountMappings)"
|
(click)="add('ChargeOffReasonExpense', chargeOffReasonToExpenseAccountMappings)"
|
||||||
>
|
>
|
||||||
<fa-icon icon="plus" class="m-r-10"></fa-icon>
|
<fa-icon icon="plus" class="m-r-10"></fa-icon>
|
||||||
@@ -466,7 +467,7 @@
|
|||||||
>
|
>
|
||||||
<fa-icon icon="edit"></fa-icon>
|
<fa-icon icon="edit"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button color="warn" (click)="delete(chargeOffReasonToExpenseAccountMappings, i)">
|
<button mat-icon-button color="warn" (click)="delete('ChargeOffReasonExpense', chargeOffReasonToExpenseAccountMappings, i)">
|
||||||
<fa-icon icon="trash"></fa-icon>
|
<fa-icon icon="trash"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
+23
-3
@@ -34,6 +34,9 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
|||||||
assetAndLiabilityAccountData: any;
|
assetAndLiabilityAccountData: any;
|
||||||
chargeOffReasonOptions: any;
|
chargeOffReasonOptions: any;
|
||||||
|
|
||||||
|
currentFormValues: any[] = [];
|
||||||
|
allowAddChargeOffReasonExpense = true;
|
||||||
|
|
||||||
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId', 'actions'];
|
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId', 'actions'];
|
||||||
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId', 'actions'];
|
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId', 'actions'];
|
||||||
chargeOffReasonExpenseDisplayedColumns: string[] = ['chargeOffReasonCodeValueId', 'expenseAccountId', 'actions'];
|
chargeOffReasonExpenseDisplayedColumns: string[] = ['chargeOffReasonCodeValueId', 'expenseAccountId', 'actions'];
|
||||||
@@ -215,11 +218,24 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add(formType: string, formArray: UntypedFormArray) {
|
add(formType: string, formArray: UntypedFormArray) {
|
||||||
|
this.currentFormValues = [];
|
||||||
|
if (formType == 'ChargeOffReasonExpense') {
|
||||||
|
this.allowAddChargeOffReasonExpense = true;
|
||||||
|
formArray.value.forEach((item: any) => this.currentFormValues.push(item.chargeOffReasonCodeValueId));
|
||||||
|
if (this.chargeOffReasonOptions.length == this.currentFormValues.length) {
|
||||||
|
this.allowAddChargeOffReasonExpense = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
const data = { ...this.getData(formType), pristine: false };
|
const data = { ...this.getData(formType), pristine: false };
|
||||||
const dialogRef = this.dialog.open(FormDialogComponent, { data });
|
const dialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||||
dialogRef.afterClosed().subscribe((response: any) => {
|
dialogRef.afterClosed().subscribe((response: any) => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
formArray.push(response.data);
|
formArray.push(response.data);
|
||||||
|
if (formType == 'ChargeOffReasonExpense') {
|
||||||
|
this.allowAddChargeOffReasonExpense = (formArray.value.length < this.chargeOffReasonOptions.length);
|
||||||
|
}
|
||||||
|
|
||||||
this.setLoanProductAccountingFormDirty();
|
this.setLoanProductAccountingFormDirty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -236,13 +252,16 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(formArray: UntypedFormArray, index: number) {
|
delete(formType: string, formArray: UntypedFormArray, index: number) {
|
||||||
const dialogRef = this.dialog.open(DeleteDialogComponent, {
|
const dialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||||
data: { deleteContext: this.translateService.instant('labels.text.this') }
|
data: { deleteContext: this.translateService.instant('labels.text.this') }
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().subscribe((response: any) => {
|
dialogRef.afterClosed().subscribe((response: any) => {
|
||||||
if (response.delete) {
|
if (response.delete) {
|
||||||
formArray.removeAt(index);
|
formArray.removeAt(index);
|
||||||
|
if (formType == 'ChargeOffReasonExpense') {
|
||||||
|
this.allowAddChargeOffReasonExpense = (formArray.value.length < this.chargeOffReasonOptions.length);
|
||||||
|
}
|
||||||
this.setLoanProductAccountingFormDirty();
|
this.setLoanProductAccountingFormDirty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -324,12 +343,13 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getChargeOffReasonExpenseFormfields(values?: any) {
|
getChargeOffReasonExpenseFormfields(values?: any) {
|
||||||
|
const reasonOptions = this.chargeOffReasonOptions.filter((item: any) => !this.currentFormValues.includes(item.id));
|
||||||
const formfields: FormfieldBase[] = [
|
const formfields: FormfieldBase[] = [
|
||||||
new SelectBase({
|
new SelectBase({
|
||||||
controlName: 'chargeOffReasonCodeValueId',
|
controlName: 'chargeOffReasonCodeValueId',
|
||||||
label: 'Charge-off reason',
|
label: 'Charge-off reason',
|
||||||
value: values ? values.chargeOffReasonCodeValueId : this.chargeOffReasonOptions[0].id,
|
value: values ? values.chargeOffReasonCodeValueId : reasonOptions[0].id,
|
||||||
options: { label: 'name', value: 'id', data: this.chargeOffReasonOptions },
|
options: { label: 'name', value: 'id', data: reasonOptions },
|
||||||
required: true,
|
required: true,
|
||||||
order: 1
|
order: 1
|
||||||
}),
|
}),
|
||||||
|
|||||||
+4
-4
@@ -2,14 +2,14 @@
|
|||||||
window["env"] = window["env"] || {};
|
window["env"] = window["env"] || {};
|
||||||
|
|
||||||
// BackEnd Environment variables
|
// BackEnd Environment variables
|
||||||
window["env"]["fineractApiUrls"] = 'https://ps-test.dev.alluvial.cloud';
|
window["env"]["fineractApiUrls"] = '';
|
||||||
window["env"]["fineractApiUrl"] = 'https://ps-test.dev.alluvial.cloud';
|
window["env"]["fineractApiUrl"] = '';
|
||||||
|
|
||||||
window["env"]["apiProvider"] = '';
|
window["env"]["apiProvider"] = '';
|
||||||
window["env"]["apiVersion"] = '';
|
window["env"]["apiVersion"] = '';
|
||||||
|
|
||||||
window["env"]["fineractPlatformTenantId"] = 'pstest';
|
window["env"]["fineractPlatformTenantId"] = '';
|
||||||
window["env"]["fineractPlatformTenantIds"] = 'pstest';
|
window["env"]["fineractPlatformTenantIds"] = '';
|
||||||
|
|
||||||
// Language Environment variables
|
// Language Environment variables
|
||||||
window["env"]["defaultLanguage"] = '';
|
window["env"]["defaultLanguage"] = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user