Merge pull request #80 from safiyu/mx-codes

Manage Codes Added
This commit is contained in:
Nayan Ambali 2013-09-04 03:08:02 -07:00
commit ab38dc7769
15 changed files with 226 additions and 8 deletions

View File

@ -39,6 +39,7 @@
"label.annualfeeon":"Annual fees on:",
"label.advancedaccountingrules":"Advanced accounting rules",
"label.heading.configurefundsourcesforpaymentchannels":"Configure Fund sources for payment channels",
"label.name1": "Name",
"# common table headings":"....",
"table.heading.officename":"Office name",
@ -253,6 +254,7 @@
"label.description":"Description",
"label.tag":"Tag",
"label.parentaccountname":"Parent Account",
"label.position":"Position",
"#Office ":"....",
@ -260,9 +262,11 @@
"label.openedon":"Opened on:",
"label.externalId":"External Id:",
"label.parentoffice":"Parent office:",
"app lebels end" :"-----------------------------------------------------",
"app erros start" :"----------------------------------------------------",
"app lebels end" :"-----------------------------------------------------",
"app erros start" :"----------------------------------------------------",
"error.login.failed":"Please try again, your credentials are not valid",
"error.delete.failed":"System defined code values cannot be deleted",
"#Journal Entry Predefined Postings":"........",
"label.journalentry.posting.title":"Add journal entry",

View File

@ -91,7 +91,7 @@
"label.description":"विवरण",
"label.tag":"टैग",
"label.parentaccountname":"खाते के जनक",
"label.position":"स्थान",
"#Office ":"....",
"label.officename":"ऑफिस का नाम:",

View File

@ -5,7 +5,7 @@
<h4 class="list-group-item-heading"><i class="icon-table icon-large"></i>&nbsp;&nbsp;Manage Data Table</h4>
<p class="list-group-item-text">Add new extra feilds to any entity in the form of data table.</p>
</a>
<a class="list-group-item" href="#">
<a class="list-group-item" href="#/codes">
<h4 class="list-group-item-heading"><i class="icon-list-ul icon-large"></i>&nbsp;&nbsp;Manage Codes</h4>
<p class="list-group-item-text">Codes are used defined drop down values</p>
</a>

View File

@ -1,4 +1,4 @@
<h3>Currecny configuration</h3>
<h3>Currency configuration</h3>
<div class="row alert-block span" ng-controller="CurrencyConfigController">
<div ng-hide="hideview">
<div class="span4 pull-right">

16
html/system/addcode.html Normal file
View File

@ -0,0 +1,16 @@
<form class="form-horizontal well" ng-controller="AddCodeController" ng-submit="submit()">
<fieldset>
<legend>Add Code</legend>
<div>
<label class="control-label" for="codename">Code Name</label>
<div class="controls">
<input type="text" class="input-xlarge" id="codename" ng-model="formData.name">
</div>
</div>
<div class="form-actions">
<a href="#/codes" class="btn btn-primary">Cancel</a>
<button type="submit" class="btn btn-primary">Save</button>
</div>
</fieldset>
</form>

25
html/system/codes.html Normal file
View File

@ -0,0 +1,25 @@
<h3>Code Name</h3>
<div class="span4 pull-right">
<a href="#/addcode" class="btn btn-primary"><i class="icon-plus icon-white"></i>Add Code</a>
</div>
<div class="row alert-block span" data-ng-controller="CodeController">
<table class="table" ui:sortable>
<thead>
<tr>
<th>CodeName</th>
<th>System Defined</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="code in codes">
<td><a href="#/viewcode/{{code.id}}">{{code.name}}</a></td>
<td>{{code.systemDefined}}</td>
</tr>
</tbody>
</table>
</div>

16
html/system/editcode.html Normal file
View File

