diff --git a/src/app/centers/centers.service.ts b/src/app/centers/centers.service.ts index 74943b51c..ee895c509 100644 --- a/src/app/centers/centers.service.ts +++ b/src/app/centers/centers.service.ts @@ -36,7 +36,6 @@ export class CentersService { // filterBy: name, externalId filterBy.forEach(function (filter: any) { if (filter.value) { - console.log(filter.value); httpParams = httpParams.set(filter.type, filter.value); } }); diff --git a/src/app/clients/clients-view/address-tab/address-tab.component.ts b/src/app/clients/clients-view/address-tab/address-tab.component.ts index 99a6d4fa7..50789af29 100644 --- a/src/app/clients/clients-view/address-tab/address-tab.component.ts +++ b/src/app/clients/clients-view/address-tab/address-tab.component.ts @@ -62,7 +62,6 @@ export class AddressTabComponent { const addAddressDialogRef = this.dialog.open(FormDialogComponent, { data }); addAddressDialogRef.afterClosed().subscribe((response: any) => { if (response.data) { - console.log(response.data); this.clientService.createClientAddress(this.clientId, response.data.value.addressType, response.data.value).subscribe((res: any) => { const addressData = response.data.value; addressData.addressId = res.resourceId; @@ -89,7 +88,6 @@ export class AddressTabComponent { const editAddressDialogRef = this.dialog.open(FormDialogComponent, { data }); editAddressDialogRef.afterClosed().subscribe((response: any) => { if (response.data) { - console.log(response.data.value); const addressData = response.data.value; addressData.addressId = address.addressId; addressData.isActive = address.isActive; diff --git a/src/app/clients/clients-view/client-actions/add-client-collateral/add-client-collateral.component.ts b/src/app/clients/clients-view/client-actions/add-client-collateral/add-client-collateral.component.ts index 368323938..a51d699a3 100644 --- a/src/app/clients/clients-view/client-actions/add-client-collateral/add-client-collateral.component.ts +++ b/src/app/clients/clients-view/client-actions/add-client-collateral/add-client-collateral.component.ts @@ -43,7 +43,6 @@ export class AddClientCollateralComponent implements OnInit { ) { this.route.data.subscribe((data: { clientActionData: any }) => { this.clientCollateralOptions = data.clientActionData; - console.log(this.clientCollateralOptions); }); this.clientId = this.route.parent.snapshot.params['clientId']; } @@ -60,7 +59,6 @@ export class AddClientCollateralComponent implements OnInit { this.clientCollateralForm.controls.collateralId.valueChanges.subscribe(collateralId => { this.productsService.getCollateral(collateralId).subscribe((data: any) => { this.collateralDetails = data; - console.log(data); this.clientCollateralForm.patchValue({ 'name': data.name, 'quality': data.quality, diff --git a/src/app/configuration-wizard/popover/popover.component.ts b/src/app/configuration-wizard/popover/popover.component.ts index 9617f6107..1ad161825 100644 --- a/src/app/configuration-wizard/popover/popover.component.ts +++ b/src/app/configuration-wizard/popover/popover.component.ts @@ -23,7 +23,6 @@ export class PopoverComponent extends BasePortalOutlet { @ViewChild(CdkPortalOutlet, { static: true }) portalOutlet: CdkPortalOutlet; attachComponentPortal(componentPortal: ComponentPortal): ComponentRef { - console.log(this.portalOutlet.attachComponentPortal(componentPortal)); return this.portalOutlet.attachComponentPortal(componentPortal); } diff --git a/src/app/core/shell/toolbar/toolbar.component.ts b/src/app/core/shell/toolbar/toolbar.component.ts index acd873a40..428a29440 100644 --- a/src/app/core/shell/toolbar/toolbar.component.ts +++ b/src/app/core/shell/toolbar/toolbar.component.ts @@ -194,7 +194,6 @@ export class ToolbarComponent implements OnInit, AfterViewInit, AfterContentChec } navigateMenu(routePath: string): void { - console.log(routePath); this.router.navigate([routePath]); } diff --git a/src/app/loans/create-loans-account/create-loans-account.component.ts b/src/app/loans/create-loans-account/create-loans-account.component.ts index 4872a3619..448c11d4c 100644 --- a/src/app/loans/create-loans-account/create-loans-account.component.ts +++ b/src/app/loans/create-loans-account/create-loans-account.component.ts @@ -33,7 +33,7 @@ export class CreateLoansAccountComponent implements OnInit { /** Loans Account Template */ loansAccountTemplate: any; /** Loans Account Product Template */ - loansAccountProductTemplate: any; + loansAccountProductTemplate: any | null = null; /** Collateral Options */ collateralOptions: any; /** Multi Disburse Loan */ @@ -63,8 +63,7 @@ export class CreateLoansAccountComponent implements OnInit { }); } - ngOnInit() { - } + ngOnInit() { } /** * Sets loans account product template and collateral template diff --git a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html index 2e176e07d..6aa06fb32 100644 --- a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html +++ b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html @@ -10,11 +10,12 @@ -

Term Options

+

Term Options

Loan Term - + Loan Term is required @@ -32,6 +33,9 @@ +

Repayments

+ Number of repayments @@ -52,7 +56,7 @@ Repaid every - + Repaid every is required @@ -60,7 +64,7 @@ Frequency - + {{ repaymentFrequencyType.value }} diff --git a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts index 2459cb291..483a06e55 100644 --- a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts +++ b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit, Input, OnChanges } from '@angular/core'; import { UntypedFormGroup, UntypedFormBuilder, Validators, FormArray } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { LoansAccountAddCollateralDialogComponent } from 'app/loans/custom-dialog/loans-account-add-collateral-dialog/loans-account-add-collateral-dialog.component'; import { SettingsService } from 'app/settings/settings.service'; import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component'; @@ -10,7 +10,6 @@ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.componen import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base'; import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base'; -import { TooltipPosition } from '@angular/material/tooltip'; /** * Create Loans Account Terms Step @@ -22,6 +21,8 @@ import { TooltipPosition } from '@angular/material/tooltip'; }) export class LoansAccountTermsStepComponent implements OnInit, OnChanges { + /** Loans Product Options */ + @Input() loansProductOptions: any; /** Loans Account Product Template */ @Input() loansAccountProductTemplate: any; /** Loans Account Template */ @@ -217,6 +218,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges { } this.createloansAccountTermsForm(); // this.setCustomValidators(); + this.setLoanTermListener(); } allowAddDisbursementDetails() { @@ -244,15 +246,36 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges { }); } + /** Custom Listeners for the form to calculate Loan Term */ + setLoanTermListener() { + this.loansAccountTermsForm.get('numberOfRepayments').valueChanges + .subscribe(numberOfRepayments => { + const repaymentEvery: number = this.loansAccountTermsForm.value.repaymentEvery; + this.calculateLoanTerm(numberOfRepayments, repaymentEvery); + }); + + this.loansAccountTermsForm.get('repaymentEvery').valueChanges + .subscribe(repaymentEvery => { + const numberOfRepayments: number = this.loansAccountTermsForm.value.numberOfRepayments; + this.calculateLoanTerm(numberOfRepayments, repaymentEvery); + }); + + this.loansAccountTermsForm.get('loanTermFrequencyType').valueChanges + .subscribe(loanTermFrequencyType => { + this.loansAccountTermsForm.patchValue({'repaymentFrequencyType': loanTermFrequencyType}); + }); + + } + /** Create Loans Account Terms Form */ createloansAccountTermsForm() { this.loansAccountTermsForm = this.formBuilder.group({ 'principalAmount': ['', Validators.required], - 'loanTermFrequency': ['', Validators.required], + 'loanTermFrequency': [{ value: '', disabled: true }, Validators.required], 'loanTermFrequencyType': ['', Validators.required], 'numberOfRepayments': ['', Validators.required], 'repaymentEvery': ['', Validators.required], - 'repaymentFrequencyType': ['', Validators.required], + 'repaymentFrequencyType': [{ value: '', disabled: true }, Validators.required], 'repaymentFrequencyNthDayType': [''], 'repaymentFrequencyDayOfWeekType': [''], 'repaymentsStartingFromDate': [''], @@ -279,6 +302,11 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges { }); } + calculateLoanTerm(numberOfRepayments: number, repaymentEvery: number): void { + const loanTerm = numberOfRepayments * repaymentEvery; + this.loansAccountTermsForm.patchValue({'loanTermFrequency': loanTerm}); + } + /** * Gets the Disbursement Data array. * @returns {Array} Disbursement Data array. diff --git a/src/app/organization/investors/investors.component.ts b/src/app/organization/investors/investors.component.ts index a596b5b9d..2b8fc23b6 100644 --- a/src/app/organization/investors/investors.component.ts +++ b/src/app/organization/investors/investors.component.ts @@ -179,7 +179,6 @@ export class InvestorsComponent implements OnInit { reload() { const url: string = this.router.url; - console.log(url); this.router.navigateByUrl(`/`, {skipLocationChange: true}) .then(() => this.router.navigate([url])); } diff --git a/src/app/organization/organization.component.ts b/src/app/organization/organization.component.ts index a7a796d50..37e9cbe37 100644 --- a/src/app/organization/organization.component.ts +++ b/src/app/organization/organization.component.ts @@ -16,7 +16,7 @@ import { ConfigurationWizardService } from '../configuration-wizard/configuratio }) export class OrganizationComponent implements OnInit, AfterViewInit { - shouldShowFundMapping: boolean = false; + shouldShowFundMapping = false; /* Reference of manage offices */ @ViewChild('office') office: ElementRef; /* Template for popover on manage offices */ diff --git a/src/app/products/loan-products/create-loan-product/create-loan-product.component.html b/src/app/products/loan-products/create-loan-product/create-loan-product.component.html index 8caaa82f5..6803e3e5b 100644 --- a/src/app/products/loan-products/create-loan-product/create-loan-product.component.html +++ b/src/app/products/loan-products/create-loan-product/create-loan-product.component.html @@ -65,8 +65,8 @@ diff --git a/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts b/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts index 2b034f7e0..5d771b63a 100644 --- a/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts +++ b/src/app/products/loan-products/create-loan-product/create-loan-product.component.ts @@ -60,7 +60,9 @@ export class CreateLoanProductComponent implements OnInit { }); } - ngOnInit() { } + ngOnInit() { + this.buildAdvancedPaymentAllocation(); + } get loanProductDetailsForm() { return this.loanProductDetailsStep.loanProductDetailsForm; @@ -85,7 +87,6 @@ export class CreateLoanProductComponent implements OnInit { } setPaymentAllocation(paymentAllocation: PaymentAllocation[]): void { - console.log(paymentAllocation); this.paymentAllocation = paymentAllocation; } diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model.ts index 2be28e6b5..5ad6ed972 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-payment-strategy-step/payment-allocation-model.ts @@ -53,16 +53,18 @@ export class AdvancedPaymentStrategy { const advancedPaymentAllocationTypes: PaymentAllocationOrder[] = loanProduct.advancedPaymentAllocationTypes; const advancedPaymentAllocationFutureInstallmentAllocationRules: FutureInstallmentAllocationRule[] = loanProduct.advancedPaymentAllocationFutureInstallmentAllocationRules; - 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, + if (loanProduct.paymentAllocation) { + 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, + }); }); - }); + } // If this is Empty, add the Default if (advancedPaymentAllocation.length === 0) { advancedPaymentAllocation.push({