From 385b3d9b646defd29ded950d2d64f77ae74c4157 Mon Sep 17 00:00:00 2001 From: Madhukar Date: Tue, 18 Mar 2014 19:35:23 +0530 Subject: [PATCH] Fixing template related issues --- app/global-translations/locale-en.json | 2 ++ .../client/ClientScreenReportController.js | 10 +++++----- .../loanAccount/LoanScreenReportController.js | 7 ++++--- .../controllers/template/EditTemplateController.js | 1 + .../controllers/template/TemplateController.js | 7 +++++-- .../controllers/template/ViewTemplateController.js | 6 +++--- app/views/clients/clientscreenreport.html | 10 +++++++++- app/views/loans/loanscreenreport.html | 9 ++++++++- app/views/templates/templates.html | 8 ++++---- app/views/templates/viewtemplate.html | 14 +++++++------- 10 files changed, 48 insertions(+), 26 deletions(-) diff --git a/app/global-translations/locale-en.json b/app/global-translations/locale-en.json index 504be49b..ee40a185 100644 --- a/app/global-translations/locale-en.json +++ b/app/global-translations/locale-en.json @@ -435,6 +435,7 @@ "label.anchor.editclient": "Edit Client", "label.anchor.uploaddocument": "Upload Document", "label.anchor.addclientidentities": "Add Client Identities", + "label.anchor.clientscreenreport": "Client screen reports", "#Inputs": "..", "label.input.filterbynameaccno": "Filter by name/account#/staff/office", @@ -1037,6 +1038,7 @@ "label.anchor.viewschedule": "Schedule", "label.anchor.loanapplication": "New Loan Application", "label.anchor.modifyloanapplication": "Modify Loan Application", + "label.anchor.loanscreenreport":"Loan screen report", "#Inputs": "..", "label.input.grouptotal": "Group total", diff --git a/app/scripts/controllers/client/ClientScreenReportController.js b/app/scripts/controllers/client/ClientScreenReportController.js index 461c4654..0a72fd97 100644 --- a/app/scripts/controllers/client/ClientScreenReportController.js +++ b/app/scripts/controllers/client/ClientScreenReportController.js @@ -1,6 +1,7 @@ (function (module) { mifosX.controllers = _.extend(module, { - ClientScreenReportController: function (scope, resourceFactory, location, $http, API_VERSION, routeParams, $rootScope) { + ClientScreenReportController: function (scope, resourceFactory, location, $http, API_VERSION, routeParams, $rootScope, $sce) { + scope.clientId = routeParams.clientId; resourceFactory.templateResource.get({entityId: 0, typeId: 0}, function (data) { scope.clientTemplateData = data; }); @@ -13,7 +14,6 @@ templateWindow.print(); templateWindow.close(); }; - scope.getClientTemplate = function (templateId) { scope.selectedTemplate = templateId; $http({ @@ -21,12 +21,12 @@ url: $rootScope.hostUrl + API_VERSION + '/templates/' + templateId + '?clientId=' + routeParams.clientId, data: {} }).then(function (data) { - scope.template = data.data; - }); + scope.template = $sce.trustAsHtml(data.data); + }); }; } }); - mifosX.ng.application.controller('ClientScreenReportController', ['$scope', 'ResourceFactory', '$location', '$http', 'API_VERSION', '$routeParams', '$rootScope', mifosX.controllers.ClientScreenReportController]).run(function ($log) { + mifosX.ng.application.controller('ClientScreenReportController', ['$scope', 'ResourceFactory', '$location', '$http', 'API_VERSION', '$routeParams', '$rootScope', '$sce', mifosX.controllers.ClientScreenReportController]).run(function ($log) { $log.info("ClientScreenReportController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/loanAccount/LoanScreenReportController.js b/app/scripts/controllers/loanAccount/LoanScreenReportController.js index 457e6a8e..a5538e71 100644 --- a/app/scripts/controllers/loanAccount/LoanScreenReportController.js +++ b/app/scripts/controllers/loanAccount/LoanScreenReportController.js @@ -1,6 +1,7 @@ (function (module) { mifosX.controllers = _.extend(module, { - LoanScreenReportController: function (scope, resourceFactory, location, http, API_VERSION, routeParams, $rootScope) { + LoanScreenReportController: function (scope, resourceFactory, location, http, API_VERSION, routeParams, $rootScope, $sce) { + scope.accountId = routeParams.loanId; resourceFactory.templateResource.get({entityId: 1, typeId: 0}, function (data) { scope.loanTemplateData = data; }); @@ -20,12 +21,12 @@ url: $rootScope.hostUrl + API_VERSION + '/templates/' + templateId + '?loanId=' + routeParams.loanId, data: {} }).then(function (data) { - scope.template = data.data; + scope.template = $sce.trustAsHtml(data.data); }); }; } }); - mifosX.ng.application.controller('LoanScreenReportController', ['$scope', 'ResourceFactory', '$location', '$http', 'API_VERSION', '$routeParams', '$rootScope', mifosX.controllers.LoanScreenReportController]).run(function ($log) { + mifosX.ng.application.controller('LoanScreenReportController', ['$scope', 'ResourceFactory', '$location', '$http', 'API_VERSION', '$routeParams', '$rootScope', '$sce', mifosX.controllers.LoanScreenReportController]).run(function ($log) { $log.info("LoanScreenReportController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/template/EditTemplateController.js b/app/scripts/controllers/template/EditTemplateController.js index 06c5adf4..cb399c16 100644 --- a/app/scripts/controllers/template/EditTemplateController.js +++ b/app/scripts/controllers/template/EditTemplateController.js @@ -24,6 +24,7 @@ scope.templateKeyEntity = data.template.entity; scope.formData.name = data.template.name; + scope.formData.text = data.template.text; for (var i in data.template.mappers) { if (i == 0) { diff --git a/app/scripts/controllers/template/TemplateController.js b/app/scripts/controllers/template/TemplateController.js index 2ab1bf76..6f600ed7 100644 --- a/app/scripts/controllers/template/TemplateController.js +++ b/app/scripts/controllers/template/TemplateController.js @@ -1,12 +1,15 @@ (function (module) { mifosX.controllers = _.extend(module, { - TemplateController: function (scope, resourceFactory) { + TemplateController: function (scope, resourceFactory, location) { resourceFactory.templateResource.get(function (data) { scope.templates = data; }); + scope.routeTo = function (id) { + location.path('/viewtemplate/' + id); + }; } }); - mifosX.ng.application.controller('TemplateController', ['$scope', 'ResourceFactory', mifosX.controllers.TemplateController]).run(function ($log) { + mifosX.ng.application.controller('TemplateController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.TemplateController]).run(function ($log) { $log.info("TemplateController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/scripts/controllers/template/ViewTemplateController.js b/app/scripts/controllers/template/ViewTemplateController.js index dfa63a8a..909f0366 100644 --- a/app/scripts/controllers/template/ViewTemplateController.js +++ b/app/scripts/controllers/template/ViewTemplateController.js @@ -1,9 +1,9 @@ (function (module) { mifosX.controllers = _.extend(module, { - ViewTemplateController: function (scope, routeParams, resourceFactory, location, $modal) { + ViewTemplateController: function (scope, routeParams, resourceFactory, location, $modal, $sce) { resourceFactory.templateResource.getTemplateDetails({templateId: routeParams.id}, function (data) { scope.template = data; - scope.text = data.text; + scope.templateText = $sce.trustAsHtml(data.text); }); scope.deleteTemplate = function () { $modal.open({ @@ -26,7 +26,7 @@ }; } }); - mifosX.ng.application.controller('ViewTemplateController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$modal', mifosX.controllers.ViewTemplateController]).run(function ($log) { + mifosX.ng.application.controller('ViewTemplateController', ['$scope', '$routeParams', 'ResourceFactory', '$location', '$modal', '$sce', mifosX.controllers.ViewTemplateController]).run(function ($log) { $log.info("ViewTemplateController initialized"); }); }(mifosX.controllers || {})); diff --git a/app/views/clients/clientscreenreport.html b/app/views/clients/clientscreenreport.html index a5eef453..071489be 100644 --- a/app/views/clients/clientscreenreport.html +++ b/app/views/clients/clientscreenreport.html @@ -1,4 +1,12 @@
+
+ +
{{'label.heading.clientscreenreport' | translate}}
@@ -11,7 +19,7 @@
- +