diff --git a/app/global-translations/locale-en.json b/app/global-translations/locale-en.json index c5809865..179a37db 100755 --- a/app/global-translations/locale-en.json +++ b/app/global-translations/locale-en.json @@ -75,6 +75,9 @@ "label.heading.count": "Count", "label.heading.percentage": "Percentage", "label.heading.due.savings.collections":"Due Savings Collections", + "label.heading.loanamount" : "Original Loan", + "label.heading.outstandingamount" : "Loan Balance", + "label.heading.dueamount" : "Amount Paid", "#Menu Links": "..", "label.menu.selectloanofficer": "Select Staff", diff --git a/app/scripts/controllers/savings/ViewSavingDetailsController.js b/app/scripts/controllers/savings/ViewSavingDetailsController.js index b06c1a87..7f085f7e 100644 --- a/app/scripts/controllers/savings/ViewSavingDetailsController.js +++ b/app/scripts/controllers/savings/ViewSavingDetailsController.js @@ -1,11 +1,13 @@ (function (module) { mifosX.controllers = _.extend(module, { - ViewSavingDetailsController: function (scope, routeParams, resourceFactory, location, route, dateFilter, $sce, $rootScope, API_VERSION) { + ViewSavingDetailsController: function (scope, routeParams, resourceFactory, location, $modal, route, dateFilter, $sce, $rootScope, API_VERSION) { scope.report = false; scope.hidePentahoReport = true; scope.showActiveCharges = true; scope.formData = {}; scope.date = {}; + scope.staffData = {}; + scope.fieldOfficers = []; scope.isDebit = function (savingsTransactionType) { return savingsTransactionType.withdrawal == true || savingsTransactionType.feeDeduction == true; }; @@ -28,7 +30,6 @@ scope.savingaccountdetails.transactions[i][dateFieldName] = new Date(scope.savingaccountdetails.transactions[i].date); } }; - scope.isRecurringCharge = function (charge) { return charge.chargeTimeType.value == 'Monthly Fee' || charge.chargeTimeType.value == 'Annual Fee' || charge.chargeTimeType.value == 'Weekly Fee'; } @@ -95,11 +96,15 @@ case "close": location.path('/savingaccount/' + accountId + '/close'); break; + + } }; resourceFactory.savingsResource.get({accountId: routeParams.id, associations: 'all'}, function (data) { scope.savingaccountdetails = data; + scope.staffData.staffId = data.staffId; + scope.date.toDate = new Date(); scope.date.fromDate = new Date(data.timeline.activatedOnDate); scope.status = data.status.value; @@ -227,6 +232,13 @@ annualdueDate.push(new Date().getFullYear()); scope.annualdueDate = new Date(annualdueDate); }; + if(!(data.fieldOfficerId)){ + resourceFactory.savingsResource.get({accountId: routeParams.id, template: 'true'}, function (data) { + scope.staffField = true; + scope.fieldOfficers = data.fieldOfficerOptions; + scope.formData.fieldOfficerId = data.fieldOfficerOptions[0].id; + }); + }; }); resourceFactory.DataTablesResource.getAllDataTables({apptable: 'm_savings_account'}, function (data) { @@ -285,6 +297,57 @@ scope.printbtn = false; }; + scope.savingsAccountStaffCenter = function (staffId,command,tempUrl) { + $modal.open({ + templateUrl: tempUrl, + controller: SavingsStaffCtrl, + resolve : { + "parameters": function () { + return { + staffId :function() + { + return staffId; + }, + command : function() + { + return command; + }, + fieldOfficers: function(){ + return scope.fieldOfficers; + } + }; + } + } + }); + }; + var SavingsStaffCtrl = function ($scope, $modalInstance,parameters) { + scope.staffData.staffId = parameters.staffId(); + $scope.command = parameters.command(); + $scope.fieldOfficers = parameters.fieldOfficers(); + $scope.unassign = function () { + switch($scope.command) + { + case "unassignFieldOfficer": + resourceFactory.savingsResource.save({accountId: routeParams.id, command:'unassignFieldOfficer'}, scope.staffData, function () { + $modalInstance.close('unassignFieldOfficer'); + route.reload(); + }); + break; + case "assignFieldOfficer": + scope.staffData.staffId = scope.formData.fieldOfficerId; + resourceFactory.savingsResource.save({accountId: routeParams.id, command: 'assignFieldOfficer'}, scope.staffData, function () { + $modalInstance.close('assignFieldOfficer'); + route.reload(); + }); + break; + } + }; + + $scope.cancel = function () { + $modalInstance.dismiss('cancel'); + }; + }; + scope.viewDataTable = function (registeredTableName,data){ if (scope.datatabledetails.isMultirow) { location.path("/viewdatatableentry/"+registeredTableName+"/"+scope.savingaccountdetails.id+"/"+data.row[0]); @@ -297,6 +360,8 @@ scope.report = false; }; + + scope.viewprintdetails = function () { scope.printbtn = true; scope.hidePentahoReport = true; @@ -324,7 +389,7 @@ scope.printReport = function () { window.print(); window.close(); - } + }; scope.deleteAll = function (apptableName, entityId) { resourceFactory.DataTablesResource.delete({datatablename: apptableName, entityId: entityId, genericResultSet: 'true'}, {}, function (data) { @@ -352,9 +417,8 @@ }; } - }) - ; - mifosX.ng.application.controller('ViewSavingDetailsController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$route', 'dateFilter', '$sce', '$rootScope', 'API_VERSION', mifosX.controllers.ViewSavingDetailsController]).run(function ($log) { + }); + mifosX.ng.application.controller('ViewSavingDetailsController', ['$scope', '$routeParams', 'ResourceFactory', '$location','$modal', '$route', 'dateFilter', '$sce', '$rootScope', 'API_VERSION', mifosX.controllers.ViewSavingDetailsController]).run(function ($log) { $log.info("ViewSavingDetailsController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/views/clients/viewclient.html b/app/views/clients/viewclient.html index 554846bc..de39cfbf 100755 --- a/app/views/clients/viewclient.html +++ b/app/views/clients/viewclient.html @@ -165,9 +165,9 @@