build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -13,7 +13,6 @@ import { ProductsService } from 'app/products/products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ChargeResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {productsService} productsService Products service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class ChargeResolver implements Resolve<Object> {
|
||||
const chargeId = route.paramMap.get('id');
|
||||
return this.productsService.getCharge(chargeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,16 +10,14 @@ import { ProductsService } from '../products.service';
|
||||
|
||||
@Injectable()
|
||||
export class ChargesTemplateAndResolver implements Resolve<Object> {
|
||||
constructor(private productsService: ProductsService) {}
|
||||
|
||||
constructor(private productsService: ProductsService) { }
|
||||
|
||||
/**
|
||||
* Returns the changes template and data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const savingProductId = route.paramMap.get('id');
|
||||
return this.productsService.getCharge(savingProductId, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the changes template and data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const savingProductId = route.paramMap.get('id');
|
||||
return this.productsService.getCharge(savingProductId, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ChargesTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class ChargesTemplateResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getChargesTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ChargesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChargesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ChargesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -24,11 +24,18 @@ import { Charge } from './models/charge.model';
|
||||
styleUrls: ['./charges.component.scss']
|
||||
})
|
||||
export class ChargesComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Charge data. */
|
||||
chargeData: Charge[] = [];
|
||||
/** Columns to be displayed in charges table. */
|
||||
displayedColumns: string[] = ['name', 'chargeAppliesTo', 'chargeTimeType', 'chargeCalculationType', 'amount', 'penalty', 'active'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'chargeAppliesTo',
|
||||
'chargeTimeType',
|
||||
'chargeCalculationType',
|
||||
'amount',
|
||||
'penalty',
|
||||
'active'
|
||||
];
|
||||
/** Data source for charges table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -55,12 +62,14 @@ export class ChargesComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
private charges: Charges) {
|
||||
this.route.data.subscribe(( data: { charges: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
private charges: Charges
|
||||
) {
|
||||
this.route.data.subscribe((data: { charges: any }) => {
|
||||
this.chargeData = data.charges;
|
||||
});
|
||||
this.chargeAppliesToOptions = this.charges.getChargeAppliesToOptions();
|
||||
@@ -89,8 +98,10 @@ export class ChargesComponent implements OnInit, AfterViewInit {
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sortingDataAccessor = (charge: any, property: any) => {
|
||||
switch (property) {
|
||||
case 'chargeAppliesTo': return charge.chargeAppliesTo.value;
|
||||
default: return charge[property];
|
||||
case 'chargeAppliesTo':
|
||||
return charge.chargeAppliesTo.value;
|
||||
default:
|
||||
return charge[property];
|
||||
}
|
||||
};
|
||||
this.dataSource.sort = this.sort;
|
||||
@@ -120,7 +131,12 @@ export class ChargesComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -146,9 +162,8 @@ export class ChargesComponent implements OnInit, AfterViewInit {
|
||||
|
||||
filterByAppliesTo(chargeAppliesTo: number) {
|
||||
const filteredCharges: Charge[] = this.chargeData.filter((charge: Charge) => {
|
||||
return (charge.chargeAppliesTo.id === chargeAppliesTo);
|
||||
return charge.chargeAppliesTo.id === chargeAppliesTo;
|
||||
});
|
||||
this.dataSource = new MatTableDataSource(filteredCharges);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ChargesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class ChargesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getCharges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateChargeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateChargeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateChargeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./create-charge.component.scss']
|
||||
})
|
||||
export class CreateChargeComponent implements OnInit {
|
||||
|
||||
/** Charge form. */
|
||||
chargeForm: UntypedFormGroup;
|
||||
/** Charges template data. */
|
||||
@@ -46,17 +45,21 @@ export class CreateChargeComponent implements OnInit {
|
||||
* @param {Dates} dateUtils Date Utils to format date.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { chargesTemplate: any }) => {
|
||||
this.chargesTemplateData = data.chargesTemplate;
|
||||
if (data.chargesTemplate.incomeOrLiabilityAccountOptions.liabilityAccountOptions) {
|
||||
this.incomeAndLiabilityAccountData = data.chargesTemplate.incomeOrLiabilityAccountOptions.incomeAccountOptions
|
||||
.concat(data.chargesTemplate.incomeOrLiabilityAccountOptions.liabilityAccountOptions);
|
||||
this.incomeAndLiabilityAccountData =
|
||||
data.chargesTemplate.incomeOrLiabilityAccountOptions.incomeAccountOptions.concat(
|
||||
data.chargesTemplate.incomeOrLiabilityAccountOptions.liabilityAccountOptions
|
||||
);
|
||||
} else {
|
||||
this.incomeAndLiabilityAccountData = data.chargesTemplate.incomeOrLiabilityAccountOptions.incomeAccountOptions;
|
||||
}
|
||||
@@ -77,17 +80,37 @@ export class CreateChargeComponent implements OnInit {
|
||||
*/
|
||||
createChargeForm() {
|
||||
this.chargeForm = this.formBuilder.group({
|
||||
'chargeAppliesTo': ['', Validators.required],
|
||||
'name': ['', Validators.required],
|
||||
'currencyCode': ['', Validators.required],
|
||||
'chargeTimeType': ['', Validators.required],
|
||||
'chargeCalculationType': ['', Validators.required],
|
||||
'amount': ['', [Validators.required, Validators.pattern('^\\s*(?=.*[1-9])\\d*(?:\\.\\d+)?\\s*$')]],
|
||||
'active': [false],
|
||||
'penalty': [false],
|
||||
'taxGroupId': [''],
|
||||
'minCap': [''],
|
||||
'maxCap': ['']
|
||||
chargeAppliesTo: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
currencyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
chargeTimeType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
chargeCalculationType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
amount: [
|
||||
'',
|
||||
[
|
||||
Validators.required,
|
||||
Validators.pattern('^\\s*(?=.*[1-9])\\d*(?:\\.\\d+)?\\s*$')]
|
||||
],
|
||||
active: [false],
|
||||
penalty: [false],
|
||||
taxGroupId: [''],
|
||||
minCap: [''],
|
||||
maxCap: ['']
|
||||
});
|
||||
}
|
||||
|
||||
@@ -122,15 +145,24 @@ export class CreateChargeComponent implements OnInit {
|
||||
*/
|
||||
filteredChargeCalculationType(): any {
|
||||
return this.chargeCalculationTypeData.filter((chargeCalculationType: any) => {
|
||||
if (this.chargeForm.get('chargeTimeType').value === 12 && (chargeCalculationType.id === 3 || chargeCalculationType.id === 4)) {
|
||||
if (
|
||||
this.chargeForm.get('chargeTimeType').value === 12 &&
|
||||
(chargeCalculationType.id === 3 || chargeCalculationType.id === 4)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (this.chargeForm.get('chargeTimeType').value !== 12 && chargeCalculationType.id === 5) {
|
||||
return false;
|
||||
}
|
||||
if (this.chargeForm.get('chargeAppliesTo').value === 2) {
|
||||
if (!(this.chargeForm.get('chargeTimeType').value === 5 || this.chargeForm.get('chargeTimeType').value === 16
|
||||
|| this.chargeForm.get('chargeTimeType').value === 17) && chargeCalculationType.id === 2) {
|
||||
if (
|
||||
!(
|
||||
this.chargeForm.get('chargeTimeType').value === 5 ||
|
||||
this.chargeForm.get('chargeTimeType').value === 16 ||
|
||||
this.chargeForm.get('chargeTimeType').value === 17
|
||||
) &&
|
||||
chargeCalculationType.id === 2
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -144,11 +176,16 @@ export class CreateChargeComponent implements OnInit {
|
||||
const chargeTimeType = this.chargeForm.controls.chargeTimeType.value;
|
||||
|
||||
if (chargeAppliesTo === 1) {
|
||||
return (chargeCalculationType === 2 || chargeCalculationType === 3 || chargeCalculationType === 4 || chargeCalculationType === 5);
|
||||
return (
|
||||
chargeCalculationType === 2 ||
|
||||
chargeCalculationType === 3 ||
|
||||
chargeCalculationType === 4 ||
|
||||
chargeCalculationType === 5
|
||||
);
|
||||
} else if (chargeAppliesTo === 2) {
|
||||
return (chargeTimeType === 16 || chargeTimeType === 5) && (chargeCalculationType === 2);
|
||||
return (chargeTimeType === 16 || chargeTimeType === 5) && chargeCalculationType === 2;
|
||||
} else if (chargeAppliesTo === 4) {
|
||||
return ((chargeTimeType === 14 || chargeTimeType === 15) && chargeCalculationType === 2);
|
||||
return (chargeTimeType === 14 || chargeTimeType === 15) && chargeCalculationType === 2;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -195,7 +232,14 @@ export class CreateChargeComponent implements OnInit {
|
||||
break;
|
||||
case 7: // Monthly Fee
|
||||
this.chargeForm.addControl('feeOnMonthDay', new UntypedFormControl(''));
|
||||
this.chargeForm.addControl('feeInterval', new UntypedFormControl('', [Validators.required, Validators.min(1), Validators.max(12), Validators.pattern('^[1-9]\\d*$')]));
|
||||
this.chargeForm.addControl(
|
||||
'feeInterval',
|
||||
new UntypedFormControl('', [
|
||||
Validators.required,
|
||||
Validators.min(1),
|
||||
Validators.max(12),
|
||||
Validators.pattern('^[1-9]\\d*$')])
|
||||
);
|
||||
this.repeatEveryLabel = 'Months';
|
||||
break;
|
||||
case 9: // Overdue Fee
|
||||
@@ -204,7 +248,12 @@ export class CreateChargeComponent implements OnInit {
|
||||
this.chargeForm.get('addFeeFrequency').valueChanges.subscribe((addFeeFrequency) => {
|
||||
if (addFeeFrequency) {
|
||||
this.chargeForm.addControl('feeFrequency', new UntypedFormControl('', Validators.required));
|
||||
this.chargeForm.addControl('feeInterval', new UntypedFormControl('', [Validators.required, Validators.pattern('^[1-9]\\d*$')]));
|
||||
this.chargeForm.addControl(
|
||||
'feeInterval',
|
||||
new UntypedFormControl('', [
|
||||
Validators.required,
|
||||
Validators.pattern('^[1-9]\\d*$')])
|
||||
);
|
||||
} else {
|
||||
this.chargeForm.removeControl('feeFrequency');
|
||||
this.chargeForm.removeControl('feeInterval');
|
||||
@@ -212,17 +261,28 @@ export class CreateChargeComponent implements OnInit {
|
||||
});
|
||||
break;
|
||||
case 11: // Weekly Fee
|
||||
this.chargeForm.addControl('feeInterval', new UntypedFormControl('', [Validators.required, Validators.pattern('^[1-9]\\d*$')]));
|
||||
this.chargeForm.addControl(
|
||||
'feeInterval',
|
||||
new UntypedFormControl('', [
|
||||
Validators.required,
|
||||
Validators.pattern('^[1-9]\\d*$')])
|
||||
);
|
||||
this.repeatEveryLabel = 'Weeks';
|
||||
break;
|
||||
}
|
||||
});
|
||||
this.chargeForm.get('currencyCode').valueChanges.subscribe((currencyCode) => {
|
||||
this.currencyDecimalPlaces = this.chargesTemplateData.currencyOptions.find((currency: any) => currency.code === currencyCode).decimalPlaces;
|
||||
this.currencyDecimalPlaces = this.chargesTemplateData.currencyOptions.find(
|
||||
(currency: any) => currency.code === currencyCode
|
||||
).decimalPlaces;
|
||||
if (this.currencyDecimalPlaces === 0) {
|
||||
this.chargeForm.get('amount').setValidators([Validators.required, Validators.pattern('^[1-9]\\d*$')]);
|
||||
this.chargeForm.get('amount').setValidators([
|
||||
Validators.required,
|
||||
Validators.pattern('^[1-9]\\d*$')]);
|
||||
} else {
|
||||
this.chargeForm.get('amount').setValidators([Validators.required, Validators.pattern(`^\\s*(?=.*[1-9])\\d*(\\.\\d{1,${this.currencyDecimalPlaces}})?\\s*$`)]);
|
||||
this.chargeForm.get('amount').setValidators([
|
||||
Validators.required,
|
||||
Validators.pattern(`^\\s*(?=.*[1-9])\\d*(\\.\\d{1,${this.currencyDecimalPlaces}})?\\s*$`)]);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -258,5 +318,4 @@ export class CreateChargeComponent implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditChargeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditChargeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditChargeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
|
||||
/**
|
||||
* Edit Charge component.
|
||||
*/
|
||||
@@ -17,7 +16,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./edit-charge.component.scss']
|
||||
})
|
||||
export class EditChargeComponent implements OnInit {
|
||||
|
||||
/** Selected Data. */
|
||||
chargeData: any;
|
||||
/** Charge form. */
|
||||
@@ -53,11 +51,13 @@ export class EditChargeComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private productsService: ProductsService,
|
||||
constructor(
|
||||
private productsService: ProductsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { chargesTemplate: any }) => {
|
||||
this.chargeData = data.chargesTemplate;
|
||||
});
|
||||
@@ -71,19 +71,37 @@ export class EditChargeComponent implements OnInit {
|
||||
* Edit Charge form.
|
||||
*/
|
||||
editChargeForm() {
|
||||
this.showFeeOptions = (this.chargeData.feeInterval && this.chargeData.feeInterval > 0);
|
||||
this.showFeeOptions = this.chargeData.feeInterval && this.chargeData.feeInterval > 0;
|
||||
|
||||
this.chargeForm = this.formBuilder.group({
|
||||
'name': [this.chargeData.name, Validators.required],
|
||||
'chargeAppliesTo': [{ value: this.chargeData.chargeAppliesTo.id, disabled: true }, Validators.required],
|
||||
'currencyCode': [this.chargeData.currency.code, Validators.required],
|
||||
'amount': [this.chargeData.amount, Validators.required],
|
||||
'active': [this.chargeData.active],
|
||||
'penalty': [this.chargeData.penalty],
|
||||
'minCap': [this.chargeData.minCap],
|
||||
'maxCap': [this.chargeData.maxCap],
|
||||
'chargeTimeType': [this.chargeData.chargeTimeType.id, Validators.required],
|
||||
'chargeCalculationType': [this.chargeData.chargeCalculationType.id, Validators.required],
|
||||
name: [
|
||||
this.chargeData.name,
|
||||
Validators.required
|
||||
],
|
||||
chargeAppliesTo: [
|
||||
{ value: this.chargeData.chargeAppliesTo.id, disabled: true },
|
||||
Validators.required
|
||||
],
|
||||
currencyCode: [
|
||||
this.chargeData.currency.code,
|
||||
Validators.required
|
||||
],
|
||||
amount: [
|
||||
this.chargeData.amount,
|
||||
Validators.required
|
||||
],
|
||||
active: [this.chargeData.active],
|
||||
penalty: [this.chargeData.penalty],
|
||||
minCap: [this.chargeData.minCap],
|
||||
maxCap: [this.chargeData.maxCap],
|
||||
chargeTimeType: [
|
||||
this.chargeData.chargeTimeType.id,
|
||||
Validators.required
|
||||
],
|
||||
chargeCalculationType: [
|
||||
this.chargeData.chargeCalculationType.id,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
switch (this.chargeData.chargeAppliesTo.value) {
|
||||
case 'Loan': {
|
||||
@@ -91,12 +109,15 @@ export class EditChargeComponent implements OnInit {
|
||||
this.chargeCalculationTypeOptions = this.chargeData.loanChargeCalculationTypeOptions;
|
||||
this.addFeeFrequency = true;
|
||||
this.chargePaymentMode = true;
|
||||
this.chargeForm.addControl('chargePaymentMode', this.formBuilder.control(this.chargeData.chargePaymentMode.id, Validators.required));
|
||||
this.chargeForm.addControl(
|
||||
'chargePaymentMode',
|
||||
this.formBuilder.control(this.chargeData.chargePaymentMode.id, Validators.required)
|
||||
);
|
||||
if (this.showFeeOptions) {
|
||||
this.getFeeFrequency(this.showFeeOptions);
|
||||
this.chargeForm.patchValue({
|
||||
'feeInterval': this.chargeData.feeInterval,
|
||||
'feeFrequency': this.chargeData.feeFrequency.id
|
||||
feeInterval: this.chargeData.feeInterval,
|
||||
feeFrequency: this.chargeData.feeFrequency.id
|
||||
});
|
||||
}
|
||||
break;
|
||||
@@ -120,12 +141,18 @@ export class EditChargeComponent implements OnInit {
|
||||
this.chargeTimeTypeOptions = this.chargeData.clientChargeTimeTypeOptions;
|
||||
this.showGLAccount = true;
|
||||
this.addFeeFrequency = false;
|
||||
this.chargeForm.addControl('incomeAccountId', this.formBuilder.control(this.chargeData.incomeOrLiabilityAccount.id, Validators.required));
|
||||
this.chargeForm.addControl(
|
||||
'incomeAccountId',
|
||||
this.formBuilder.control(this.chargeData.incomeOrLiabilityAccount.id, Validators.required)
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this.chargeData.taxGroup) {
|
||||
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: this.chargeData.taxGroup.id, disabled: true }));
|
||||
this.chargeForm.addControl(
|
||||
'taxGroupId',
|
||||
this.formBuilder.control({ value: this.chargeData.taxGroup.id, disabled: true })
|
||||
);
|
||||
} else {
|
||||
this.chargeForm.addControl('taxGroupId', this.formBuilder.control({ value: '' }));
|
||||
}
|
||||
@@ -160,10 +187,8 @@ export class EditChargeComponent implements OnInit {
|
||||
if (!charges.maxCap) {
|
||||
delete charges.maxCap;
|
||||
}
|
||||
this.productsService.updateCharge(this.chargeData.id.toString(), charges)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.productsService.updateCharge(this.chargeData.id.toString(), charges).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,51 +2,51 @@ import { Currency, PaymentTypeOption } from 'app/shared/models/general.model';
|
||||
import { OptionData } from 'app/shared/models/option-data.model';
|
||||
|
||||
export interface Charge {
|
||||
id: number;
|
||||
name: string;
|
||||
active: boolean;
|
||||
penalty: boolean;
|
||||
freeWithdrawal: boolean;
|
||||
freeWithdrawalChargeFrequency: number;
|
||||
restartFrequency: number;
|
||||
restartFrequencyEnum: number;
|
||||
isPaymentType: boolean;
|
||||
currency: Currency;
|
||||
amount: number;
|
||||
chargeTimeType: OptionData;
|
||||
chargeAppliesTo: OptionData;
|
||||
chargeCalculationType: OptionData;
|
||||
chargePaymentMode: OptionData;
|
||||
feeInterval?: number;
|
||||
feeFrequency?: OptionData;
|
||||
feeOnMonthDay?: number[];
|
||||
paymentTypeOptions?: PaymentTypeOption;
|
||||
id: number;
|
||||
name: string;
|
||||
active: boolean;
|
||||
penalty: boolean;
|
||||
freeWithdrawal: boolean;
|
||||
freeWithdrawalChargeFrequency: number;
|
||||
restartFrequency: number;
|
||||
restartFrequencyEnum: number;
|
||||
isPaymentType: boolean;
|
||||
currency: Currency;
|
||||
amount: number;
|
||||
chargeTimeType: OptionData;
|
||||
chargeAppliesTo: OptionData;
|
||||
chargeCalculationType: OptionData;
|
||||
chargePaymentMode: OptionData;
|
||||
feeInterval?: number;
|
||||
feeFrequency?: OptionData;
|
||||
feeOnMonthDay?: number[];
|
||||
paymentTypeOptions?: PaymentTypeOption;
|
||||
}
|
||||
|
||||
export enum ChargeAppliesToCode {
|
||||
ChargeAppliesToClient = 'chargeAppliesTo.client',
|
||||
ChargeAppliesToLoan = 'chargeAppliesTo.loan',
|
||||
ChargeAppliesToSavings = 'chargeAppliesTo.savings',
|
||||
ChargeAppliesToShares = 'chargeAppliesTo.shares',
|
||||
ChargeCalculationTypeFlat = 'chargeCalculationType.flat',
|
||||
ChargeCalculationTypePercentOfAmount = 'chargeCalculationType.percent.of.amount',
|
||||
ChargeCalculationTypePercentOfAmountAndInterest = 'chargeCalculationType.percent.of.amount.and.interest',
|
||||
ChargeCalculationTypePercentOfInterest = 'chargeCalculationType.percent.of.interest',
|
||||
ChargeTimeTypeActivation = 'chargeTimeType.activation',
|
||||
ChargeTimeTypeAnnualFee = 'chargeTimeType.annualFee',
|
||||
ChargeTimeTypeDisbursement = 'chargeTimeType.disbursement',
|
||||
ChargeTimeTypeInstalmentFee = 'chargeTimeType.instalmentFee',
|
||||
ChargeTimeTypeMonthlyFee = 'chargeTimeType.monthlyFee',
|
||||
ChargeTimeTypeOverdueInstallment = 'chargeTimeType.overdueInstallment',
|
||||
ChargeTimeTypeSavingsActivation = 'chargeTimeType.savingsActivation',
|
||||
ChargeTimeTypeSavingsNoActivityFee = 'chargeTimeType.savingsNoActivityFee',
|
||||
ChargeTimeTypeSharespurchase = 'chargeTimeType.sharespurchase',
|
||||
ChargeTimeTypeSharesredeem = 'chargeTimeType.sharesredeem',
|
||||
ChargeTimeTypeSolidarityFund = 'chargeTimeType.solidarityFund',
|
||||
ChargeTimeTypeSpecifiedDueDate = 'chargeTimeType.specifiedDueDate',
|
||||
ChargeTimeTypeWeeklyFee = 'chargeTimeType.weeklyFee',
|
||||
ChargeTimeTypeWithdrawalFee = 'chargeTimeType.withdrawalFee',
|
||||
ChargepaymentmodeAccounttransfer = 'chargepaymentmode.accounttransfer',
|
||||
ChargepaymentmodeRegular = 'chargepaymentmode.regular',
|
||||
FeeFrequencyperiodFrequencyTypeMonths = 'feeFrequencyperiodFrequencyType.months',
|
||||
ChargeAppliesToClient = 'chargeAppliesTo.client',
|
||||
ChargeAppliesToLoan = 'chargeAppliesTo.loan',
|
||||
ChargeAppliesToSavings = 'chargeAppliesTo.savings',
|
||||
ChargeAppliesToShares = 'chargeAppliesTo.shares',
|
||||
ChargeCalculationTypeFlat = 'chargeCalculationType.flat',
|
||||
ChargeCalculationTypePercentOfAmount = 'chargeCalculationType.percent.of.amount',
|
||||
ChargeCalculationTypePercentOfAmountAndInterest = 'chargeCalculationType.percent.of.amount.and.interest',
|
||||
ChargeCalculationTypePercentOfInterest = 'chargeCalculationType.percent.of.interest',
|
||||
ChargeTimeTypeActivation = 'chargeTimeType.activation',
|
||||
ChargeTimeTypeAnnualFee = 'chargeTimeType.annualFee',
|
||||
ChargeTimeTypeDisbursement = 'chargeTimeType.disbursement',
|
||||
ChargeTimeTypeInstalmentFee = 'chargeTimeType.instalmentFee',
|
||||
ChargeTimeTypeMonthlyFee = 'chargeTimeType.monthlyFee',
|
||||
ChargeTimeTypeOverdueInstallment = 'chargeTimeType.overdueInstallment',
|
||||
ChargeTimeTypeSavingsActivation = 'chargeTimeType.savingsActivation',
|
||||
ChargeTimeTypeSavingsNoActivityFee = 'chargeTimeType.savingsNoActivityFee',
|
||||
ChargeTimeTypeSharespurchase = 'chargeTimeType.sharespurchase',
|
||||
ChargeTimeTypeSharesredeem = 'chargeTimeType.sharesredeem',
|
||||
ChargeTimeTypeSolidarityFund = 'chargeTimeType.solidarityFund',
|
||||
ChargeTimeTypeSpecifiedDueDate = 'chargeTimeType.specifiedDueDate',
|
||||
ChargeTimeTypeWeeklyFee = 'chargeTimeType.weeklyFee',
|
||||
ChargeTimeTypeWithdrawalFee = 'chargeTimeType.withdrawalFee',
|
||||
ChargepaymentmodeAccounttransfer = 'chargepaymentmode.accounttransfer',
|
||||
ChargepaymentmodeRegular = 'chargepaymentmode.regular',
|
||||
FeeFrequencyperiodFrequencyTypeMonths = 'feeFrequencyperiodFrequencyType.months'
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewChargeComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewChargeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewChargeComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -19,7 +19,6 @@ import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dial
|
||||
styleUrls: ['./view-charge.component.scss']
|
||||
})
|
||||
export class ViewChargeComponent {
|
||||
|
||||
/** Charge data. */
|
||||
chargeData: any;
|
||||
/** Boolean for MinCap and MaxCap */
|
||||
@@ -33,11 +32,13 @@ export class ViewChargeComponent {
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private productsService: ProductsService,
|
||||
constructor(
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { charge: any }) => {
|
||||
this.chargeData = data.charge;
|
||||
if (this.chargeData.minCap) {
|
||||
@@ -54,16 +55,14 @@ export class ViewChargeComponent {
|
||||
*/
|
||||
deleteCharge() {
|
||||
const deleteChargeDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Charge') + ' ' + this.chargeData.id}
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Charge') + ' ' + this.chargeData.id }
|
||||
});
|
||||
deleteChargeDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.productsService.deleteCharge(this.chargeData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/products/charges']);
|
||||
});
|
||||
this.productsService.deleteCharge(this.chargeData.id).subscribe(() => {
|
||||
this.router.navigate(['/products/charges']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CollateralResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class CollateralResolver implements Resolve<Object> {
|
||||
const collateralId = route.paramMap.get('id');
|
||||
return this.productsService.getCollateral(collateralId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CollateralTemplateResolver implements Resolve<Object> {
|
||||
/**
|
||||
* @param {ProductsService} productsService products Service
|
||||
*/
|
||||
constructor(private productsService: ProductsService) {}
|
||||
/**
|
||||
* @param {ProductsService} productsService products Service
|
||||
*/
|
||||
constructor(private productsService: ProductsService) {}
|
||||
|
||||
/**
|
||||
* Returns the product Data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getCollateralTemplate();
|
||||
}
|
||||
/**
|
||||
* Returns the product Data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getCollateralTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CollateralsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CollateralsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CollateralsComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,11 +11,16 @@ import { ActivatedRoute } from '@angular/router';
|
||||
styleUrls: ['./collaterals.component.scss']
|
||||
})
|
||||
export class CollateralsComponent implements OnInit {
|
||||
|
||||
/** Collateral Data */
|
||||
collateralData: any;
|
||||
/** Columns to be displayed in the Collaterals Table */
|
||||
displayedColumns: string[] = ['name', 'quality', 'basePrice', 'basePercentage', 'unitType'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'quality',
|
||||
'basePrice',
|
||||
'basePercentage',
|
||||
'unitType'
|
||||
];
|
||||
/** DataSource for the Collateral Table */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -28,8 +33,8 @@ export class CollateralsComponent implements OnInit {
|
||||
* Retrieves the Collaterals data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { collaterals: any }) => {
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: { collaterals: any }) => {
|
||||
this.collateralData = data.collaterals;
|
||||
});
|
||||
}
|
||||
@@ -52,10 +57,9 @@ export class CollateralsComponent implements OnInit {
|
||||
/**
|
||||
* Initializes the data source, paginator and sorter for collateral table.
|
||||
*/
|
||||
setCollaterals() {
|
||||
setCollaterals() {
|
||||
this.dataSource = new MatTableDataSource(this.collateralData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,16 +13,16 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class CollateralsResolver implements Resolve<Object> {
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service
|
||||
*/
|
||||
constructor(private productsService: ProductsService) {}
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service
|
||||
*/
|
||||
constructor(private productsService: ProductsService) {}
|
||||
|
||||
/**
|
||||
* Returns the All Collaterals Data
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getCollaterals();
|
||||
}
|
||||
/**
|
||||
* Returns the All Collaterals Data
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getCollaterals();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateCollateralComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ CreateCollateralComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateCollateralComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./create-collateral.component.scss']
|
||||
})
|
||||
export class CreateCollateralComponent implements OnInit {
|
||||
|
||||
/** Collateral form */
|
||||
collateralForm: UntypedFormGroup;
|
||||
/** Charges Template data */
|
||||
@@ -31,15 +30,17 @@ export class CreateCollateralComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { collateralTemplate: any }) => {
|
||||
this.collateralTemplateData = data.collateralTemplate;
|
||||
});
|
||||
}
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { collateralTemplate: any }) => {
|
||||
this.collateralTemplateData = data.collateralTemplate;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and sets Collateral Form
|
||||
@@ -53,12 +54,30 @@ export class CreateCollateralComponent implements OnInit {
|
||||
*/
|
||||
createCollateralForm() {
|
||||
this.collateralForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required],
|
||||
'unitType': ['', Validators.required],
|
||||
'basePrice': ['', Validators.required],
|
||||
'pctToBase': ['', Validators.required],
|
||||
'currency': ['', Validators.required],
|
||||
'quality': ['', Validators.required]
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
unitType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
basePrice: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
pctToBase: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
currency: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
quality: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,7 +95,4 @@ export class CreateCollateralComponent implements OnInit {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditCollateralComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ EditCollateralComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditCollateralComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./edit-collateral.component.scss']
|
||||
})
|
||||
export class EditCollateralComponent implements OnInit {
|
||||
|
||||
/** Colalteral Data */
|
||||
collateralData: any;
|
||||
/** Collateral Template */
|
||||
@@ -29,16 +28,18 @@ export class EditCollateralComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
constructor(private productsService: ProductsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { collateral: any, collateralTemplate: any }) => {
|
||||
this.collateralData = data.collateral;
|
||||
this.collateralTemplateData = data.collateralTemplate;
|
||||
});
|
||||
}
|
||||
constructor(
|
||||
private productsService: ProductsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { collateral: any; collateralTemplate: any }) => {
|
||||
this.collateralData = data.collateral;
|
||||
this.collateralTemplateData = data.collateralTemplate;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.editCollateralForm();
|
||||
@@ -49,12 +50,30 @@ export class EditCollateralComponent implements OnInit {
|
||||
*/
|
||||
editCollateralForm() {
|
||||
this.collateralForm = this.formBuilder.group({
|
||||
'name': [this.collateralData.name, Validators.required],
|
||||
'quality': [this.collateralData.quality, Validators.required],
|
||||
'unitType': [this.collateralData.unitType, Validators.required],
|
||||
'basePrice': [this.collateralData.basePrice, Validators.required],
|
||||
'pctToBase': [this.collateralData.pctToBase, Validators.required],
|
||||
'currency': [this.collateralData.currency, Validators.required],
|
||||
name: [
|
||||
this.collateralData.name,
|
||||
Validators.required
|
||||
],
|
||||
quality: [
|
||||
this.collateralData.quality,
|
||||
Validators.required
|
||||
],
|
||||
unitType: [
|
||||
this.collateralData.unitType,
|
||||
Validators.required
|
||||
],
|
||||
basePrice: [
|
||||
this.collateralData.basePrice,
|
||||
Validators.required
|
||||
],
|
||||
pctToBase: [
|
||||
this.collateralData.pctToBase,
|
||||
Validators.required
|
||||
],
|
||||
currency: [
|
||||
this.collateralData.currency,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -64,10 +83,8 @@ export class EditCollateralComponent implements OnInit {
|
||||
submit() {
|
||||
const collateral = this.collateralForm.value;
|
||||
collateral.locale = this.settingsService.language.code;
|
||||
this.productsService.updateCollateral(this.collateralData.id.toString(), collateral)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
this.productsService.updateCollateral(this.collateralData.id.toString(), collateral).subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewCollateralComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ViewCollateralComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewCollateralComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dial
|
||||
styleUrls: ['./view-collateral.component.scss']
|
||||
})
|
||||
export class ViewCollateralComponent {
|
||||
|
||||
/** Collateral Data */
|
||||
collateralData: any;
|
||||
|
||||
@@ -30,31 +29,31 @@ export class ViewCollateralComponent {
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
this.route.data.subscribe((data: { collateral: any }) => {
|
||||
this.collateralData = data.collateral;
|
||||
});
|
||||
}
|
||||
constructor(
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { collateral: any }) => {
|
||||
this.collateralData = data.collateral;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the collateral and redirects to collaterals
|
||||
*/
|
||||
deleteCollateral() {
|
||||
const deleteCollateralDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.text.Collateral') + ' ' + this.collateralData.id}
|
||||
data: { deleteContext: this.translateService.instant('labels.text.Collateral') + ' ' + this.collateralData.id }
|
||||
});
|
||||
deleteCollateralDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
this.productsService.deleteCollateral(this.collateralData.id)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['/products/collaterals']);
|
||||
});
|
||||
this.productsService.deleteCollateral(this.collateralData.id).subscribe(() => {
|
||||
this.router.navigate(['/products/collaterals']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('DepositProductIncentiveFormDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DepositProductIncentiveFormDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [DepositProductIncentiveFormDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+42
-25
@@ -9,9 +9,8 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
styleUrls: ['./deposit-product-incentive-form-dialog.component.scss']
|
||||
})
|
||||
export class DepositProductIncentiveFormDialogComponent implements OnInit {
|
||||
|
||||
layout: {
|
||||
addButtonText?: string
|
||||
addButtonText?: string;
|
||||
} = {
|
||||
addButtonText: 'Add'
|
||||
};
|
||||
@@ -26,10 +25,12 @@ export class DepositProductIncentiveFormDialogComponent implements OnInit {
|
||||
attributeValueData: any;
|
||||
incentiveTypeData: any;
|
||||
|
||||
constructor(public dialogRef: MatDialogRef<DepositProductIncentiveFormDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<DepositProductIncentiveFormDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.createDepositProductIncentiveForm();
|
||||
this.setConditionalControls();
|
||||
this.layout = { ...this.layout, ...data.layout };
|
||||
@@ -46,38 +47,54 @@ export class DepositProductIncentiveFormDialogComponent implements OnInit {
|
||||
|
||||
if (this.data.values) {
|
||||
this.depositProductIncentiveForm.patchValue({
|
||||
'entityType': this.data.values.entityType,
|
||||
'attributeName': this.data.values.attributeName,
|
||||
'conditionType': this.data.values.conditionType,
|
||||
'attributeValue': this.data.values.attributeValue,
|
||||
'incentiveType': this.data.values.incentiveType,
|
||||
'amount': this.data.values.amount
|
||||
entityType: this.data.values.entityType,
|
||||
attributeName: this.data.values.attributeName,
|
||||
conditionType: this.data.values.conditionType,
|
||||
attributeValue: this.data.values.attributeValue,
|
||||
incentiveType: this.data.values.incentiveType,
|
||||
amount: this.data.values.amount
|
||||
});
|
||||
} else {
|
||||
this.depositProductIncentiveForm.patchValue({
|
||||
'entityType': this.data.entityType
|
||||
entityType: this.data.entityType
|
||||
});
|
||||
}
|
||||
this.title = this.translateService.instant('labels.heading.Incentives');
|
||||
}
|
||||
|
||||
setConditionalControls() {
|
||||
this.depositProductIncentiveForm.get('attributeName').valueChanges
|
||||
.subscribe((attributeName: any) => {
|
||||
this.depositProductIncentiveForm.patchValue({ 'attributeValue': '' });
|
||||
this.attributeValueData = this.data.chartTemplate[`${this.attributeNameData.find((option: any) => option.id === attributeName).code.split('.')[1]}Options`];
|
||||
});
|
||||
this.depositProductIncentiveForm.get('attributeName').valueChanges.subscribe((attributeName: any) => {
|
||||
this.depositProductIncentiveForm.patchValue({ attributeValue: '' });
|
||||
this.attributeValueData =
|
||||
this.data.chartTemplate[
|
||||
`${this.attributeNameData.find((option: any) => option.id === attributeName).code.split('.')[1]}Options`
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
createDepositProductIncentiveForm() {
|
||||
this.depositProductIncentiveForm = this.formBuilder.group({
|
||||
'entityType': [''],
|
||||
'attributeName': ['', Validators.required],
|
||||
'conditionType': ['', Validators.required],
|
||||
'attributeValue': ['', Validators.required],
|
||||
'incentiveType': ['', Validators.required],
|
||||
'amount': ['', Validators.required]
|
||||
entityType: [''],
|
||||
attributeName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
conditionType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
attributeValue: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
incentiveType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
amount: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateFixedDepositProductComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateFixedDepositProductComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateFixedDepositProductComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+30
-18
@@ -22,14 +22,20 @@ import { Accounting } from 'app/core/utils/accounting';
|
||||
styleUrls: ['./create-fixed-deposit-product.component.scss']
|
||||
})
|
||||
export class CreateFixedDepositProductComponent {
|
||||
|
||||
@ViewChild(FixedDepositProductDetailsStepComponent, { static: true }) fixedDepositProductDetailsStep: FixedDepositProductDetailsStepComponent;
|
||||
@ViewChild(FixedDepositProductCurrencyStepComponent, { static: true }) fixedDepositProductCurrencyStep: FixedDepositProductCurrencyStepComponent;
|
||||
@ViewChild(FixedDepositProductTermsStepComponent, { static: true }) fixedDepositProductTermsStep: FixedDepositProductTermsStepComponent;
|
||||
@ViewChild(FixedDepositProductSettingsStepComponent, { static: true }) fixedDepositProductSettingsStep: FixedDepositProductSettingsStepComponent;
|
||||
@ViewChild(FixedDepositProductInterestRateChartStepComponent, { static: true }) fixedDepositProductInterestRateChartStep: FixedDepositProductInterestRateChartStepComponent;
|
||||
@ViewChild(FixedDepositProductChargesStepComponent, { static: true }) fixedDepositProductChargesStep: FixedDepositProductChargesStepComponent;
|
||||
@ViewChild(FixedDepositProductAccountingStepComponent, { static: true }) fixedDepositProductAccountingStep: FixedDepositProductAccountingStepComponent;
|
||||
@ViewChild(FixedDepositProductDetailsStepComponent, { static: true })
|
||||
fixedDepositProductDetailsStep: FixedDepositProductDetailsStepComponent;
|
||||
@ViewChild(FixedDepositProductCurrencyStepComponent, { static: true })
|
||||
fixedDepositProductCurrencyStep: FixedDepositProductCurrencyStepComponent;
|
||||
@ViewChild(FixedDepositProductTermsStepComponent, { static: true })
|
||||
fixedDepositProductTermsStep: FixedDepositProductTermsStepComponent;
|
||||
@ViewChild(FixedDepositProductSettingsStepComponent, { static: true })
|
||||
fixedDepositProductSettingsStep: FixedDepositProductSettingsStepComponent;
|
||||
@ViewChild(FixedDepositProductInterestRateChartStepComponent, { static: true })
|
||||
fixedDepositProductInterestRateChartStep: FixedDepositProductInterestRateChartStepComponent;
|
||||
@ViewChild(FixedDepositProductChargesStepComponent, { static: true })
|
||||
fixedDepositProductChargesStep: FixedDepositProductChargesStepComponent;
|
||||
@ViewChild(FixedDepositProductAccountingStepComponent, { static: true })
|
||||
fixedDepositProductAccountingStep: FixedDepositProductAccountingStepComponent;
|
||||
|
||||
fixedDepositProductsTemplate: any;
|
||||
accountingRuleData: string[] = [];
|
||||
@@ -41,11 +47,13 @@ export class CreateFixedDepositProductComponent {
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
private accounting: Accounting) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
private accounting: Accounting
|
||||
) {
|
||||
this.route.data.subscribe((data: { fixedDepositProductsTemplate: any }) => {
|
||||
this.fixedDepositProductsTemplate = data.fixedDepositProductsTemplate;
|
||||
});
|
||||
@@ -107,10 +115,14 @@ export class CreateFixedDepositProductComponent {
|
||||
locale: this.settingsService.language.code // locale required for depositAmount
|
||||
};
|
||||
delete fixedDepositProduct.advancedAccountingRules;
|
||||
this.productsService.createFixedDepositProduct(fixedDepositProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.productsService.createFixedDepositProduct(fixedDepositProduct).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditFixedDepositProductComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditFixedDepositProductComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditFixedDepositProductComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+25
-19
@@ -22,14 +22,20 @@ import { Accounting } from 'app/core/utils/accounting';
|
||||
styleUrls: ['./edit-fixed-deposit-product.component.scss']
|
||||
})
|
||||
export class EditFixedDepositProductComponent {
|
||||
|
||||
@ViewChild(FixedDepositProductDetailsStepComponent, { static: true }) fixedDepositProductDetailsStep: FixedDepositProductDetailsStepComponent;
|
||||
@ViewChild(FixedDepositProductCurrencyStepComponent, { static: true }) fixedDepositProductCurrencyStep: FixedDepositProductCurrencyStepComponent;
|
||||
@ViewChild(FixedDepositProductTermsStepComponent, { static: true }) fixedDepositProductTermsStep: FixedDepositProductTermsStepComponent;
|
||||
@ViewChild(FixedDepositProductSettingsStepComponent, { static: true }) fixedDepositProductSettingsStep: FixedDepositProductSettingsStepComponent;
|
||||
@ViewChild(FixedDepositProductInterestRateChartStepComponent, { static: true }) fixedDepositProductInterestRateChartStep: FixedDepositProductInterestRateChartStepComponent;
|
||||
@ViewChild(FixedDepositProductChargesStepComponent, { static: true }) fixedDepositProductChargesStep: FixedDepositProductChargesStepComponent;
|
||||
@ViewChild(FixedDepositProductAccountingStepComponent, { static: true }) fixedDepositProductAccountingStep: FixedDepositProductAccountingStepComponent;
|
||||
@ViewChild(FixedDepositProductDetailsStepComponent, { static: true })
|
||||
fixedDepositProductDetailsStep: FixedDepositProductDetailsStepComponent;
|
||||
@ViewChild(FixedDepositProductCurrencyStepComponent, { static: true })
|
||||
fixedDepositProductCurrencyStep: FixedDepositProductCurrencyStepComponent;
|
||||
@ViewChild(FixedDepositProductTermsStepComponent, { static: true })
|
||||
fixedDepositProductTermsStep: FixedDepositProductTermsStepComponent;
|
||||
@ViewChild(FixedDepositProductSettingsStepComponent, { static: true })
|
||||
fixedDepositProductSettingsStep: FixedDepositProductSettingsStepComponent;
|
||||
@ViewChild(FixedDepositProductInterestRateChartStepComponent, { static: true })
|
||||
fixedDepositProductInterestRateChartStep: FixedDepositProductInterestRateChartStepComponent;
|
||||
@ViewChild(FixedDepositProductChargesStepComponent, { static: true })
|
||||
fixedDepositProductChargesStep: FixedDepositProductChargesStepComponent;
|
||||
@ViewChild(FixedDepositProductAccountingStepComponent, { static: true })
|
||||
fixedDepositProductAccountingStep: FixedDepositProductAccountingStepComponent;
|
||||
|
||||
fixedDepositProductsTemplate: any;
|
||||
accountingRuleData: string[] = [];
|
||||
@@ -41,11 +47,13 @@ export class EditFixedDepositProductComponent {
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
private accounting: Accounting) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
private accounting: Accounting
|
||||
) {
|
||||
this.route.data.subscribe((data: { fixedDepositProductAndTemplate: any }) => {
|
||||
this.fixedDepositProductsTemplate = data.fixedDepositProductAndTemplate;
|
||||
});
|
||||
@@ -84,14 +92,12 @@ export class EditFixedDepositProductComponent {
|
||||
this.fixedDepositProductSettingsForm.valid &&
|
||||
this.fixedDepositProductInterestRateChartForm.valid &&
|
||||
this.fixedDepositProductAccountingForm.valid &&
|
||||
(
|
||||
this.fixedDepositProductDetailsForm.pristine ||
|
||||
(this.fixedDepositProductDetailsForm.pristine ||
|
||||
this.fixedDepositProductCurrencyForm.pristine ||
|
||||
this.fixedDepositProductTermsForm.pristine ||
|
||||
this.fixedDepositProductSettingsForm.pristine ||
|
||||
this.fixedDepositProductInterestRateChartForm.pristine ||
|
||||
this.fixedDepositProductAccountingForm.pristine
|
||||
)
|
||||
this.fixedDepositProductAccountingForm.pristine)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -129,10 +135,10 @@ export class EditFixedDepositProductComponent {
|
||||
fixedDepositProduct.charts = charts;
|
||||
|
||||
delete fixedDepositProduct.advancedAccountingRules;
|
||||
this.productsService.updateFixedDepositProduct(this.fixedDepositProductsTemplate.id, fixedDepositProduct)
|
||||
this.productsService
|
||||
.updateFixedDepositProduct(this.fixedDepositProductsTemplate.id, fixedDepositProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-3
@@ -13,11 +13,10 @@ import { ProductsService } from '../../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class FixedDepositProductAndTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
constructor(private productsService: ProductsService) { }
|
||||
constructor(private productsService: ProductsService) {}
|
||||
|
||||
/**
|
||||
* Returns the Fixed Deposits Product and Template.
|
||||
@@ -28,5 +27,4 @@ export class FixedDepositProductAndTemplateResolver implements Resolve<Object> {
|
||||
const productId = route.parent.paramMap.get('productId');
|
||||
return this.productsService.getFixedDepositProductAndTemplate(productId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositProductAccountingStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductAccountingStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductAccountingStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+180
-89
@@ -16,7 +16,6 @@ import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
styleUrls: ['./fixed-deposit-product-accounting-step.component.scss']
|
||||
})
|
||||
export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
|
||||
@Input() fixedDepositProductsTemplate: any;
|
||||
@Input() accountingRuleData: any;
|
||||
@Input() fixedDepositProductFormValid: boolean;
|
||||
@@ -31,13 +30,23 @@ export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
expenseAccountData: any;
|
||||
liabilityAccountData: any;
|
||||
|
||||
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId', 'actions'];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId', 'actions'];
|
||||
paymentFundSourceDisplayedColumns: string[] = [
|
||||
'paymentTypeId',
|
||||
'fundSourceAccountId',
|
||||
'actions'
|
||||
];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = [
|
||||
'chargeId',
|
||||
'incomeAccountId',
|
||||
'actions'
|
||||
];
|
||||
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private accounting: Accounting,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private accounting: Accounting,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.createfixedDepositProductAccountingForm();
|
||||
this.setConditionalControls();
|
||||
}
|
||||
@@ -49,7 +58,8 @@ export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
this.assetAccountData = this.fixedDepositProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
|
||||
this.incomeAccountData = this.fixedDepositProductsTemplate.accountingMappingOptions.incomeAccountOptions || [];
|
||||
this.expenseAccountData = this.fixedDepositProductsTemplate.accountingMappingOptions.expenseAccountOptions || [];
|
||||
this.liabilityAccountData = this.fixedDepositProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
this.liabilityAccountData =
|
||||
this.fixedDepositProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
if (!(this.fixedDepositProductsTemplate === undefined) && this.fixedDepositProductsTemplate.id) {
|
||||
this.assignAccountingStepData();
|
||||
}
|
||||
@@ -57,121 +67,191 @@ export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
|
||||
assignAccountingStepData() {
|
||||
this.fixedDepositProductAccountingForm.patchValue({
|
||||
'accountingRule': this.fixedDepositProductsTemplate.accountingRule.id
|
||||
accountingRule: this.fixedDepositProductsTemplate.accountingRule.id
|
||||
});
|
||||
if (this.isCashOrAccrualAccounting()) {
|
||||
this.fixedDepositProductAccountingForm.patchValue({
|
||||
'savingsReferenceAccountId': this.fixedDepositProductsTemplate.accountingMappings.savingsReferenceAccount.id,
|
||||
'savingsControlAccountId': this.fixedDepositProductsTemplate.accountingMappings.savingsControlAccount.id,
|
||||
'transfersInSuspenseAccountId': this.fixedDepositProductsTemplate.accountingMappings.transfersInSuspenseAccount.id,
|
||||
'incomeFromFeeAccountId': this.fixedDepositProductsTemplate.accountingMappings.incomeFromFeeAccount.id,
|
||||
'incomeFromPenaltyAccountId': this.fixedDepositProductsTemplate.accountingMappings.incomeFromPenaltyAccount.id,
|
||||
'interestOnSavingsAccountId': this.fixedDepositProductsTemplate.accountingMappings.interestOnSavingsAccount.id
|
||||
savingsReferenceAccountId: this.fixedDepositProductsTemplate.accountingMappings.savingsReferenceAccount.id,
|
||||
savingsControlAccountId: this.fixedDepositProductsTemplate.accountingMappings.savingsControlAccount.id,
|
||||
transfersInSuspenseAccountId:
|
||||
this.fixedDepositProductsTemplate.accountingMappings.transfersInSuspenseAccount.id,
|
||||
incomeFromFeeAccountId: this.fixedDepositProductsTemplate.accountingMappings.incomeFromFeeAccount.id,
|
||||
incomeFromPenaltyAccountId: this.fixedDepositProductsTemplate.accountingMappings.incomeFromPenaltyAccount.id,
|
||||
interestOnSavingsAccountId: this.fixedDepositProductsTemplate.accountingMappings.interestOnSavingsAccount.id
|
||||
});
|
||||
|
||||
if (this.isAccrualAccounting()) {
|
||||
this.fixedDepositProductAccountingForm.patchValue({
|
||||
'feesReceivableAccountId': this.fixedDepositProductsTemplate.accountingMappings.feeReceivableAccount.id,
|
||||
'penaltiesReceivableAccountId': this.fixedDepositProductsTemplate.accountingMappings.penaltyReceivableAccount.id,
|
||||
'interestPayableAccountId': this.fixedDepositProductsTemplate.accountingMappings.interestPayableAccount.id
|
||||
feesReceivableAccountId: this.fixedDepositProductsTemplate.accountingMappings.feeReceivableAccount.id,
|
||||
penaltiesReceivableAccountId:
|
||||
this.fixedDepositProductsTemplate.accountingMappings.penaltyReceivableAccount.id,
|
||||
interestPayableAccountId: this.fixedDepositProductsTemplate.accountingMappings.interestPayableAccount.id
|
||||
});
|
||||
}
|
||||
|
||||
if (this.fixedDepositProductsTemplate.paymentChannelToFundSourceMappings || this.fixedDepositProductsTemplate.feeToIncomeAccountMappings || this.fixedDepositProductsTemplate.penaltyToIncomeAccountMappings) {
|
||||
if (
|
||||
this.fixedDepositProductsTemplate.paymentChannelToFundSourceMappings ||
|
||||
this.fixedDepositProductsTemplate.feeToIncomeAccountMappings ||
|
||||
this.fixedDepositProductsTemplate.penaltyToIncomeAccountMappings
|
||||
) {
|
||||
this.fixedDepositProductAccountingForm.patchValue({
|
||||
'advancedAccountingRules': true
|
||||
advancedAccountingRules: true
|
||||
});
|
||||
}
|
||||
if (this.fixedDepositProductsTemplate.paymentChannelToFundSourceMappings) {
|
||||
this.fixedDepositProductsTemplate.paymentChannelToFundSourceMappings.forEach((paymentChannelToFundSourceMapping: any) => {
|
||||
const paymentChannelToFundSourceMappingData = this.formBuilder.group({
|
||||
paymentTypeId: [paymentChannelToFundSourceMapping.paymentType.id, Validators.required],
|
||||
fundSourceAccountId: [paymentChannelToFundSourceMapping.fundSourceAccount.id, Validators.required]
|
||||
});
|
||||
const formArray = this.fixedDepositProductAccountingForm.controls['paymentChannelToFundSourceMappings'] as UntypedFormArray;
|
||||
formArray.push(paymentChannelToFundSourceMappingData);
|
||||
});
|
||||
this.fixedDepositProductsTemplate.paymentChannelToFundSourceMappings.forEach(
|
||||
(paymentChannelToFundSourceMapping: any) => {
|
||||
const paymentChannelToFundSourceMappingData = this.formBuilder.group({
|
||||
paymentTypeId: [
|
||||
paymentChannelToFundSourceMapping.paymentType.id,
|
||||
Validators.required
|
||||
],
|
||||
fundSourceAccountId: [
|
||||
paymentChannelToFundSourceMapping.fundSourceAccount.id,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
const formArray = this.fixedDepositProductAccountingForm.controls[
|
||||
'paymentChannelToFundSourceMappings'
|
||||
] as UntypedFormArray;
|
||||
formArray.push(paymentChannelToFundSourceMappingData);
|
||||
}
|
||||
);
|
||||
}
|
||||
if (this.fixedDepositProductsTemplate.feeToIncomeAccountMappings) {
|
||||
this.fixedDepositProductsTemplate.feeToIncomeAccountMappings.forEach((feeToIncomeAccountMapping: any) => {
|
||||
const feeToIncomeAccountMappingData = this.formBuilder.group({
|
||||
chargeId: [feeToIncomeAccountMapping.charge.id, Validators.required],
|
||||
incomeAccountId: [feeToIncomeAccountMapping.incomeAccount.id, Validators.required]
|
||||
chargeId: [
|
||||
feeToIncomeAccountMapping.charge.id,
|
||||
Validators.required
|
||||
],
|
||||
incomeAccountId: [
|
||||
feeToIncomeAccountMapping.incomeAccount.id,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
const formArray = this.fixedDepositProductAccountingForm.controls['feeToIncomeAccountMappings'] as UntypedFormArray;
|
||||
const formArray = this.fixedDepositProductAccountingForm.controls[
|
||||
'feeToIncomeAccountMappings'
|
||||
] as UntypedFormArray;
|
||||
formArray.push(feeToIncomeAccountMappingData);
|
||||
});
|
||||
}
|
||||
if (this.fixedDepositProductsTemplate.penaltyToIncomeAccountMappings) {
|
||||
this.fixedDepositProductsTemplate.penaltyToIncomeAccountMappings.forEach((penaltyToIncomeAccountMapping: any) => {
|
||||
const penaltyToIncomeAccountMappingData = this.formBuilder.group({
|
||||
chargeId: [penaltyToIncomeAccountMapping.charge.id, Validators.required],
|
||||
incomeAccountId: [penaltyToIncomeAccountMapping.incomeAccount.id, Validators.required]
|
||||
});
|
||||
const formArray = this.fixedDepositProductAccountingForm.controls['penaltyToIncomeAccountMappings'] as UntypedFormArray;
|
||||
formArray.push(penaltyToIncomeAccountMappingData);
|
||||
});
|
||||
this.fixedDepositProductsTemplate.penaltyToIncomeAccountMappings.forEach(
|
||||
(penaltyToIncomeAccountMapping: any) => {
|
||||
const penaltyToIncomeAccountMappingData = this.formBuilder.group({
|
||||
chargeId: [
|
||||
penaltyToIncomeAccountMapping.charge.id,
|
||||
Validators.required
|
||||
],
|
||||
incomeAccountId: [
|
||||
penaltyToIncomeAccountMapping.incomeAccount.id,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
const formArray = this.fixedDepositProductAccountingForm.controls[
|
||||
'penaltyToIncomeAccountMappings'
|
||||
] as UntypedFormArray;
|
||||
formArray.push(penaltyToIncomeAccountMappingData);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
createfixedDepositProductAccountingForm() {
|
||||
this.fixedDepositProductAccountingForm = this.formBuilder.group({
|
||||
'accountingRule': [1]
|
||||
accountingRule: [1]
|
||||
});
|
||||
}
|
||||
|
||||
existCharges(): boolean {
|
||||
return (this.chargeData.length > 0);
|
||||
return this.chargeData.length > 0;
|
||||
}
|
||||
|
||||
setConditionalControls() {
|
||||
this.fixedDepositProductAccountingForm.get('accountingRule').valueChanges
|
||||
.subscribe((accountingRule: any) => {
|
||||
if (accountingRule === 2 || accountingRule === 3) {
|
||||
this.fixedDepositProductAccountingForm.addControl('savingsReferenceAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.fixedDepositProductAccountingForm.addControl('savingsControlAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.fixedDepositProductAccountingForm.addControl('transfersInSuspenseAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.fixedDepositProductAccountingForm.addControl('interestOnSavingsAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.fixedDepositProductAccountingForm.addControl('incomeFromFeeAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.fixedDepositProductAccountingForm.addControl('incomeFromPenaltyAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.fixedDepositProductAccountingForm.addControl('advancedAccountingRules', new UntypedFormControl(false));
|
||||
this.fixedDepositProductAccountingForm.get('accountingRule').valueChanges.subscribe((accountingRule: any) => {
|
||||
if (accountingRule === 2 || accountingRule === 3) {
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'savingsReferenceAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'savingsControlAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'transfersInSuspenseAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'interestOnSavingsAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'incomeFromFeeAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'incomeFromPenaltyAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl('advancedAccountingRules', new UntypedFormControl(false));
|
||||
|
||||
if (accountingRule === 3) {
|
||||
this.fixedDepositProductAccountingForm.addControl('feesReceivableAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.fixedDepositProductAccountingForm.addControl('penaltiesReceivableAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.fixedDepositProductAccountingForm.addControl('interestPayableAccountId', new UntypedFormControl('', Validators.required));
|
||||
}
|
||||
|
||||
this.fixedDepositProductAccountingForm.get('advancedAccountingRules').valueChanges
|
||||
.subscribe((advancedAccountingRules: boolean) => {
|
||||
if (advancedAccountingRules) {
|
||||
this.fixedDepositProductAccountingForm.addControl('paymentChannelToFundSourceMappings', this.formBuilder.array([]));
|
||||
this.fixedDepositProductAccountingForm.addControl('feeToIncomeAccountMappings', this.formBuilder.array([]));
|
||||
this.fixedDepositProductAccountingForm.addControl('penaltyToIncomeAccountMappings', this.formBuilder.array([]));
|
||||
} else {
|
||||
this.fixedDepositProductAccountingForm.removeControl('paymentChannelToFundSourceMappings');
|
||||
this.fixedDepositProductAccountingForm.removeControl('feeToIncomeAccountMappings');
|
||||
this.fixedDepositProductAccountingForm.removeControl('penaltyToIncomeAccountMappings');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.fixedDepositProductAccountingForm.removeControl('savingsReferenceAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('overdraftPortfolioControlId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('savingsControlAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('transfersInSuspenseAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('interestOnSavingsAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('writeOffAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('incomeFromFeeAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('incomeFromPenaltyAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('incomeFromInterestId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('advancedAccountingRules');
|
||||
this.fixedDepositProductAccountingForm.removeControl('escheatLiabilityId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('feesReceivableAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('penaltiesReceivableAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('interestPayableAccountId');
|
||||
if (accountingRule === 3) {
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'feesReceivableAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'penaltiesReceivableAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'interestPayableAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
this.fixedDepositProductAccountingForm
|
||||
.get('advancedAccountingRules')
|
||||
.valueChanges.subscribe((advancedAccountingRules: boolean) => {
|
||||
if (advancedAccountingRules) {
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'paymentChannelToFundSourceMappings',
|
||||
this.formBuilder.array([])
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'feeToIncomeAccountMappings',
|
||||
this.formBuilder.array([])
|
||||
);
|
||||
this.fixedDepositProductAccountingForm.addControl(
|
||||
'penaltyToIncomeAccountMappings',
|
||||
this.formBuilder.array([])
|
||||
);
|
||||
} else {
|
||||
this.fixedDepositProductAccountingForm.removeControl('paymentChannelToFundSourceMappings');
|
||||
this.fixedDepositProductAccountingForm.removeControl('feeToIncomeAccountMappings');
|
||||
this.fixedDepositProductAccountingForm.removeControl('penaltyToIncomeAccountMappings');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.fixedDepositProductAccountingForm.removeControl('savingsReferenceAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('overdraftPortfolioControlId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('savingsControlAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('transfersInSuspenseAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('interestOnSavingsAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('writeOffAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('incomeFromFeeAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('incomeFromPenaltyAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('incomeFromInterestId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('advancedAccountingRules');
|
||||
this.fixedDepositProductAccountingForm.removeControl('escheatLiabilityId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('feesReceivableAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('penaltiesReceivableAccountId');
|
||||
this.fixedDepositProductAccountingForm.removeControl('interestPayableAccountId');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get paymentChannelToFundSourceMappings(): UntypedFormArray {
|
||||
@@ -219,9 +299,18 @@ export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
|
||||
getData(formType: string, values?: any) {
|
||||
switch (formType) {
|
||||
case 'PaymentFundSource': return { title: 'Configure Fund Sources for Payment Channels', formfields: this.getPaymentFundSourceFormfields(values) };
|
||||
case 'FeesIncome': return { title: 'Map Fees to Income Accounts', formfields: this.getFeesIncomeFormfields(values) };
|
||||
case 'PenaltyIncome': return { title: 'Map Penalties to Specific Income Accounts', formfields: this.getPenaltyIncomeFormfields(values) };
|
||||
case 'PaymentFundSource':
|
||||
return {
|
||||
title: 'Configure Fund Sources for Payment Channels',
|
||||
formfields: this.getPaymentFundSourceFormfields(values)
|
||||
};
|
||||
case 'FeesIncome':
|
||||
return { title: 'Map Fees to Income Accounts', formfields: this.getFeesIncomeFormfields(values) };
|
||||
case 'PenaltyIncome':
|
||||
return {
|
||||
title: 'Map Penalties to Specific Income Accounts',
|
||||
formfields: this.getPenaltyIncomeFormfields(values)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +332,7 @@ export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
return formfields;
|
||||
}
|
||||
@@ -265,6 +355,7 @@ export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
return formfields;
|
||||
}
|
||||
@@ -287,6 +378,7 @@ export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
return formfields;
|
||||
}
|
||||
@@ -302,5 +394,4 @@ export class FixedDepositProductAccountingStepComponent implements OnInit {
|
||||
isAccrualAccounting(): boolean {
|
||||
return this.accounting.isAccrualAccountingRuleId(this.fixedDepositProductAccountingForm.value.accountingRule);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositProductChargesStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductChargesStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductChargesStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+12
-7
@@ -11,18 +11,24 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
|
||||
styleUrls: ['./fixed-deposit-product-charges-step.component.scss']
|
||||
})
|
||||
export class FixedDepositProductChargesStepComponent implements OnInit {
|
||||
|
||||
@Input() fixedDepositProductsTemplate: any;
|
||||
@Input() currencyCode: UntypedFormControl;
|
||||
|
||||
chargeData: any;
|
||||
|
||||
chargesDataSource: {}[];
|
||||
displayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'action'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'chargeCalculationType',
|
||||
'amount',
|
||||
'chargeTimeType',
|
||||
'action'
|
||||
];
|
||||
|
||||
constructor(public dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
}
|
||||
constructor(
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.chargeData = this.fixedDepositProductsTemplate.chargeOptions;
|
||||
@@ -31,7 +37,7 @@ export class FixedDepositProductChargesStepComponent implements OnInit {
|
||||
} else {
|
||||
this.chargesDataSource = [];
|
||||
}
|
||||
this.currencyCode.valueChanges.subscribe(() => this.chargesDataSource = []);
|
||||
this.currencyCode.valueChanges.subscribe(() => (this.chargesDataSource = []));
|
||||
}
|
||||
|
||||
addCharge(charge: any) {
|
||||
@@ -56,5 +62,4 @@ export class FixedDepositProductChargesStepComponent implements OnInit {
|
||||
charges: this.chargesDataSource
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositProductCurrencyStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductCurrencyStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductCurrencyStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+14
-10
@@ -7,7 +7,6 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms
|
||||
styleUrls: ['./fixed-deposit-product-currency-step.component.scss']
|
||||
})
|
||||
export class FixedDepositProductCurrencyStepComponent implements OnInit {
|
||||
|
||||
@Input() fixedDepositProductsTemplate: any;
|
||||
|
||||
fixedDepositProductCurrencyForm: UntypedFormGroup;
|
||||
@@ -23,28 +22,33 @@ export class FixedDepositProductCurrencyStepComponent implements OnInit {
|
||||
|
||||
if (!(this.fixedDepositProductsTemplate === undefined) && this.fixedDepositProductsTemplate.id) {
|
||||
this.fixedDepositProductCurrencyForm.patchValue({
|
||||
'currencyCode': this.fixedDepositProductsTemplate.currency.code,
|
||||
'digitsAfterDecimal': this.fixedDepositProductsTemplate.currency.decimalPlaces,
|
||||
'inMultiplesOf': this.fixedDepositProductsTemplate.currency.inMultiplesOf
|
||||
currencyCode: this.fixedDepositProductsTemplate.currency.code,
|
||||
digitsAfterDecimal: this.fixedDepositProductsTemplate.currency.decimalPlaces,
|
||||
inMultiplesOf: this.fixedDepositProductsTemplate.currency.inMultiplesOf
|
||||
});
|
||||
} else {
|
||||
this.fixedDepositProductCurrencyForm.patchValue({
|
||||
'currencyCode': this.currencyData[0].code,
|
||||
'digitsAfterDecimal': 2
|
||||
currencyCode: this.currencyData[0].code,
|
||||
digitsAfterDecimal: 2
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createFixedDepositProductCurrencyForm() {
|
||||
this.fixedDepositProductCurrencyForm = this.formBuilder.group({
|
||||
'currencyCode': ['', Validators.required],
|
||||
'digitsAfterDecimal': ['', Validators.required],
|
||||
'inMultiplesOf': ['']
|
||||
currencyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
digitsAfterDecimal: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
inMultiplesOf: ['']
|
||||
});
|
||||
}
|
||||
|
||||
get fixedDepositProductCurrency() {
|
||||
return this.fixedDepositProductCurrencyForm.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositProductDetailsStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductDetailsStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductDetailsStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+15
-8
@@ -7,7 +7,6 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators } from '@angular/forms
|
||||
styleUrls: ['./fixed-deposit-product-details-step.component.scss']
|
||||
})
|
||||
export class FixedDepositProductDetailsStepComponent implements OnInit {
|
||||
|
||||
@Input() fixedDepositProductsTemplate: any;
|
||||
|
||||
fixedDepositProductDetailsForm: UntypedFormGroup;
|
||||
@@ -19,23 +18,31 @@ export class FixedDepositProductDetailsStepComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
if (!(this.fixedDepositProductsTemplate === undefined) && this.fixedDepositProductsTemplate.id) {
|
||||
this.fixedDepositProductDetailsForm.patchValue({
|
||||
'name': this.fixedDepositProductsTemplate.name,
|
||||
'shortName': this.fixedDepositProductsTemplate.shortName,
|
||||
'description': this.fixedDepositProductsTemplate.description,
|
||||
name: this.fixedDepositProductsTemplate.name,
|
||||
shortName: this.fixedDepositProductsTemplate.shortName,
|
||||
description: this.fixedDepositProductsTemplate.description
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createFixedDepositProductDetailsForm() {
|
||||
this.fixedDepositProductDetailsForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required],
|
||||
'shortName': ['', Validators.required],
|
||||
'description': ['', Validators.required]
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
shortName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
description: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
get fixedDepositProductDetails() {
|
||||
return this.fixedDepositProductDetailsForm.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositProductInterestRateChartStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductInterestRateChartStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductInterestRateChartStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+105
-42
@@ -27,12 +27,11 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
trigger('expandChartSlab', [
|
||||
state('collapsed', style({ height: '0px', minHeight: '0' })),
|
||||
state('expanded', style({ height: '*' })),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))
|
||||
])
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))])
|
||||
|
||||
]
|
||||
})
|
||||
export class FixedDepositProductInterestRateChartStepComponent implements OnInit {
|
||||
|
||||
@Input() fixedDepositProductsTemplate: any;
|
||||
|
||||
fixedDepositProductInterestRateChartForm: UntypedFormGroup;
|
||||
@@ -48,7 +47,15 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
|
||||
chartSlabsDisplayedColumns: any[] = [];
|
||||
chartSlabsIncentivesDisplayedColumns: string[] = ['incentives'];
|
||||
incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount', 'actions'];
|
||||
incentivesDisplayedColumns: string[] = [
|
||||
'entityType',
|
||||
'attributeName',
|
||||
'conditionType',
|
||||
'attributeValue',
|
||||
'incentiveType',
|
||||
'amount',
|
||||
'actions'
|
||||
];
|
||||
|
||||
minDate = new Date(2000, 0, 1);
|
||||
maxDate = new Date(new Date().setFullYear(new Date().getFullYear() + 10));
|
||||
@@ -64,11 +71,13 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.createFixedDepositProductInterestRateChartForm();
|
||||
}
|
||||
|
||||
@@ -103,23 +112,33 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
|
||||
// Iterates for every chart in charts
|
||||
this.charts.controls.forEach((chartDetailControl: UntypedFormGroup, i: number) => {
|
||||
|
||||
if (!this.chartsDetail[i]) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Iterate for every chartSlab in chart
|
||||
this.chartsDetail[i].chartSlabs.forEach((chartSlabDetail: any, j: number) => {
|
||||
|
||||
const chartSlabInfo = this.formBuilder.group({
|
||||
id: [chartSlabDetail.id],
|
||||
amountRangeFrom: [chartSlabDetail.amountRangeFrom || ''],
|
||||
amountRangeTo: [chartSlabDetail.amountRangeTo || ''],
|
||||
annualInterestRate: [chartSlabDetail.annualInterestRate, Validators.required],
|
||||
description: [chartSlabDetail.description, Validators.required],
|
||||
fromPeriod: [chartSlabDetail.fromPeriod, Validators.required],
|
||||
annualInterestRate: [
|
||||
chartSlabDetail.annualInterestRate,
|
||||
Validators.required
|
||||
],
|
||||
description: [
|
||||
chartSlabDetail.description,
|
||||
Validators.required
|
||||
],
|
||||
fromPeriod: [
|
||||
chartSlabDetail.fromPeriod,
|
||||
Validators.required
|
||||
],
|
||||
toPeriod: [chartSlabDetail.toPeriod || ''],
|
||||
periodType: [chartSlabDetail.periodType, Validators.required],
|
||||
periodType: [
|
||||
chartSlabDetail.periodType,
|
||||
Validators.required
|
||||
],
|
||||
incentives: this.formBuilder.array([])
|
||||
});
|
||||
const formArray = chartDetailControl.controls['chartSlabs'] as UntypedFormArray;
|
||||
@@ -131,19 +150,35 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
// Iterate to input all the incentive for particular chart slab
|
||||
this.chartsDetail[i].chartSlabs[j].incentives.forEach((chartIncentiveDetail: any) => {
|
||||
const incentiveInfo = this.formBuilder.group({
|
||||
amount: [chartIncentiveDetail.amount, Validators.required],
|
||||
attributeName: [chartIncentiveDetail.attributeName, Validators.required],
|
||||
attribureValue: [chartIncentiveDetail.attribureValue, Validators.required],
|
||||
conditionType: [chartIncentiveDetail.conditionType, Validators.required],
|
||||
entityType: [chartIncentiveDetail.entityType, Validators.required],
|
||||
incentiveType: [chartIncentiveDetail.incentiveType, Validators.required]
|
||||
amount: [
|
||||
chartIncentiveDetail.amount,
|
||||
Validators.required
|
||||
],
|
||||
attributeName: [
|
||||
chartIncentiveDetail.attributeName,
|
||||
Validators.required
|
||||
],
|
||||
attribureValue: [
|
||||
chartIncentiveDetail.attribureValue,
|
||||
Validators.required
|
||||
],
|
||||
conditionType: [
|
||||
chartIncentiveDetail.conditionType,
|
||||
Validators.required
|
||||
],
|
||||
entityType: [
|
||||
chartIncentiveDetail.entityType,
|
||||
Validators.required
|
||||
],
|
||||
incentiveType: [
|
||||
chartIncentiveDetail.incentiveType,
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
const newFormArray = chartIncentiveControl['controls']['incentives'] as UntypedFormArray;
|
||||
newFormArray.push(incentiveInfo);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -163,7 +198,7 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
this.chartsDetail.push(chart);
|
||||
});
|
||||
this.fixedDepositProductInterestRateChartForm.patchValue({
|
||||
'charts': this.chartsDetail
|
||||
charts: this.chartsDetail
|
||||
});
|
||||
}
|
||||
|
||||
@@ -213,7 +248,7 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
attributeValue: incentiveData.attributeValue,
|
||||
conditionType: incentiveData.conditionType,
|
||||
entityType: incentiveData.entityType,
|
||||
incentiveType: incentiveData.incentiveType,
|
||||
incentiveType: incentiveData.incentiveType
|
||||
};
|
||||
incentives.push(incentive);
|
||||
});
|
||||
@@ -223,7 +258,7 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
|
||||
createFixedDepositProductInterestRateChartForm() {
|
||||
this.fixedDepositProductInterestRateChartForm = this.formBuilder.group({
|
||||
'charts': this.formBuilder.array([])
|
||||
charts: this.formBuilder.array([])
|
||||
});
|
||||
}
|
||||
|
||||
@@ -233,13 +268,16 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
|
||||
createChartForm(): UntypedFormGroup {
|
||||
return this.formBuilder.group({
|
||||
'id': [null],
|
||||
'name': [''],
|
||||
'description': [''],
|
||||
'fromDate': ['', Validators.required],
|
||||
'endDate': [''],
|
||||
'isPrimaryGroupingByAmount': [false],
|
||||
'chartSlabs': this.formBuilder.array([], Validators.required)
|
||||
id: [null],
|
||||
name: [''],
|
||||
description: [''],
|
||||
fromDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
endDate: [''],
|
||||
isPrimaryGroupingByAmount: [false],
|
||||
chartSlabs: this.formBuilder.array([], Validators.required)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -249,10 +287,24 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
}
|
||||
|
||||
setConditionalControls(chartIndex: number) {
|
||||
this.chartSlabsDisplayedColumns[chartIndex] = ['period', 'amountRange', 'annualInterestRate', 'description', 'actions'];
|
||||
this.charts.at(chartIndex).get('isPrimaryGroupingByAmount').valueChanges
|
||||
.subscribe((isPrimaryGroupingByAmount: boolean) => {
|
||||
this.chartSlabsDisplayedColumns[chartIndex] = isPrimaryGroupingByAmount ? ['amountRange', 'period'] : ['period', 'amountRange'];
|
||||
this.chartSlabsDisplayedColumns[chartIndex] = [
|
||||
'period',
|
||||
'amountRange',
|
||||
'annualInterestRate',
|
||||
'description',
|
||||
'actions'
|
||||
];
|
||||
this.charts
|
||||
.at(chartIndex)
|
||||
.get('isPrimaryGroupingByAmount')
|
||||
.valueChanges.subscribe((isPrimaryGroupingByAmount: boolean) => {
|
||||
this.chartSlabsDisplayedColumns[chartIndex] = isPrimaryGroupingByAmount ? [
|
||||
'amountRange',
|
||||
'period'
|
||||
] : [
|
||||
'period',
|
||||
'amountRange'
|
||||
];
|
||||
this.chartSlabsDisplayedColumns[chartIndex].push('annualInterestRate', 'description', 'actions');
|
||||
});
|
||||
}
|
||||
@@ -283,7 +335,10 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
}
|
||||
|
||||
editChartSlab(chartSlabs: UntypedFormArray, chartSlabIndex: number) {
|
||||
const data = { ...this.getData('Slab', chartSlabs.at(chartSlabIndex).value), layout: { addButtonText: this.translateService.instant('labels.text.this') } };
|
||||
const data = {
|
||||
...this.getData('Slab', chartSlabs.at(chartSlabIndex).value),
|
||||
layout: { addButtonText: this.translateService.instant('labels.text.this') }
|
||||
};
|
||||
const dialogRef = this.dialog.open(FormDialogComponent, { data });
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
@@ -293,7 +348,10 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
}
|
||||
|
||||
editIncentive(incentives: UntypedFormArray, incentiveIndex: number) {
|
||||
const data = { ...this.getData('Incentive', incentives.at(incentiveIndex).value), layout: { addButtonText: this.translateService.instant('labels.text.this') } };
|
||||
const data = {
|
||||
...this.getData('Incentive', incentives.at(incentiveIndex).value),
|
||||
layout: { addButtonText: this.translateService.instant('labels.text.this') }
|
||||
};
|
||||
const dialogRef = this.dialog.open(DepositProductIncentiveFormDialogComponent, { data });
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.data) {
|
||||
@@ -315,8 +373,13 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
|
||||
getData(formType: string, values?: any) {
|
||||
switch (formType) {
|
||||
case 'Slab': return { title: this.translateService.instant('labels.inputs.Slab'), formfields: this.getSlabFormfields(values) };
|
||||
case 'Incentive': return { values, chartTemplate: this.fixedDepositProductsTemplate.chartTemplate };
|
||||
case 'Slab':
|
||||
return {
|
||||
title: this.translateService.instant('labels.inputs.Slab'),
|
||||
formfields: this.getSlabFormfields(values)
|
||||
};
|
||||
case 'Incentive':
|
||||
return { values, chartTemplate: this.fixedDepositProductsTemplate.chartTemplate };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,6 +437,7 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
required: true,
|
||||
order: 7
|
||||
})
|
||||
|
||||
];
|
||||
return formfields;
|
||||
}
|
||||
@@ -403,5 +467,4 @@ export class FixedDepositProductInterestRateChartStepComponent implements OnInit
|
||||
}
|
||||
return fixedDepositProductInterestRateChart;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositProductPreviewStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductPreviewStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductPreviewStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+65
-21
@@ -9,14 +9,13 @@ import { OptionData } from 'app/shared/models/option-data.model';
|
||||
styleUrls: ['./fixed-deposit-product-preview-step.component.scss'],
|
||||
animations: [
|
||||
trigger('expandChartSlab', [
|
||||
state('collapsed', style({height: '0px', minHeight: '0'})),
|
||||
state('expanded', style({height: '*'})),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))
|
||||
])
|
||||
state('collapsed', style({ height: '0px', minHeight: '0' })),
|
||||
state('expanded', style({ height: '*' })),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))])
|
||||
|
||||
]
|
||||
})
|
||||
export class FixedDepositProductPreviewStepComponent implements OnInit, OnChanges {
|
||||
|
||||
@Input() fixedDepositProductsTemplate: any;
|
||||
@Input() chartSlabsDisplayedColumns: any[];
|
||||
@Input() accountingRuleData: any;
|
||||
@@ -24,17 +23,35 @@ export class FixedDepositProductPreviewStepComponent implements OnInit, OnChange
|
||||
@Output() submitEvent = new EventEmitter();
|
||||
|
||||
chartSlabsIncentivesDisplayedColumns: string[] = ['incentives'];
|
||||
incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount'];
|
||||
chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType'];
|
||||
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId'];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId'];
|
||||
incentivesDisplayedColumns: string[] = [
|
||||
'entityType',
|
||||
'attributeName',
|
||||
'conditionType',
|
||||
'attributeValue',
|
||||
'incentiveType',
|
||||
'amount'
|
||||
];
|
||||
chargesDisplayedColumns: string[] = [
|
||||
'name',
|
||||
'chargeCalculationType',
|
||||
'amount',
|
||||
'chargeTimeType'
|
||||
];
|
||||
paymentFundSourceDisplayedColumns: string[] = [
|
||||
'paymentTypeId',
|
||||
'fundSourceAccountId'
|
||||
];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = [
|
||||
'chargeId',
|
||||
'incomeAccountId'
|
||||
];
|
||||
|
||||
expandChartSlabIndex: number[] = [];
|
||||
|
||||
accountingMappings: any = {};
|
||||
accountingRule: OptionData;
|
||||
|
||||
constructor(private accounting: Accounting) { }
|
||||
constructor(private accounting: Accounting) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.setCurrentValues();
|
||||
@@ -51,21 +68,49 @@ export class FixedDepositProductPreviewStepComponent implements OnInit, OnChange
|
||||
const assetAccountData = this.fixedDepositProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
|
||||
const incomeAccountData = this.fixedDepositProductsTemplate.accountingMappingOptions.incomeAccountOptions || [];
|
||||
const expenseAccountData = this.fixedDepositProductsTemplate.accountingMappingOptions.expenseAccountOptions || [];
|
||||
const liabilityAccountData = this.fixedDepositProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
const liabilityAccountData =
|
||||
this.fixedDepositProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
|
||||
this.accountingMappings = {
|
||||
'savingsReferenceAccount': this.accounting.glAccountLookUp(this.fixedDepositProduct.savingsReferenceAccountId, assetAccountData),
|
||||
'savingsControlAccount': this.accounting.glAccountLookUp(this.fixedDepositProduct.savingsControlAccountId, liabilityAccountData),
|
||||
'transfersInSuspenseAccount': this.accounting.glAccountLookUp(this.fixedDepositProduct.transfersInSuspenseAccountId, liabilityAccountData),
|
||||
'interestOnSavingsAccount': this.accounting.glAccountLookUp(this.fixedDepositProduct.interestOnSavingsAccountId, expenseAccountData),
|
||||
'incomeFromFeeAccount': this.accounting.glAccountLookUp(this.fixedDepositProduct.incomeFromFeeAccountId, incomeAccountData),
|
||||
'incomeFromPenaltyAccount': this.accounting.glAccountLookUp(this.fixedDepositProduct.incomeFromPenaltyAccountId, incomeAccountData)
|
||||
savingsReferenceAccount: this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.savingsReferenceAccountId,
|
||||
assetAccountData
|
||||
),
|
||||
savingsControlAccount: this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.savingsControlAccountId,
|
||||
liabilityAccountData
|
||||
),
|
||||
transfersInSuspenseAccount: this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.transfersInSuspenseAccountId,
|
||||
liabilityAccountData
|
||||
),
|
||||
interestOnSavingsAccount: this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.interestOnSavingsAccountId,
|
||||
expenseAccountData
|
||||
),
|
||||
incomeFromFeeAccount: this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.incomeFromFeeAccountId,
|
||||
incomeAccountData
|
||||
),
|
||||
incomeFromPenaltyAccount: this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.incomeFromPenaltyAccountId,
|
||||
incomeAccountData
|
||||
)
|
||||
};
|
||||
|
||||
if (this.isAccrualAccounting()) {
|
||||
this.accountingMappings['feeReceivableAccount'] = this.accounting.glAccountLookUp(this.fixedDepositProduct.feesReceivableAccountId, assetAccountData);
|
||||
this.accountingMappings['penaltyReceivableAccount'] = this.accounting.glAccountLookUp(this.fixedDepositProduct.penaltiesReceivableAccountId, assetAccountData);
|
||||
this.accountingMappings['interestPayableAccount'] = this.accounting.glAccountLookUp(this.fixedDepositProduct.interestPayableAccountId, liabilityAccountData);
|
||||
this.accountingMappings['feeReceivableAccount'] = this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.feesReceivableAccountId,
|
||||
assetAccountData
|
||||
);
|
||||
this.accountingMappings['penaltyReceivableAccount'] = this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.penaltiesReceivableAccountId,
|
||||
assetAccountData
|
||||
);
|
||||
this.accountingMappings['interestPayableAccount'] = this.accounting.glAccountLookUp(
|
||||
this.fixedDepositProduct.interestPayableAccountId,
|
||||
liabilityAccountData
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,5 +126,4 @@ export class FixedDepositProductPreviewStepComponent implements OnInit, OnChange
|
||||
isAccrualAccounting(): boolean {
|
||||
return this.accounting.isAccrualAccountingRuleId(this.fixedDepositProduct.accountingRule);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositProductSettingsStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductSettingsStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductSettingsStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+51
-38
@@ -8,7 +8,6 @@ import { TooltipPosition } from '@angular/material/tooltip';
|
||||
styleUrls: ['./fixed-deposit-product-settings-step.component.scss']
|
||||
})
|
||||
export class FixedDepositProductSettingsStepComponent implements OnInit {
|
||||
|
||||
@Input() fixedDepositProductsTemplate: any;
|
||||
|
||||
fixedDepositProductSettingsForm: UntypedFormGroup;
|
||||
@@ -31,57 +30,72 @@ export class FixedDepositProductSettingsStepComponent implements OnInit {
|
||||
|
||||
if (!(this.fixedDepositProductsTemplate === undefined) && this.fixedDepositProductsTemplate.id) {
|
||||
this.fixedDepositProductSettingsForm.patchValue({
|
||||
'isMandatoryDeposit': this.fixedDepositProductsTemplate.isMandatoryDeposit,
|
||||
'adjustAdvanceTowardsFuturePayments': this.fixedDepositProductsTemplate.adjustAdvanceTowardsFuturePayments,
|
||||
'allowWithdrawal': this.fixedDepositProductsTemplate.allowWithdrawal,
|
||||
'lockinPeriodFrequency': this.fixedDepositProductsTemplate.lockinPeriodFrequency,
|
||||
'lockinPeriodFrequencyType': this.fixedDepositProductsTemplate.lockinPeriodFrequencyType ? this.fixedDepositProductsTemplate.lockinPeriodFrequencyType.id : '',
|
||||
'minDepositTerm': this.fixedDepositProductsTemplate.minDepositTerm,
|
||||
'minDepositTermTypeId': this.fixedDepositProductsTemplate.minDepositTermType ? this.fixedDepositProductsTemplate.minDepositTermType.id : '',
|
||||
'inMultiplesOfDepositTerm': this.fixedDepositProductsTemplate.inMultiplesOfDepositTerm,
|
||||
'inMultiplesOfDepositTermTypeId': this.fixedDepositProductsTemplate.inMultiplesOfDepositTermType ? this.fixedDepositProductsTemplate.inMultiplesOfDepositTerm.id : '',
|
||||
'maxDepositTerm': this.fixedDepositProductsTemplate.maxDepositTerm,
|
||||
'maxDepositTermTypeId': this.fixedDepositProductsTemplate.maxDepositTermType ? this.fixedDepositProductsTemplate.minDepositTermType.id : '',
|
||||
'preClosurePenalApplicable': this.fixedDepositProductsTemplate.preClosurePenalApplicable,
|
||||
'preClosurePenalInterest': this.fixedDepositProductsTemplate.preClosurePenalInterest,
|
||||
'preClosurePenalInterestOnTypeId': this.fixedDepositProductsTemplate.preClosurePenalInterestOnType ? this.fixedDepositProductsTemplate.preClosurePenalInterestOnType.id : '',
|
||||
'withHoldTax': this.fixedDepositProductsTemplate.withHoldTax
|
||||
isMandatoryDeposit: this.fixedDepositProductsTemplate.isMandatoryDeposit,
|
||||
adjustAdvanceTowardsFuturePayments: this.fixedDepositProductsTemplate.adjustAdvanceTowardsFuturePayments,
|
||||
allowWithdrawal: this.fixedDepositProductsTemplate.allowWithdrawal,
|
||||
lockinPeriodFrequency: this.fixedDepositProductsTemplate.lockinPeriodFrequency,
|
||||
lockinPeriodFrequencyType: this.fixedDepositProductsTemplate.lockinPeriodFrequencyType
|
||||
? this.fixedDepositProductsTemplate.lockinPeriodFrequencyType.id
|
||||
: '',
|
||||
minDepositTerm: this.fixedDepositProductsTemplate.minDepositTerm,
|
||||
minDepositTermTypeId: this.fixedDepositProductsTemplate.minDepositTermType
|
||||
? this.fixedDepositProductsTemplate.minDepositTermType.id
|
||||
: '',
|
||||
inMultiplesOfDepositTerm: this.fixedDepositProductsTemplate.inMultiplesOfDepositTerm,
|
||||
inMultiplesOfDepositTermTypeId: this.fixedDepositProductsTemplate.inMultiplesOfDepositTermType
|
||||
? this.fixedDepositProductsTemplate.inMultiplesOfDepositTerm.id
|
||||
: '',
|
||||
maxDepositTerm: this.fixedDepositProductsTemplate.maxDepositTerm,
|
||||
maxDepositTermTypeId: this.fixedDepositProductsTemplate.maxDepositTermType
|
||||
? this.fixedDepositProductsTemplate.minDepositTermType.id
|
||||
: '',
|
||||
preClosurePenalApplicable: this.fixedDepositProductsTemplate.preClosurePenalApplicable,
|
||||
preClosurePenalInterest: this.fixedDepositProductsTemplate.preClosurePenalInterest,
|
||||
preClosurePenalInterestOnTypeId: this.fixedDepositProductsTemplate.preClosurePenalInterestOnType
|
||||
? this.fixedDepositProductsTemplate.preClosurePenalInterestOnType.id
|
||||
: '',
|
||||
withHoldTax: this.fixedDepositProductsTemplate.withHoldTax
|
||||
});
|
||||
}
|
||||
|
||||
if (this.fixedDepositProductsTemplate.withHoldTax) {
|
||||
this.fixedDepositProductSettingsForm.patchValue({
|
||||
'taxGroupId': this.fixedDepositProductsTemplate.taxGroup ? this.fixedDepositProductsTemplate.taxGroup.id : ''
|
||||
taxGroupId: this.fixedDepositProductsTemplate.taxGroup ? this.fixedDepositProductsTemplate.taxGroup.id : ''
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
createFixedDepositProductSettingsForm() {
|
||||
this.fixedDepositProductSettingsForm = this.formBuilder.group({
|
||||
'lockinPeriodFrequency': [''],
|
||||
'lockinPeriodFrequencyType': [''],
|
||||
'minDepositTerm': ['', Validators.required],
|
||||
'minDepositTermTypeId': ['', Validators.required],
|
||||
'inMultiplesOfDepositTerm': [''],
|
||||
'inMultiplesOfDepositTermTypeId': [''],
|
||||
'maxDepositTerm': [''],
|
||||
'maxDepositTermTypeId': [''],
|
||||
'preClosurePenalApplicable': [false],
|
||||
'preClosurePenalInterest': [''],
|
||||
'preClosurePenalInterestOnTypeId': [''],
|
||||
'withHoldTax': [false]
|
||||
lockinPeriodFrequency: [''],
|
||||
lockinPeriodFrequencyType: [''],
|
||||
minDepositTerm: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
minDepositTermTypeId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
inMultiplesOfDepositTerm: [''],
|
||||
inMultiplesOfDepositTermTypeId: [''],
|
||||
maxDepositTerm: [''],
|
||||
maxDepositTermTypeId: [''],
|
||||
preClosurePenalApplicable: [false],
|
||||
preClosurePenalInterest: [''],
|
||||
preClosurePenalInterestOnTypeId: [''],
|
||||
withHoldTax: [false]
|
||||
});
|
||||
}
|
||||
|
||||
setConditionalControls() {
|
||||
this.fixedDepositProductSettingsForm.get('withHoldTax').valueChanges
|
||||
.subscribe((withHoldTax: any) => {
|
||||
if (withHoldTax) {
|
||||
this.fixedDepositProductSettingsForm.addControl('taxGroupId', new UntypedFormControl('', Validators.required));
|
||||
} else {
|
||||
this.fixedDepositProductSettingsForm.removeControl('taxGroupId');
|
||||
}
|
||||
});
|
||||
this.fixedDepositProductSettingsForm.get('withHoldTax').valueChanges.subscribe((withHoldTax: any) => {
|
||||
if (withHoldTax) {
|
||||
this.fixedDepositProductSettingsForm.addControl('taxGroupId', new UntypedFormControl('', Validators.required));
|
||||
} else {
|
||||
this.fixedDepositProductSettingsForm.removeControl('taxGroupId');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get fixedDepositProductSettings() {
|
||||
@@ -93,5 +107,4 @@ export class FixedDepositProductSettingsStepComponent implements OnInit {
|
||||
}
|
||||
return fixedDepositProductSettings;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositProductTermsStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductTermsStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductTermsStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+31
-17
@@ -8,7 +8,6 @@ import { TooltipPosition } from '@angular/material/tooltip';
|
||||
styleUrls: ['./fixed-deposit-product-terms-step.component.scss']
|
||||
})
|
||||
export class FixedDepositProductTermsStepComponent implements OnInit {
|
||||
|
||||
@Input() fixedDepositProductsTemplate: any;
|
||||
|
||||
fixedDepositProductTermsForm: UntypedFormGroup;
|
||||
@@ -26,33 +25,49 @@ export class FixedDepositProductTermsStepComponent implements OnInit {
|
||||
this.interestCompoundingPeriodTypeData = this.fixedDepositProductsTemplate.interestCompoundingPeriodTypeOptions;
|
||||
this.interestPostingPeriodTypeData = this.fixedDepositProductsTemplate.interestPostingPeriodTypeOptions;
|
||||
this.interestCalculationTypeData = this.fixedDepositProductsTemplate.interestCalculationTypeOptions;
|
||||
this.interestCalculationDaysInYearTypeData = this.fixedDepositProductsTemplate.interestCalculationDaysInYearTypeOptions;
|
||||
this.interestCalculationDaysInYearTypeData =
|
||||
this.fixedDepositProductsTemplate.interestCalculationDaysInYearTypeOptions;
|
||||
|
||||
if (!(this.fixedDepositProductsTemplate === undefined) && this.fixedDepositProductsTemplate.id) {
|
||||
this.fixedDepositProductTermsForm.patchValue({
|
||||
'minDepositAmount': this.fixedDepositProductsTemplate.minDepositAmount,
|
||||
'depositAmount': this.fixedDepositProductsTemplate.depositAmount,
|
||||
'maxDepositAmount': this.fixedDepositProductsTemplate.maxDepositAmount,
|
||||
minDepositAmount: this.fixedDepositProductsTemplate.minDepositAmount,
|
||||
depositAmount: this.fixedDepositProductsTemplate.depositAmount,
|
||||
maxDepositAmount: this.fixedDepositProductsTemplate.maxDepositAmount
|
||||
});
|
||||
}
|
||||
|
||||
this.fixedDepositProductTermsForm.patchValue({
|
||||
'interestCompoundingPeriodType': this.fixedDepositProductsTemplate.interestCompoundingPeriodType.id,
|
||||
'interestPostingPeriodType': this.fixedDepositProductsTemplate.interestPostingPeriodType.id,
|
||||
'interestCalculationType': this.fixedDepositProductsTemplate.interestCalculationType.id,
|
||||
'interestCalculationDaysInYearType': this.fixedDepositProductsTemplate.interestCalculationDaysInYearType.id
|
||||
interestCompoundingPeriodType: this.fixedDepositProductsTemplate.interestCompoundingPeriodType.id,
|
||||
interestPostingPeriodType: this.fixedDepositProductsTemplate.interestPostingPeriodType.id,
|
||||
interestCalculationType: this.fixedDepositProductsTemplate.interestCalculationType.id,
|
||||
interestCalculationDaysInYearType: this.fixedDepositProductsTemplate.interestCalculationDaysInYearType.id
|
||||
});
|
||||
}
|
||||
|
||||
createFixedDepositProductTermsForm() {
|
||||
this.fixedDepositProductTermsForm = this.formBuilder.group({
|
||||
'minDepositAmount': [''],
|
||||
'depositAmount': ['', Validators.required],
|
||||
'maxDepositAmount': [''],
|
||||
'interestCompoundingPeriodType': ['', Validators.required],
|
||||
'interestPostingPeriodType': ['', Validators.required],
|
||||
'interestCalculationType': ['', Validators.required],
|
||||
'interestCalculationDaysInYearType': ['', Validators.required]
|
||||
minDepositAmount: [''],
|
||||
depositAmount: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
maxDepositAmount: [''],
|
||||
interestCompoundingPeriodType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
interestPostingPeriodType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
interestCalculationType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
interestCalculationDaysInYearType: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,5 +80,4 @@ export class FixedDepositProductTermsStepComponent implements OnInit {
|
||||
}
|
||||
return fixedDepositProductTerms;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,11 +13,10 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class FixedDepositProductResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
constructor(private productsService: ProductsService) { }
|
||||
constructor(private productsService: ProductsService) {}
|
||||
|
||||
/**
|
||||
* Returns the fixed deposit product data.
|
||||
@@ -27,5 +26,4 @@ export class FixedDepositProductResolver implements Resolve<Object> {
|
||||
const productId = route.parent.paramMap.get('productId');
|
||||
return this.productsService.getFixedDepositProduct(productId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import { ProductsService } from '../products.service';
|
||||
|
||||
@Injectable()
|
||||
export class FixedDepositProductsTemplateResolver implements Resolve<Object> {
|
||||
|
||||
constructor(private productsService: ProductsService) {}
|
||||
|
||||
/**
|
||||
@@ -20,5 +19,4 @@ export class FixedDepositProductsTemplateResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getFixedDepositProductsTemplate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('FixedDepositProductsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositProductsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositProductsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -21,11 +21,13 @@ import { ConfigurationWizardService } from '../../configuration-wizard/configura
|
||||
styleUrls: ['./fixed-deposit-products.component.scss']
|
||||
})
|
||||
export class FixedDepositProductsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Fixed deposit products data. */
|
||||
fixedDepositProductData: any;
|
||||
/** Columns to be displayed in fixed deposit products table. */
|
||||
displayedColumns: string[] = ['name', 'shortName'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'shortName'
|
||||
];
|
||||
/** Data source for fixed deposit products table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -50,11 +52,13 @@ export class FixedDepositProductsComponent implements OnInit, AfterViewInit {
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { fixedDepositProducts: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService
|
||||
) {
|
||||
this.route.data.subscribe((data: { fixedDepositProducts: any }) => {
|
||||
this.fixedDepositProductData = data.fixedDepositProducts;
|
||||
});
|
||||
}
|
||||
@@ -89,7 +93,12 @@ export class FixedDepositProductsComponent implements OnInit, AfterViewInit {
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showFixedDepositProductsPage === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonCreateFixedProduct, this.buttonCreateFixedProduct.nativeElement, 'bottom', true);
|
||||
this.showPopover(
|
||||
this.templateButtonCreateFixedProduct,
|
||||
this.buttonCreateFixedProduct.nativeElement,
|
||||
'bottom',
|
||||
true
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -107,7 +116,12 @@ export class FixedDepositProductsComponent implements OnInit, AfterViewInit {
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
showPopover(
|
||||
template: TemplateRef<any>,
|
||||
target: HTMLElement | ElementRef<any>,
|
||||
position: string,
|
||||
backdrop: boolean
|
||||
): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
@@ -130,5 +144,4 @@ export class FixedDepositProductsComponent implements OnInit, AfterViewInit {
|
||||
this.configurationWizardService.showFixedDepositProducts = true;
|
||||
this.router.navigate(['/products']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class FixedDepositProductsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class FixedDepositProductsResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getFixedDepositProducts();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositDatatableTabComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositDatatableTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositDatatableTabComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
-1
@@ -19,5 +19,4 @@ export class FixedDepositDatatableTabComponent {
|
||||
this.multiRowDatatableFlag = this.entityDatatable.columnHeaders[0].columnName === 'id' ? true : false;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FixedDepositGeneralTabComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositGeneralTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FixedDepositGeneralTabComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+34
-11
@@ -8,10 +8,10 @@ import { trigger, state, transition, animate, style } from '@angular/animations'
|
||||
styleUrls: ['./fixed-deposit-general-tab.component.scss'],
|
||||
animations: [
|
||||
trigger('expandChartSlab', [
|
||||
state('collapsed', style({height: '0px', minHeight: '0'})),
|
||||
state('expanded', style({height: '*'})),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))
|
||||
])
|
||||
state('collapsed', style({ height: '0px', minHeight: '0' })),
|
||||
state('expanded', style({ height: '*' })),
|
||||
transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)'))])
|
||||
|
||||
]
|
||||
})
|
||||
export class FixedDepositGeneralTabComponent {
|
||||
@@ -20,21 +20,44 @@ export class FixedDepositGeneralTabComponent {
|
||||
fixedDepositProductsTemplate: any;
|
||||
|
||||
chartSlabsIncentivesDisplayedColumns: string[] = ['incentives'];
|
||||
chartSlabsDisplayedColumns: string[] = ['period', 'amountRange', 'annualInterestRate', 'description', 'actions'];
|
||||
incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount'];
|
||||
chargesDisplayedColumns: string[] = ['name', 'type', 'amount', 'collectedon'];
|
||||
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId'];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId'];
|
||||
chartSlabsDisplayedColumns: string[] = [
|
||||
'period',
|
||||
'amountRange',
|
||||
'annualInterestRate',
|
||||
'description',
|
||||
'actions'
|
||||
];
|
||||
incentivesDisplayedColumns: string[] = [
|
||||
'entityType',
|
||||
'attributeName',
|
||||
'conditionType',
|
||||
'attributeValue',
|
||||
'incentiveType',
|
||||
'amount'
|
||||
];
|
||||
chargesDisplayedColumns: string[] = [
|
||||
'name',
|
||||
'type',
|
||||
'amount',
|
||||
'collectedon'
|
||||
];
|
||||
paymentFundSourceDisplayedColumns: string[] = [
|
||||
'paymentTypeId',
|
||||
'fundSourceAccountId'
|
||||
];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = [
|
||||
'chargeId',
|
||||
'incomeAccountId'
|
||||
];
|
||||
|
||||
/**
|
||||
* Retrieves the fixed deposit product data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: { fixedDepositProduct: any, fixedDepositProductsTemplate: any }) => {
|
||||
this.route.data.subscribe((data: { fixedDepositProduct: any; fixedDepositProductsTemplate: any }) => {
|
||||
this.fixedDepositProductData = data.fixedDepositProduct;
|
||||
this.fixedDepositProductsTemplate = data.fixedDepositProductsTemplate;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewFixedDepositProductComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewFixedDepositProductComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewFixedDepositProductComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
-3
@@ -10,9 +10,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
templateUrl: './view-fixed-deposit-product.component.html',
|
||||
styleUrls: ['./view-fixed-deposit-product.component.scss']
|
||||
})
|
||||
|
||||
export class ViewFixedDepositProductComponent {
|
||||
|
||||
fixedDepositDatatables: any = [];
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
@@ -25,5 +23,4 @@ export class ViewFixedDepositProductComponent {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateFloatingRateComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateFloatingRateComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateFloatingRateComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+46
-22
@@ -26,7 +26,6 @@ import { FloatingRatePeriodDialogComponent } from '../floating-rate-period-dialo
|
||||
styleUrls: ['./create-floating-rate.component.scss']
|
||||
})
|
||||
export class CreateFloatingRateComponent implements OnInit {
|
||||
|
||||
/** Floating Rate Period Data. */
|
||||
floatingRatePeriodsData: any[] = [];
|
||||
/** Minimum floating rate period date allowed. */
|
||||
@@ -34,7 +33,12 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
/** Floating Rate Form. */
|
||||
floatingRateForm: UntypedFormGroup;
|
||||
/** Columns to be displayed in floating rate periods table. */
|
||||
displayedColumns: string[] = ['fromDate', 'interestRate', 'isDifferential', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'fromDate',
|
||||
'interestRate',
|
||||
'isDifferential',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for floating rate periods table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Date Format. */
|
||||
@@ -55,14 +59,16 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private router: Router,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: TranslateService) { }
|
||||
constructor(
|
||||
private router: Router,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Sets the floating rate periods table.
|
||||
@@ -77,9 +83,12 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
*/
|
||||
createFloatingRateForm() {
|
||||
this.floatingRateForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required],
|
||||
'isBaseLendingRate': [false],
|
||||
'isActive': [false]
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
isBaseLendingRate: [false],
|
||||
isActive: [false]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -98,9 +107,15 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
*/
|
||||
createFloatingRatePeriodsForm(): UntypedFormGroup {
|
||||
return this.formBuilder.group({
|
||||
'fromDate': ['', Validators.required],
|
||||
'interestRate': ['', Validators.required],
|
||||
'isDifferentialToBaseLendingRate': [false]
|
||||
fromDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
interestRate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
isDifferentialToBaseLendingRate: [false]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -160,7 +175,12 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
*/
|
||||
deleteFloatingRatePeriod(ratePeriod: any) {
|
||||
const deleteFloatingRatePeriodRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.floating rate period with from date as') + ' ' + ratePeriod.fromDate }
|
||||
data: {
|
||||
deleteContext:
|
||||
this.translateService.instant('labels.inputs.floating rate period with from date as') +
|
||||
' ' +
|
||||
ratePeriod.fromDate
|
||||
}
|
||||
});
|
||||
deleteFloatingRatePeriodRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -176,10 +196,14 @@ export class CreateFloatingRateComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
this.floatingRateForm.value.ratePeriods = this.floatingRatePeriodsData;
|
||||
this.productsService.createFloatingRate(this.floatingRateForm.value)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.productsService.createFloatingRate(this.floatingRateForm.value).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditFloatingRateComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditFloatingRateComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditFloatingRateComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+40
-19
@@ -26,7 +26,6 @@ import { FloatingRatePeriodDialogComponent } from '../floating-rate-period-dialo
|
||||
styleUrls: ['./edit-floating-rate.component.scss']
|
||||
})
|
||||
export class EditFloatingRateComponent implements OnInit {
|
||||
|
||||
/** Floating Rate Form. */
|
||||
floatingRateForm: UntypedFormGroup;
|
||||
/** Floating Rate Data. */
|
||||
@@ -36,7 +35,12 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
/** Form Pristine Status. */
|
||||
isFloatingRateFormPristine = true;
|
||||
/** Columns to be displayed in floating rate periods table. */
|
||||
displayedColumns: string[] = ['fromDate', 'interestRate', 'isDifferential', 'actions'];
|
||||
displayedColumns: string[] = [
|
||||
'fromDate',
|
||||
'interestRate',
|
||||
'isDifferential',
|
||||
'actions'
|
||||
];
|
||||
/** Data source for floating rate periods table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
/** Date Format. */
|
||||
@@ -60,14 +64,16 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {TranslateService} translateService Translate Service.
|
||||
*/
|
||||
constructor(private router: Router,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private productsService: ProductsService,
|
||||
private route: ActivatedRoute,
|
||||
private dateUtils: Dates,
|
||||
private dialog: MatDialog,
|
||||
private settingsService: SettingsService,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.route.data.subscribe((data: { floatingRate: any }) => {
|
||||
this.floatingRateData = data.floatingRate;
|
||||
this.floatingRatePeriodsData = data.floatingRate.ratePeriods ? data.floatingRate.ratePeriods : [];
|
||||
@@ -87,9 +93,12 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
*/
|
||||
createFloatingRateForm() {
|
||||
this.floatingRateForm = this.formBuilder.group({
|
||||
'name': [this.floatingRateData.name, Validators.required],
|
||||
'isBaseLendingRate': [this.floatingRateData.isBaseLendingRate],
|
||||
'isActive': [this.floatingRateData.isActive]
|
||||
name: [
|
||||
this.floatingRateData.name,
|
||||
Validators.required
|
||||
],
|
||||
isBaseLendingRate: [this.floatingRateData.isBaseLendingRate],
|
||||
isActive: [this.floatingRateData.isActive]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -157,7 +166,12 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
*/
|
||||
deleteFloatingRatePeriod(ratePeriod: any) {
|
||||
const deleteFloatingRatePeriodRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.floating rate period with from date as') + ' ' + ratePeriod.fromDate }
|
||||
data: {
|
||||
deleteContext:
|
||||
this.translateService.instant('labels.inputs.floating rate period with from date as') +
|
||||
' ' +
|
||||
ratePeriod.fromDate
|
||||
}
|
||||
});
|
||||
deleteFloatingRatePeriodRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -173,7 +187,7 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
* if successful redirects to view created floating rate.
|
||||
*/
|
||||
submit() {
|
||||
this.floatingRatePeriodsData.map(floatingRatePeriod => {
|
||||
this.floatingRatePeriodsData.map((floatingRatePeriod) => {
|
||||
floatingRatePeriod.modifiedOn = undefined;
|
||||
floatingRatePeriod.createdOn = undefined;
|
||||
floatingRatePeriod.id = undefined;
|
||||
@@ -184,11 +198,18 @@ export class EditFloatingRateComponent implements OnInit {
|
||||
floatingRatePeriod.dateFormat = this.dateFormat;
|
||||
floatingRatePeriod.fromDate = this.dateUtils.formatDate(floatingRatePeriod.fromDate, this.dateFormat);
|
||||
});
|
||||
this.floatingRateForm.value.ratePeriods = this.floatingRatePeriodsData.length > 0 ? this.floatingRatePeriodsData : undefined;
|
||||
this.productsService.updateFloatingRate(this.route.snapshot.paramMap.get('id'), this.floatingRateForm.value)
|
||||
this.floatingRateForm.value.ratePeriods =
|
||||
this.floatingRatePeriodsData.length > 0 ? this.floatingRatePeriodsData : undefined;
|
||||
this.productsService
|
||||
.updateFloatingRate(this.route.snapshot.paramMap.get('id'), this.floatingRateForm.value)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
this.router.navigate(
|
||||
[
|
||||
'../../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('FloatingRatePeriodDialogComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FloatingRatePeriodDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FloatingRatePeriodDialogComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+17
-11
@@ -13,7 +13,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./floating-rate-period-dialog.component.scss']
|
||||
})
|
||||
export class FloatingRatePeriodDialogComponent implements OnInit {
|
||||
|
||||
/** Floating Rate Period Form. */
|
||||
floatingRatePeriodForm: UntypedFormGroup;
|
||||
/** Minimum floating rate period date allowed. */
|
||||
@@ -24,11 +23,12 @@ export class FloatingRatePeriodDialogComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {any} data Provides values for the form (if available).
|
||||
*/
|
||||
constructor(public dialogRef: MatDialogRef<FloatingRatePeriodDialogComponent>,
|
||||
public formBuilder: UntypedFormBuilder,
|
||||
private settingsService: SettingsService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
}
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<FloatingRatePeriodDialogComponent>,
|
||||
public formBuilder: UntypedFormBuilder,
|
||||
private settingsService: SettingsService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Creates the floating rate period form.
|
||||
@@ -36,16 +36,23 @@ export class FloatingRatePeriodDialogComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.minDate = this.settingsService.businessDate;
|
||||
let rowDisabled = false;
|
||||
if (this.data && (new Date(this.data.fromDate) < this.minDate)) {
|
||||
if (this.data && new Date(this.data.fromDate) < this.minDate) {
|
||||
rowDisabled = true;
|
||||
}
|
||||
if (this.data.isNew) {
|
||||
rowDisabled = false;
|
||||
}
|
||||
this.floatingRatePeriodForm = this.formBuilder.group({
|
||||
'fromDate': [{ value: this.data ? new Date(this.data.fromDate) : '', disabled: rowDisabled }, Validators.required],
|
||||
'interestRate': [{ value: this.data ? this.data.interestRate : '', disabled: rowDisabled }, Validators.required],
|
||||
'isDifferentialToBaseLendingRate': [{ value: this.data ? this.data.isDifferentialToBaseLendingRate : false, disabled: rowDisabled }]
|
||||
fromDate: [
|
||||
{ value: this.data ? new Date(this.data.fromDate) : '', disabled: rowDisabled },
|
||||
Validators.required
|
||||
],
|
||||
interestRate: [
|
||||
{ value: this.data ? this.data.interestRate : '', disabled: rowDisabled },
|
||||
Validators.required
|
||||
],
|
||||
isDifferentialToBaseLendingRate: [
|
||||
{ value: this.data ? this.data.isDifferentialToBaseLendingRate : false, disabled: rowDisabled }]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -55,5 +62,4 @@ export class FloatingRatePeriodDialogComponent implements OnInit {
|
||||
submit() {
|
||||
this.dialogRef.close(this.floatingRatePeriodForm.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class FloatingRateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class FloatingRateResolver implements Resolve<Object> {
|
||||
const floatingRateId = route.paramMap.get('id');
|
||||
return this.productsService.getFloatingRate(floatingRateId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('FloatingRatesComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FloatingRatesComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [FloatingRatesComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,11 +14,15 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
styleUrls: ['./floating-rates.component.scss']
|
||||
})
|
||||
export class FloatingRatesComponent implements OnInit {
|
||||
|
||||
/** Floating Rates data. */
|
||||
floatingRatesData: any;
|
||||
/** Columns to be displayed in floating rates table. */
|
||||
displayedColumns: string[] = ['name', 'createdBy', 'isBaseLendingRate', 'isActive'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'createdBy',
|
||||
'isBaseLendingRate',
|
||||
'isActive'
|
||||
];
|
||||
/** Data source for floating rates table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -32,10 +36,10 @@ export class FloatingRatesComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { floatingrates: any } ) => {
|
||||
this.route.data.subscribe((data: { floatingrates: any }) => {
|
||||
this.floatingRatesData = data.floatingrates;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters data in floating rates table based on passed value.
|
||||
@@ -56,9 +60,8 @@ export class FloatingRatesComponent implements OnInit {
|
||||
* Initializes the data source, paginator and sorter for floating rates table.
|
||||
*/
|
||||
setFloatingRates() {
|
||||
this.dataSource = new MatTableDataSource(this.floatingRatesData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource = new MatTableDataSource(this.floatingRatesData);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ProductsService } from '../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class FloatingRatesResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class FloatingRatesResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.productsService.getFloatingRates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('ViewFloatingRateComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewFloatingRateComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewFloatingRateComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,11 +14,14 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
styleUrls: ['./view-floating-rate.component.scss']
|
||||
})
|
||||
export class ViewFloatingRateComponent implements OnInit {
|
||||
|
||||
/** Floating Rate Data. */
|
||||
floatingRateData: any;
|
||||
/** Columns to be displayed in floating rate periods table. */
|
||||
displayedColumns: string[] = ['fromDate', 'interestRate', 'isDifferential'];
|
||||
displayedColumns: string[] = [
|
||||
'fromDate',
|
||||
'interestRate',
|
||||
'isDifferential'
|
||||
];
|
||||
/** Data source for floating rate periods table. */
|
||||
dataSource: MatTableDataSource<any>;
|
||||
|
||||
@@ -32,7 +35,7 @@ export class ViewFloatingRateComponent implements OnInit {
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe(( data: { floatingRate: any } ) => {
|
||||
this.route.data.subscribe((data: { floatingRate: any }) => {
|
||||
this.floatingRateData = data.floatingRate;
|
||||
});
|
||||
}
|
||||
@@ -48,9 +51,8 @@ export class ViewFloatingRateComponent implements OnInit {
|
||||
* Initializes the data source, paginator and sorter for floating rate periods table.
|
||||
*/
|
||||
setFloatingRates() {
|
||||
this.dataSource = new MatTableDataSource(this.floatingRateData.ratePeriods);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
this.dataSource = new MatTableDataSource(this.floatingRateData.ratePeriods);
|
||||
this.dataSource.paginator = this.paginator;
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductSummaryComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductSummaryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductSummaryComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(LoanProductSummaryComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
+189
-84
@@ -11,7 +11,11 @@ import {
|
||||
PaymentType,
|
||||
PaymentTypeOption
|
||||
} from '../../../../shared/models/general.model';
|
||||
import { AdvancePaymentAllocationData, CreditAllocation, PaymentAllocation } from '../../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
|
||||
import {
|
||||
AdvancePaymentAllocationData,
|
||||
CreditAllocation,
|
||||
PaymentAllocation
|
||||
} from '../../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
|
||||
import { LoanProducts } from '../../loan-products';
|
||||
import { CodeName, OptionData, StringEnumOptionData } from '../../../../shared/models/option-data.model';
|
||||
import { Accounting } from 'app/core/utils/accounting';
|
||||
@@ -22,7 +26,6 @@ import { Accounting } from 'app/core/utils/accounting';
|
||||
styleUrls: ['./loan-product-summary.component.scss']
|
||||
})
|
||||
export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
|
||||
@Input() action: string;
|
||||
@Input() loanProduct: LoanProduct;
|
||||
@Input() loanProductsTemplate: any | null;
|
||||
@@ -31,11 +34,31 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
@Input() creditAllocations: CreditAllocation | null;
|
||||
@Input() supportedInterestRefundTypes: StringEnumOptionData[] | null;
|
||||
|
||||
variationsDisplayedColumns: string[] = ['valueConditionType', 'borrowerCycleNumber', 'minValue', 'defaultValue', 'maxValue'];
|
||||
chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType'];
|
||||
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId'];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId'];
|
||||
chargeOffReasonExpenseDisplayedColumns: string[] = ['chargeOffReasonCodeValueId', 'expenseAccountId'];
|
||||
variationsDisplayedColumns: string[] = [
|
||||
'valueConditionType',
|
||||
'borrowerCycleNumber',
|
||||
'minValue',
|
||||
'defaultValue',
|
||||
'maxValue'
|
||||
];
|
||||
chargesDisplayedColumns: string[] = [
|
||||
'name',
|
||||
'chargeCalculationType',
|
||||
'amount',
|
||||
'chargeTimeType'
|
||||
];
|
||||
paymentFundSourceDisplayedColumns: string[] = [
|
||||
'paymentTypeId',
|
||||
'fundSourceAccountId'
|
||||
];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = [
|
||||
'chargeId',
|
||||
'incomeAccountId'
|
||||
];
|
||||
chargeOffReasonExpenseDisplayedColumns: string[] = [
|
||||
'chargeOffReasonCodeValueId',
|
||||
'expenseAccountId'
|
||||
];
|
||||
accountingRuleData: string[] = [];
|
||||
|
||||
isAdvancedPaymentAllocation = false;
|
||||
@@ -48,7 +71,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
penaltyToIncomeAccountMappings: ChargeToIncomeAccountMapping[] = [];
|
||||
chargeOffReasonToExpenseAccountMappings: ChargeOffReasonToExpenseAccountMapping[] = [];
|
||||
|
||||
constructor(private accounting: Accounting) { }
|
||||
constructor(private accounting: Accounting) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.accountingRuleData = this.accounting.getAccountingRulesForLoans();
|
||||
@@ -60,7 +83,9 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
setCurrentValues(): void {
|
||||
this.isAdvancedPaymentAllocation = LoanProducts.isAdvancedPaymentAllocationStrategy(this.loanProduct.transactionProcessingStrategyCode);
|
||||
this.isAdvancedPaymentAllocation = LoanProducts.isAdvancedPaymentAllocationStrategy(
|
||||
this.loanProduct.transactionProcessingStrategyCode
|
||||
);
|
||||
|
||||
if (!this.loanProduct.currency) {
|
||||
this.loanProductsTemplate.currencyOptions.some((o: any) => {
|
||||
@@ -76,40 +101,67 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
this.feeToIncomeAccountMappings = this.loanProduct.feeToIncomeAccountMappings || [];
|
||||
this.penaltyToIncomeAccountMappings = this.loanProduct.penaltyToIncomeAccountMappings || [];
|
||||
this.chargeOffReasonToExpenseAccountMappings = this.loanProduct.chargeOffReasonToExpenseAccountMappings || [];
|
||||
|
||||
} else {
|
||||
this.accountingMappings = {};
|
||||
|
||||
if ((this.loanProduct.accountingRule && this.loanProduct.accountingRule > 1) || this.loanProductsTemplate.accountingRule.value !== 'NONE') {
|
||||
if (
|
||||
(this.loanProduct.accountingRule && this.loanProduct.accountingRule > 1) ||
|
||||
this.loanProductsTemplate.accountingRule.value !== 'NONE'
|
||||
) {
|
||||
const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
|
||||
const incomeAccountData = this.loanProductsTemplate.accountingMappingOptions.incomeAccountOptions || [];
|
||||
const expenseAccountData = this.loanProductsTemplate.accountingMappingOptions.expenseAccountOptions || [];
|
||||
const liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
const assetAndLiabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions || [];
|
||||
const assetAndLiabilityAccountData =
|
||||
this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions || [];
|
||||
const chargeOffReasonOptions: any = this.loanProductsTemplate.chargeOffReasonOptions || [];
|
||||
|
||||
this.accountingMappings = {
|
||||
'fundSourceAccount': this.glAccountLookUp(this.loanProduct.fundSourceAccountId, assetAndLiabilityAccountData),
|
||||
'loanPortfolioAccount': this.glAccountLookUp(this.loanProduct.loanPortfolioAccountId, assetAccountData),
|
||||
'receivableInterestAccount': this.glAccountLookUp(this.loanProduct.receivableInterestAccountId, assetAccountData),
|
||||
'receivableFeeAccount': this.glAccountLookUp(this.loanProduct.receivableFeeAccountId, assetAccountData),
|
||||
'receivablePenaltyAccount': this.glAccountLookUp(this.loanProduct.receivablePenaltyAccountId, assetAccountData),
|
||||
'transfersInSuspenseAccount': this.glAccountLookUp(this.loanProduct.transfersInSuspenseAccountId, assetAccountData),
|
||||
fundSourceAccount: this.glAccountLookUp(this.loanProduct.fundSourceAccountId, assetAndLiabilityAccountData),
|
||||
loanPortfolioAccount: this.glAccountLookUp(this.loanProduct.loanPortfolioAccountId, assetAccountData),
|
||||
receivableInterestAccount: this.glAccountLookUp(
|
||||
this.loanProduct.receivableInterestAccountId,
|
||||
assetAccountData
|
||||
),
|
||||
receivableFeeAccount: this.glAccountLookUp(this.loanProduct.receivableFeeAccountId, assetAccountData),
|
||||
receivablePenaltyAccount: this.glAccountLookUp(this.loanProduct.receivablePenaltyAccountId, assetAccountData),
|
||||
transfersInSuspenseAccount: this.glAccountLookUp(
|
||||
this.loanProduct.transfersInSuspenseAccountId,
|
||||
assetAccountData
|
||||
),
|
||||
|
||||
'interestOnLoanAccount': this.glAccountLookUp(this.loanProduct.interestOnLoanAccountId, incomeAccountData),
|
||||
'incomeFromFeeAccount': this.glAccountLookUp(this.loanProduct.incomeFromFeeAccountId, incomeAccountData),
|
||||
'incomeFromPenaltyAccount': this.glAccountLookUp(this.loanProduct.incomeFromPenaltyAccountId, incomeAccountData),
|
||||
'incomeFromRecoveryAccount': this.glAccountLookUp(this.loanProduct.incomeFromRecoveryAccountId, incomeAccountData),
|
||||
'incomeFromChargeOffInterestAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffInterestAccountId, incomeAccountData),
|
||||
'incomeFromChargeOffFeesAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffFeesAccountId, incomeAccountData),
|
||||
'incomeFromChargeOffPenaltyAccount': this.glAccountLookUp(this.loanProduct.incomeFromChargeOffPenaltyAccountId, incomeAccountData),
|
||||
interestOnLoanAccount: this.glAccountLookUp(this.loanProduct.interestOnLoanAccountId, incomeAccountData),
|
||||
incomeFromFeeAccount: this.glAccountLookUp(this.loanProduct.incomeFromFeeAccountId, incomeAccountData),
|
||||
incomeFromPenaltyAccount: this.glAccountLookUp(
|
||||
this.loanProduct.incomeFromPenaltyAccountId,
|
||||
incomeAccountData
|
||||
),
|
||||
incomeFromRecoveryAccount: this.glAccountLookUp(
|
||||
this.loanProduct.incomeFromRecoveryAccountId,
|
||||
incomeAccountData
|
||||
),
|
||||
incomeFromChargeOffInterestAccount: this.glAccountLookUp(
|
||||
this.loanProduct.incomeFromChargeOffInterestAccountId,
|
||||
incomeAccountData
|
||||
),
|
||||
incomeFromChargeOffFeesAccount: this.glAccountLookUp(
|
||||
this.loanProduct.incomeFromChargeOffFeesAccountId,
|
||||
incomeAccountData
|
||||
),
|
||||
incomeFromChargeOffPenaltyAccount: this.glAccountLookUp(
|
||||
this.loanProduct.incomeFromChargeOffPenaltyAccountId,
|
||||
incomeAccountData
|
||||
),
|
||||
|
||||
'writeOffAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
|
||||
'goodwillCreditAccount': this.glAccountLookUp(this.loanProduct.goodwillCreditAccountId, expenseAccountData),
|
||||
'chargeOffExpenseAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
|
||||
'chargeOffFraudExpenseAccount': this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
|
||||
writeOffAccount: this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
|
||||
goodwillCreditAccount: this.glAccountLookUp(this.loanProduct.goodwillCreditAccountId, expenseAccountData),
|
||||
chargeOffExpenseAccount: this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
|
||||
chargeOffFraudExpenseAccount: this.glAccountLookUp(this.loanProduct.writeOffAccountId, expenseAccountData),
|
||||
|
||||
'overpaymentLiabilityAccount': this.glAccountLookUp(this.loanProduct.overpaymentLiabilityAccountId, liabilityAccountData),
|
||||
overpaymentLiabilityAccount: this.glAccountLookUp(
|
||||
this.loanProduct.overpaymentLiabilityAccountId,
|
||||
liabilityAccountData
|
||||
)
|
||||
};
|
||||
|
||||
this.paymentChannelToFundSourceMappings = [];
|
||||
@@ -145,106 +197,159 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
|
||||
this.chargeOffReasonToExpenseAccountMappings = [];
|
||||
if (this.loanProduct.chargeOffReasonToExpenseAccountMappings?.length > 0) {
|
||||
this.loanProduct.chargeOffReasonToExpenseAccountMappings.forEach((m: ChargeOffReasonToExpenseAccountMapping) => {
|
||||
let optionData = this.optionDataLookUp(m.chargeOffReasonCodeValueId, chargeOffReasonOptions);
|
||||
this.chargeOffReasonToExpenseAccountMappings.push({
|
||||
expenseAccount: this.glAccountLookUp(m.expenseAccountId, expenseAccountData),
|
||||
chargeOffReasonCodeValue: {
|
||||
id: optionData.id,
|
||||
name: optionData.value
|
||||
} as ChargeOffReasonCodeValue
|
||||
});
|
||||
});
|
||||
this.loanProduct.chargeOffReasonToExpenseAccountMappings.forEach(
|
||||
(m: ChargeOffReasonToExpenseAccountMapping) => {
|
||||
let optionData = this.optionDataLookUp(m.chargeOffReasonCodeValueId, chargeOffReasonOptions);
|
||||
this.chargeOffReasonToExpenseAccountMappings.push({
|
||||
expenseAccount: this.glAccountLookUp(m.expenseAccountId, expenseAccountData),
|
||||
chargeOffReasonCodeValue: {
|
||||
id: optionData.id,
|
||||
name: optionData.value
|
||||
} as ChargeOffReasonCodeValue
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.loanProduct.isInterestRecalculationEnabled) {
|
||||
this.loanProduct.interestRecalculationData = {
|
||||
interestRecalculationCompoundingType: this.optionDataLookUp(this.loanProduct.interestRecalculationCompoundingMethod,
|
||||
this.loanProductsTemplate.interestRecalculationCompoundingTypeOptions),
|
||||
rescheduleStrategyType: this.optionDataLookUp(this.loanProduct.rescheduleStrategyMethod,
|
||||
this.loanProductsTemplate.rescheduleStrategyTypeOptions),
|
||||
recalculationCompoundingFrequencyType: this.optionDataLookUp(this.loanProduct.recalculationCompoundingFrequencyType,
|
||||
this.loanProductsTemplate.interestRecalculationFrequencyTypeOptions),
|
||||
recalculationRestFrequencyType: this.optionDataLookUp(this.loanProduct.recalculationRestFrequencyType,
|
||||
this.loanProductsTemplate.interestRecalculationFrequencyTypeOptions),
|
||||
preClosureInterestCalculationStrategy: this.optionDataLookUp(this.loanProduct.preClosureInterestCalculationStrategy,
|
||||
this.loanProductsTemplate.preClosureInterestCalculationStrategyOptions),
|
||||
interestRecalculationCompoundingType: this.optionDataLookUp(
|
||||
this.loanProduct.interestRecalculationCompoundingMethod,
|
||||
this.loanProductsTemplate.interestRecalculationCompoundingTypeOptions
|
||||
),
|
||||
rescheduleStrategyType: this.optionDataLookUp(
|
||||
this.loanProduct.rescheduleStrategyMethod,
|
||||
this.loanProductsTemplate.rescheduleStrategyTypeOptions
|
||||
),
|
||||
recalculationCompoundingFrequencyType: this.optionDataLookUp(
|
||||
this.loanProduct.recalculationCompoundingFrequencyType,
|
||||
this.loanProductsTemplate.interestRecalculationFrequencyTypeOptions
|
||||
),
|
||||
recalculationRestFrequencyType: this.optionDataLookUp(
|
||||
this.loanProduct.recalculationRestFrequencyType,
|
||||
this.loanProductsTemplate.interestRecalculationFrequencyTypeOptions
|
||||
),
|
||||
preClosureInterestCalculationStrategy: this.optionDataLookUp(
|
||||
this.loanProduct.preClosureInterestCalculationStrategy,
|
||||
this.loanProductsTemplate.preClosureInterestCalculationStrategyOptions
|
||||
),
|
||||
allowCompoundingOnEod: this.loanProduct.allowCompoundingOnEod,
|
||||
isArrearsBasedOnOriginalSchedule: this.loanProduct.isArrearsBasedOnOriginalSchedule,
|
||||
isCompoundingToBePostedAsTransaction: this.loanProduct.isCompoundingToBePostedAsTransaction,
|
||||
recalculationRestFrequencyInterval: this.loanProduct.recalculationRestFrequencyInterval,
|
||||
disallowInterestCalculationOnPastDue: this.loanProduct.disallowInterestCalculationOnPastDue,
|
||||
disallowInterestCalculationOnPastDue: this.loanProduct.disallowInterestCalculationOnPastDue
|
||||
};
|
||||
}
|
||||
|
||||
let optionValue: OptionData = this.optionDataLookUp(this.loanProduct.amortizationType, this.loanProductsTemplate.amortizationTypeOptions);
|
||||
let optionValue: OptionData = this.optionDataLookUp(
|
||||
this.loanProduct.amortizationType,
|
||||
this.loanProductsTemplate.amortizationTypeOptions
|
||||
);
|
||||
this.loanProduct.amortizationType = optionValue;
|
||||
|
||||
optionValue = this.optionDataLookUp(this.loanProduct.interestType, this.loanProductsTemplate.interestTypeOptions);
|
||||
this.loanProduct.interestType = optionValue;
|
||||
|
||||
optionValue = this.optionDataLookUp(this.loanProduct.interestCalculationPeriodType, this.loanProductsTemplate.interestCalculationPeriodTypeOptions);
|
||||
optionValue = this.optionDataLookUp(
|
||||
this.loanProduct.interestCalculationPeriodType,
|
||||
this.loanProductsTemplate.interestCalculationPeriodTypeOptions
|
||||
);
|
||||
this.loanProduct.interestCalculationPeriodType = optionValue;
|
||||
|
||||
if (!this.loanProduct.repaymentFrequencyType || !this.loanProduct.repaymentFrequencyType.value) {
|
||||
optionValue = this.optionDataLookUp(this.loanProduct.repaymentFrequencyType, this.loanProductsTemplate.repaymentFrequencyTypeOptions);
|
||||
optionValue = this.optionDataLookUp(
|
||||
this.loanProduct.repaymentFrequencyType,
|
||||
this.loanProductsTemplate.repaymentFrequencyTypeOptions
|
||||
);
|
||||
this.loanProduct.repaymentFrequencyType = optionValue;
|
||||
}
|
||||
|
||||
optionValue = this.optionDataLookUp(this.loanProduct.daysInMonthType, this.loanProductsTemplate.daysInMonthTypeOptions);
|
||||
optionValue = this.optionDataLookUp(
|
||||
this.loanProduct.daysInMonthType,
|
||||
this.loanProductsTemplate.daysInMonthTypeOptions
|
||||
);
|
||||
this.loanProduct.daysInMonthType = optionValue;
|
||||
optionValue = this.optionDataLookUp(this.loanProduct.daysInYearType, this.loanProductsTemplate.daysInYearTypeOptions);
|
||||
optionValue = this.optionDataLookUp(
|
||||
this.loanProduct.daysInYearType,
|
||||
this.loanProductsTemplate.daysInYearTypeOptions
|
||||
);
|
||||
this.loanProduct.daysInYearType = optionValue;
|
||||
optionValue = this.optionDataLookUp(this.loanProduct.interestRateFrequencyType, this.loanProductsTemplate.interestRateFrequencyTypeOptions);
|
||||
optionValue = this.optionDataLookUp(
|
||||
this.loanProduct.interestRateFrequencyType,
|
||||
this.loanProductsTemplate.interestRateFrequencyTypeOptions
|
||||
);
|
||||
this.loanProduct.interestRateFrequencyType = optionValue;
|
||||
|
||||
optionValue = this.optionDataLookUp(this.loanProduct.repaymentStartDateType, this.loanProductsTemplate.repaymentStartDateTypeOptions);
|
||||
optionValue = this.optionDataLookUp(
|
||||
this.loanProduct.repaymentStartDateType,
|
||||
this.loanProductsTemplate.repaymentStartDateTypeOptions
|
||||
);
|
||||
this.loanProduct.repaymentStartDateType = optionValue;
|
||||
|
||||
if (this.loanProduct.delinquencyBucketId) {
|
||||
this.loanProduct.delinquencyBucket = this.delinquencyBucketLookUp(this.loanProduct.delinquencyBucketId, this.loanProductsTemplate.delinquencyBucketOptions);
|
||||
this.loanProduct.delinquencyBucket = this.delinquencyBucketLookUp(
|
||||
this.loanProduct.delinquencyBucketId,
|
||||
this.loanProductsTemplate.delinquencyBucketOptions
|
||||
);
|
||||
}
|
||||
|
||||
const codeValue: CodeName = this.codeNameLookUpByCode(this.loanProduct.transactionProcessingStrategyCode,
|
||||
this.loanProductsTemplate.transactionProcessingStrategyOptions);
|
||||
const codeValue: CodeName = this.codeNameLookUpByCode(
|
||||
this.loanProduct.transactionProcessingStrategyCode,
|
||||
this.loanProductsTemplate.transactionProcessingStrategyOptions
|
||||
);
|
||||
this.loanProduct.transactionProcessingStrategyName = codeValue.name;
|
||||
|
||||
if (!this.loanProduct.loanScheduleType || !this.loanProduct.loanScheduleType.value) {
|
||||
this.loanProduct.loanScheduleType = this.optionDataLookUpByCode(this.loanProduct.loanScheduleType,
|
||||
this.loanProductsTemplate.loanScheduleTypeOptions);
|
||||
this.loanProduct.loanScheduleType = this.optionDataLookUpByCode(
|
||||
this.loanProduct.loanScheduleType,
|
||||
this.loanProductsTemplate.loanScheduleTypeOptions
|
||||
);
|
||||
}
|
||||
|
||||
if (this.isAdvancedPaymentAllocation) {
|
||||
if (!this.loanProduct.loanScheduleProcessingType || !this.loanProduct.loanScheduleProcessingType.value) {
|
||||
this.loanProduct.loanScheduleProcessingType = this.optionDataLookUpByCode(this.loanProduct.loanScheduleProcessingType,
|
||||
this.loanProductsTemplate.loanScheduleProcessingTypeOptions);
|
||||
this.loanProduct.loanScheduleProcessingType = this.optionDataLookUpByCode(
|
||||
this.loanProduct.loanScheduleProcessingType,
|
||||
this.loanProductsTemplate.loanScheduleProcessingTypeOptions
|
||||
);
|
||||
}
|
||||
if (!this.loanProduct.chargeOffBehaviour.value) {
|
||||
this.loanProduct.chargeOffBehaviour = this.stringEnumOptionDataLookUp(this.loanProduct.chargeOffBehaviour, this.loanProductsTemplate.chargeOffBehaviourOptions);
|
||||
this.loanProduct.chargeOffBehaviour = this.stringEnumOptionDataLookUp(
|
||||
this.loanProduct.chargeOffBehaviour,
|
||||
this.loanProductsTemplate.chargeOffBehaviourOptions
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.loanProduct.advancedPaymentAllocationTransactionTypes) {
|
||||
const advancedAllocationTransactionTypes: OptionData[] = this.loanProduct.advancedPaymentAllocationTransactionTypes
|
||||
.concat(this.loanProduct.creditAllocationTransactionTypes);
|
||||
const advancedPaymentAllocationTypes: OptionData[] = this.loanProduct.advancedPaymentAllocationTypes
|
||||
.concat(this.loanProduct.creditAllocationAllocationTypes);
|
||||
const advancedAllocationTransactionTypes: OptionData[] =
|
||||
this.loanProduct.advancedPaymentAllocationTransactionTypes.concat(
|
||||
this.loanProduct.creditAllocationTransactionTypes
|
||||
);
|
||||
const advancedPaymentAllocationTypes: OptionData[] = this.loanProduct.advancedPaymentAllocationTypes.concat(
|
||||
this.loanProduct.creditAllocationAllocationTypes
|
||||
);
|
||||
this.advancePaymentAllocationData = {
|
||||
transactionTypes: advancedAllocationTransactionTypes,
|
||||
allocationTypes: advancedPaymentAllocationTypes,
|
||||
futureInstallmentAllocationRules: this.loanProduct.advancedPaymentAllocationFutureInstallmentAllocationRules
|
||||
};
|
||||
} else {
|
||||
const advancedAllocationTransactionTypes: OptionData[] = this.loanProductsTemplate.advancedPaymentAllocationTransactionTypes
|
||||
.concat(this.loanProductsTemplate.creditAllocationTransactionTypes);
|
||||
const advancedPaymentAllocationTypes: OptionData[] = this.loanProductsTemplate.advancedPaymentAllocationTypes
|
||||
.concat(this.loanProductsTemplate.creditAllocationAllocationTypes);
|
||||
const advancedAllocationTransactionTypes: OptionData[] =
|
||||
this.loanProductsTemplate.advancedPaymentAllocationTransactionTypes.concat(
|
||||
this.loanProductsTemplate.creditAllocationTransactionTypes
|
||||
);
|
||||
const advancedPaymentAllocationTypes: OptionData[] =
|
||||
this.loanProductsTemplate.advancedPaymentAllocationTypes.concat(
|
||||
this.loanProductsTemplate.creditAllocationAllocationTypes
|
||||
);
|
||||
this.advancePaymentAllocationData = {
|
||||
transactionTypes: advancedAllocationTransactionTypes,
|
||||
allocationTypes: advancedPaymentAllocationTypes,
|
||||
futureInstallmentAllocationRules: this.loanProductsTemplate.advancedPaymentAllocationFutureInstallmentAllocationRules
|
||||
futureInstallmentAllocationRules:
|
||||
this.loanProductsTemplate.advancedPaymentAllocationFutureInstallmentAllocationRules
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -357,8 +462,7 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
accountingRule(): number {
|
||||
return this.loanProduct.accountingRule.id ?
|
||||
this.loanProduct.accountingRule.id : this.loanProduct.accountingRule;
|
||||
return this.loanProduct.accountingRule.id ? this.loanProduct.accountingRule.id : this.loanProduct.accountingRule;
|
||||
}
|
||||
|
||||
get isAccountingAccrualBased(): boolean {
|
||||
@@ -366,14 +470,16 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
isAccountingEnabled(): boolean {
|
||||
return (this.accountingRule() >= 2);
|
||||
return this.accountingRule() >= 2;
|
||||
}
|
||||
|
||||
isAdvancedAccountingEnabled(): boolean {
|
||||
return (this.loanProduct.paymentChannelToFundSourceMappings?.length > 0
|
||||
|| this.loanProduct.feeToIncomeAccountMappings?.length > 0
|
||||
|| this.loanProduct.penaltyToIncomeAccountMappings?.length > 0
|
||||
|| this.loanProduct.chargeOffReasonToExpenseAccountMappings?.length > 0);
|
||||
return (
|
||||
this.loanProduct.paymentChannelToFundSourceMappings?.length > 0 ||
|
||||
this.loanProduct.feeToIncomeAccountMappings?.length > 0 ||
|
||||
this.loanProduct.penaltyToIncomeAccountMappings?.length > 0 ||
|
||||
this.loanProduct.chargeOffReasonToExpenseAccountMappings?.length > 0
|
||||
);
|
||||
}
|
||||
|
||||
getAccountingRuleName(value: string): string {
|
||||
@@ -381,7 +487,6 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
mapHumanReadableValueStringEnumOptionDataList(incomingParameter: StringEnumOptionData[]): string[] {
|
||||
return incomingParameter.map(v => v.value);
|
||||
return incomingParameter.map((v) => v.value);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('CreateLoanProductComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateLoanProductComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateLoanProductComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+46
-27
@@ -14,7 +14,11 @@ import { LoanProductInterestRefundStepComponent } from '../loan-product-stepper/
|
||||
/** Custom Services */
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { LoanProducts } from '../loan-products';
|
||||
import { AdvancedPaymentAllocation, AdvancedPaymentStrategy, PaymentAllocation } from '../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
|
||||
import {
|
||||
AdvancedPaymentAllocation,
|
||||
AdvancedPaymentStrategy,
|
||||
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';
|
||||
|
||||
@@ -24,14 +28,17 @@ import { StringEnumOptionData } from '../../../shared/models/option-data.model';
|
||||
styleUrls: ['./create-loan-product.component.scss']
|
||||
})
|
||||
export class CreateLoanProductComponent implements OnInit {
|
||||
|
||||
@ViewChild(LoanProductDetailsStepComponent, { static: true }) loanProductDetailsStep: LoanProductDetailsStepComponent;
|
||||
@ViewChild(LoanProductCurrencyStepComponent, { static: true }) loanProductCurrencyStep: LoanProductCurrencyStepComponent;
|
||||
@ViewChild(LoanProductInterestRefundStepComponent, {static: true}) loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
|
||||
@ViewChild(LoanProductCurrencyStepComponent, { static: true })
|
||||
loanProductCurrencyStep: LoanProductCurrencyStepComponent;
|
||||
@ViewChild(LoanProductInterestRefundStepComponent, { static: true })
|
||||
loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
|
||||
@ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent;
|
||||
@ViewChild(LoanProductSettingsStepComponent, { static: true }) loanProductSettingsStep: LoanProductSettingsStepComponent;
|
||||
@ViewChild(LoanProductSettingsStepComponent, { static: true })
|
||||
loanProductSettingsStep: LoanProductSettingsStepComponent;
|
||||
@ViewChild(LoanProductChargesStepComponent, { static: true }) loanProductChargesStep: LoanProductChargesStepComponent;
|
||||
@ViewChild(LoanProductAccountingStepComponent, { static: true }) loanProductAccountingStep: LoanProductAccountingStepComponent;
|
||||
@ViewChild(LoanProductAccountingStepComponent, { static: true })
|
||||
loanProductAccountingStep: LoanProductAccountingStepComponent;
|
||||
|
||||
loanProductsTemplate: any;
|
||||
accountingRuleData: string[] = [];
|
||||
@@ -44,23 +51,26 @@ export class CreateLoanProductComponent implements OnInit {
|
||||
advancedPaymentAllocations: AdvancedPaymentAllocation[] = [];
|
||||
advancedCreditAllocations: AdvancedPaymentAllocation[] = [];
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Product Service.
|
||||
* @param {LoanProducts} loanProducts LoanProducts
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private loanProducts: LoanProducts,
|
||||
private router: Router,
|
||||
private accounting: Accounting,
|
||||
private advancedPaymentStrategy: AdvancedPaymentStrategy) {
|
||||
this.route.data.subscribe((data: { loanProductsTemplate: any, configurations: any }) => {
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {ProductsService} productsService Product Service.
|
||||
* @param {LoanProducts} loanProducts LoanProducts
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private loanProducts: LoanProducts,
|
||||
private router: Router,
|
||||
private accounting: Accounting,
|
||||
private advancedPaymentStrategy: AdvancedPaymentStrategy
|
||||
) {
|
||||
this.route.data.subscribe((data: { loanProductsTemplate: any; configurations: any }) => {
|
||||
this.loanProductsTemplate = data.loanProductsTemplate;
|
||||
const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
|
||||
const liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
|
||||
this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions =
|
||||
assetAccountData.concat(liabilityAccountData);
|
||||
|
||||
this.itemsByDefault = loanProducts.setItemsByDefault(data.configurations);
|
||||
this.loanProductsTemplate['itemsByDefault'] = this.itemsByDefault;
|
||||
@@ -98,7 +108,9 @@ export class CreateLoanProductComponent implements OnInit {
|
||||
}
|
||||
|
||||
buildAdvancedPaymentAllocation(): void {
|
||||
this.advancedPaymentAllocations = this.advancedPaymentStrategy.buildAdvancedPaymentAllocationList(this.loanProductsTemplate);
|
||||
this.advancedPaymentAllocations = this.advancedPaymentStrategy.buildAdvancedPaymentAllocationList(
|
||||
this.loanProductsTemplate
|
||||
);
|
||||
}
|
||||
|
||||
setPaymentAllocation(paymentAllocation: PaymentAllocation[]): void {
|
||||
@@ -155,22 +167,29 @@ export class CreateLoanProductComponent implements OnInit {
|
||||
loanProduct['overDueDaysForRepaymentEvent'] = null;
|
||||
}
|
||||
if (this.isAdvancedPaymentStrategy) {
|
||||
loanProduct['supportedInterestRefundTypes'] = this.mapStringEnumOptionToIdList(loanProduct['supportedInterestRefundTypes']);
|
||||
loanProduct['supportedInterestRefundTypes'] = this.mapStringEnumOptionToIdList(
|
||||
loanProduct['supportedInterestRefundTypes']
|
||||
);
|
||||
} else {
|
||||
delete loanProduct['supportedInterestRefundTypes'];
|
||||
}
|
||||
delete loanProduct['useDueForRepaymentsConfigurations'];
|
||||
|
||||
this.productsService.createLoanProduct(loanProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.productsService.createLoanProduct(loanProduct).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
mapStringEnumOptionToIdList(incomingValues: StringEnumOptionData[]): string[] {
|
||||
if (!incomingValues) {
|
||||
return [];
|
||||
}
|
||||
return incomingValues.map(v => v.id);
|
||||
return incomingValues.map((v) => v.id);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('EditLoanProductComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditLoanProductComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditLoanProductComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -14,7 +14,13 @@ import { LoanProductAccountingStepComponent } from '../loan-product-stepper/loan
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { GlobalConfiguration } from 'app/system/configurations/global-configurations-tab/configuration.model';
|
||||
import { LoanProducts } from '../loan-products';
|
||||
import { AdvancedCreditAllocation, AdvancedPaymentAllocation, AdvancedPaymentStrategy, CreditAllocation, PaymentAllocation } from '../loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model';
|
||||
import {
|
||||
AdvancedCreditAllocation,
|
||||
AdvancedPaymentAllocation,
|
||||
AdvancedPaymentStrategy,
|
||||
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';
|
||||
@@ -25,14 +31,17 @@ import { StringEnumOptionData } from '../../../shared/models/option-data.model';
|
||||
styleUrls: ['./edit-loan-product.component.scss']
|
||||
})
|
||||
export class EditLoanProductComponent implements OnInit {
|
||||
|
||||
@ViewChild(LoanProductDetailsStepComponent, { static: true }) loanProductDetailsStep: LoanProductDetailsStepComponent;
|
||||
@ViewChild(LoanProductCurrencyStepComponent, { static: true }) loanProductCurrencyStep: LoanProductCurrencyStepComponent;
|
||||
@ViewChild(LoanProductInterestRefundStepComponent, { static: true }) loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
|
||||
@ViewChild(LoanProductCurrencyStepComponent, { static: true })
|
||||
loanProductCurrencyStep: LoanProductCurrencyStepComponent;
|
||||
@ViewChild(LoanProductInterestRefundStepComponent, { static: true })
|
||||
loanProductInterestRefundStep: LoanProductInterestRefundStepComponent;
|
||||
@ViewChild(LoanProductTermsStepComponent, { static: true }) loanProductTermsStep: LoanProductTermsStepComponent;
|
||||
@ViewChild(LoanProductSettingsStepComponent, { static: true }) loanProductSettingsStep: LoanProductSettingsStepComponent;
|
||||
@ViewChild(LoanProductSettingsStepComponent, { static: true })
|
||||
loanProductSettingsStep: LoanProductSettingsStepComponent;
|
||||
@ViewChild(LoanProductChargesStepComponent, { static: true }) loanProductChargesStep: LoanProductChargesStepComponent;
|
||||
@ViewChild(LoanProductAccountingStepComponent, { static: true }) loanProductAccountingStep: LoanProductAccountingStepComponent;
|
||||
@ViewChild(LoanProductAccountingStepComponent, { static: true })
|
||||
loanProductAccountingStep: LoanProductAccountingStepComponent;
|
||||
|
||||
loanProductAndTemplate: any;
|
||||
accountingRuleData: string[] = [];
|
||||
@@ -53,17 +62,20 @@ export class EditLoanProductComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
*/
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private loanProducts: LoanProducts,
|
||||
private router: Router,
|
||||
private accounting: Accounting,
|
||||
private advancedPaymentStrategy: AdvancedPaymentStrategy) {
|
||||
this.route.data.subscribe((data: { loanProductAndTemplate: any, configurations: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private productsService: ProductsService,
|
||||
private loanProducts: LoanProducts,
|
||||
private router: Router,
|
||||
private accounting: Accounting,
|
||||
private advancedPaymentStrategy: AdvancedPaymentStrategy
|
||||
) {
|
||||
this.route.data.subscribe((data: { loanProductAndTemplate: any; configurations: any }) => {
|
||||
this.loanProductAndTemplate = data.loanProductAndTemplate;
|
||||
const assetAccountData = this.loanProductAndTemplate.accountingMappingOptions.assetAccountOptions || [];
|
||||
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.loanProductAndTemplate['itemsByDefault'] = this.itemsByDefault;
|
||||
@@ -108,8 +120,12 @@ export class EditLoanProductComponent implements OnInit {
|
||||
}
|
||||
|
||||
buildAdvancedPaymentAllocation(): void {
|
||||
this.advancedPaymentAllocations = this.advancedPaymentStrategy.buildAdvancedPaymentAllocationList(this.loanProductAndTemplate);
|
||||
this.advancedCreditAllocations = this.advancedPaymentStrategy.buildAdvancedCreditAllocationList(this.loanProductAndTemplate);
|
||||
this.advancedPaymentAllocations = this.advancedPaymentStrategy.buildAdvancedPaymentAllocationList(
|
||||
this.loanProductAndTemplate
|
||||
);
|
||||
this.advancedCreditAllocations = this.advancedPaymentStrategy.buildAdvancedCreditAllocationList(
|
||||
this.loanProductAndTemplate
|
||||
);
|
||||
}
|
||||
|
||||
setPaymentAllocation(paymentAllocation: PaymentAllocation[]): void {
|
||||
@@ -141,15 +157,13 @@ export class EditLoanProductComponent implements OnInit {
|
||||
this.loanProductTermsForm.valid &&
|
||||
this.loanProductSettingsForm.valid &&
|
||||
this.loanProductAccountingForm.valid &&
|
||||
(
|
||||
!this.loanProductDetailsForm.pristine ||
|
||||
(!this.loanProductDetailsForm.pristine ||
|
||||
!this.loanProductCurrencyForm.pristine ||
|
||||
!this.loanProductTermsForm.pristine ||
|
||||
!this.loanProductSettingsForm.pristine ||
|
||||
!this.loanProductChargesStep.pristine ||
|
||||
!this.loanProductAccountingForm.pristine ||
|
||||
this.wasPaymentAllocationChanged
|
||||
)
|
||||
this.wasPaymentAllocationChanged)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -181,20 +195,26 @@ export class EditLoanProductComponent implements OnInit {
|
||||
loanProduct['overDueDaysForRepaymentEvent'] = null;
|
||||
}
|
||||
if (this.isAdvancedPaymentStrategy) {
|
||||
loanProduct['supportedInterestRefundTypes'] = this.mapStringEnumOptionToIdList(loanProduct['supportedInterestRefundTypes']);
|
||||
loanProduct['supportedInterestRefundTypes'] = this.mapStringEnumOptionToIdList(
|
||||
loanProduct['supportedInterestRefundTypes']
|
||||
);
|
||||
} else {
|
||||
delete loanProduct['supportedInterestRefundTypes'];
|
||||
}
|
||||
delete loanProduct['useDueForRepaymentsConfigurations'];
|
||||
|
||||
this.productsService.updateLoanProduct(this.loanProductAndTemplate.id, loanProduct)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../', response.resourceId], { relativeTo: this.route });
|
||||
});
|
||||
this.productsService.updateLoanProduct(this.loanProductAndTemplate.id, loanProduct).subscribe((response: any) => {
|
||||
this.router.navigate(
|
||||
[
|
||||
'../../',
|
||||
response.resourceId
|
||||
],
|
||||
{ relativeTo: this.route }
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
mapStringEnumOptionToIdList(incomingValues: StringEnumOptionData[]): string[] {
|
||||
return incomingValues.map(v => v.id);
|
||||
return incomingValues.map((v) => v.id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ProductsService } from '../../products.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class LoanProductAndTemplateResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ProductsService} productsService Products service.
|
||||
*/
|
||||
@@ -27,5 +26,4 @@ export class LoanProductAndTemplateResolver implements Resolve<Object> {
|
||||
const loanProductId = route.parent.paramMap.get('productId');
|
||||
return this.productsService.getLoanProduct(loanProductId, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,11 +7,10 @@ import { Observable } from 'rxjs';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoanProductDatatableResolver implements Resolve<boolean> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService Products service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) { }
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the loan product data.
|
||||
@@ -22,5 +21,4 @@ export class LoanProductDatatableResolver implements Resolve<boolean> {
|
||||
const datatableName = route.paramMap.get('datatableName');
|
||||
return this.systemService.getEntityDatatable(productId, datatableName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,11 +7,10 @@ import { Observable } from 'rxjs';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class LoanProductDatatablesResolver implements Resolve<boolean> {
|
||||
|
||||
/**
|
||||
* @param {SystemService} systemService Products service.
|
||||
*/
|
||||
constructor(private systemService: SystemService) { }
|
||||
constructor(private systemService: SystemService) {}
|
||||
|
||||
/**
|
||||
* Returns the loan product data.
|
||||
|
||||
+10
-2
@@ -302,7 +302,11 @@
|
||||
>
|
||||
<fa-icon icon="edit"></fa-icon>
|
||||
</button>
|
||||
<button mat-icon-button color="warn" (click)="delete('PaymentFundSource', paymentChannelToFundSourceMappings, i)">
|
||||
<button
|
||||
mat-icon-button
|
||||
color="warn"
|
||||
(click)="delete('PaymentFundSource', paymentChannelToFundSourceMappings, i)"
|
||||
>
|
||||
<fa-icon icon="trash"></fa-icon>
|
||||
</button>
|
||||
</td>
|
||||
@@ -467,7 +471,11 @@
|
||||
>
|
||||
<fa-icon icon="edit"></fa-icon>
|
||||
</button>
|
||||
<button mat-icon-button color="warn" (click)="delete('ChargeOffReasonExpense', chargeOffReasonToExpenseAccountMappings, i)">
|
||||
<button
|
||||
mat-icon-button
|
||||
color="warn"
|
||||
(click)="delete('ChargeOffReasonExpense', chargeOffReasonToExpenseAccountMappings, i)"
|
||||
>
|
||||
<fa-icon icon="trash"></fa-icon>
|
||||
</button>
|
||||
</td>
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductAccountingStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductAccountingStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductAccountingStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+268
-124
@@ -16,7 +16,6 @@ import { ChargeOffReasonToExpenseAccountMapping } from 'app/shared/models/genera
|
||||
styleUrls: ['./loan-product-accounting-step.component.scss']
|
||||
})
|
||||
export class LoanProductAccountingStepComponent implements OnInit {
|
||||
|
||||
@Input() loanProductsTemplate: any;
|
||||
@Input() accountingRuleData: any;
|
||||
@Input() loanProductFormValid: boolean;
|
||||
@@ -37,13 +36,27 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
currentFormValues: any[] = [];
|
||||
allowAddChargeOffReasonExpense = true;
|
||||
|
||||
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId', 'actions'];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId', 'actions'];
|
||||
chargeOffReasonExpenseDisplayedColumns: string[] = ['chargeOffReasonCodeValueId', 'expenseAccountId', 'actions'];
|
||||
paymentFundSourceDisplayedColumns: string[] = [
|
||||
'paymentTypeId',
|
||||
'fundSourceAccountId',
|
||||
'actions'
|
||||
];
|
||||
feesPenaltyIncomeDisplayedColumns: string[] = [
|
||||
'chargeId',
|
||||
'incomeAccountId',
|
||||
'actions'
|
||||
];
|
||||
chargeOffReasonExpenseDisplayedColumns: string[] = [
|
||||
'chargeOffReasonCodeValueId',
|
||||
'expenseAccountId',
|
||||
'actions'
|
||||
];
|
||||
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.createLoanProductAccountingForm();
|
||||
this.setConditionalControls();
|
||||
}
|
||||
@@ -57,11 +70,12 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
this.expenseAccountData = this.loanProductsTemplate.accountingMappingOptions.expenseAccountOptions || [];
|
||||
this.liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
|
||||
this.incomeAndLiabilityAccountData = this.incomeAccountData.concat(this.liabilityAccountData);
|
||||
this.assetAndLiabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions || [];
|
||||
this.assetAndLiabilityAccountData =
|
||||
this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions || [];
|
||||
this.chargeOffReasonOptions = this.loanProductsTemplate.chargeOffReasonOptions || [];
|
||||
|
||||
this.loanProductAccountingForm.patchValue({
|
||||
'accountingRule': this.loanProductsTemplate.accountingRule.id
|
||||
accountingRule: this.loanProductsTemplate.accountingRule.id
|
||||
});
|
||||
|
||||
const accountingMappings = this.loanProductsTemplate.accountingMappings;
|
||||
@@ -69,130 +83,244 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
case 3:
|
||||
case 4:
|
||||
this.loanProductAccountingForm.patchValue({
|
||||
'receivableInterestAccountId': accountingMappings.receivableInterestAccount.id,
|
||||
'receivableFeeAccountId': accountingMappings.receivableFeeAccount.id,
|
||||
'receivablePenaltyAccountId': accountingMappings.receivablePenaltyAccount.id,
|
||||
receivableInterestAccountId: accountingMappings.receivableInterestAccount.id,
|
||||
receivableFeeAccountId: accountingMappings.receivableFeeAccount.id,
|
||||
receivablePenaltyAccountId: accountingMappings.receivablePenaltyAccount.id
|
||||
});
|
||||
this.loanProductAccountingForm.patchValue({
|
||||
'enableAccrualActivityPosting': this.loanProductsTemplate.enableAccrualActivityPosting
|
||||
enableAccrualActivityPosting: this.loanProductsTemplate.enableAccrualActivityPosting
|
||||
});
|
||||
/* falls through */
|
||||
/* falls through */
|
||||
case 2:
|
||||
this.loanProductAccountingForm.patchValue({
|
||||
'fundSourceAccountId': accountingMappings.fundSourceAccount.id,
|
||||
'loanPortfolioAccountId': accountingMappings.loanPortfolioAccount.id,
|
||||
'transfersInSuspenseAccountId': accountingMappings.transfersInSuspenseAccount.id,
|
||||
'interestOnLoanAccountId': accountingMappings.interestOnLoanAccount.id,
|
||||
'incomeFromFeeAccountId': accountingMappings.incomeFromFeeAccount.id,
|
||||
'incomeFromPenaltyAccountId': accountingMappings.incomeFromPenaltyAccount.id,
|
||||
'incomeFromRecoveryAccountId': accountingMappings.incomeFromRecoveryAccount.id,
|
||||
'writeOffAccountId': accountingMappings.writeOffAccount.id,
|
||||
'goodwillCreditAccountId': accountingMappings.goodwillCreditAccount.id,
|
||||
'overpaymentLiabilityAccountId': accountingMappings.overpaymentLiabilityAccount.id,
|
||||
'chargeOffFraudExpenseAccountId': accountingMappings.chargeOffFraudExpenseAccount ? accountingMappings.chargeOffFraudExpenseAccount.id : '',
|
||||
'chargeOffExpenseAccountId': accountingMappings.chargeOffExpenseAccount ? accountingMappings.chargeOffExpenseAccount.id : '',
|
||||
'incomeFromChargeOffPenaltyAccountId': accountingMappings.incomeFromChargeOffPenaltyAccount ? accountingMappings.incomeFromChargeOffPenaltyAccount.id : '',
|
||||
'incomeFromChargeOffFeesAccountId': accountingMappings.incomeFromChargeOffFeesAccount ? accountingMappings.incomeFromChargeOffFeesAccount.id : '',
|
||||
'incomeFromChargeOffInterestAccountId': accountingMappings.incomeFromChargeOffInterestAccount ? accountingMappings.incomeFromChargeOffInterestAccount.id : '',
|
||||
'incomeFromGoodwillCreditInterestAccountId': accountingMappings.incomeFromGoodwillCreditInterestAccount ? accountingMappings.incomeFromGoodwillCreditInterestAccount.id : '',
|
||||
'incomeFromGoodwillCreditFeesAccountId': accountingMappings.incomeFromGoodwillCreditFeesAccount ? accountingMappings.incomeFromGoodwillCreditFeesAccount.id : '',
|
||||
'incomeFromGoodwillCreditPenaltyAccountId': accountingMappings.incomeFromGoodwillCreditPenaltyAccount ? accountingMappings.incomeFromGoodwillCreditPenaltyAccount.id : '',
|
||||
'advancedAccountingRules': (this.loanProductsTemplate.paymentChannelToFundSourceMappings || this.loanProductsTemplate.feeToIncomeAccountMappings || this.loanProductsTemplate.penaltyToIncomeAccountMappings || this.loanProductsTemplate.chargeOffReasonToExpenseAccountMappings) ? true : false
|
||||
fundSourceAccountId: accountingMappings.fundSourceAccount.id,
|
||||
loanPortfolioAccountId: accountingMappings.loanPortfolioAccount.id,
|
||||
transfersInSuspenseAccountId: accountingMappings.transfersInSuspenseAccount.id,
|
||||
interestOnLoanAccountId: accountingMappings.interestOnLoanAccount.id,
|
||||
incomeFromFeeAccountId: accountingMappings.incomeFromFeeAccount.id,
|
||||
incomeFromPenaltyAccountId: accountingMappings.incomeFromPenaltyAccount.id,
|
||||
incomeFromRecoveryAccountId: accountingMappings.incomeFromRecoveryAccount.id,
|
||||
writeOffAccountId: accountingMappings.writeOffAccount.id,
|
||||
goodwillCreditAccountId: accountingMappings.goodwillCreditAccount.id,
|
||||
overpaymentLiabilityAccountId: accountingMappings.overpaymentLiabilityAccount.id,
|
||||
chargeOffFraudExpenseAccountId: accountingMappings.chargeOffFraudExpenseAccount
|
||||
? accountingMappings.chargeOffFraudExpenseAccount.id
|
||||
: '',
|
||||
chargeOffExpenseAccountId: accountingMappings.chargeOffExpenseAccount
|
||||
? accountingMappings.chargeOffExpenseAccount.id
|
||||
: '',
|
||||
incomeFromChargeOffPenaltyAccountId: accountingMappings.incomeFromChargeOffPenaltyAccount
|
||||
? accountingMappings.incomeFromChargeOffPenaltyAccount.id
|
||||
: '',
|
||||
incomeFromChargeOffFeesAccountId: accountingMappings.incomeFromChargeOffFeesAccount
|
||||
? accountingMappings.incomeFromChargeOffFeesAccount.id
|
||||
: '',
|
||||
incomeFromChargeOffInterestAccountId: accountingMappings.incomeFromChargeOffInterestAccount
|
||||
? accountingMappings.incomeFromChargeOffInterestAccount.id
|
||||
: '',
|
||||
incomeFromGoodwillCreditInterestAccountId: accountingMappings.incomeFromGoodwillCreditInterestAccount
|
||||
? accountingMappings.incomeFromGoodwillCreditInterestAccount.id
|
||||
: '',
|
||||
incomeFromGoodwillCreditFeesAccountId: accountingMappings.incomeFromGoodwillCreditFeesAccount
|
||||
? accountingMappings.incomeFromGoodwillCreditFeesAccount.id
|
||||
: '',
|
||||
incomeFromGoodwillCreditPenaltyAccountId: accountingMappings.incomeFromGoodwillCreditPenaltyAccount
|
||||
? accountingMappings.incomeFromGoodwillCreditPenaltyAccount.id
|
||||
: '',
|
||||
advancedAccountingRules:
|
||||
this.loanProductsTemplate.paymentChannelToFundSourceMappings ||
|
||||
this.loanProductsTemplate.feeToIncomeAccountMappings ||
|
||||
this.loanProductsTemplate.penaltyToIncomeAccountMappings ||
|
||||
this.loanProductsTemplate.chargeOffReasonToExpenseAccountMappings
|
||||
? true
|
||||
: false
|
||||
});
|
||||
|
||||
this.loanProductAccountingForm.setControl('paymentChannelToFundSourceMappings',
|
||||
this.formBuilder.array((this.loanProductsTemplate.paymentChannelToFundSourceMappings || []).map((paymentFundSource: any) =>
|
||||
({ paymentTypeId: paymentFundSource.paymentType.id, fundSourceAccountId: paymentFundSource.fundSourceAccount.id }))));
|
||||
this.loanProductAccountingForm.setControl('feeToIncomeAccountMappings',
|
||||
this.formBuilder.array((this.loanProductsTemplate.feeToIncomeAccountMappings || []).map((feesIncome: any) =>
|
||||
({ chargeId: feesIncome.charge.id, incomeAccountId: feesIncome.incomeAccount.id }))));
|
||||
this.loanProductAccountingForm.setControl('penaltyToIncomeAccountMappings',
|
||||
this.formBuilder.array((this.loanProductsTemplate.penaltyToIncomeAccountMappings || []).map((penaltyIncome: any) =>
|
||||
({ chargeId: penaltyIncome.charge.id, incomeAccountId: penaltyIncome.incomeAccount.id }))));
|
||||
this.loanProductAccountingForm.setControl('chargeOffReasonToExpenseAccountMappings',
|
||||
this.formBuilder.array((this.loanProductsTemplate.chargeOffReasonToExpenseAccountMappings || []).map((m: ChargeOffReasonToExpenseAccountMapping) =>
|
||||
({ chargeOffReasonCodeValueId: m.chargeOffReasonCodeValue.id, expenseAccountId: m.expenseAccount.id }))));
|
||||
this.loanProductAccountingForm.setControl(
|
||||
'paymentChannelToFundSourceMappings',
|
||||
this.formBuilder.array(
|
||||
(this.loanProductsTemplate.paymentChannelToFundSourceMappings || []).map((paymentFundSource: any) => ({
|
||||
paymentTypeId: paymentFundSource.paymentType.id,
|
||||
fundSourceAccountId: paymentFundSource.fundSourceAccount.id
|
||||
}))
|
||||
)
|
||||
);
|
||||
this.loanProductAccountingForm.setControl(
|
||||
'feeToIncomeAccountMappings',
|
||||
this.formBuilder.array(
|
||||
(this.loanProductsTemplate.feeToIncomeAccountMappings || []).map((feesIncome: any) => ({
|
||||
chargeId: feesIncome.charge.id,
|
||||
incomeAccountId: feesIncome.incomeAccount.id
|
||||
}))
|
||||
)
|
||||
);
|
||||
this.loanProductAccountingForm.setControl(
|
||||
'penaltyToIncomeAccountMappings',
|
||||
this.formBuilder.array(
|
||||
(this.loanProductsTemplate.penaltyToIncomeAccountMappings || []).map((penaltyIncome: any) => ({
|
||||
chargeId: penaltyIncome.charge.id,
|
||||
incomeAccountId: penaltyIncome.incomeAccount.id
|
||||
}))
|
||||
)
|
||||
);
|
||||
this.loanProductAccountingForm.setControl(
|
||||
'chargeOffReasonToExpenseAccountMappings',
|
||||
this.formBuilder.array(
|
||||
(this.loanProductsTemplate.chargeOffReasonToExpenseAccountMappings || []).map(
|
||||
(m: ChargeOffReasonToExpenseAccountMapping) => ({
|
||||
chargeOffReasonCodeValueId: m.chargeOffReasonCodeValue.id,
|
||||
expenseAccountId: m.expenseAccount.id
|
||||
})
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
createLoanProductAccountingForm() {
|
||||
this.loanProductAccountingForm = this.formBuilder.group({
|
||||
'accountingRule': [1]
|
||||
accountingRule: [1]
|
||||
});
|
||||
}
|
||||
|
||||
setConditionalControls() {
|
||||
this.loanProductAccountingForm.get('accountingRule').valueChanges
|
||||
.subscribe((accountingRule: any) => {
|
||||
if (accountingRule >= 2 && accountingRule <= 4) {
|
||||
this.loanProductAccountingForm.addControl('fundSourceAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('loanPortfolioAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('transfersInSuspenseAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('interestOnLoanAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromFeeAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromPenaltyAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromRecoveryAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('writeOffAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('goodwillCreditAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('overpaymentLiabilityAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('advancedAccountingRules', new UntypedFormControl(false));
|
||||
this.loanProductAccountingForm.addControl('chargeOffFraudExpenseAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('chargeOffExpenseAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromChargeOffPenaltyAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromChargeOffFeesAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromChargeOffInterestAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromGoodwillCreditInterestAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromGoodwillCreditFeesAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('incomeFromGoodwillCreditPenaltyAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.get('accountingRule').valueChanges.subscribe((accountingRule: any) => {
|
||||
if (accountingRule >= 2 && accountingRule <= 4) {
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'fundSourceAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'loanPortfolioAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'transfersInSuspenseAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'interestOnLoanAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromFeeAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromPenaltyAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromRecoveryAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl('writeOffAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'goodwillCreditAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'overpaymentLiabilityAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl('advancedAccountingRules', new UntypedFormControl(false));
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'chargeOffFraudExpenseAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'chargeOffExpenseAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromChargeOffPenaltyAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromChargeOffFeesAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromChargeOffInterestAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromGoodwillCreditInterestAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromGoodwillCreditFeesAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'incomeFromGoodwillCreditPenaltyAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
|
||||
this.loanProductAccountingForm.get('advancedAccountingRules').valueChanges
|
||||
.subscribe((advancedAccountingRules: boolean) => {
|
||||
if (advancedAccountingRules) {
|
||||
this.loanProductAccountingForm.addControl('paymentChannelToFundSourceMappings', this.formBuilder.array([]));
|
||||
this.loanProductAccountingForm.addControl('feeToIncomeAccountMappings', this.formBuilder.array([]));
|
||||
this.loanProductAccountingForm.addControl('penaltyToIncomeAccountMappings', this.formBuilder.array([]));
|
||||
this.loanProductAccountingForm.addControl('chargeOffReasonToExpenseAccountMappings', this.formBuilder.array([]));
|
||||
} else {
|
||||
this.loanProductAccountingForm.removeControl('paymentChannelToFundSourceMappings');
|
||||
this.loanProductAccountingForm.removeControl('feeToIncomeAccountMappings');
|
||||
this.loanProductAccountingForm.removeControl('penaltyToIncomeAccountMappings');
|
||||
this.loanProductAccountingForm.removeControl('chargeOffReasonToExpenseAccountMappings');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.loanProductAccountingForm.removeControl('fundSourceAccountId');
|
||||
this.loanProductAccountingForm.removeControl('loanPortfolioAccountId');
|
||||
this.loanProductAccountingForm.removeControl('transfersInSuspenseAccountId');
|
||||
this.loanProductAccountingForm.removeControl('interestOnLoanAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromFeeAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromPenaltyAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromRecoveryAccountId');
|
||||
this.loanProductAccountingForm.removeControl('writeOffAccountId');
|
||||
this.loanProductAccountingForm.removeControl('goodwillCreditAccountId');
|
||||
this.loanProductAccountingForm.removeControl('overpaymentLiabilityAccountId');
|
||||
this.loanProductAccountingForm.removeControl('advancedAccountingRules');
|
||||
this.loanProductAccountingForm.removeControl('chargeOffExpenseAccountId');
|
||||
this.loanProductAccountingForm.removeControl('chargeOffFraudExpenseAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromChargeOffPenaltyAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromChargeOffFeesAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromChargeOffInterestAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromGoodwillCreditInterestAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromGoodwillCreditFeesAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromGoodwillCreditPenaltyAccountId');
|
||||
}
|
||||
this.loanProductAccountingForm
|
||||
.get('advancedAccountingRules')
|
||||
.valueChanges.subscribe((advancedAccountingRules: boolean) => {
|
||||
if (advancedAccountingRules) {
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'paymentChannelToFundSourceMappings',
|
||||
this.formBuilder.array([])
|
||||
);
|
||||
this.loanProductAccountingForm.addControl('feeToIncomeAccountMappings', this.formBuilder.array([]));
|
||||
this.loanProductAccountingForm.addControl('penaltyToIncomeAccountMappings', this.formBuilder.array([]));
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'chargeOffReasonToExpenseAccountMappings',
|
||||
this.formBuilder.array([])
|
||||
);
|
||||
} else {
|
||||
this.loanProductAccountingForm.removeControl('paymentChannelToFundSourceMappings');
|
||||
this.loanProductAccountingForm.removeControl('feeToIncomeAccountMappings');
|
||||
this.loanProductAccountingForm.removeControl('penaltyToIncomeAccountMappings');
|
||||
this.loanProductAccountingForm.removeControl('chargeOffReasonToExpenseAccountMappings');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.loanProductAccountingForm.removeControl('fundSourceAccountId');
|
||||
this.loanProductAccountingForm.removeControl('loanPortfolioAccountId');
|
||||
this.loanProductAccountingForm.removeControl('transfersInSuspenseAccountId');
|
||||
this.loanProductAccountingForm.removeControl('interestOnLoanAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromFeeAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromPenaltyAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromRecoveryAccountId');
|
||||
this.loanProductAccountingForm.removeControl('writeOffAccountId');
|
||||
this.loanProductAccountingForm.removeControl('goodwillCreditAccountId');
|
||||
this.loanProductAccountingForm.removeControl('overpaymentLiabilityAccountId');
|
||||
this.loanProductAccountingForm.removeControl('advancedAccountingRules');
|
||||
this.loanProductAccountingForm.removeControl('chargeOffExpenseAccountId');
|
||||
this.loanProductAccountingForm.removeControl('chargeOffFraudExpenseAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromChargeOffPenaltyAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromChargeOffFeesAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromChargeOffInterestAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromGoodwillCreditInterestAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromGoodwillCreditFeesAccountId');
|
||||
this.loanProductAccountingForm.removeControl('incomeFromGoodwillCreditPenaltyAccountId');
|
||||
}
|
||||
|
||||
if (accountingRule === 3 || accountingRule === 4) {
|
||||
this.loanProductAccountingForm.addControl('receivableInterestAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('receivableFeeAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('receivablePenaltyAccountId', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductAccountingForm.addControl('enableAccrualActivityPosting', new UntypedFormControl(false));
|
||||
} else {
|
||||
this.loanProductAccountingForm.removeControl('receivableInterestAccountId');
|
||||
this.loanProductAccountingForm.removeControl('receivableFeeAccountId');
|
||||
this.loanProductAccountingForm.removeControl('receivablePenaltyAccountId');
|
||||
this.loanProductAccountingForm.removeControl('enableAccrualActivityPosting');
|
||||
}
|
||||
});
|
||||
if (accountingRule === 3 || accountingRule === 4) {
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'receivableInterestAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'receivableFeeAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl(
|
||||
'receivablePenaltyAccountId',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
this.loanProductAccountingForm.addControl('enableAccrualActivityPosting', new UntypedFormControl(false));
|
||||
} else {
|
||||
this.loanProductAccountingForm.removeControl('receivableInterestAccountId');
|
||||
this.loanProductAccountingForm.removeControl('receivableFeeAccountId');
|
||||
this.loanProductAccountingForm.removeControl('receivablePenaltyAccountId');
|
||||
this.loanProductAccountingForm.removeControl('enableAccrualActivityPosting');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get paymentChannelToFundSourceMappings(): UntypedFormArray {
|
||||
@@ -233,7 +361,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
if (response.data) {
|
||||
formArray.push(response.data);
|
||||
if (formType == 'ChargeOffReasonExpense') {
|
||||
this.allowAddChargeOffReasonExpense = (formArray.value.length < this.chargeOffReasonOptions.length);
|
||||
this.allowAddChargeOffReasonExpense = formArray.value.length < this.chargeOffReasonOptions.length;
|
||||
}
|
||||
|
||||
this.setLoanProductAccountingFormDirty();
|
||||
@@ -254,13 +382,13 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
|
||||
delete(formType: string, formArray: UntypedFormArray, index: number) {
|
||||
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) => {
|
||||
if (response.delete) {
|
||||
formArray.removeAt(index);
|
||||
if (formType == 'ChargeOffReasonExpense') {
|
||||
this.allowAddChargeOffReasonExpense = (formArray.value.length < this.chargeOffReasonOptions.length);
|
||||
this.allowAddChargeOffReasonExpense = formArray.value.length < this.chargeOffReasonOptions.length;
|
||||
}
|
||||
this.setLoanProductAccountingFormDirty();
|
||||
}
|
||||
@@ -269,10 +397,23 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
|
||||
getData(formType: string, values?: any) {
|
||||
switch (formType) {
|
||||
case 'PaymentFundSource': return { title: 'Configure Fund Sources for Payment Channels', formfields: this.getPaymentFundSourceFormfields(values) };
|
||||
case 'FeesIncome': return { title: 'Map Fees to Income Accounts', formfields: this.getFeesIncomeFormfields(values) };
|
||||
case 'PenaltyIncome': return { title: 'Map Penalties to Specific Income Accounts', formfields: this.getPenaltyIncomeFormfields(values) };
|
||||
case 'ChargeOffReasonExpense': return { title: 'Map Charge-off reasons to Expense accounts', formfields: this.getChargeOffReasonExpenseFormfields(values) };
|
||||
case 'PaymentFundSource':
|
||||
return {
|
||||
title: 'Configure Fund Sources for Payment Channels',
|
||||
formfields: this.getPaymentFundSourceFormfields(values)
|
||||
};
|
||||
case 'FeesIncome':
|
||||
return { title: 'Map Fees to Income Accounts', formfields: this.getFeesIncomeFormfields(values) };
|
||||
case 'PenaltyIncome':
|
||||
return {
|
||||
title: 'Map Penalties to Specific Income Accounts',
|
||||
formfields: this.getPenaltyIncomeFormfields(values)
|
||||
};
|
||||
case 'ChargeOffReasonExpense':
|
||||
return {
|
||||
title: 'Map Charge-off reasons to Expense accounts',
|
||||
formfields: this.getChargeOffReasonExpenseFormfields(values)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,6 +435,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
return formfields;
|
||||
}
|
||||
@@ -316,6 +458,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
return formfields;
|
||||
}
|
||||
@@ -338,6 +481,7 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
return formfields;
|
||||
}
|
||||
@@ -361,17 +505,17 @@ export class LoanProductAccountingStepComponent implements OnInit {
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
return formfields;
|
||||
}
|
||||
|
||||
get isAccountingAccrualBased() {
|
||||
const accountingRule = this.loanProductAccountingForm.value.accountingRule;
|
||||
return accountingRule === 3 || accountingRule === 4;
|
||||
return accountingRule === 3 || accountingRule === 4;
|
||||
}
|
||||
|
||||
get loanProductAccounting() {
|
||||
return this.loanProductAccountingForm.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductChargesStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductChargesStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductChargesStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+19
-12
@@ -11,7 +11,6 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
|
||||
styleUrls: ['./loan-product-charges-step.component.scss']
|
||||
})
|
||||
export class LoanProductChargesStepComponent implements OnInit {
|
||||
|
||||
@Input() loanProductsTemplate: any;
|
||||
@Input() currencyCode: UntypedFormControl;
|
||||
@Input() multiDisburseLoan: UntypedFormControl;
|
||||
@@ -20,25 +19,34 @@ export class LoanProductChargesStepComponent implements OnInit {
|
||||
overdueChargeData: any;
|
||||
|
||||
chargesDataSource: {}[];
|
||||
displayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'action'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'chargeCalculationType',
|
||||
'amount',
|
||||
'chargeTimeType',
|
||||
'action'
|
||||
];
|
||||
|
||||
pristine = true;
|
||||
|
||||
constructor(public dialog: MatDialog,
|
||||
private translateService: TranslateService) {
|
||||
}
|
||||
constructor(
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.chargeData = this.loanProductsTemplate.chargeOptions;
|
||||
this.overdueChargeData = this.loanProductsTemplate.penaltyOptions ?
|
||||
this.loanProductsTemplate.penaltyOptions.filter((penalty: any) => penalty.chargeTimeType.code === 'chargeTimeType.overdueInstallment') :
|
||||
[];
|
||||
this.overdueChargeData = this.loanProductsTemplate.penaltyOptions
|
||||
? this.loanProductsTemplate.penaltyOptions.filter(
|
||||
(penalty: any) => penalty.chargeTimeType.code === 'chargeTimeType.overdueInstallment'
|
||||
)
|
||||
: [];
|
||||
|
||||
this.chargesDataSource = this.loanProductsTemplate.charges || [];
|
||||
this.pristine = true;
|
||||
|
||||
this.currencyCode.valueChanges.subscribe(() => this.chargesDataSource = []);
|
||||
this.multiDisburseLoan.valueChanges.subscribe(() => this.chargesDataSource = []);
|
||||
this.currencyCode.valueChanges.subscribe(() => (this.chargesDataSource = []));
|
||||
this.multiDisburseLoan.valueChanges.subscribe(() => (this.chargesDataSource = []));
|
||||
}
|
||||
|
||||
addCharge(charge: any) {
|
||||
@@ -49,7 +57,7 @@ export class LoanProductChargesStepComponent implements OnInit {
|
||||
|
||||
deleteCharge(charge: any) {
|
||||
const deleteChargeDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Charge') + ' ' + charge.name }
|
||||
data: { deleteContext: this.translateService.instant('labels.inputs.Charge') + ' ' + charge.name }
|
||||
});
|
||||
deleteChargeDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -65,5 +73,4 @@ export class LoanProductChargesStepComponent implements OnInit {
|
||||
charges: this.chargesDataSource
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductCurrencyStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductCurrencyStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductCurrencyStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+16
-10
@@ -8,7 +8,6 @@ import { TooltipPosition } from '@angular/material/tooltip';
|
||||
styleUrls: ['./loan-product-currency-step.component.scss']
|
||||
})
|
||||
export class LoanProductCurrencyStepComponent implements OnInit {
|
||||
|
||||
@Input() loanProductsTemplate: any;
|
||||
|
||||
loanProductCurrencyForm: UntypedFormGroup;
|
||||
@@ -22,24 +21,31 @@ export class LoanProductCurrencyStepComponent implements OnInit {
|
||||
ngOnInit() {
|
||||
this.currencyData = this.loanProductsTemplate.currencyOptions;
|
||||
this.loanProductCurrencyForm.patchValue({
|
||||
'currencyCode': this.loanProductsTemplate.currency.code || this.currencyData[0].code,
|
||||
'digitsAfterDecimal': this.loanProductsTemplate.currency.decimalPlaces ? this.loanProductsTemplate.currency.decimalPlaces : 2,
|
||||
'inMultiplesOf': this.loanProductsTemplate.currency.inMultiplesOf,
|
||||
'installmentAmountInMultiplesOf': this.loanProductsTemplate.installmentAmountInMultiplesOf
|
||||
currencyCode: this.loanProductsTemplate.currency.code || this.currencyData[0].code,
|
||||
digitsAfterDecimal: this.loanProductsTemplate.currency.decimalPlaces
|
||||
? this.loanProductsTemplate.currency.decimalPlaces
|
||||
: 2,
|
||||
inMultiplesOf: this.loanProductsTemplate.currency.inMultiplesOf,
|
||||
installmentAmountInMultiplesOf: this.loanProductsTemplate.installmentAmountInMultiplesOf
|
||||
});
|
||||
}
|
||||
|
||||
createLoanProductCurrencyForm() {
|
||||
this.loanProductCurrencyForm = this.formBuilder.group({
|
||||
'currencyCode': ['', Validators.required],
|
||||
'digitsAfterDecimal': [2, Validators.required],
|
||||
'inMultiplesOf': '',
|
||||
'installmentAmountInMultiplesOf': ''
|
||||
currencyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
digitsAfterDecimal: [
|
||||
2,
|
||||
Validators.required
|
||||
],
|
||||
inMultiplesOf: '',
|
||||
installmentAmountInMultiplesOf: ''
|
||||
});
|
||||
}
|
||||
|
||||
get loanProductCurrency() {
|
||||
return this.loanProductCurrencyForm.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductDetailsStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductDetailsStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductDetailsStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+27
-21
@@ -13,7 +13,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./loan-product-details-step.component.scss']
|
||||
})
|
||||
export class LoanProductDetailsStepComponent implements OnInit {
|
||||
|
||||
@Input() loanProductsTemplate: any;
|
||||
|
||||
loanProductDetailsForm: UntypedFormGroup;
|
||||
@@ -29,9 +28,11 @@ export class LoanProductDetailsStepComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
*/
|
||||
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.createLoanProductDetailsForm();
|
||||
}
|
||||
|
||||
@@ -39,27 +40,33 @@ export class LoanProductDetailsStepComponent implements OnInit {
|
||||
this.fundData = this.loanProductsTemplate.fundOptions;
|
||||
|
||||
this.loanProductDetailsForm.patchValue({
|
||||
'name': this.loanProductsTemplate.name,
|
||||
'shortName': this.loanProductsTemplate.shortName,
|
||||
'description': this.loanProductsTemplate.description,
|
||||
'externalId': this.loanProductsTemplate.externalId,
|
||||
'fundId': this.loanProductsTemplate.fundId,
|
||||
'startDate': this.loanProductsTemplate.startDate && new Date(this.loanProductsTemplate.startDate),
|
||||
'closeDate': this.loanProductsTemplate.closeDate && new Date(this.loanProductsTemplate.closeDate),
|
||||
'includeInBorrowerCycle': this.loanProductsTemplate.includeInBorrowerCycle
|
||||
name: this.loanProductsTemplate.name,
|
||||
shortName: this.loanProductsTemplate.shortName,
|
||||
description: this.loanProductsTemplate.description,
|
||||
externalId: this.loanProductsTemplate.externalId,
|
||||
fundId: this.loanProductsTemplate.fundId,
|
||||
startDate: this.loanProductsTemplate.startDate && new Date(this.loanProductsTemplate.startDate),
|
||||
closeDate: this.loanProductsTemplate.closeDate && new Date(this.loanProductsTemplate.closeDate),
|
||||
includeInBorrowerCycle: this.loanProductsTemplate.includeInBorrowerCycle
|
||||
});
|
||||
}
|
||||
|
||||
createLoanProductDetailsForm() {
|
||||
this.loanProductDetailsForm = this.formBuilder.group({
|
||||
'name': ['', Validators.required],
|
||||
'shortName': ['', Validators.required],
|
||||
'description': [''],
|
||||
'externalId': [''],
|
||||
'fundId': [''],
|
||||
'startDate': [''],
|
||||
'closeDate': [''],
|
||||
'includeInBorrowerCycle': [false]
|
||||
name: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
shortName: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
description: [''],
|
||||
externalId: [''],
|
||||
fundId: [''],
|
||||
startDate: [''],
|
||||
closeDate: [''],
|
||||
includeInBorrowerCycle: [false]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -76,5 +83,4 @@ export class LoanProductDetailsStepComponent implements OnInit {
|
||||
}
|
||||
return loanProductDetailsFormData;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductInterestRefundStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductInterestRefundStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductInterestRefundStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+10
-10
@@ -1,5 +1,5 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup} from '@angular/forms';
|
||||
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
|
||||
import { StringEnumOptionData } from '../../../../shared/models/option-data.model';
|
||||
|
||||
@Component({
|
||||
@@ -8,7 +8,6 @@ import { StringEnumOptionData } from '../../../../shared/models/option-data.mode
|
||||
styleUrls: ['./loan-product-interest-refund-step.component.scss']
|
||||
})
|
||||
export class LoanProductInterestRefundStepComponent implements OnInit {
|
||||
|
||||
@Input() loanProductsTemplate: any;
|
||||
@Output() supportedInterestRefundTypes = new EventEmitter<StringEnumOptionData[]>();
|
||||
|
||||
@@ -26,32 +25,33 @@ export class LoanProductInterestRefundStepComponent implements OnInit {
|
||||
const values: StringEnumOptionData[] = this.loanProductsTemplate.supportedInterestRefundTypes;
|
||||
const supportedInterestRefundTypes: string[] = this.mapStringEnumOptionToIdList(values);
|
||||
this.loanProductInterestRefundForm.patchValue({
|
||||
'supportedInterestRefundTypes': supportedInterestRefundTypes
|
||||
supportedInterestRefundTypes: supportedInterestRefundTypes
|
||||
});
|
||||
this.supportedInterestRefundTypes.emit(values);
|
||||
}
|
||||
|
||||
createLoanProductInterestRefundForm() {
|
||||
this.loanProductInterestRefundForm = this.formBuilder.group({
|
||||
'supportedInterestRefundTypes': ''
|
||||
supportedInterestRefundTypes: ''
|
||||
});
|
||||
}
|
||||
|
||||
setConditionalControls() {
|
||||
this.loanProductInterestRefundForm.get('supportedInterestRefundTypes').valueChanges
|
||||
.subscribe(value => {
|
||||
this.supportedInterestRefundTypes.emit(this.mapIdToStringEnumOptionList(value, this.loanProductsTemplate.supportedInterestRefundTypesOptions));
|
||||
});
|
||||
this.loanProductInterestRefundForm.get('supportedInterestRefundTypes').valueChanges.subscribe((value) => {
|
||||
this.supportedInterestRefundTypes.emit(
|
||||
this.mapIdToStringEnumOptionList(value, this.loanProductsTemplate.supportedInterestRefundTypesOptions)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
mapStringEnumOptionToIdList(incomingValues: StringEnumOptionData[]): string[] {
|
||||
if (!incomingValues) {
|
||||
return [];
|
||||
}
|
||||
return incomingValues.map(v => v.id);
|
||||
return incomingValues.map((v) => v.id);
|
||||
}
|
||||
|
||||
mapIdToStringEnumOptionList(incomingValues: string[], options: StringEnumOptionData[]): StringEnumOptionData[] {
|
||||
return options.filter(v => incomingValues.includes(v.id));
|
||||
return options.filter((v) => incomingValues.includes(v.id));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('AdvancePaymentAllocationTabComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdvancePaymentAllocationTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AdvancePaymentAllocationTabComponent]
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(AdvancePaymentAllocationTabComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
+32
-13
@@ -5,7 +5,15 @@ import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
import { AdvancedCreditAllocation, AdvancedPaymentAllocation, AdvancedPaymentStrategy, CreditAllocationOrder, FutureInstallmentAllocationRule, PaymentAllocationOrder, PaymentAllocationTransactionType } from '../payment-allocation-model';
|
||||
import {
|
||||
AdvancedCreditAllocation,
|
||||
AdvancedPaymentAllocation,
|
||||
AdvancedPaymentStrategy,
|
||||
CreditAllocationOrder,
|
||||
FutureInstallmentAllocationRule,
|
||||
PaymentAllocationOrder,
|
||||
PaymentAllocationTransactionType
|
||||
} from '../payment-allocation-model';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-advance-payment-allocation-tab',
|
||||
@@ -13,7 +21,6 @@ import { AdvancedCreditAllocation, AdvancedPaymentAllocation, AdvancedPaymentStr
|
||||
styleUrls: ['./advance-payment-allocation-tab.component.scss']
|
||||
})
|
||||
export class AdvancePaymentAllocationTabComponent implements OnInit {
|
||||
|
||||
@Input() advancedPaymentAllocation: AdvancedPaymentAllocation;
|
||||
@Input() advancedCreditAllocation: AdvancedCreditAllocation;
|
||||
|
||||
@@ -24,15 +31,21 @@ export class AdvancePaymentAllocationTabComponent implements OnInit {
|
||||
creditAllocationsData: CreditAllocationOrder[] | null = null;
|
||||
|
||||
/** Columns to be displayed in the table. */
|
||||
displayedColumns: string[] = ['actions', 'order', 'allocationRule'];
|
||||
displayedColumns: string[] = [
|
||||
'actions',
|
||||
'order',
|
||||
'allocationRule'
|
||||
];
|
||||
|
||||
futureInstallmentAllocationRule = new UntypedFormControl('', Validators.required);
|
||||
|
||||
@ViewChild('table') table: MatTable<any>;
|
||||
|
||||
constructor(private dialog: MatDialog,
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
private advancedPaymentStrategy: AdvancedPaymentStrategy,
|
||||
private translateService: TranslateService) { }
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (this.advancedCreditAllocation) {
|
||||
@@ -43,15 +56,19 @@ export class AdvancePaymentAllocationTabComponent implements OnInit {
|
||||
this.paymentAllocationsData = this.advancedPaymentAllocation?.paymentAllocationOrder;
|
||||
|
||||
if (this.advancedPaymentAllocation.futureInstallmentAllocationRule) {
|
||||
this.futureInstallmentAllocationRule.patchValue(this.advancedPaymentAllocation.futureInstallmentAllocationRule.code);
|
||||
this.futureInstallmentAllocationRule.patchValue(
|
||||
this.advancedPaymentAllocation.futureInstallmentAllocationRule.code
|
||||
);
|
||||
}
|
||||
this.futureInstallmentAllocationRule.valueChanges.subscribe((value: any) => {
|
||||
this.advancedPaymentAllocation.futureInstallmentAllocationRules.forEach((item: FutureInstallmentAllocationRule) => {
|
||||
if (value === item.code) {
|
||||
this.advancedPaymentAllocation.futureInstallmentAllocationRule = item;
|
||||
this.allocationChanged.emit(true);
|
||||
this.advancedPaymentAllocation.futureInstallmentAllocationRules.forEach(
|
||||
(item: FutureInstallmentAllocationRule) => {
|
||||
if (value === item.code) {
|
||||
this.advancedPaymentAllocation.futureInstallmentAllocationRule = item;
|
||||
this.allocationChanged.emit(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -90,7 +107,10 @@ export class AdvancePaymentAllocationTabComponent implements OnInit {
|
||||
transaction.credit = true;
|
||||
}
|
||||
const dialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||
data: { deleteContext: this.translateService.instant('labels.dialogContext.the Transaction Type') + ' ' + transaction.value }
|
||||
data: {
|
||||
deleteContext:
|
||||
this.translateService.instant('labels.dialogContext.the Transaction Type') + ' ' + transaction.value
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response.delete) {
|
||||
@@ -98,5 +118,4 @@ export class AdvancePaymentAllocationTabComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductPaymentStrategyStepComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductPaymentStrategyStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductPaymentStrategyStepComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+30
-11
@@ -1,5 +1,14 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { AdvancedCreditAllocation, AdvancedPaymentAllocation, AdvancedPaymentStrategy, CreditAllocation, CreditAllocationOrder, PaymentAllocation, PaymentAllocationOrder, PaymentAllocationTransactionType } from './payment-allocation-model';
|
||||
import {
|
||||
AdvancedCreditAllocation,
|
||||
AdvancedPaymentAllocation,
|
||||
AdvancedPaymentStrategy,
|
||||
CreditAllocation,
|
||||
CreditAllocationOrder,
|
||||
PaymentAllocation,
|
||||
PaymentAllocationOrder,
|
||||
PaymentAllocationTransactionType
|
||||
} from './payment-allocation-model';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||
@@ -13,7 +22,6 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
styleUrls: ['./loan-product-payment-strategy-step.component.scss']
|
||||
})
|
||||
export class LoanProductPaymentStrategyStepComponent implements OnInit {
|
||||
|
||||
@Input() advancedPaymentAllocations: AdvancedPaymentAllocation[] = [];
|
||||
@Input() advancedCreditAllocations: AdvancedCreditAllocation[] = [];
|
||||
@Input() advancedPaymentAllocationTransactionTypes: PaymentAllocationTransactionType[] = [];
|
||||
@@ -27,16 +35,20 @@ export class LoanProductPaymentStrategyStepComponent implements OnInit {
|
||||
|
||||
@ViewChild(MatTabGroup) tabGroup: MatTabGroup;
|
||||
|
||||
constructor(private dialog: MatDialog,
|
||||
constructor(
|
||||
private dialog: MatDialog,
|
||||
private advancedPaymentStrategy: AdvancedPaymentStrategy,
|
||||
private translateService: TranslateService) { }
|
||||
private translateService: TranslateService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.sendAllocations();
|
||||
}
|
||||
|
||||
sendAllocations(): void {
|
||||
this.setPaymentAllocation.emit(this.advancedPaymentStrategy.buildPaymentAllocations(this.advancedPaymentAllocations));
|
||||
this.setPaymentAllocation.emit(
|
||||
this.advancedPaymentStrategy.buildPaymentAllocations(this.advancedPaymentAllocations)
|
||||
);
|
||||
this.setCreditAllocation.emit(this.advancedPaymentStrategy.buildCreditAllocations(this.advancedCreditAllocations));
|
||||
}
|
||||
|
||||
@@ -77,6 +89,7 @@ export class LoanProductPaymentStrategyStepComponent implements OnInit {
|
||||
options: { label: 'value', value: 'code', data: transactionTypesOptions },
|
||||
order: 1
|
||||
})
|
||||
|
||||
];
|
||||
const data = {
|
||||
title: this.translateService.instant('labels.inputs.Advanced Payment Allocation Transaction Type'),
|
||||
@@ -94,12 +107,19 @@ export class LoanProductPaymentStrategyStepComponent implements OnInit {
|
||||
if (transactionType.code === response.data.value.code) {
|
||||
if (!transactionType.credit) {
|
||||
this.advancedPaymentAllocations.push(
|
||||
this.advancedPaymentStrategy.buildAdvancedPaymentAllocation(true, transactionType, this.paymentAllocationOrderDefault,
|
||||
defaultPaymentAllocation.futureInstallmentAllocationRules)
|
||||
this.advancedPaymentStrategy.buildAdvancedPaymentAllocation(
|
||||
true,
|
||||
transactionType,
|
||||
this.paymentAllocationOrderDefault,
|
||||
defaultPaymentAllocation.futureInstallmentAllocationRules
|
||||
)
|
||||
);
|
||||
} else {
|
||||
this.advancedCreditAllocations.push(
|
||||
this.advancedPaymentStrategy.buildAdvancedCreditAllocation(transactionType, this.creditAllocationOrderDefault)
|
||||
this.advancedPaymentStrategy.buildAdvancedCreditAllocation(
|
||||
transactionType,
|
||||
this.creditAllocationOrderDefault
|
||||
)
|
||||
);
|
||||
}
|
||||
this.paymentAllocationChange.emit(true);
|
||||
@@ -116,7 +136,7 @@ export class LoanProductPaymentStrategyStepComponent implements OnInit {
|
||||
if (item.transaction.code === transaction.code) {
|
||||
this.advancedPaymentAllocations.splice(index, 1);
|
||||
this.paymentAllocationChange.emit(true);
|
||||
this.tabGroup.selectedIndex = (index - 1);
|
||||
this.tabGroup.selectedIndex = index - 1;
|
||||
this.sendAllocations();
|
||||
}
|
||||
});
|
||||
@@ -125,11 +145,10 @@ export class LoanProductPaymentStrategyStepComponent implements OnInit {
|
||||
if (item.transaction.code === transaction.code) {
|
||||
this.advancedCreditAllocations.splice(index, 1);
|
||||
this.paymentAllocationChange.emit(true);
|
||||
this.tabGroup.selectedIndex = (index - 1);
|
||||
this.tabGroup.selectedIndex = index - 1;
|
||||
this.sendAllocations();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+61
-37
@@ -68,7 +68,6 @@ export class AdvancePaymentAllocationData {
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AdvancedPaymentStrategy {
|
||||
|
||||
public buildAdvancedCreditAllocationList(loanProduct: any): AdvancedCreditAllocation[] {
|
||||
const advancedCreditAllocation: AdvancedCreditAllocation[] = [];
|
||||
const advancedCreditAllocationTransactionTypes: PaymentAllocationTransactionType[] =
|
||||
@@ -78,8 +77,10 @@ export class AdvancedPaymentStrategy {
|
||||
loanProduct.creditAllocation.forEach((item: CreditAllocation) => {
|
||||
advancedCreditAllocation.push({
|
||||
transaction: this.getItemByCode(item.transactionType, advancedCreditAllocationTransactionTypes),
|
||||
creditAllocationOrder: this.buildCurrentCreditAllocationOrder(item.creditAllocationOrder,
|
||||
advancedPaymentAllocationTypes),
|
||||
creditAllocationOrder: this.buildCurrentCreditAllocationOrder(
|
||||
item.creditAllocationOrder,
|
||||
advancedPaymentAllocationTypes
|
||||
)
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -97,11 +98,15 @@ export class AdvancedPaymentStrategy {
|
||||
loanProduct.paymentAllocation.forEach((item: PaymentAllocation) => {
|
||||
advancedPaymentAllocation.push({
|
||||
transaction: this.getItemByCode(item.transactionType, advancedPaymentAllocationTransactionTypes),
|
||||
paymentAllocationOrder: this.buildCurrentPaymentAllocationOrder(item.paymentAllocationOrder,
|
||||
advancedPaymentAllocationTypes),
|
||||
futureInstallmentAllocationRule: this.getItemByCode(item.futureInstallmentAllocationRule,
|
||||
advancedPaymentAllocationFutureInstallmentAllocationRules),
|
||||
futureInstallmentAllocationRules: advancedPaymentAllocationFutureInstallmentAllocationRules,
|
||||
paymentAllocationOrder: this.buildCurrentPaymentAllocationOrder(
|
||||
item.paymentAllocationOrder,
|
||||
advancedPaymentAllocationTypes
|
||||
),
|
||||
futureInstallmentAllocationRule: this.getItemByCode(
|
||||
item.futureInstallmentAllocationRule,
|
||||
advancedPaymentAllocationFutureInstallmentAllocationRules
|
||||
),
|
||||
futureInstallmentAllocationRules: advancedPaymentAllocationFutureInstallmentAllocationRules
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -109,34 +114,47 @@ export class AdvancedPaymentStrategy {
|
||||
if (advancedPaymentAllocation.length === 0) {
|
||||
advancedPaymentAllocation.push({
|
||||
transaction: PaymentAllocationTransactionTypes.DEFAULT_TRANSACTION,
|
||||
paymentAllocationOrder: this.buildPaymentAllocationTransactionOrder(true, [], loanProduct.advancedPaymentAllocationTypes),
|
||||
paymentAllocationOrder: this.buildPaymentAllocationTransactionOrder(
|
||||
true,
|
||||
[],
|
||||
loanProduct.advancedPaymentAllocationTypes
|
||||
),
|
||||
futureInstallmentAllocationRule: loanProduct.advancedPaymentAllocationFutureInstallmentAllocationRules[0],
|
||||
futureInstallmentAllocationRules: loanProduct.advancedPaymentAllocationFutureInstallmentAllocationRules,
|
||||
futureInstallmentAllocationRules: loanProduct.advancedPaymentAllocationFutureInstallmentAllocationRules
|
||||
});
|
||||
}
|
||||
return advancedPaymentAllocation;
|
||||
}
|
||||
|
||||
public buildAdvancedPaymentAllocation(forDefault: boolean, transaction: PaymentAllocationTransactionType,
|
||||
public buildAdvancedPaymentAllocation(
|
||||
forDefault: boolean,
|
||||
transaction: PaymentAllocationTransactionType,
|
||||
currentItems: PaymentAllocationOrder[],
|
||||
futureInstallmentAllocationRules: FutureInstallmentAllocationRule[]): AdvancedPaymentAllocation {
|
||||
futureInstallmentAllocationRules: FutureInstallmentAllocationRule[]
|
||||
): AdvancedPaymentAllocation {
|
||||
return {
|
||||
transaction: transaction,
|
||||
paymentAllocationOrder: this.buildPaymentAllocationTransactionOrder(forDefault, currentItems, currentItems),
|
||||
futureInstallmentAllocationRule: futureInstallmentAllocationRules[0],
|
||||
futureInstallmentAllocationRules: futureInstallmentAllocationRules,
|
||||
futureInstallmentAllocationRules: futureInstallmentAllocationRules
|
||||
};
|
||||
}
|
||||
|
||||
public buildAdvancedCreditAllocation(transaction: PaymentAllocationTransactionType,
|
||||
currentItems: CreditAllocationOrder[]): AdvancedCreditAllocation {
|
||||
public buildAdvancedCreditAllocation(
|
||||
transaction: PaymentAllocationTransactionType,
|
||||
currentItems: CreditAllocationOrder[]
|
||||
): AdvancedCreditAllocation {
|
||||
return {
|
||||
transaction: transaction,
|
||||
creditAllocationOrder: this.buildCreditAllocationTransactionOrder(true, currentItems, currentItems)
|
||||
};
|
||||
}
|
||||
|
||||
public buildPaymentAllocationTransactionOrder(forDefault: boolean, currentItems: PaymentAllocationOrder[], defaultItems: PaymentAllocationOrder[]): PaymentAllocationOrder[] {
|
||||
public buildPaymentAllocationTransactionOrder(
|
||||
forDefault: boolean,
|
||||
currentItems: PaymentAllocationOrder[],
|
||||
defaultItems: PaymentAllocationOrder[]
|
||||
): PaymentAllocationOrder[] {
|
||||
const paymentAllocationOrder: PaymentAllocationOrder[] = [];
|
||||
if (forDefault) {
|
||||
return defaultItems;
|
||||
@@ -152,7 +170,11 @@ export class AdvancedPaymentStrategy {
|
||||
return paymentAllocationOrder;
|
||||
}
|
||||
|
||||
public buildCreditAllocationTransactionOrder(forDefault: boolean, currentItems: CreditAllocationOrder[], defaultItems: CreditAllocationOrder[]): CreditAllocationOrder[] {
|
||||
public buildCreditAllocationTransactionOrder(
|
||||
forDefault: boolean,
|
||||
currentItems: CreditAllocationOrder[],
|
||||
defaultItems: CreditAllocationOrder[]
|
||||
): CreditAllocationOrder[] {
|
||||
const paymentAllocationOrder: CreditAllocationOrder[] = [];
|
||||
if (forDefault) {
|
||||
return defaultItems;
|
||||
@@ -199,7 +221,7 @@ export class AdvancedPaymentStrategy {
|
||||
const paymentAllocations: any[] = [];
|
||||
paymentAllocationOrder.forEach((item: any, index: number) => {
|
||||
paymentAllocations.push({
|
||||
order: (index + 1),
|
||||
order: index + 1,
|
||||
paymentAllocationRule: item.code
|
||||
});
|
||||
});
|
||||
@@ -211,7 +233,7 @@ export class AdvancedPaymentStrategy {
|
||||
const creditAllocations: CreditAllocationOrder[] = [];
|
||||
creditAllocationOrder.forEach((item: any, index: number) => {
|
||||
creditAllocations.push({
|
||||
order: (index + 1),
|
||||
order: index + 1,
|
||||
creditAllocationRule: item.code
|
||||
});
|
||||
});
|
||||
@@ -219,26 +241,29 @@ export class AdvancedPaymentStrategy {
|
||||
return creditAllocations;
|
||||
}
|
||||
|
||||
private buildCurrentPaymentAllocationOrder(currentItems: any[], defaultItems: PaymentAllocationOrder[]):
|
||||
PaymentAllocationOrder[] {
|
||||
const paymentAllocationOrder: PaymentAllocationOrder[] = [];
|
||||
currentItems.forEach((item: any) => {
|
||||
paymentAllocationOrder.push(this.getItemByCode(item.paymentAllocationRule, defaultItems));
|
||||
});
|
||||
return paymentAllocationOrder;
|
||||
private buildCurrentPaymentAllocationOrder(
|
||||
currentItems: any[],
|
||||
defaultItems: PaymentAllocationOrder[]
|
||||
): PaymentAllocationOrder[] {
|
||||
const paymentAllocationOrder: PaymentAllocationOrder[] = [];
|
||||
currentItems.forEach((item: any) => {
|
||||
paymentAllocationOrder.push(this.getItemByCode(item.paymentAllocationRule, defaultItems));
|
||||
});
|
||||
return paymentAllocationOrder;
|
||||
}
|
||||
|
||||
private buildCurrentCreditAllocationOrder(currentItems: any[], defaultItems: CreditAllocationOrder[]):
|
||||
CreditAllocationOrder[] {
|
||||
const creditAllocationOrder: CreditAllocationOrder[] = [];
|
||||
currentItems.forEach((item: any) => {
|
||||
creditAllocationOrder.push(this.getItemByCode(item.creditAllocationRule, defaultItems));
|
||||
});
|
||||
return creditAllocationOrder;
|
||||
private buildCurrentCreditAllocationOrder(
|
||||
currentItems: any[],
|
||||
defaultItems: CreditAllocationOrder[]
|
||||
): CreditAllocationOrder[] {
|
||||
const creditAllocationOrder: CreditAllocationOrder[] = [];
|
||||
currentItems.forEach((item: any) => {
|
||||
creditAllocationOrder.push(this.getItemByCode(item.creditAllocationRule, defaultItems));
|
||||
});
|
||||
return creditAllocationOrder;
|
||||
}
|
||||
|
||||
private getItemByCode(code: string,
|
||||
options: any[]): any {
|
||||
private getItemByCode(code: string, options: any[]): any {
|
||||
let transaction: any;
|
||||
options.forEach((option: any) => {
|
||||
if (option.code === code) {
|
||||
@@ -249,7 +274,6 @@ export class AdvancedPaymentStrategy {
|
||||
}
|
||||
|
||||
public isDefault(transaction: PaymentAllocationTransactionType): boolean {
|
||||
return (transaction.code === PaymentAllocationTransactionTypes.DEFAULT_TRANSACTION.code);
|
||||
return transaction.code === PaymentAllocationTransactionTypes.DEFAULT_TRANSACTION.code;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductPreviewStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductPreviewStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductPreviewStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+4
-4
@@ -7,7 +7,6 @@ import { LoanProducts } from '../../loan-products';
|
||||
styleUrls: ['./loan-product-preview-step.component.scss']
|
||||
})
|
||||
export class LoanProductPreviewStepComponent implements OnInit, OnChanges {
|
||||
|
||||
@Input() loanProductsTemplate: any;
|
||||
@Input() accountingRuleData: any;
|
||||
@Input() loanProduct: any;
|
||||
@@ -15,7 +14,7 @@ export class LoanProductPreviewStepComponent implements OnInit, OnChanges {
|
||||
|
||||
isAdvancedPaymentAllocation = false;
|
||||
|
||||
constructor() { }
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {
|
||||
this.advancedPaymentAllocation();
|
||||
@@ -26,7 +25,8 @@ export class LoanProductPreviewStepComponent implements OnInit, OnChanges {
|
||||
}
|
||||
|
||||
advancedPaymentAllocation() {
|
||||
this.isAdvancedPaymentAllocation = LoanProducts.isAdvancedPaymentAllocationStrategy(this.loanProduct.transactionProcessingStrategyCode);
|
||||
this.isAdvancedPaymentAllocation = LoanProducts.isAdvancedPaymentAllocationStrategy(
|
||||
this.loanProduct.transactionProcessingStrategyCode
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductSettingsStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductSettingsStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductSettingsStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+404
-268
@@ -6,14 +6,12 @@ import { GlobalConfiguration } from 'app/system/configurations/global-configurat
|
||||
import { CodeName, OptionData, StringEnumOptionData } from 'app/shared/models/option-data.model';
|
||||
import { ProcessingStrategyService } from '../../services/processing-strategy.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loan-product-settings-step',
|
||||
templateUrl: './loan-product-settings-step.component.html',
|
||||
styleUrls: ['./loan-product-settings-step.component.scss']
|
||||
})
|
||||
export class LoanProductSettingsStepComponent implements OnInit {
|
||||
|
||||
DAYS_BEFORE_REPAYMENT_IS_DUE = LoanProducts.DAYS_BEFORE_REPAYMENT_IS_DUE;
|
||||
DAYS_AFTER_REPAYMENT_IS_OVERDUE = LoanProducts.DAYS_AFTER_REPAYMENT_IS_OVERDUE;
|
||||
|
||||
@@ -51,21 +49,22 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
/** Values to Days for Repayments */
|
||||
defaultConfigValues: GlobalConfiguration[] = [];
|
||||
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private processingStrategyService: ProcessingStrategyService) {
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private processingStrategyService: ProcessingStrategyService
|
||||
) {
|
||||
this.createLoanProductSettingsForm();
|
||||
this.setConditionalControls();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.defaultConfigValues = this.loanProductsTemplate['itemsByDefault'];
|
||||
this.isLinkedToFloatingInterestRates.valueChanges
|
||||
.subscribe((isLinkedToFloatingInterestRates: any) => {
|
||||
if (isLinkedToFloatingInterestRates) {
|
||||
this.loanProductSettingsForm.get('isInterestRecalculationEnabled').setValue(true);
|
||||
this.loanProductSettingsForm.get('allowPartialPeriodInterestCalcualtion').setValue(true);
|
||||
}
|
||||
});
|
||||
this.isLinkedToFloatingInterestRates.valueChanges.subscribe((isLinkedToFloatingInterestRates: any) => {
|
||||
if (isLinkedToFloatingInterestRates) {
|
||||
this.loanProductSettingsForm.get('isInterestRecalculationEnabled').setValue(true);
|
||||
this.loanProductSettingsForm.get('allowPartialPeriodInterestCalcualtion').setValue(true);
|
||||
}
|
||||
});
|
||||
|
||||
this.amortizationTypeData = this.loanProductsTemplate.amortizationTypeOptions;
|
||||
this.interestTypeData = this.loanProductsTemplate.interestTypeOptions;
|
||||
@@ -74,13 +73,15 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
this.transactionProcessingStrategyDataBase = this.loanProductsTemplate.transactionProcessingStrategyOptions;
|
||||
this.daysInYearTypeData = this.loanProductsTemplate.daysInYearTypeOptions;
|
||||
this.daysInMonthTypeData = this.loanProductsTemplate.daysInMonthTypeOptions;
|
||||
this.preClosureInterestCalculationStrategyData = this.loanProductsTemplate.preClosureInterestCalculationStrategyOptions;
|
||||
this.preClosureInterestCalculationStrategyData =
|
||||
this.loanProductsTemplate.preClosureInterestCalculationStrategyOptions;
|
||||
this.rescheduleStrategyTypeData = this.loanProductsTemplate.rescheduleStrategyTypeOptions;
|
||||
this.rescheduleStrategyTypeDataBase = this.loanProductsTemplate.rescheduleStrategyTypeOptions;
|
||||
this.interestRecalculationCompoundingTypeData = this.loanProductsTemplate.interestRecalculationCompoundingTypeOptions;
|
||||
this.interestRecalculationCompoundingTypeData =
|
||||
this.loanProductsTemplate.interestRecalculationCompoundingTypeOptions;
|
||||
this.interestRecalculationFrequencyTypeData = this.loanProductsTemplate.interestRecalculationFrequencyTypeOptions;
|
||||
this.interestRecalculationNthDayTypeData = this.loanProductsTemplate.interestRecalculationNthDayTypeOptions;
|
||||
this.interestRecalculationNthDayTypeData.push({ 'id': -2, 'code': 'onDay', 'value': 'on day' });
|
||||
this.interestRecalculationNthDayTypeData.push({ id: -2, code: 'onDay', value: 'on day' });
|
||||
this.interestRecalculationDayOfWeekTypeData = this.loanProductsTemplate.interestRecalculationDayOfWeekTypeOptions;
|
||||
this.interestRecalculationOnDayTypeData = Array.from({ length: 28 }, (_, index) => index + 1);
|
||||
this.delinquencyBucketData = this.loanProductsTemplate.delinquencyBucketOptions;
|
||||
@@ -90,121 +91,158 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
|
||||
// this.useDueForRepaymentsConfigurations = (!this.loanProduct.dueDaysForRepaymentEvent && !this.loanProduct.overDueDaysForRepaymentEvent);
|
||||
|
||||
const transactionProcessingStrategyCode: string = this.loanProductsTemplate.transactionProcessingStrategyCode || this.transactionProcessingStrategyData[0].code;
|
||||
const transactionProcessingStrategyCode: string =
|
||||
this.loanProductsTemplate.transactionProcessingStrategyCode || this.transactionProcessingStrategyData[0].code;
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'amortizationType': this.loanProductsTemplate.amortizationType.id,
|
||||
'interestType': this.loanProductsTemplate.interestType.id,
|
||||
'isEqualAmortization': this.loanProductsTemplate.isEqualAmortization,
|
||||
'interestCalculationPeriodType': this.loanProductsTemplate.interestCalculationPeriodType.id,
|
||||
'allowPartialPeriodInterestCalcualtion': this.loanProductsTemplate.allowPartialPeriodInterestCalcualtion,
|
||||
'transactionProcessingStrategyCode': transactionProcessingStrategyCode,
|
||||
'graceOnPrincipalPayment': this.loanProductsTemplate.graceOnPrincipalPayment,
|
||||
'graceOnInterestPayment': this.loanProductsTemplate.graceOnInterestPayment,
|
||||
'graceOnInterestCharged': this.loanProductsTemplate.graceOnInterestCharged,
|
||||
'inArrearsTolerance': this.loanProductsTemplate.inArrearsTolerance,
|
||||
'daysInYearType': this.loanProductsTemplate.daysInYearType.id,
|
||||
'daysInMonthType': this.loanProductsTemplate.daysInMonthType.id,
|
||||
'canDefineInstallmentAmount': this.loanProductsTemplate.canDefineInstallmentAmount,
|
||||
'graceOnArrearsAgeing': this.loanProductsTemplate.graceOnArrearsAgeing,
|
||||
'overdueDaysForNPA': this.loanProductsTemplate.overdueDaysForNPA,
|
||||
'accountMovesOutOfNPAOnlyOnArrearsCompletion': this.loanProductsTemplate.accountMovesOutOfNPAOnlyOnArrearsCompletion,
|
||||
'principalThresholdForLastInstallment': this.loanProductsTemplate.principalThresholdForLastInstallment,
|
||||
'allowVariableInstallments': this.loanProductsTemplate.allowVariableInstallments,
|
||||
'disallowExpectedDisbursements': this.loanProductsTemplate.disallowExpectedDisbursements,
|
||||
'minimumGap': this.loanProductsTemplate.minimumGap,
|
||||
'maximumGap': this.loanProductsTemplate.maximumGap,
|
||||
'canUseForTopup': this.loanProductsTemplate.canUseForTopup,
|
||||
'isInterestRecalculationEnabled': this.loanProductsTemplate.isInterestRecalculationEnabled,
|
||||
'holdGuaranteeFunds': this.loanProductsTemplate.holdGuaranteeFunds,
|
||||
'multiDisburseLoan': this.loanProductsTemplate.multiDisburseLoan,
|
||||
'maxTrancheCount': this.loanProductsTemplate.maxTrancheCount,
|
||||
'outstandingLoanBalance': this.loanProductsTemplate.outstandingLoanBalance,
|
||||
'enableDownPayment': this.loanProductsTemplate.enableDownPayment,
|
||||
'enableInstallmentLevelDelinquency': this.loanProductsTemplate.enableInstallmentLevelDelinquency,
|
||||
'loanScheduleType': this.loanProductsTemplate.loanScheduleType.code,
|
||||
'useDueForRepaymentsConfigurations': this.loanProductsTemplate.useDueForRepaymentsConfigurations,
|
||||
'allowAccrualPostingInArrears': this.loanProductsTemplate.allowAccrualPostingInArrears,
|
||||
'chargeOffBehaviour': this.loanProductsTemplate.chargeOffBehaviour.id
|
||||
amortizationType: this.loanProductsTemplate.amortizationType.id,
|
||||
interestType: this.loanProductsTemplate.interestType.id,
|
||||
isEqualAmortization: this.loanProductsTemplate.isEqualAmortization,
|
||||
interestCalculationPeriodType: this.loanProductsTemplate.interestCalculationPeriodType.id,
|
||||
allowPartialPeriodInterestCalcualtion: this.loanProductsTemplate.allowPartialPeriodInterestCalcualtion,
|
||||
transactionProcessingStrategyCode: transactionProcessingStrategyCode,
|
||||
graceOnPrincipalPayment: this.loanProductsTemplate.graceOnPrincipalPayment,
|
||||
graceOnInterestPayment: this.loanProductsTemplate.graceOnInterestPayment,
|
||||
graceOnInterestCharged: this.loanProductsTemplate.graceOnInterestCharged,
|
||||
inArrearsTolerance: this.loanProductsTemplate.inArrearsTolerance,
|
||||
daysInYearType: this.loanProductsTemplate.daysInYearType.id,
|
||||
daysInMonthType: this.loanProductsTemplate.daysInMonthType.id,
|
||||
canDefineInstallmentAmount: this.loanProductsTemplate.canDefineInstallmentAmount,
|
||||
graceOnArrearsAgeing: this.loanProductsTemplate.graceOnArrearsAgeing,
|
||||
overdueDaysForNPA: this.loanProductsTemplate.overdueDaysForNPA,
|
||||
accountMovesOutOfNPAOnlyOnArrearsCompletion:
|
||||
this.loanProductsTemplate.accountMovesOutOfNPAOnlyOnArrearsCompletion,
|
||||
principalThresholdForLastInstallment: this.loanProductsTemplate.principalThresholdForLastInstallment,
|
||||
allowVariableInstallments: this.loanProductsTemplate.allowVariableInstallments,
|
||||
disallowExpectedDisbursements: this.loanProductsTemplate.disallowExpectedDisbursements,
|
||||
minimumGap: this.loanProductsTemplate.minimumGap,
|
||||
maximumGap: this.loanProductsTemplate.maximumGap,
|
||||
canUseForTopup: this.loanProductsTemplate.canUseForTopup,
|
||||
isInterestRecalculationEnabled: this.loanProductsTemplate.isInterestRecalculationEnabled,
|
||||
holdGuaranteeFunds: this.loanProductsTemplate.holdGuaranteeFunds,
|
||||
multiDisburseLoan: this.loanProductsTemplate.multiDisburseLoan,
|
||||
maxTrancheCount: this.loanProductsTemplate.maxTrancheCount,
|
||||
outstandingLoanBalance: this.loanProductsTemplate.outstandingLoanBalance,
|
||||
enableDownPayment: this.loanProductsTemplate.enableDownPayment,
|
||||
enableInstallmentLevelDelinquency: this.loanProductsTemplate.enableInstallmentLevelDelinquency,
|
||||
loanScheduleType: this.loanProductsTemplate.loanScheduleType.code,
|
||||
useDueForRepaymentsConfigurations: this.loanProductsTemplate.useDueForRepaymentsConfigurations,
|
||||
allowAccrualPostingInArrears: this.loanProductsTemplate.allowAccrualPostingInArrears,
|
||||
chargeOffBehaviour: this.loanProductsTemplate.chargeOffBehaviour.id
|
||||
});
|
||||
|
||||
this.isAdvancedTransactionProcessingStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(transactionProcessingStrategyCode);
|
||||
this.isAdvancedTransactionProcessingStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(
|
||||
transactionProcessingStrategyCode
|
||||
);
|
||||
this.processingStrategyService.initialize(this.isAdvancedTransactionProcessingStrategy);
|
||||
this.validateAdvancedPaymentStrategyControls();
|
||||
|
||||
if (this.loanProductsTemplate.dueDaysForRepaymentEvent != null &&
|
||||
this.loanProductsTemplate.overDueDaysForRepaymentEvent != null) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'useDueForRepaymentsConfigurations': false,
|
||||
'dueDaysForRepaymentEvent': this.loanProductsTemplate.dueDaysForRepaymentEvent,
|
||||
'overDueDaysForRepaymentEvent': this.loanProductsTemplate.overDueDaysForRepaymentEvent
|
||||
});
|
||||
if (
|
||||
this.loanProductsTemplate.dueDaysForRepaymentEvent != null &&
|
||||
this.loanProductsTemplate.overDueDaysForRepaymentEvent != null
|
||||
) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
useDueForRepaymentsConfigurations: false,
|
||||
dueDaysForRepaymentEvent: this.loanProductsTemplate.dueDaysForRepaymentEvent,
|
||||
overDueDaysForRepaymentEvent: this.loanProductsTemplate.overDueDaysForRepaymentEvent
|
||||
});
|
||||
} else {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'useDueForRepaymentsConfigurations': true,
|
||||
'dueDaysForRepaymentEvent': null,
|
||||
'overDueDaysForRepaymentEvent': null
|
||||
useDueForRepaymentsConfigurations: true,
|
||||
dueDaysForRepaymentEvent: null,
|
||||
overDueDaysForRepaymentEvent: null
|
||||
});
|
||||
}
|
||||
|
||||
if (this.loanProductsTemplate.delinquencyBucket) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'delinquencyBucketId': this.loanProductsTemplate.delinquencyBucket.id > 0 ? this.loanProductsTemplate.delinquencyBucket.id : null
|
||||
delinquencyBucketId:
|
||||
this.loanProductsTemplate.delinquencyBucket.id > 0 ? this.loanProductsTemplate.delinquencyBucket.id : null
|
||||
});
|
||||
}
|
||||
|
||||
if (this.loanProductsTemplate.enableDownPayment) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'disbursedAmountPercentageForDownPayment': this.loanProductsTemplate.disbursedAmountPercentageForDownPayment || 0,
|
||||
'enableAutoRepaymentForDownPayment': this.loanProductsTemplate.enableAutoRepaymentForDownPayment || false
|
||||
disbursedAmountPercentageForDownPayment: this.loanProductsTemplate.disbursedAmountPercentageForDownPayment || 0,
|
||||
enableAutoRepaymentForDownPayment: this.loanProductsTemplate.enableAutoRepaymentForDownPayment || false
|
||||
});
|
||||
}
|
||||
|
||||
if (this.loanProductsTemplate.isInterestRecalculationEnabled) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'preClosureInterestCalculationStrategy': this.loanProductsTemplate.interestRecalculationData.preClosureInterestCalculationStrategy.id,
|
||||
'rescheduleStrategyMethod': this.loanProductsTemplate.interestRecalculationData.rescheduleStrategyType.id,
|
||||
'interestRecalculationCompoundingMethod': this.loanProductsTemplate.interestRecalculationData.interestRecalculationCompoundingType.id,
|
||||
'recalculationRestFrequencyType': this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyType.id,
|
||||
'isArrearsBasedOnOriginalSchedule': this.loanProductsTemplate.interestRecalculationData.isArrearsBasedOnOriginalSchedule,
|
||||
'recalculationCompoundingFrequencyType': this.loanProductsTemplate.interestRecalculationData.interestRecalculationCompoundingType.id && this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyType.id,
|
||||
'recalculationCompoundingFrequencyInterval': this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyInterval,
|
||||
'recalculationRestFrequencyInterval': this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyInterval,
|
||||
'recalculationRestFrequencyNthDayType': this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyType.id === 4 && this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyOnDay ?
|
||||
-2 : this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyNthDay && this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyNthDay.id,
|
||||
'recalculationCompoundingFrequencyNthDayType': this.loanProductsTemplate.interestRecalculationData.interestRecalculationCompoundingType.id && this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyType.id === 4
|
||||
&& this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyOnDay ? -2 : this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyNthDay
|
||||
&& this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyNthDay.id,
|
||||
'recalculationCompoundingFrequencyDayOfWeekType': this.loanProductsTemplate.interestRecalculationData.interestRecalculationCompoundingType.id && ((this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyType.id
|
||||
=== 4 && !this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyOnDay) || this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyType.id === 3)
|
||||
&& this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyWeekday && this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyWeekday.id,
|
||||
'recalculationRestFrequencyDayOfWeekType': ((this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyType.id === 4 && !this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyOnDay)
|
||||
|| this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyType.id === 3) && this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyWeekday
|
||||
&& this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyWeekday.id,
|
||||
'recalculationCompoundingFrequencyOnDayType': this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyOnDay,
|
||||
'recalculationRestFrequencyOnDayType': this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyOnDay
|
||||
preClosureInterestCalculationStrategy:
|
||||
this.loanProductsTemplate.interestRecalculationData.preClosureInterestCalculationStrategy.id,
|
||||
rescheduleStrategyMethod: this.loanProductsTemplate.interestRecalculationData.rescheduleStrategyType.id,
|
||||
interestRecalculationCompoundingMethod:
|
||||
this.loanProductsTemplate.interestRecalculationData.interestRecalculationCompoundingType.id,
|
||||
recalculationRestFrequencyType:
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyType.id,
|
||||
isArrearsBasedOnOriginalSchedule:
|
||||
this.loanProductsTemplate.interestRecalculationData.isArrearsBasedOnOriginalSchedule,
|
||||
recalculationCompoundingFrequencyType:
|
||||
this.loanProductsTemplate.interestRecalculationData.interestRecalculationCompoundingType.id &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyType.id,
|
||||
recalculationCompoundingFrequencyInterval:
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyInterval,
|
||||
recalculationRestFrequencyInterval:
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyInterval,
|
||||
recalculationRestFrequencyNthDayType:
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyType.id === 4 &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyOnDay
|
||||
? -2
|
||||
: this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyNthDay &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyNthDay.id,
|
||||
recalculationCompoundingFrequencyNthDayType:
|
||||
this.loanProductsTemplate.interestRecalculationData.interestRecalculationCompoundingType.id &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyType.id === 4 &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyOnDay
|
||||
? -2
|
||||
: this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyNthDay &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyNthDay.id,
|
||||
recalculationCompoundingFrequencyDayOfWeekType:
|
||||
this.loanProductsTemplate.interestRecalculationData.interestRecalculationCompoundingType.id &&
|
||||
((this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyType.id === 4 &&
|
||||
!this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyOnDay) ||
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyType.id === 3) &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyWeekday &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyWeekday.id,
|
||||
recalculationRestFrequencyDayOfWeekType:
|
||||
((this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyType.id === 4 &&
|
||||
!this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyOnDay) ||
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyType.id === 3) &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyWeekday &&
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyWeekday.id,
|
||||
recalculationCompoundingFrequencyOnDayType:
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationCompoundingFrequencyOnDay,
|
||||
recalculationRestFrequencyOnDayType:
|
||||
this.loanProductsTemplate.interestRecalculationData.recalculationRestFrequencyOnDay
|
||||
});
|
||||
}
|
||||
|
||||
if (this.loanProductsTemplate.holdGuaranteeFunds) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'mandatoryGuarantee': this.loanProductsTemplate.productGuaranteeData.mandatoryGuarantee,
|
||||
'minimumGuaranteeFromOwnFunds': this.loanProductsTemplate.productGuaranteeData.minimumGuaranteeFromOwnFunds,
|
||||
'minimumGuaranteeFromGuarantor': this.loanProductsTemplate.productGuaranteeData.minimumGuaranteeFromGuarantor
|
||||
mandatoryGuarantee: this.loanProductsTemplate.productGuaranteeData.mandatoryGuarantee,
|
||||
minimumGuaranteeFromOwnFunds: this.loanProductsTemplate.productGuaranteeData.minimumGuaranteeFromOwnFunds,
|
||||
minimumGuaranteeFromGuarantor: this.loanProductsTemplate.productGuaranteeData.minimumGuaranteeFromGuarantor
|
||||
});
|
||||
}
|
||||
|
||||
if (this.loanProductsTemplate.allowAttributeOverrides) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'allowAttributeConfiguration': Object.values(this.loanProductsTemplate.allowAttributeOverrides).some((attribute: boolean) => attribute),
|
||||
'allowAttributeOverrides': {
|
||||
'amortizationType': this.loanProductsTemplate.allowAttributeOverrides.amortizationType,
|
||||
'interestType': this.loanProductsTemplate.allowAttributeOverrides.interestType,
|
||||
'transactionProcessingStrategyCode': this.loanProductsTemplate.allowAttributeOverrides.transactionProcessingStrategyCode,
|
||||
'interestCalculationPeriodType': this.loanProductsTemplate.allowAttributeOverrides.interestCalculationPeriodType,
|
||||
'inArrearsTolerance': this.loanProductsTemplate.allowAttributeOverrides.inArrearsTolerance,
|
||||
'repaymentEvery': this.loanProductsTemplate.allowAttributeOverrides.repaymentEvery,
|
||||
'graceOnPrincipalAndInterestPayment': this.loanProductsTemplate.allowAttributeOverrides.graceOnPrincipalAndInterestPayment,
|
||||
'graceOnArrearsAgeing': this.loanProductsTemplate.allowAttributeOverrides.graceOnArrearsAgeing
|
||||
allowAttributeConfiguration: Object.values(this.loanProductsTemplate.allowAttributeOverrides).some(
|
||||
(attribute: boolean) => attribute
|
||||
),
|
||||
allowAttributeOverrides: {
|
||||
amortizationType: this.loanProductsTemplate.allowAttributeOverrides.amortizationType,
|
||||
interestType: this.loanProductsTemplate.allowAttributeOverrides.interestType,
|
||||
transactionProcessingStrategyCode:
|
||||
this.loanProductsTemplate.allowAttributeOverrides.transactionProcessingStrategyCode,
|
||||
interestCalculationPeriodType:
|
||||
this.loanProductsTemplate.allowAttributeOverrides.interestCalculationPeriodType,
|
||||
inArrearsTolerance: this.loanProductsTemplate.allowAttributeOverrides.inArrearsTolerance,
|
||||
repaymentEvery: this.loanProductsTemplate.allowAttributeOverrides.repaymentEvery,
|
||||
graceOnPrincipalAndInterestPayment:
|
||||
this.loanProductsTemplate.allowAttributeOverrides.graceOnPrincipalAndInterestPayment,
|
||||
graceOnArrearsAgeing: this.loanProductsTemplate.allowAttributeOverrides.graceOnArrearsAgeing
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -212,63 +250,86 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
|
||||
createLoanProductSettingsForm() {
|
||||
this.loanProductSettingsForm = this.formBuilder.group({
|
||||
'amortizationType': ['', Validators.required],
|
||||
'interestType': ['', Validators.required],
|
||||
'isEqualAmortization': [false],
|
||||
'interestCalculationPeriodType': ['', Validators.required],
|
||||
'transactionProcessingStrategyCode': ['', Validators.required],
|
||||
'graceOnPrincipalPayment': [''],
|
||||
'graceOnInterestPayment': [''],
|
||||
'graceOnInterestCharged': [''],
|
||||
'inArrearsTolerance': [''],
|
||||
'daysInYearType': ['', Validators.required],
|
||||
'daysInMonthType': ['', Validators.required],
|
||||
'canDefineInstallmentAmount': [false],
|
||||
'graceOnArrearsAgeing': [''],
|
||||
'overdueDaysForNPA': [''],
|
||||
'accountMovesOutOfNPAOnlyOnArrearsCompletion': [false],
|
||||
'principalThresholdForLastInstallment': [''],
|
||||
'allowVariableInstallments': [false],
|
||||
'disallowExpectedDisbursements': [false],
|
||||
'canUseForTopup': [false],
|
||||
'isInterestRecalculationEnabled': [false],
|
||||
'holdGuaranteeFunds': [false],
|
||||
'multiDisburseLoan': [false],
|
||||
'allowAttributeConfiguration': [true],
|
||||
'allowPartialPeriodInterestCalcualtion': [false],
|
||||
'allowAttributeOverrides': this.formBuilder.group({
|
||||
'amortizationType': [true],
|
||||
'interestType': [true],
|
||||
'transactionProcessingStrategyCode': [true],
|
||||
'interestCalculationPeriodType': [true],
|
||||
'inArrearsTolerance': [true],
|
||||
'repaymentEvery': [true],
|
||||
'graceOnPrincipalAndInterestPayment': [true],
|
||||
'graceOnArrearsAgeing': [true]
|
||||
amortizationType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
interestType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
isEqualAmortization: [false],
|
||||
interestCalculationPeriodType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
transactionProcessingStrategyCode: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
graceOnPrincipalPayment: [''],
|
||||
graceOnInterestPayment: [''],
|
||||
graceOnInterestCharged: [''],
|
||||
inArrearsTolerance: [''],
|
||||
daysInYearType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
daysInMonthType: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
canDefineInstallmentAmount: [false],
|
||||
graceOnArrearsAgeing: [''],
|
||||
overdueDaysForNPA: [''],
|
||||
accountMovesOutOfNPAOnlyOnArrearsCompletion: [false],
|
||||
principalThresholdForLastInstallment: [''],
|
||||
allowVariableInstallments: [false],
|
||||
disallowExpectedDisbursements: [false],
|
||||
canUseForTopup: [false],
|
||||
isInterestRecalculationEnabled: [false],
|
||||
holdGuaranteeFunds: [false],
|
||||
multiDisburseLoan: [false],
|
||||
allowAttributeConfiguration: [true],
|
||||
allowPartialPeriodInterestCalcualtion: [false],
|
||||
allowAttributeOverrides: this.formBuilder.group({
|
||||
amortizationType: [true],
|
||||
interestType: [true],
|
||||
transactionProcessingStrategyCode: [true],
|
||||
interestCalculationPeriodType: [true],
|
||||
inArrearsTolerance: [true],
|
||||
repaymentEvery: [true],
|
||||
graceOnPrincipalAndInterestPayment: [true],
|
||||
graceOnArrearsAgeing: [true]
|
||||
}),
|
||||
'delinquencyBucketId': [''],
|
||||
'enableDownPayment': [false],
|
||||
'enableInstallmentLevelDelinquency': [false],
|
||||
'useDueForRepaymentsConfigurations': [false],
|
||||
'dueDaysForRepaymentEvent': [''],
|
||||
'overDueDaysForRepaymentEvent': [''],
|
||||
'loanScheduleType': [LoanProducts.LOAN_SCHEDULE_TYPE_CUMULATIVE, Validators.required],
|
||||
'allowAccrualPostingInArrears': [false]
|
||||
delinquencyBucketId: [''],
|
||||
enableDownPayment: [false],
|
||||
enableInstallmentLevelDelinquency: [false],
|
||||
useDueForRepaymentsConfigurations: [false],
|
||||
dueDaysForRepaymentEvent: [''],
|
||||
overDueDaysForRepaymentEvent: [''],
|
||||
loanScheduleType: [
|
||||
LoanProducts.LOAN_SCHEDULE_TYPE_CUMULATIVE,
|
||||
Validators.required
|
||||
],
|
||||
allowAccrualPostingInArrears: [false]
|
||||
});
|
||||
}
|
||||
|
||||
setConditionalControls() {
|
||||
const allowAttributeOverrides = this.loanProductSettingsForm.get('allowAttributeOverrides');
|
||||
|
||||
this.loanProductSettingsForm.get('interestCalculationPeriodType').valueChanges
|
||||
.subscribe((interestCalculationPeriodType: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('interestCalculationPeriodType')
|
||||
.valueChanges.subscribe((interestCalculationPeriodType: any) => {
|
||||
if (interestCalculationPeriodType === 0) {
|
||||
this.loanProductSettingsForm.patchValue({ 'allowPartialPeriodInterestCalcualtion': false });
|
||||
this.loanProductSettingsForm.patchValue({ allowPartialPeriodInterestCalcualtion: false });
|
||||
}
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('allowVariableInstallments').valueChanges
|
||||
.subscribe((allowVariableInstallments: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('allowVariableInstallments')
|
||||
.valueChanges.subscribe((allowVariableInstallments: any) => {
|
||||
if (allowVariableInstallments) {
|
||||
this.loanProductSettingsForm.addControl('minimumGap', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductSettingsForm.addControl('maximumGap', new UntypedFormControl('', Validators.required));
|
||||
@@ -278,45 +339,84 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('isInterestRecalculationEnabled').valueChanges
|
||||
.subscribe((isInterestRecalculationEnabled: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('isInterestRecalculationEnabled')
|
||||
.valueChanges.subscribe((isInterestRecalculationEnabled: any) => {
|
||||
if (isInterestRecalculationEnabled) {
|
||||
this.loanProductSettingsForm.addControl('preClosureInterestCalculationStrategy', new UntypedFormControl(this.preClosureInterestCalculationStrategyData[0].id, Validators.required));
|
||||
this.loanProductSettingsForm.addControl('rescheduleStrategyMethod', new UntypedFormControl(this.rescheduleStrategyTypeData[0].id, Validators.required));
|
||||
this.loanProductSettingsForm.addControl('interestRecalculationCompoundingMethod', new UntypedFormControl(this.interestRecalculationCompoundingTypeData[0].id, Validators.required));
|
||||
this.loanProductSettingsForm.addControl('recalculationRestFrequencyType', new UntypedFormControl(this.interestRecalculationFrequencyTypeData[0].id, Validators.required));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'preClosureInterestCalculationStrategy',
|
||||
new UntypedFormControl(this.preClosureInterestCalculationStrategyData[0].id, Validators.required)
|
||||
);
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'rescheduleStrategyMethod',
|
||||
new UntypedFormControl(this.rescheduleStrategyTypeData[0].id, Validators.required)
|
||||
);
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'interestRecalculationCompoundingMethod',
|
||||
new UntypedFormControl(this.interestRecalculationCompoundingTypeData[0].id, Validators.required)
|
||||
);
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationRestFrequencyType',
|
||||
new UntypedFormControl(this.interestRecalculationFrequencyTypeData[0].id, Validators.required)
|
||||
);
|
||||
this.loanProductSettingsForm.addControl('isArrearsBasedOnOriginalSchedule', new UntypedFormControl(''));
|
||||
if (this.loanProductSettingsForm.value.isInterestRecalculationEnabled) {
|
||||
this.setRescheduleStrategies();
|
||||
}
|
||||
this.loanProductSettingsForm.get('interestRecalculationCompoundingMethod').valueChanges
|
||||
.subscribe((interestRecalculationCompoundingMethod: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('interestRecalculationCompoundingMethod')
|
||||
.valueChanges.subscribe((interestRecalculationCompoundingMethod: any) => {
|
||||
if (interestRecalculationCompoundingMethod !== 0) {
|
||||
this.loanProductSettingsForm.addControl('recalculationCompoundingFrequencyType', new UntypedFormControl(this.interestRecalculationFrequencyTypeData[0].id, Validators.required));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationCompoundingFrequencyType',
|
||||
new UntypedFormControl(this.interestRecalculationFrequencyTypeData[0].id, Validators.required)
|
||||
);
|
||||
|
||||
this.loanProductSettingsForm.get('recalculationCompoundingFrequencyType').valueChanges
|
||||
.subscribe((recalculationCompoundingFrequencyType: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('recalculationCompoundingFrequencyType')
|
||||
.valueChanges.subscribe((recalculationCompoundingFrequencyType: any) => {
|
||||
if (recalculationCompoundingFrequencyType !== 1) {
|
||||
this.loanProductSettingsForm.addControl('recalculationCompoundingFrequencyInterval', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationCompoundingFrequencyInterval',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('recalculationCompoundingFrequencyInterval');
|
||||
}
|
||||
|
||||
if (recalculationCompoundingFrequencyType === 3) {
|
||||
this.loanProductSettingsForm.addControl('recalculationCompoundingFrequencyDayOfWeekType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationCompoundingFrequencyDayOfWeekType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
this.loanProductSettingsForm.removeControl('recalculationCompoundingFrequencyNthDayType');
|
||||
this.loanProductSettingsForm.removeControl('recalculationCompoundingFrequencyOnDayType');
|
||||
} else if (recalculationCompoundingFrequencyType === 4) {
|
||||
this.loanProductSettingsForm.addControl('recalculationCompoundingFrequencyNthDayType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl('recalculationCompoundingFrequencyDayOfWeekType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationCompoundingFrequencyNthDayType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationCompoundingFrequencyDayOfWeekType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
|
||||
this.loanProductSettingsForm.get('recalculationCompoundingFrequencyNthDayType').valueChanges
|
||||
.subscribe((recalculationCompoundingFrequencyNthDayType: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('recalculationCompoundingFrequencyNthDayType')
|
||||
.valueChanges.subscribe((recalculationCompoundingFrequencyNthDayType: any) => {
|
||||
if (recalculationCompoundingFrequencyNthDayType === -2) {
|
||||
this.loanProductSettingsForm.addControl('recalculationCompoundingFrequencyOnDayType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.removeControl('recalculationCompoundingFrequencyDayOfWeekType');
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationCompoundingFrequencyOnDayType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
this.loanProductSettingsForm.removeControl(
|
||||
'recalculationCompoundingFrequencyDayOfWeekType'
|
||||
);
|
||||
} else {
|
||||
this.loanProductSettingsForm.addControl('recalculationCompoundingFrequencyDayOfWeekType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationCompoundingFrequencyDayOfWeekType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
this.loanProductSettingsForm.removeControl('recalculationCompoundingFrequencyOnDayType');
|
||||
}
|
||||
});
|
||||
@@ -326,46 +426,63 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
this.loanProductSettingsForm.removeControl('recalculationCompoundingFrequencyOnDayType');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('recalculationCompoundingFrequencyType');
|
||||
}
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('recalculationRestFrequencyType').valueChanges
|
||||
.subscribe((recalculationRestFrequencyType: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('recalculationRestFrequencyType')
|
||||
.valueChanges.subscribe((recalculationRestFrequencyType: any) => {
|
||||
if (recalculationRestFrequencyType !== 1) {
|
||||
this.loanProductSettingsForm.addControl('recalculationRestFrequencyInterval', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationRestFrequencyInterval',
|
||||
new UntypedFormControl('', Validators.required)
|
||||
);
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyInterval');
|
||||
}
|
||||
|
||||
if (recalculationRestFrequencyType === 3) {
|
||||
this.loanProductSettingsForm.addControl('recalculationRestFrequencyDayOfWeekType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationRestFrequencyDayOfWeekType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyNthDayType');
|
||||
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyOnDayType');
|
||||
} else if (recalculationRestFrequencyType === 4) {
|
||||
this.loanProductSettingsForm.addControl('recalculationRestFrequencyNthDayType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl('recalculationRestFrequencyDayOfWeekType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationRestFrequencyNthDayType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationRestFrequencyDayOfWeekType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
|
||||
this.loanProductSettingsForm.get('recalculationRestFrequencyNthDayType').valueChanges
|
||||
.subscribe((recalculationRestFrequencyNthDayType: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('recalculationRestFrequencyNthDayType')
|
||||
.valueChanges.subscribe((recalculationRestFrequencyNthDayType: any) => {
|
||||
if (recalculationRestFrequencyNthDayType === -2) {
|
||||
this.loanProductSettingsForm.addControl('recalculationRestFrequencyOnDayType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationRestFrequencyOnDayType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyDayOfWeekType');
|
||||
} else {
|
||||
this.loanProductSettingsForm.addControl('recalculationRestFrequencyDayOfWeekType', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'recalculationRestFrequencyDayOfWeekType',
|
||||
new UntypedFormControl('')
|
||||
);
|
||||
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyOnDayType');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyNthDayType');
|
||||
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyDayOfWeekType');
|
||||
this.loanProductSettingsForm.removeControl('recalculationRestFrequencyOnDayType');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('preClosureInterestCalculationStrategy');
|
||||
this.loanProductSettingsForm.removeControl('rescheduleStrategyMethod');
|
||||
@@ -376,122 +493,134 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
this.enableFieldsWhenScheduleTypeIsProgressiveAndInterestRateRecalculationEnabled();
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('holdGuaranteeFunds').valueChanges
|
||||
.subscribe(holdGuaranteeFunds => {
|
||||
if (holdGuaranteeFunds) {
|
||||
this.loanProductSettingsForm.addControl('mandatoryGuarantee', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductSettingsForm.addControl('minimumGuaranteeFromOwnFunds', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl('minimumGuaranteeFromGuarantor', new UntypedFormControl(''));
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('mandatoryGuarantee');
|
||||
this.loanProductSettingsForm.removeControl('minimumGuaranteeFromOwnFunds');
|
||||
this.loanProductSettingsForm.removeControl('minimumGuaranteeFromGuarantor');
|
||||
}
|
||||
});
|
||||
this.loanProductSettingsForm.get('holdGuaranteeFunds').valueChanges.subscribe((holdGuaranteeFunds) => {
|
||||
if (holdGuaranteeFunds) {
|
||||
this.loanProductSettingsForm.addControl('mandatoryGuarantee', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductSettingsForm.addControl('minimumGuaranteeFromOwnFunds', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.addControl('minimumGuaranteeFromGuarantor', new UntypedFormControl(''));
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('mandatoryGuarantee');
|
||||
this.loanProductSettingsForm.removeControl('minimumGuaranteeFromOwnFunds');
|
||||
this.loanProductSettingsForm.removeControl('minimumGuaranteeFromGuarantor');
|
||||
}
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('multiDisburseLoan').valueChanges
|
||||
.subscribe(multiDisburseLoan => {
|
||||
if (multiDisburseLoan) {
|
||||
this.loanProductSettingsForm.addControl('maxTrancheCount', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductSettingsForm.addControl('outstandingLoanBalance', new UntypedFormControl(''));
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('maxTrancheCount');
|
||||
this.loanProductSettingsForm.removeControl('outstandingLoanBalance');
|
||||
this.loanProductSettingsForm.patchValue({ 'disallowExpectedDisbursements': false });
|
||||
}
|
||||
});
|
||||
this.loanProductSettingsForm.get('multiDisburseLoan').valueChanges.subscribe((multiDisburseLoan) => {
|
||||
if (multiDisburseLoan) {
|
||||
this.loanProductSettingsForm.addControl('maxTrancheCount', new UntypedFormControl('', Validators.required));
|
||||
this.loanProductSettingsForm.addControl('outstandingLoanBalance', new UntypedFormControl(''));
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('maxTrancheCount');
|
||||
this.loanProductSettingsForm.removeControl('outstandingLoanBalance');
|
||||
this.loanProductSettingsForm.patchValue({ disallowExpectedDisbursements: false });
|
||||
}
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('enableDownPayment').valueChanges
|
||||
.subscribe(enableDownPayment => {
|
||||
if (enableDownPayment) {
|
||||
this.loanProductSettingsForm.addControl('disbursedAmountPercentageForDownPayment', new UntypedFormControl(0, [Validators.required, rangeValidator(0, 100) ]));
|
||||
this.loanProductSettingsForm.addControl('enableAutoRepaymentForDownPayment', new UntypedFormControl(false, []));
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('disbursedAmountPercentageForDownPayment');
|
||||
this.loanProductSettingsForm.removeControl('enableAutoRepaymentForDownPayment');
|
||||
}
|
||||
});
|
||||
this.loanProductSettingsForm.get('enableDownPayment').valueChanges.subscribe((enableDownPayment) => {
|
||||
if (enableDownPayment) {
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'disbursedAmountPercentageForDownPayment',
|
||||
new UntypedFormControl(0, [
|
||||
Validators.required,
|
||||
rangeValidator(0, 100)])
|
||||
);
|
||||
this.loanProductSettingsForm.addControl('enableAutoRepaymentForDownPayment', new UntypedFormControl(false, []));
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('disbursedAmountPercentageForDownPayment');
|
||||
this.loanProductSettingsForm.removeControl('enableAutoRepaymentForDownPayment');
|
||||
}
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('transactionProcessingStrategyCode').valueChanges
|
||||
.subscribe((transactionProcessingStrategyCode: string) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('transactionProcessingStrategyCode')
|
||||
.valueChanges.subscribe((transactionProcessingStrategyCode: string) => {
|
||||
this.advancePaymentStrategy.emit(transactionProcessingStrategyCode);
|
||||
this.isAdvancedTransactionProcessingStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(transactionProcessingStrategyCode);
|
||||
this.isAdvancedTransactionProcessingStrategy = LoanProducts.isAdvancedPaymentAllocationStrategy(
|
||||
transactionProcessingStrategyCode
|
||||
);
|
||||
this.processingStrategyService.initialize(this.isAdvancedTransactionProcessingStrategy);
|
||||
this.validateAdvancedPaymentStrategyControls();
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('allowAttributeConfiguration').valueChanges
|
||||
.subscribe((allowAttributeConfiguration: any) => {
|
||||
this.loanProductSettingsForm
|
||||
.get('allowAttributeConfiguration')
|
||||
.valueChanges.subscribe((allowAttributeConfiguration: any) => {
|
||||
if (allowAttributeConfiguration) {
|
||||
allowAttributeOverrides.patchValue({
|
||||
'amortizationType': true,
|
||||
'interestType': true,
|
||||
'transactionProcessingStrategyCode': true,
|
||||
'interestCalculationPeriodType': true,
|
||||
'inArrearsTolerance': true,
|
||||
'repaymentEvery': true,
|
||||
'graceOnPrincipalAndInterestPayment': true,
|
||||
'graceOnArrearsAgeing': true
|
||||
amortizationType: true,
|
||||
interestType: true,
|
||||
transactionProcessingStrategyCode: true,
|
||||
interestCalculationPeriodType: true,
|
||||
inArrearsTolerance: true,
|
||||
repaymentEvery: true,
|
||||
graceOnPrincipalAndInterestPayment: true,
|
||||
graceOnArrearsAgeing: true
|
||||
});
|
||||
} else {
|
||||
allowAttributeOverrides.patchValue({
|
||||
'amortizationType': false,
|
||||
'interestType': false,
|
||||
'transactionProcessingStrategyCode': false,
|
||||
'interestCalculationPeriodType': false,
|
||||
'inArrearsTolerance': false,
|
||||
'repaymentEvery': false,
|
||||
'graceOnPrincipalAndInterestPayment': false,
|
||||
'graceOnArrearsAgeing': false
|
||||
amortizationType: false,
|
||||
interestType: false,
|
||||
transactionProcessingStrategyCode: false,
|
||||
interestCalculationPeriodType: false,
|
||||
inArrearsTolerance: false,
|
||||
repaymentEvery: false,
|
||||
graceOnPrincipalAndInterestPayment: false,
|
||||
graceOnArrearsAgeing: false
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('useDueForRepaymentsConfigurations').valueChanges
|
||||
.subscribe((useDueForRepaymentsConfigurations: boolean) => {
|
||||
if (useDueForRepaymentsConfigurations) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'dueDaysForRepaymentEvent': null,
|
||||
'overDueDaysForRepaymentEvent': null
|
||||
});
|
||||
} else {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'dueDaysForRepaymentEvent': this.getGlobalConfigValue(LoanProducts.DAYS_BEFORE_REPAYMENT_IS_DUE),
|
||||
'overDueDaysForRepaymentEvent': this.getGlobalConfigValue(LoanProducts.DAYS_AFTER_REPAYMENT_IS_OVERDUE)
|
||||
});
|
||||
}
|
||||
});
|
||||
this.loanProductSettingsForm
|
||||
.get('useDueForRepaymentsConfigurations')
|
||||
.valueChanges.subscribe((useDueForRepaymentsConfigurations: boolean) => {
|
||||
if (useDueForRepaymentsConfigurations) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
dueDaysForRepaymentEvent: null,
|
||||
overDueDaysForRepaymentEvent: null
|
||||
});
|
||||
} else {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
dueDaysForRepaymentEvent: this.getGlobalConfigValue(LoanProducts.DAYS_BEFORE_REPAYMENT_IS_DUE),
|
||||
overDueDaysForRepaymentEvent: this.getGlobalConfigValue(LoanProducts.DAYS_AFTER_REPAYMENT_IS_OVERDUE)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.loanProductSettingsForm.get('loanScheduleType').valueChanges
|
||||
.subscribe((loanScheduleType: string) => {
|
||||
this.loanProductSettingsForm.get('loanScheduleType').valueChanges.subscribe((loanScheduleType: string) => {
|
||||
this.transactionProcessingStrategyData = [];
|
||||
if (loanScheduleType === LoanProducts.LOAN_SCHEDULE_TYPE_CUMULATIVE) {
|
||||
// Filter Advanced Payment Allocation Strategy
|
||||
this.transactionProcessingStrategyData = this.transactionProcessingStrategyDataBase.filter(
|
||||
(cn: CodeName) => !LoanProducts.isAdvancedPaymentAllocationStrategy(cn.code)
|
||||
);
|
||||
if (LoanProducts.isAdvancedPaymentAllocationStrategy(this.loanProductSettingsForm.value.transactionProcessingStrategyCode)) {
|
||||
if (
|
||||
LoanProducts.isAdvancedPaymentAllocationStrategy(
|
||||
this.loanProductSettingsForm.value.transactionProcessingStrategyCode
|
||||
)
|
||||
) {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'transactionProcessingStrategyCode': this.transactionProcessingStrategyData[0].code
|
||||
transactionProcessingStrategyCode: this.transactionProcessingStrategyData[0].code
|
||||
});
|
||||
}
|
||||
this.advancedTransactionProcessingStrategyDisabled = false;
|
||||
this.isAdvancedTransactionProcessingStrategy = false;
|
||||
this.isAdvancedTransactionProcessingStrategy = false;
|
||||
this.loanProductSettingsForm.removeControl('chargeOffBehaviour');
|
||||
} else {
|
||||
// Only Advanced Payment Allocation Strategy
|
||||
this.transactionProcessingStrategyDataBase.some(
|
||||
(cn: CodeName) => {
|
||||
this.transactionProcessingStrategyDataBase.some((cn: CodeName) => {
|
||||
if (LoanProducts.isAdvancedPaymentAllocationStrategy(cn.code)) {
|
||||
this.transactionProcessingStrategyData.push(cn);
|
||||
}
|
||||
});
|
||||
this.advancedTransactionProcessingStrategyDisabled = true;
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'transactionProcessingStrategyCode': this.transactionProcessingStrategyData[0].code
|
||||
transactionProcessingStrategyCode: this.transactionProcessingStrategyData[0].code
|
||||
});
|
||||
this.isAdvancedTransactionProcessingStrategy = true;
|
||||
this.loanProductSettingsForm.addControl('chargeOffBehaviour', new UntypedFormControl(this.loanProductsTemplate.chargeOffBehaviour.id));
|
||||
this.isAdvancedTransactionProcessingStrategy = true;
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'chargeOffBehaviour',
|
||||
new UntypedFormControl(this.loanProductsTemplate.chargeOffBehaviour.id)
|
||||
);
|
||||
}
|
||||
if (this.loanProductSettingsForm.value.isInterestRecalculationEnabled) {
|
||||
this.setRescheduleStrategies();
|
||||
@@ -502,35 +631,36 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
}
|
||||
|
||||
private enableFieldsWhenScheduleTypeIsProgressiveAndInterestRateRecalculationEnabled() {
|
||||
const isProgressiveLoan = this.loanProductSettingsForm.get('loanScheduleType').value === LoanProducts.LOAN_SCHEDULE_TYPE_PROGRESSIVE;
|
||||
const isInterestRecalculationEnabled = this.loanProductSettingsForm.get('isInterestRecalculationEnabled').value == true;
|
||||
const isProgressiveLoan =
|
||||
this.loanProductSettingsForm.get('loanScheduleType').value === LoanProducts.LOAN_SCHEDULE_TYPE_PROGRESSIVE;
|
||||
const isInterestRecalculationEnabled =
|
||||
this.loanProductSettingsForm.get('isInterestRecalculationEnabled').value == true;
|
||||
const shouldControlExists = isProgressiveLoan && isInterestRecalculationEnabled;
|
||||
const isControlExists = this.loanProductSettingsForm.contains('disallowInterestCalculationOnPastDue');
|
||||
|
||||
if (shouldControlExists && !isControlExists) {
|
||||
this.loanProductSettingsForm.addControl('disallowInterestCalculationOnPastDue', new UntypedFormControl(''));
|
||||
this.loanProductSettingsForm.patchValue({'disallowInterestCalculationOnPastDue': this.loanProductsTemplate.interestRecalculationData?.disallowInterestCalculationOnPastDue ?? false});
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
disallowInterestCalculationOnPastDue:
|
||||
this.loanProductsTemplate.interestRecalculationData?.disallowInterestCalculationOnPastDue ?? false
|
||||
});
|
||||
} else if (isControlExists && !shouldControlExists) {
|
||||
this.loanProductSettingsForm.patchValue({'disallowInterestCalculationOnPastDue': undefined });
|
||||
this.loanProductSettingsForm.patchValue({ disallowInterestCalculationOnPastDue: undefined });
|
||||
this.loanProductSettingsForm.removeControl('disallowInterestCalculationOnPastDue');
|
||||
}
|
||||
}
|
||||
|
||||
private setRescheduleStrategies() {
|
||||
if (this.advancedTransactionProcessingStrategyDisabled) {
|
||||
this.rescheduleStrategyTypeData = this.rescheduleStrategyTypeDataBase.filter(
|
||||
(o: OptionData) => o.id > 3
|
||||
);
|
||||
this.rescheduleStrategyTypeData = this.rescheduleStrategyTypeDataBase.filter((o: OptionData) => o.id > 3);
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'rescheduleStrategyMethod': this.rescheduleStrategyTypeData[0].id
|
||||
rescheduleStrategyMethod: this.rescheduleStrategyTypeData[0].id
|
||||
});
|
||||
this.rescheduleStrategyTypeDisabled = true;
|
||||
} else {
|
||||
this.rescheduleStrategyTypeData = this.rescheduleStrategyTypeDataBase.filter(
|
||||
(o: OptionData) => o.id < 4
|
||||
);
|
||||
this.rescheduleStrategyTypeData = this.rescheduleStrategyTypeDataBase.filter((o: OptionData) => o.id < 4);
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'rescheduleStrategyMethod': this.rescheduleStrategyTypeData[0].id
|
||||
rescheduleStrategyMethod: this.rescheduleStrategyTypeData[0].id
|
||||
});
|
||||
this.rescheduleStrategyTypeDisabled = false;
|
||||
}
|
||||
@@ -549,7 +679,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
clearProperty($event: Event, propertyName: string): void {
|
||||
if (propertyName === 'delinquencyBucketId') {
|
||||
this.loanProductSettingsForm.patchValue({
|
||||
'delinquencyBucketId': ''
|
||||
delinquencyBucketId: ''
|
||||
});
|
||||
}
|
||||
this.loanProductSettingsForm.markAsDirty();
|
||||
@@ -570,8 +700,14 @@ export class LoanProductSettingsStepComponent implements OnInit {
|
||||
|
||||
private validateAdvancedPaymentStrategyControls(): void {
|
||||
if (this.isAdvancedTransactionProcessingStrategy) {
|
||||
this.loanProductSettingsForm.addControl('loanScheduleProcessingType', new UntypedFormControl(
|
||||
this.loanProductsTemplate.loanScheduleProcessingType.code || LoanProducts.LOAN_SCHEDULE_PROCESSING_TYPE_HORIZONTAL, [Validators.required]));
|
||||
this.loanProductSettingsForm.addControl(
|
||||
'loanScheduleProcessingType',
|
||||
new UntypedFormControl(
|
||||
this.loanProductsTemplate.loanScheduleProcessingType.code ||
|
||||
LoanProducts.LOAN_SCHEDULE_PROCESSING_TYPE_HORIZONTAL,
|
||||
[Validators.required]
|
||||
)
|
||||
);
|
||||
} else {
|
||||
this.loanProductSettingsForm.removeControl('loanScheduleProcessingType');
|
||||
}
|
||||
|
||||
+2
-3
@@ -8,9 +8,8 @@ describe('LoanProductTermsStepComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LoanProductTermsStepComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [LoanProductTermsStepComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user