Merge pull request #76 from goutham-M/mifosx-datatables

list/view datatable feature is added
This commit is contained in:
Nayan Ambali 2013-09-03 04:27:19 -07:00
commit 8f18728463
9 changed files with 124 additions and 1 deletions

View File

@ -56,6 +56,22 @@
"label.name":"Name:",
"label.filename":"File name:",
"#common button name":"",
"button.edit":"Edit",
"#datatable":"",
"table.heading.datatablename":"Data Table Name",
"table.heading.associatedwith":"Associated With",
"button.createdatatable":"Create Datatable",
"#view datatable":"",
"table.heading.fieldname":"Field Name",
"table.heading.type":"Type",
"table.heading.length":"Length",
"table.heading.code":"Code",
"table.heading.mandatory":"Mandatory",
"label.associatedwith":"Associated with:",
"#employee table":"....",
"table.heading.isLoanOfficer":"Is Loan Officer?",
"link.create.new.employee":"Create Employee",

View File

@ -1,7 +1,7 @@
<div class="row paddedleft paddedtop">
<div class="span6">
<div class="list-group">
<a class="list-group-item" href="#">
<a class="list-group-item" href="#/datatables">
<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>

View File

@ -0,0 +1,22 @@
<div class="row alert-block span" >
<input ng-model="filterText" type="text" class="form-control" placeholder="Filter by name">
<div class="span4 pull-right">
<a href="#/createdatatable" class="btn btn-primary"><i class="icon-plus icon-white"></i> {{'button.createdatatable' | translate}}</a>
</div>
</div>
<div class="row alert-block span" ng-controller="DataTableController">
<table class="table" ui:sortable>
<thead>
<tr>
<th>{{'table.heading.datatablename' | translate}}</th>
<th>{{'table.heading.associatedwith' | translate}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="datatable in datatables | filter:filterText">
<td><a href="#/viewdatatable/{{datatable.registeredTableName}}">{{datatable.registeredTableName}}</a></td>
<td>{{datatable.applicationTableName}}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,34 @@
<div id="viewlptop">
<div class="row paddedtop">
<div class="pull-right">
<div class="btn-group">
<a href="#" class="btn btn-primary"><i class="icon-edit icon-white"></i> {{'button.edit' | translate}}</a>
<a href="#" class="btn btn-primary"><i class="icon-trash icon-white"></i> {{'button.delete' | translate}}</a>
</div>
</div>
</div>
<div class="row alert-block span" ng-controller="ViewDataTableController">
<legend>{{datatable.registeredTableName}}</legend>
<strong>{{'label.associatedwith' | translate}}</strong>&nbsp;&nbsp;{{datatable.applicationTableName}}
<table class="table" ui:sortable>
<thead>
<tr>
<th>{{'table.heading.fieldname' | translate}}</th>
<th>{{'table.heading.type' | translate}}</th>
<th>{{'table.heading.length' | translate}}</th>
<th>{{'table.heading.code' | translate}}</th>
<th>{{'table.heading.mandatory' | translate}}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="column in datatable.columnHeaderData | filter:filterText">
<td>{{column.columnName}}</td>
<td>{{column.columnType}}</td>
<td>{{column.columnLength}}</td>
<td>{{column.code}}</td>
<td>{{column.isColumnNullable}}</td>
</tr>
</tbody>
</table>
</div>

View File

@ -1,3 +1,4 @@
<div class="row alert-block span" >
<input ng-model="filterText" type="text" class="form-control" placeholder="Filter by name/fundname">
<div class="span4 pull-right">

View File

@ -0,0 +1,14 @@
(function(module) {
mifosX.controllers = _.extend(module, {
DataTableController: function(scope, resourceFactory) {
resourceFactory.DataTablesResource.getAllDataTables(function(data) {
scope.datatables = data;
});
}
});
mifosX.ng.application.controller('DataTableController', ['$scope', 'ResourceFactory', mifosX.controllers.DataTableController]).run(function($log) {
$log.info("DataTableController initialized");
});
}(mifosX.controllers || {}));

View File

@ -0,0 +1,28 @@
(function(module) {
mifosX.controllers = _.extend(module, {
ViewDataTableController: function(scope, routeParams , resourceFactory ) {
resourceFactory.DataTablesResource.getTableDetails({datatablename: routeParams.tableName} , function(data) {
var temp=[];
if(data.columnHeaderData[0].columnName == "id") {
data.columnHeaderData.splice(0,1);
}
if(data.columnHeaderData[0].columnName == "client_id") {
data.columnHeaderData.splice(0,1);
}
for(var i=0; i< data.columnHeaderData.length; i++) {
if(data.columnHeaderData[i].columnName.indexOf("_cd_") > 0) {
temp = data.columnHeaderData[i].columnName.split("_cd_");
data.columnHeaderData[i].columnName = temp[1];
data.columnHeaderData[i].code = temp[0];
}
}
scope.datatable = data;
});
}
});
mifosX.ng.application.controller('ViewDataTableController', ['$scope', '$routeParams','ResourceFactory', mifosX.controllers.ViewDataTableController]).run(function($log) {
$log.info("ViewDataTableController initialized");
});
}(mifosX.controllers || {}));

View File

@ -25,6 +25,8 @@ define(['underscore', 'mifosX'], function() {
'ViewClientController',
'CreateClientController',
'TaskController',
'DataTableController',
'ViewDataTableController',
'CurrencyConfigController',
'SearchController',
'ViewLoanProductController',

View File

@ -37,6 +37,12 @@
.when('/system', {
templateUrl: 'html/administration/system.html'
})
.when('/datatables', {
templateUrl: 'html/administration/system/datatables.html'
})
.when('/viewdatatable/:tableName', {
templateUrl: 'html/administration/system/viewdatatable.html'
})
.when('/loanproducts', {
templateUrl: 'html/products/loanproducts.html'
})