fix: Loan Product using global configurations for repayments

This commit is contained in:
Jose Alberto Hernandez
2024-07-04 00:07:57 -06:00
committed by Jose Alberto Hernandez
parent 5a79d5d290
commit 55b5ce616f
8 changed files with 17 additions and 8 deletions
@@ -24,7 +24,7 @@ export class FormatAmountDirective implements OnInit {
target.value = this.parse(target.value); target.value = this.parse(target.value);
} }
@HostListener('focus', ['$event.target']) focus(target: any) { @HostListener('focus', ['$event.target']) focus(target: any) {
if (typeof this.control.value == 'undefined') { if (typeof this.control.value === 'undefined') {
target.value = ''; target.value = '';
} else { } else {
target.value = this.control.value; target.value = this.control.value;
@@ -57,13 +57,16 @@ export class EditLoanProductComponent implements OnInit {
private advancedPaymentStrategy: AdvancedPaymentStrategy) { private advancedPaymentStrategy: AdvancedPaymentStrategy) {
this.route.data.subscribe((data: { loanProductAndTemplate: any, configurations: any }) => { this.route.data.subscribe((data: { loanProductAndTemplate: any, configurations: any }) => {
this.loanProductAndTemplate = data.loanProductAndTemplate; this.loanProductAndTemplate = data.loanProductAndTemplate;
console.log(this.loanProductAndTemplate);
const assetAccountData = this.loanProductAndTemplate.accountingMappingOptions.assetAccountOptions || []; const assetAccountData = this.loanProductAndTemplate.accountingMappingOptions.assetAccountOptions || [];
const liabilityAccountData = this.loanProductAndTemplate.accountingMappingOptions.liabilityAccountOptions || []; const liabilityAccountData = this.loanProductAndTemplate.accountingMappingOptions.liabilityAccountOptions || [];
this.loanProductAndTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData); this.loanProductAndTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
this.itemsByDefault = loanProducts.setItemsByDefault(data.configurations); this.itemsByDefault = loanProducts.setItemsByDefault(data.configurations);
this.loanProductAndTemplate['itemsByDefault'] = this.itemsByDefault; this.loanProductAndTemplate['itemsByDefault'] = this.itemsByDefault;
this.loanProductAndTemplate = loanProducts.updateLoanProductDefaults(this.loanProductAndTemplate, true); // this.loanProductAndTemplate = loanProducts.updateLoanProductDefaults(this.loanProductAndTemplate, true);
console.log(this.loanProductAndTemplate);
}); });
} }
@@ -43,6 +43,7 @@ export class LoanProductSettingsStepComponent implements OnInit {
loanScheduleProcessingTypeData: OptionData[] = []; loanScheduleProcessingTypeData: OptionData[] = [];
isAdvancedTransactionProcessingStrategy = false; isAdvancedTransactionProcessingStrategy = false;
advancedTransactionProcessingStrategyDisabled = true; advancedTransactionProcessingStrategyDisabled = true;
useDueForRepaymentsConfigurations = false;
/** Values to Days for Repayments */ /** Values to Days for Repayments */
defaultConfigValues: GlobalConfiguration[] = []; defaultConfigValues: GlobalConfiguration[] = [];
@@ -82,6 +83,8 @@ export class LoanProductSettingsStepComponent implements OnInit {
this.loanScheduleTypeData = this.loanProductsTemplate.loanScheduleTypeOptions; this.loanScheduleTypeData = this.loanProductsTemplate.loanScheduleTypeOptions;
this.loanScheduleProcessingTypeData = this.loanProductsTemplate.loanScheduleProcessingTypeOptions; this.loanScheduleProcessingTypeData = this.loanProductsTemplate.loanScheduleProcessingTypeOptions;
// 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({ this.loanProductSettingsForm.patchValue({
'amortizationType': this.loanProductsTemplate.amortizationType.id, 'amortizationType': this.loanProductsTemplate.amortizationType.id,
@@ -122,6 +125,9 @@ export class LoanProductSettingsStepComponent implements OnInit {
this.processingStrategyService.initialize(this.isAdvancedTransactionProcessingStrategy); this.processingStrategyService.initialize(this.isAdvancedTransactionProcessingStrategy);
this.validateAdvancedPaymentStrategyControls(); this.validateAdvancedPaymentStrategyControls();
console.log(this.loanProductsTemplate.dueDaysForRepaymentEvent);
console.log(this.loanProductsTemplate.overDueDaysForRepaymentEvent);
if (this.loanProductsTemplate.dueDaysForRepaymentEvent != null && if (this.loanProductsTemplate.dueDaysForRepaymentEvent != null &&
this.loanProductsTemplate.overDueDaysForRepaymentEvent != null) { this.loanProductsTemplate.overDueDaysForRepaymentEvent != null) {
this.loanProductSettingsForm.patchValue({ this.loanProductSettingsForm.patchValue({
@@ -58,7 +58,7 @@ export class LoanLockedComponent implements OnInit {
private systemService: SystemService, private systemService: SystemService,
private tasksService: TasksService, private tasksService: TasksService,
private dialog: MatDialog, private dialog: MatDialog,
private translateService:TranslateService) { private translateService: TranslateService) {
} }
ngOnInit(): void { ngOnInit(): void {
@@ -27,7 +27,7 @@ export class ErrorLogPopoverComponent implements OnInit {
} }
buttonLabel(): string { buttonLabel(): string {
const label: string = this.show ? this.translateService.instant('labels.buttons.Show less'): this.translateService.instant('labels.buttons.Show more'); const label: string = this.show ? this.translateService.instant('labels.buttons.Show less') : this.translateService.instant('labels.buttons.Show more');
return this.translateService.instant('labels.buttons.' + label); return this.translateService.instant('labels.buttons.' + label);
} }
@@ -34,7 +34,7 @@ export class WorkflowJobsComponent implements OnInit {
constructor(private systemService: SystemService, constructor(private systemService: SystemService,
public dialog: MatDialog, public dialog: MatDialog,
private translateService:TranslateService) {} private translateService: TranslateService) {}
ngOnInit(): void { ngOnInit(): void {
this.systemService.getWorkflowJobNames().toPromise() this.systemService.getWorkflowJobNames().toPromise()
@@ -111,7 +111,7 @@ export class WorkflowJobsComponent implements OnInit {
if (this.jobAvailableStepsData.length > 0) { if (this.jobAvailableStepsData.length > 0) {
for (let index = 0; index < this.jobAvailableStepsData.length; index++) { for (let index = 0; index < this.jobAvailableStepsData.length; index++) {
this.jobAvailableStepsData[index].stepDescription = this.translateService.instant(`labels.catalogs.${this.jobAvailableStepsData[index].stepDescription}`) this.jobAvailableStepsData[index].stepDescription = this.translateService.instant(`labels.catalogs.${this.jobAvailableStepsData[index].stepDescription}`);
} }
const frmFields: FormfieldBase[] = [ const frmFields: FormfieldBase[] = [
new SelectBase({ new SelectBase({
@@ -63,7 +63,7 @@ export class CreateReportComponent implements OnInit {
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private dialog: MatDialog, private dialog: MatDialog,
private translateServices:TranslateService) { private translateServices: TranslateService) {
this.route.data.subscribe((data: { reportTemplate: any }) => { this.route.data.subscribe((data: { reportTemplate: any }) => {
this.reportTemplateData = data.reportTemplate; this.reportTemplateData = data.reportTemplate;
this.dataForDialog.allowedParameters = this.reportTemplateData.allowedParameters; this.dataForDialog.allowedParameters = this.reportTemplateData.allowedParameters;
@@ -66,7 +66,7 @@ export class ViewRoleComponent implements OnInit {
private systemService: SystemService, private systemService: SystemService,
private router: Router, private router: Router,
private formBuilder: UntypedFormBuilder, private formBuilder: UntypedFormBuilder,
private translateService:TranslateService, private translateService: TranslateService,
public dialog: MatDialog) { public dialog: MatDialog) {
this.route.data.subscribe((data: { roledetails: any }) => { this.route.data.subscribe((data: { roledetails: any }) => {
this.rolePermissionService = data.roledetails; this.rolePermissionService = data.roledetails;