MIFOSX-976 - added editing values for global configurations

This commit is contained in:
Pramod Nuthakki 2014-03-13 13:59:03 +05:30
parent 7c74324fa5
commit 8a1282a1b3
7 changed files with 75 additions and 0 deletions

View File

@ -1572,6 +1572,7 @@
"label.anchor.editpermissions": "Edit Permissions",
"label.anchor.edituser": "Edit User",
"label.anchor.globalconfigurations": "Global Configurations",
"label.anchor.editconfiguration":"Edit Configuration",
"#Inputs": "..",

View File

@ -0,0 +1,25 @@
(function (module) {
mifosX.controllers = _.extend(module, {
EditConfigurationController: function (scope, resourceFactory, routeParams, location) {
scope.configId = routeParams.configId;
resourceFactory.configurationResource.get({id: scope.configId}, function (data) {
scope.formData = {value: data.value};
});
scope.cancel = function () {
location.path('/global');
};
scope.submit = function () {
resourceFactory.configurationResource.update({resourceType: 'configurations', id: scope.configId}, this.formData, function (data) {
location.path('/global');
});
};
}
});
mifosX.ng.application.controller('EditConfigurationController', ['$scope', 'ResourceFactory', '$routeParams', '$location', mifosX.controllers.EditConfigurationController]).run(function ($log) {
$log.info("EditConfigurationController initialized");
});
}(mifosX.controllers || {}));

View File

@ -4,6 +4,7 @@
scope.configs = [];
resourceFactory.configurationResource.get(function (data) {
for (var i in data.globalConfiguration) {
data.globalConfiguration[i].showEditvalue = true;
scope.configs.push(data.globalConfiguration[i])
}
resourceFactory.cacheResource.get(function (data) {
@ -12,6 +13,7 @@
var cache = {};
cache.name = 'Is Cache Enabled';
cache.enabled = data[i].enabled;
cache.showEditvalue = false;
scope.configs.push(cache);
}
}

View File

@ -149,6 +149,7 @@ define(['underscore', 'mifosX'], function () {
'product/CreateChargeController',
'product/EditChargeController',
'configurations/GlobalConfigurationController',
'configurations/EditConfigurationController',
'product/productmix/ProductMixController',
'product/productmix/ViewProductMixController',
'product/productmix/AddProductMixController',

View File

@ -460,6 +460,9 @@
.when('/global', {
templateUrl: 'views/administration/global.html'
})
.when('/configurations/:configId/editconfig', {
templateUrl: 'views/administration/editGlobalConfiguration.html'
})
.when('/productmix', {
templateUrl: 'views/products/productmix/productmix.html'
})

View File

@ -0,0 +1,34 @@
<div ng-controller="EditConfigurationController">
<div>
<ul class="breadcrumb">
<li><a href="#/viewloanaccount/{{loanId}}">{{'label.anchor.globalconfigurations' | translate}}</a> <span
class="divider">/</span></li>
<li class="active">{{'label.anchor.editconfiguration' | translate}}</li>
</ul>
</div>
<form name="editconfigurationform" novalidate="" class="form-horizontal well" ng-submit="submit()">
<api-validate></api-validate>
<fieldset>
<legend>{{ 'label.anchor.editconfiguration' | translate }}</legend>
<div class="control-group">
<label class="control-label" for="amount">{{ 'label.input.value' | translate }}<span
class="required">*</span></label>
<div class="controls">
<input id="amount" ng-autofocus="true" type="text" name="value" ng-model="formData.value" required
late-Validate/>
<form-validate valattributeform="editconfigurationform" valattribute="value"/>
</div>
</div>
<div class="offset3">
<button id="cancel" type="reset" class="btn" ng-click="cancel()">{{ 'label.button.cancel' | translate
}}
</button>
<button id="save" type="submit" ng-disabled="!editconfigurationform.$valid" has-permission='UPDATE_CONFIGURATION' class="btn btn-primary">{{
'label.button.save' | translate }}
</button>
</div>
</fieldset>
</form>
</div>

View File

@ -12,6 +12,8 @@
<th>{{'label.heading.name' | translate}}</th>
<th>{{'label.heading.enabled' | translate}}</th>
<th></th>
<th>{{'label.heading.value' | translate}}</th>
<th></th>
</tr>
</thead>
<tbody>
@ -23,7 +25,14 @@
data-ng-click="enable(config.id, config.name)" has-permission='UPDATE_CONFIGURATION'><i class="icon-flag-alt"></i></button>
<button type="button" class="btn btn-danger flag" data-ng-show="config.enabled"
data-ng-click="disable(config.id, config.name)" has-permission='UPDATE_CONFIGURATION'><i class="icon-remove"></i></button>
</td>
<td>{{config.value}}</td>
<td>
<a title="{{'label.edit' | translate}}" data-ng-show="config.showEditvalue"
href="#/configurations/{{config.id}}/editconfig"><i
class="icon-pencil icon-white"></i></a>
</td>
</tr>
</tbody>
</table>