Fixing template related issues

This commit is contained in:
Madhukar 2014-03-18 19:35:23 +05:30
parent d6d7281dfc
commit 385b3d9b64
10 changed files with 48 additions and 26 deletions

View File

@ -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",

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -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) {

View File

@ -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 || {}));

View File

@ -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 || {}));

View File

@ -1,4 +1,12 @@
<div ng-controller="ClientScreenReportController">
<div>
<ul class="breadcrumb">
<li><a href="#/clients">{{'label.anchor.clients' | translate}}</a> <span class="divider">/</span></li>
<li><a href='#/viewclient/{{clientId}}'>{{'label.anchor.viewclient' | translate}}</a> <span class="divider">/</span>
</li>
<li class="active">{{'label.anchor.clientscreenreport' | translate}}</li>
</ul>
</div>
<legend>{{'label.heading.clientscreenreport' | translate}}</legend>
<div class="span"></div>
<div class="span2">
@ -11,7 +19,7 @@
</table>
</div>
<div class="span8" ng-show="template">
<span ng-bind-html-unsafe="template"></span>
<span ng-bind-html="template"></span>
<span class="offset3 paddedtop10">
<button type="button" data-ng-click="print(template)" class="btn btn-primary"><i class="icon-print"></i>&nbsp;&nbsp;{{'label.button.print'|
translate}}

View File

@ -1,4 +1,11 @@
<div ng-controller="LoanScreenReportController">
<div>
<ul class="breadcrumb">
<li><a href="#/viewloanaccount/{{accountId}}">{{'label.anchor.viewloanaccount' | translate}}</a><span
class="divider">/</span></li>
<li class="active">{{'label.anchor.loanscreenreport' | translate}}</li>
</ul>
</div>
<legend>{{'label.heading.loanscreenreport' | translate}}</legend>
<div class="span"></div>
<div class="span2">
@ -11,7 +18,7 @@
</table>
</div>
<div class="span8" ng-show="template">
<span ng-bind-html-unsafe="template"></span>
<span ng-bind-html="template"></span>
<span class="offset3 paddedtop10">
<button type="button" data-ng-click="print(template)" class="btn btn-primary"><i class="icon-print"></i>&nbsp;&nbsp;{{'label.button.print'|
translate}}

View File

@ -19,10 +19,10 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="template in templates | filter:filterText">
<td>{{template.entity}}</td>
<td>{{template.type}}</td>
<td><a href="#/viewtemplate/{{template.id}}">{{template.name}}</a></td>
<tr class="pointer-main" ng-repeat="template in templates | filter:filterText">
<td class="pointer" data-ng-click="routeTo(template.id)">{{template.entity}}</td>
<td class="pointer" data-ng-click="routeTo(template.id)">{{template.type}}</td>
<td class="pointer" data-ng-click="routeTo(template.id)">{{template.name}}</td>
</tr>
</tbody>
</table>

View File

@ -26,18 +26,18 @@
</script>
<div class="row paddedleft">
<h3>{{template.name}}</h3>
<table width="80%">
<table class="table table-bordered width100">
<tr>
<td width="20%">{{'label.heading.entity' | translate }}</td>
<td width="60%">{{template.entity}}</td>
<td class="width19 table-bold">{{'label.heading.entity' | translate }}</td>
<td class="width60">{{template.entity}}</td>
</tr>
<tr>
<td>{{ 'label.heading.type' | translate }}</td>
<td class="width19 table-bold">{{ 'label.heading.type' | translate }}</td>
<td>{{template.type}}</td>
</tr>
<tr>
<td valign="top">{{ 'label.heading.text' | translate }}</td>
<td ng-bind-html-unsafe="text"></td>
<tr data-ng-show="templateText">
<td valign="top" class="width19 table-bold">{{ 'label.heading.text' | translate }}</td>
<td ng-bind-html="templateText"></td>
</tr>
</table>
</div>