From 29057438a7b7ac52f0fd85c1eae3f59fcd32440d Mon Sep 17 00:00:00 2001 From: Rahul Pawar Date: Mon, 10 Jan 2022 18:00:39 +0530 Subject: [PATCH] FiX-View-Charge (#3446) --- app/global-translations/locale-en.json | 5 ++++ .../product/EditChargeController.js | 11 ++++---- .../product/ViewChargeController.js | 17 +++++++++++- app/views/products/editcharge.html | 5 ++-- app/views/products/viewcharge.html | 26 ++++++++++++++++++- 5 files changed, 54 insertions(+), 10 deletions(-) diff --git a/app/global-translations/locale-en.json b/app/global-translations/locale-en.json index 239e088a..e096f047 100644 --- a/app/global-translations/locale-en.json +++ b/app/global-translations/locale-en.json @@ -2947,6 +2947,11 @@ "label.heading.chargetimetype": "Charge Time Type", "label.heading.chargeappliesto": "Charge Applies to", "label.heading.chargecalculationtype": "Charge Calculation Type", + "label.heading.enablewithdrawtype": "Enable Withdraw Type", + "label.heading.enablepaymenttype": "Enable Payment Type", + "label.heading.freewithdrawalfrequency": "No. of Free Withdrawals", + "label.heading.restartcount": "Restart Counting Every", + "label.heading.frequencyType": "Frequency Type", "label.heading.chargepaymentmode": "Charge Payment Mode", "label.heading.closedate": "Closed Date", "label.heading.includeborrowercycle": "Include in Customer Loan Counter", diff --git a/app/scripts/controllers/product/EditChargeController.js b/app/scripts/controllers/product/EditChargeController.js index 8b4cd872..1ae28e02 100644 --- a/app/scripts/controllers/product/EditChargeController.js +++ b/app/scripts/controllers/product/EditChargeController.js @@ -7,6 +7,7 @@ scope.first = {}; scope.flag = false; scope.showPenalty = true ; + scope.paymentTypeOptions = []; resourceFactory.chargeResource.getCharge({chargeId: routeParams.id, template: true}, function (data) { scope.template = data; @@ -45,6 +46,10 @@ scope.flag = true; scope.showFrequencyOptions = false; scope.showGLAccount = true; + resourceFactory.paymentTypeResource.getAll( function (data) { + scope.paymentTypeOptions = data; + }); + if(data.freeWithdrawal === true) { scope.showenablefreewithdrawal = true; scope.showpaymenttype = true; @@ -186,15 +191,11 @@ resourceFactory.loanProductResource.get({resourceType: 'template'}, function (data) { scope.product = data; - scope.paymentTypeOptions = data.paymentTypeOptions; + const i = 1; scope.filteredItems = scope.product.repaymentFrequencyTypeOptions.slice(0, i).concat(scope.product.repaymentFrequencyTypeOptions.slice(i + 1, scope.product.repaymentFrequencyTypeOptions.length)); }); - resourceFactory.paymentTypeResource.getAll( function (data) { - - }); - scope.setOptions = function() { if (this.formData.enableFreeWithdrawalCharge) { scope.showfreewithdrawalfrequency = true; diff --git a/app/scripts/controllers/product/ViewChargeController.js b/app/scripts/controllers/product/ViewChargeController.js index dc8069b6..4206c012 100644 --- a/app/scripts/controllers/product/ViewChargeController.js +++ b/app/scripts/controllers/product/ViewChargeController.js @@ -5,6 +5,22 @@ scope.choice = 0; resourceFactory.chargeResource.get({chargeId: routeParams.id}, function (data) { scope.charge = data; + + resourceFactory.loanProductResource.get({resourceType: 'template'}, function (data) { + scope.product = data; + scope.paymentTypeOptions = data.paymentTypeOptions; + const repaymentFrequency = 1; + scope.filteredItems = scope.product.repaymentFrequencyTypeOptions.slice(0, repaymentFrequency).concat(scope.product.repaymentFrequencyTypeOptions.slice(repaymentFrequency + 1, scope.product.repaymentFrequencyTypeOptions.length)); + + var restartFrequencyId = scope.charge.restartFrequencyEnum; + scope.restartEnum = scope.charge.restartFrequencyEnum; + + angular.forEach(scope.filteredItems, function(items, key){ + if(items.id == restartFrequencyId){ + scope.frequencyType = items.value; + } + }); + }); }); scope.deleteCharge = function () { @@ -24,7 +40,6 @@ $uibModalInstance.dismiss('cancel'); }; }; - } }); mifosX.ng.application.controller('ViewChargeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$uibModal', mifosX.controllers.ViewChargeController]).run(function ($log) { diff --git a/app/views/products/editcharge.html b/app/views/products/editcharge.html index c711b6a4..d86c70eb 100644 --- a/app/views/products/editcharge.html +++ b/app/views/products/editcharge.html @@ -79,9 +79,9 @@
-
@@ -117,7 +117,6 @@
-
diff --git a/app/views/products/viewcharge.html b/app/views/products/viewcharge.html index 007770b8..2a5f2129 100644 --- a/app/views/products/viewcharge.html +++ b/app/views/products/viewcharge.html @@ -56,6 +56,30 @@ {{'label.heading.chargecalculationtype' | translate}} {{charge.chargeCalculationType.value}} + + {{'label.heading.enablepaymenttype' | translate}} + {{charge.isPaymentType}} + + + {{'label.heading.paymenttype' | translate}} + {{charge.paymentTypeOptions .name}} + + + {{'label.heading.enablewithdrawtype' | translate}} + {{charge.freeWithdrawal}} + + + {{'label.heading.freewithdrawalfrequency' | translate}} + {{charge.freeWithdrawalChargeFrequency}} + + + {{'label.heading.restartcount' | translate}} + {{charge.restartFrequency}} + + + {{'label.heading.frequencyType' | translate}} + {{frequencyType}} + {{'label.heading.active' | translate}} {{charge.active | YesOrNo}} @@ -84,4 +108,4 @@
- \ No newline at end of file +