@ -0,0 +1,16 @@
<div ng-controller="EditCodeController" ng-submit="submit()">
<h3>Edit&nbsp;{{code.name}}</h3>
<form>
<input ng-model="newEle.name" placeholder="Code Value" type="text"/>&nbsp;&nbsp;<input ng-model="newEle.position"
placeholder="Position" type="text"/>&nbsp;&nbsp;
<a data-ng-click="addCv()" class="btn btn-primary"><i class="icon-plus icon-white"></i>Add</a>
</form>
<div data-ng-repeat="codevalue in codevalues">
<input disabled="" placeholder={{codevalue.name}} type="text"/>&nbsp;&nbsp;<input disabled="" placeholder={{codevalue.position}}
type="text"/>&nbsp;&nbsp;<a ng-click='deleteCv(codevalue.id)'><i class="icon-remove"></i></a>
</div>
<div class="pull-right" data-ng-show="stat">
<p>{{ 'error.delete.failed' | translate }}</p>
</div>
</div>

29
html/system/viewcode.html Normal file
View File

@ -0,0 +1,29 @@
<div ng-controller="ViewCodeController">
<div class="row paddedtop">
<div class="pull-right">
<div class="btn-group">
<a href="#/editcode/{{code.id}}" class="btn btn-primary"><i class="icon-edit icon-white"></i> Edit</a>
<a data-ng-click="delcode()" class="btn btn-primary" ng-show="code.systemDefined == false"><i class="icon-trash icon-white"></i> Delete</a></div>
</div>
</div>
<div class="row paddedleft">
<h3>{{code.name}}</h3>
<div>
<table class="table" ui:sortable>
<thead>
<tr>
<th>{{ 'label.name1' | translate }}</th>
<th>{{ 'label.position' | translate }}</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="codevalue in codevalues">
<td>{{codevalue.name}}</td>
<td>{{codevalue.position}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>

View File

@ -0,0 +1,21 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AddCodeController: function(scope, resourceFactory, location) {
scope.codes = [];
resourceFactory.codeResources.getAllCodes(function(data) {
scope.codes = data;
});
scope.submit = function() {
resourceFactory.codeResources.save(this.formData,function(data){
location.path('/codes');
});
};
}
});
mifosX.ng.application.controller('AddCodeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.AddCodeController]).run(function($log) {
$log.info("AddCodeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -0,0 +1,13 @@
(function(module) {
mifosX.controllers = _.extend(module, {
CodeController: function(scope, resourceFactory) {
scope.codes = [];
resourceFactory.codeResources.getAllCodes(function(data){
scope.codes = data;
});
}
});
mifosX.ng.application.controller('CodeController', ['$scope', 'ResourceFactory', mifosX.controllers.CodeController]).run(function($log) {
$log.info("CodeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -0,0 +1,38 @@
(function(module) {
mifosX.controllers = _.extend(module, {
EditCodeController: function(scope, routeParams , resourceFactory, location ) {
scope.codevalues = [];
scope.newcodevalues = [];
scope.newEle = undefined;
resourceFactory.codeResources.get({codeId: routeParams.id} , function(data) {
scope.code = data;
});
resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id} , function(data) {
scope.codevalues = data;
});
scope.addCv = function(){
if(scope.newEle != undefined && scope.newEle.hasOwnProperty('name')) {
resourceFactory.codeValueResource.save({codeId: routeParams.id},this.newEle,function(data){
scope.stat=false;
location.path('/viewcode/'+routeParams.id);
});
}
};
scope.deleteCv = function(id){
resourceFactory.codeValueResource.remove({codeId: routeParams.id,codevalueId: id},{},function(data){
scope.stat=false;
location.path('/viewcode/'+routeParams.id);
});
};
}
});
mifosX.ng.application.controller('EditCodeController', ['$scope', '$routeParams','ResourceFactory','$location', mifosX.controllers.EditCodeController]).run(function($log) {
$log.info("EditCodeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -0,0 +1,22 @@
(function(module) {
mifosX.controllers = _.extend(module, {
ViewCodeController: function(scope, routeParams , resourceFactory, location ) {
scope.codevalues = [];
resourceFactory.codeResources.get({codeId: routeParams.id} , function(data) {
scope.code = data;
});
resourceFactory.codeValueResource.getAllCodeValues({codeId: routeParams.id} , function(data) {
scope.codevalues = data;
});
scope.delcode = function(){
resourceFactory.codeResources.remove({codeId: routeParams.id},this.code,function(data){
location.path('/codes');
});
}
}
});
mifosX.ng.application.controller('ViewCodeController', ['$scope', '$routeParams','ResourceFactory','$location', mifosX.controllers.ViewCodeController]).run(function($log) {
$log.info("ViewCodeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -51,7 +51,11 @@ define(['underscore', 'mifosX'], function() {
'AccountingRuleController',
'ViewAccRuleController',
'AccCreateRuleController',
'AccEditRuleController'
'AccEditRuleController',
'CodeController',
'AddCodeController',
'ViewCodeController',
'EditCodeController'
],
filters: [
'StatusLookup'

View File

@ -142,6 +142,9 @@
.when('/accounts_closure', {
templateUrl: 'html/accounting/accounts_closure.html'
})
.when('/codes', {
templateUrl: 'html/system/codes.html'
})
.when('/closedaccountingDetails/:officeId', {
templateUrl: 'html/accounting/view_close_accounting.html'
})
@ -156,8 +159,21 @@
})
.when('/editaccrule/:id', {
templateUrl: 'html/accounting/edit_acc_rule.html'
})
.when('/viewcode/:id', {
templateUrl: 'html/system/viewcode.html'
})
.when('/addcode', {
templateUrl: 'html/system/addcode.html'
})
.when('/codes', {
templateUrl: 'html/system/codes.html'
})
.when('/editcode/:id', {
templateUrl: 'html/system/editcode.html'
});
$locationProvider.html5Mode(false);
};
mifosX.ng.application.config(defineRoutes).run(function($log) {

View File

@ -17,6 +17,7 @@
officeResource: defineResource(apiVer + "/offices/:officeId", {officeId:"@officeId"}, {
getAllOffices: {method: 'GET', params: {}, isArray: true}
}),
clientResource: defineResource(apiVer + "/clients/:clientId/:anotherresource", {clientId:'@clientId',anotherresource:'@anotherresource'}, {
getAllClients: {method: 'GET', params: {}},
getAllClientDocuments: {method: 'GET', params: {}, isArray: true},
@ -59,6 +60,7 @@
LoanDocumentResource: defineResource(apiVer + "/loans/:loanId/documents", {loanId:'@loanId'}, {
getLoanDocuments: {method: 'GET', params: {} , isArray: true}
}),
currencyConfigResource: defineResource(apiVer + "/currencies", {}, {
update: { method: 'PUT'}
}),
@ -71,7 +73,7 @@
}),
employeeResource: defineResource(apiVer + "/staff/:staffId", {staffId:'@staffId'}, {
getAllEmployees: {method: 'GET', params: {}, isArray: true},
update: { method: 'PUT'}
update: { method: 'PUT' }
}),
globalSearch: defineResource(apiVer + "/search", {query:'@query'}, {
search: { method: 'GET',
@ -79,7 +81,7 @@
isArray:true
}
}),
fundsResource: defineResource(apiVer + "/funds/:fundId", {fundId:'@fundId'}, {
fundsResource: defineResource(apiVer + "/funds/:fundId", {fundId:'@fundId'}, {
getAllFunds: {method: 'GET', params: {}, isArray: true}
}),
accountingRulesResource: defineResource(apiVer + "/accountingrules/:accountingRuleId", {accountingRuleId:'@accountingRuleId'}, {
@ -103,9 +105,21 @@
reverse: {method: 'POST', params:{command:'reverse'}},
search:{method: 'GET', params: {}}
}),
accountingClosureResource: defineResource(apiVer + "/glclosures", {}, {
get: {method: 'GET', params: {}, isArray:true}
}) ,
codeResources: defineResource(apiVer + "/codes/:codeId", {codeId:"@codeId"}, {
getAllCodes: {method: 'GET', params: {}, isArray: true}
}),
codeValueResource: defineResource(apiVer + "/codes/:codeId/codevalues/:codevalueId", {codeId:'@codeId',codevalueId:'@codevalueId'}, {
getAllCodeValues: {method: 'GET', params: {}, isArray:true},
update: { method: 'PUT', params: {}, isArray:true }
})
};
}];
}