diff --git a/package-lock.json b/package-lock.json index 70543054f..6b7ca9f9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "moment": "^2.29.4", "rxjs": "6.6.2", "tslib": "^2.0.0", + "vkbeautify": "^0.99.2", "zone.js": "0.11.6" }, "devDependencies": { @@ -59,6 +60,7 @@ "@types/jasminewd2": "2.0.6", "@types/lodash": "4.14.132", "@types/node": "12.11.1", + "@types/vkbeautify": "^0.99.2", "codelyzer": "6.0.0", "cypress": "^10.7.0", "git-describe": "^4.1.1", @@ -4198,6 +4200,12 @@ "vfile-message": "*" } }, + "node_modules/@types/vkbeautify": { + "version": "0.99.4", + "resolved": "https://registry.npmjs.org/@types/vkbeautify/-/vkbeautify-0.99.4.tgz", + "integrity": "sha512-IB/vC9R2BPQJDbKaBwG6B8nnBKeu/RMYKVgVBoSiMjj3CmePsRqHaFNLiYov7sBn+CiGe6eqY9UslPv+TEyjvA==", + "dev": true + }, "node_modules/@types/ws": { "version": "8.5.8", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.8.tgz", @@ -21791,6 +21799,11 @@ "unist-util-stringify-position": "^1.1.1" } }, + "node_modules/vkbeautify": { + "version": "0.99.3", + "resolved": "https://registry.npmjs.org/vkbeautify/-/vkbeautify-0.99.3.tgz", + "integrity": "sha512-2ozZEFfmVvQcHWoHLNuiKlUfDKlhh4KGsy54U0UrlLMR1SO+XKAIDqBxtBwHgNrekurlJwE8A9K6L49T78ZQ9Q==" + }, "node_modules/void-elements": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", diff --git a/src/app/core/utils/datatables.ts b/src/app/core/utils/datatables.ts index bf5fbf80b..4e13db704 100644 --- a/src/app/core/utils/datatables.ts +++ b/src/app/core/utils/datatables.ts @@ -161,7 +161,7 @@ export class Datatables { public isValidUrl(urlString: string): boolean { try { const url = new URL(urlString); - return url.protocol.startsWith("http") || url.protocol.startsWith("https"); + return url.protocol.startsWith('http') || url.protocol.startsWith('https'); } catch (e) { return false; } diff --git a/src/app/pipes/pretty-print.pipe.ts b/src/app/pipes/pretty-print.pipe.ts index b9a7c3640..497824cf8 100644 --- a/src/app/pipes/pretty-print.pipe.ts +++ b/src/app/pipes/pretty-print.pipe.ts @@ -10,10 +10,10 @@ export class PrettyPrintPipe implements PipeTransform { if (value.charAt(0) === '{' && value.charAt(value.length - 1) === '}') { try { return vkbeautify.json(value); - } catch(error) { + } catch (error) { return value; } } return value; } -} \ No newline at end of file +} diff --git a/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts b/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts index f3c26edc7..2d65cef6c 100644 --- a/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts +++ b/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.ts @@ -50,59 +50,68 @@ export class LoanProductSummaryComponent implements OnInit, OnChanges { this.penaltyToIncomeAccountMappings = this.loanProduct.penaltyToIncomeAccountMappings || []; } else { - 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 || []; + this.accountingMappings = {}; + 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 || []; - 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), + 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), - '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), - }; - const paymentTypesData = this.loanProductsTemplate.paymentTypeOptions || []; + 'overpaymentLiabilityAccount': this.glAccountLookUp(this.loanProduct.overpaymentLiabilityAccountId, liabilityAccountData), + }; - this.loanProduct.paymentChannelToFundSourceMappings.forEach((m: any) => { - this.paymentChannelToFundSourceMappings.push({ - fundSourceAccount: this.glAccountLookUp(m.fundSourceAccountId, assetAndLiabilityAccountData), - paymentType: this.paymentTypeLookUp(m.paymentTypeId, paymentTypesData) - }); - }); + if (this.loanProduct.paymentChannelToFundSourceMappings?.length > 0) { + const paymentTypesData = this.loanProductsTemplate.paymentTypeOptions || []; + this.loanProduct.paymentChannelToFundSourceMappings.forEach((m: any) => { + this.paymentChannelToFundSourceMappings.push({ + fundSourceAccount: this.glAccountLookUp(m.fundSourceAccountId, assetAndLiabilityAccountData), + paymentType: this.paymentTypeLookUp(m.paymentTypeId, paymentTypesData) + }); + }); + } - this.feeToIncomeAccountMappings = []; - this.loanProduct.feeToIncomeAccountMappings.forEach((m: any) => { - this.feeToIncomeAccountMappings.push({ - incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData), - charge: this.chargeLookUp(m.chargeId, this.loanProductsTemplate.chargeOptions) - }); - }); + this.feeToIncomeAccountMappings = []; + if (this.loanProduct.feeToIncomeAccountMappings?.length > 0) { + this.loanProduct.feeToIncomeAccountMappings.forEach((m: any) => { + this.feeToIncomeAccountMappings.push({ + incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData), + charge: this.chargeLookUp(m.chargeId, this.loanProductsTemplate.chargeOptions) + }); + }); + } - this.penaltyToIncomeAccountMappings = []; - this.loanProduct.penaltyToIncomeAccountMappings.forEach((m: any) => { - this.penaltyToIncomeAccountMappings.push({ - incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData), - charge: this.chargeLookUp(m.chargeId, this.loanProductsTemplate.penaltyOptions) - }); - }); + this.penaltyToIncomeAccountMappings = []; + if (this.loanProduct.penaltyToIncomeAccountMappings?.length > 0) { + this.loanProduct.penaltyToIncomeAccountMappings.forEach((m: any) => { + this.penaltyToIncomeAccountMappings.push({ + incomeAccount: this.glAccountLookUp(m.incomeAccountId, incomeAccountData), + charge: this.chargeLookUp(m.chargeId, this.loanProductsTemplate.penaltyOptions) + }); + }); + } + } if (this.loanProduct.isInterestRecalculationEnabled) { this.loanProduct.interestRecalculationData = { diff --git a/src/app/shared/tabs/entity-datatable-tab/datatable-single-row/datatable-single-row.component.ts b/src/app/shared/tabs/entity-datatable-tab/datatable-single-row/datatable-single-row.component.ts index 51808c9f9..18555f17d 100644 --- a/src/app/shared/tabs/entity-datatable-tab/datatable-single-row/datatable-single-row.component.ts +++ b/src/app/shared/tabs/entity-datatable-tab/datatable-single-row/datatable-single-row.component.ts @@ -144,7 +144,7 @@ export class DatatableSingleRowComponent implements OnInit { return columnDisplayType; } case 'TEXT': { - if (columnType == 'JSON') { + if (columnType === 'JSON') { return 'JSON'; } else { return columnDisplayType; diff --git a/src/environments/.env.ts b/src/environments/.env.ts index 77f36ea34..b8551f38a 100644 --- a/src/environments/.env.ts +++ b/src/environments/.env.ts @@ -2,8 +2,8 @@ /* tslint:disable */ export default { 'mifos_x': { - 'version': '0.0.0', - 'hash': '9b40d307' + 'version': '231121', + 'hash': 'f6edab0d' }, 'allow_switching_backend_instance': true };