mirror of
https://github.com/openMF/community-app.git
synced 2026-02-06 13:51:55 +00:00
Merge pull request #27 from goutham-M/mifosx-users
users features added
This commit is contained in:
commit
0386313308
71
html/administration/createuser.html
Normal file
71
html/administration/createuser.html
Normal file
@ -0,0 +1,71 @@
|
||||
<form class="form-horizontal well" ng-controller="CreateUserController" ng-submit="submit()">
|
||||
<fieldset>
|
||||
<legend>Create User</legend>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="username">User Name</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="username" ng-model="formData.username">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="firstname">First Name</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="firstname" ng-model="formData.firstname">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="lastname">Last Name</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="lastname" ng-model="formData.lastname">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="email">Email</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="email" ng-model="formData.email">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="sendPasswordToEmail">Auto generate password</label>
|
||||
<div class="controls">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" ng-model="formData.sendPasswordToEmail">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="formData.sendPasswordToEmail">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="password">Password</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="password" ng-model="formData.password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="repeatPassword">Repeat Password</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="repeatPassword" ng-model="formData.repeatPassword">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group info">
|
||||
<label class="control-label" for="office">Office</label>
|
||||
<div class="controls">
|
||||
<select id="office" class="input-xlarge" ng-model="formData.officeId">
|
||||
<option ng-repeat="office in offices" value="{{office.id}}">{{office.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group info">
|
||||
<label class="control-label" for="role">Select roles</label>
|
||||
<div class="controls">
|
||||
<select id="role" class="input-xlarge" ng-model="formData.roles" multiple>
|
||||
<option ng-repeat="availablerole in availableRoles" value="{{availablerole.id}}">{{availablerole.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="reset" class="btn">Cancel</button>
|
||||
<button type="submit" class="btn btn-primary">Save</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
27
html/administration/userslist.html
Normal file
27
html/administration/userslist.html
Normal file
@ -0,0 +1,27 @@
|
||||
<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="#/createuser" class="btn btn-primary"><i class="icon-plus icon-white"></i> Create User</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row alert-block span" ng-controller="UserListController">
|
||||
<table class="table" ui:sortable>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Office name</th>
|
||||
<th>User name</th>
|
||||
<th>Name</th>
|
||||
<th>Email</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="user in users | filter:filterText">
|
||||
<td>{{user.officeName}}</td>
|
||||
<td><a href="#/viewuser/{{user.id}}">{{user.username}}</a></td>
|
||||
<td>{{user.firstname}} {{user.lastname}}</td>
|
||||
<td>{{user.email}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
47
html/administration/viewuser.html
Normal file
47
html/administration/viewuser.html
Normal file
@ -0,0 +1,47 @@
|
||||
<div>
|
||||
<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> Edit</a>
|
||||
<a href="#" class="btn btn-primary"><i class="icon-trash icon-white"></i> Delete</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row paddedleft" ng-controller="ViewUserController">
|
||||
<hr/>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td><h3>{{user.username}}</h3></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>First name:</td>
|
||||
<td>{{user.firstname}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Last name:</td>
|
||||
<td>{{user.lastname}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email:</td>
|
||||
<td>{{user.email}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Office:</td>
|
||||
<td>{{user.officeName}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Selected roles:</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr ng-repeat="role in user.selectedRoles">
|
||||
<td>
|
||||
<span>{{role.name}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<div class="control-group info">
|
||||
<label class="control-label" for="office">Office</label>
|
||||
<div class="controls">
|
||||
<select id="office" ng-model="formData.officeId">
|
||||
<select id="office" class="input-xlarge" ng-model="formData.officeId">
|
||||
<option ng-repeat="office in offices" value="{{office.id}}">{{office.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -12,7 +12,7 @@
|
||||
<div class="control-group info">
|
||||
<label class="control-label" for="loanofficer">Loan Officer</label>
|
||||
<div class="controls">
|
||||
<select id="loanofficer" ng-model="formData.staffId">
|
||||
<select id="loanofficer" class="input-xlarge" ng-model="formData.staffId">
|
||||
<option ng-repeat="staff in staffs" value="{{staff.id}}">{{staff.displayName}}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -122,7 +122,7 @@
|
||||
<li class="dropdown" id="preview-menu">
|
||||
<a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="icon-wrench"></i>Admin<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="#">Users</a></li>
|
||||
<li><a href="#/userslist">Users</a></li>
|
||||
<li><a href="#/organization">Organization</a></li>
|
||||
<li><a href="#/system">System</a></li>
|
||||
</ul>
|
||||
|
||||
24
js/controllers/CreateUserController.js
Normal file
24
js/controllers/CreateUserController.js
Normal file
@ -0,0 +1,24 @@
|
||||
(function(module) {
|
||||
mifosX.controllers = _.extend(module, {
|
||||
CreateUserController: function(scope, resourceFactory, location) {
|
||||
scope.offices = [];
|
||||
scope.availableRoles = [];
|
||||
resourceFactory.userTemplateResource.get(function(data) {
|
||||
scope.offices = data.allowedOffices;
|
||||
scope.availableRoles = data.availableRoles;
|
||||
scope.formData = {
|
||||
sendPasswordToEmail: true
|
||||
};
|
||||
});
|
||||
|
||||
scope.submit = function() {
|
||||
resourceFactory.userListResource.save(this.formData,function(data){
|
||||
location.path('/viewuser/' + data.resourceId);
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
mifosX.ng.application.controller('CreateUserController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateUserController]).run(function($log) {
|
||||
$log.info("CreateUserController initialized");
|
||||
});
|
||||
}(mifosX.controllers || {}));
|
||||
13
js/controllers/UserListController.js
Normal file
13
js/controllers/UserListController.js
Normal file
@ -0,0 +1,13 @@
|
||||
(function(module) {
|
||||
mifosX.controllers = _.extend(module, {
|
||||
UserListController: function(scope, resourceFactory) {
|
||||
scope.users = [];
|
||||
resourceFactory.userListResource.getAllUsers(function(data) {
|
||||
scope.users = data;
|
||||
});
|
||||
}
|
||||
});
|
||||
mifosX.ng.application.controller('UserListController', ['$scope', 'ResourceFactory', mifosX.controllers.UserListController]).run(function($log) {
|
||||
$log.info("UserListController initialized");
|
||||
});
|
||||
}(mifosX.controllers || {}));
|
||||
13
js/controllers/ViewUserController.js
Normal file
13
js/controllers/ViewUserController.js
Normal file
@ -0,0 +1,13 @@
|
||||
(function(module) {
|
||||
mifosX.controllers = _.extend(module, {
|
||||
ViewUserController: function(scope, routeParams , resourceFactory ) {
|
||||
scope.user = [];
|
||||
resourceFactory.userListResource.get({userId: routeParams.id} , function(data) {
|
||||
scope.user = data;
|
||||
});
|
||||
}
|
||||
});
|
||||
mifosX.ng.application.controller('ViewUserController', ['$scope', '$routeParams','ResourceFactory', mifosX.controllers.ViewUserController]).run(function($log) {
|
||||
$log.info("ViewUserController initialized");
|
||||
});
|
||||
}(mifosX.controllers || {}));
|
||||
@ -22,7 +22,10 @@ define(['underscore', 'mifosX'], function() {
|
||||
'TaskController',
|
||||
'CurrencyConfigController',
|
||||
'SearchController',
|
||||
'ViewLoanProductController'
|
||||
'ViewLoanProductController',
|
||||
'UserListController',
|
||||
'CreateUserController',
|
||||
'ViewUserController'
|
||||
],
|
||||
filters: [
|
||||
'StatusLookup'
|
||||
|
||||
11
js/routes.js
11
js/routes.js
@ -60,7 +60,16 @@
|
||||
})
|
||||
.when('/usersetting', {
|
||||
templateUrl: 'html/administration/usersettings.html'
|
||||
});;
|
||||
})
|
||||
.when('/userslist/', {
|
||||
templateUrl: 'html/administration/userslist.html'
|
||||
})
|
||||
.when('/createuser/', {
|
||||
templateUrl: 'html/administration/createuser.html'
|
||||
})
|
||||
.when('/viewuser/:id', {
|
||||
templateUrl: 'html/administration/viewuser.html'
|
||||
});
|
||||
|
||||
$locationProvider.html5Mode(false);
|
||||
};
|
||||
|
||||
@ -44,6 +44,12 @@
|
||||
currencyConfigResource: defineResource(apiVer + "/currencies", {}, {
|
||||
update: { method: 'PUT'}
|
||||
}),
|
||||
userListResource: defineResource(apiVer + "/users/:userId", {userId:'@userId'}, {
|
||||
getAllUsers: {method: 'GET', params: {}, isArray: true}
|
||||
}),
|
||||
userTemplateResource: defineResource(apiVer + "/users/template", {}, {
|
||||
get: {method: 'GET', params: {}}
|
||||
}),
|
||||
globalSearch: defineResource(apiVer + "/search", {query:'@query'}, {
|
||||
search: { method: 'GET',
|
||||
params: { query: '@query'} ,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user