center actions

bug
This commit is contained in:
safiyu 2013-09-26 19:30:00 +05:30
parent 30360753a0
commit e2f2c3c68c
19 changed files with 483 additions and 13 deletions

View File

@ -618,5 +618,8 @@
"label.list.externalid":"ExternalId:",
"label.groups":"Groups",
"label.centersavingapplication":"Center Saving Application",
"label.form.accountno":"Account No"
"label.form.accountno":"Account No",
"label.createcenter":"Create Center",
"label.addgroup":"Add Group",
"label.editcenter":"Edit Center"
}

View File

@ -0,0 +1,24 @@
(function(module) {
mifosX.controllers = _.extend(module, {
AddGroupController: function(scope, resourceFactory, location, routeParams) {
resourceFactory.groupTemplateResource.get({centerId: routeParams.centerId} , function(data) {
scope.groupTemplate = data;
});
scope.addGroup = function(){
this.formData.active = this.formData.active || false;
this.formData.locale = 'en';
this.formData.dateFormat = 'dd MMMM yyyy';
this.formData.centerId = routeParams.centerId ;
this.formData.officeId = routeParams.officeId;
resourceFactory.groupResource.save(this.formData,function(data) {
location.path('/viewcenter/'+routeParams.centerId);
});
};
}
});
mifosX.ng.application.controller('AddGroupController', ['$scope', 'ResourceFactory', '$location','$routeParams', mifosX.controllers.AddGroupController]).run(function($log) {
$log.info("AddGroupController initialized");
});
}(mifosX.controllers || {}));

View File

@ -0,0 +1,38 @@
(function(module) {
mifosX.controllers = _.extend(module, {
CenterAttendanceController: function(scope, resourceFactory , routeParams, location) {
scope.center = [];
scope.tempData = {};
resourceFactory.centerResource.get({centerId: routeParams.centerId, associations:'groupMembers,collectionMeetingCalendar'} , function(data) {
scope.center = data;
scope.meeting = data.collectionMeetingCalendar;
});
resourceFactory.centerMeetingResource.getMeetingInfo({centerId: routeParams.centerId,templateSource: 'template',calenderId: routeParams.calendarId}, function(data) {
scope.clients = data.clients;
scope.attendanceOptions = data.attendanceTypeOptions;
});
scope.attendanceUpdate = function(id){
this.formData.clientsAttendance=[];
for(var i=0; i<scope.clients.length;i++)
{
this.formData.clientsAttendance[i] ={clientId:scope.clients[i].id,attendanceType:this.tempData[scope.clients[i].id]};
}
this.formData.locale = 'en' ;
this.formData.dateFormat = 'dd MMMM yyyy';
this.formData.calendarId = id;
resourceFactory.centerMeetingResource.save({centerId: routeParams.centerId,calendarId: routeParams.calendarId},this.formData, function(data) {
location.path('/viewcenter/' + routeParams.centerId);
});
}
}
});
mifosX.ng.application.controller('CenterAttendanceController', ['$scope', 'ResourceFactory', '$routeParams','$location', mifosX.controllers.CenterAttendanceController]).run(function($log) {
$log.info("CenterAttendanceController initialized");
});
}(mifosX.controllers || {}));

View File

@ -0,0 +1,26 @@
(function(module) {
mifosX.controllers = _.extend(module, {
CloseCenterController: function(scope, routeParams, route, location, resourceFactory) {
scope.template = [];
scope.center = [];
resourceFactory.centerResource.get({centerId: routeParams.id,associations:'groupMembers,collectionMeetingCalendar'} , function(data) {
scope.center = data;
});
resourceFactory.centerTemplateResource.get({command:'close'}, function(data){
scope.template = data;
});
scope.closeGroup = function(){
this.formData.locale = 'en';
this.formData.dateFormat = 'dd MMMM yyyy';
resourceFactory.centerResource.save({centerId: routeParams.id ,command:'close'},this.formData, function(data){
location.path('/viewcenter/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('CloseCenterController', ['$scope', '$routeParams','$route', '$location', 'ResourceFactory', mifosX.controllers.CloseCenterController]).run(function($log) {
$log.info("CloseCenterController initialized");
});
}(mifosX.controllers || {}));

View File

@ -0,0 +1,94 @@
(function(module) {
mifosX.controllers = _.extend(module, {
CreateCenterController: function(scope, resourceFactory, location, timeout) {
scope.offices = [];
scope.staffs = [];
scope.data = {};
resourceFactory.centerTemplateResource.get(function(data) {
scope.offices = data.officeOptions;
scope.staffs = data.staffOptions;
scope.groups = data.groupMembersOptions;
});
scope.changeOffice =function(officeId) {
resourceFactory.centerTemplateResource.get({staffInSelectedOfficeOnly : false, officeId : officeId
}, function(data) {
scope.staffs = data.staffOptions;
});
resourceFactory.centerTemplateResource.get({officeId : officeId }, function(data) {
scope.groups = data.groupMembersOptions;
});
};
//Date picker
scope.today = function() {
scope.dt = new Date();
};
scope.today();
scope.showWeeks = false;
scope.toggleWeeks = function () {
scope.showWeeks = ! scope.showWeeks;
};
scope.clear = function () {
scope.dt = null;
};
scope.toggleMin = function() {
scope.minDate = ( scope.minDate ) ? null : new Date();
};
scope.toggleMin();
scope.$watch('dt', function(v){
var d = new Date(v);
var curr_date = d.getDate();
var temp_month = d.getMonth() + 1;
var curr_month = 'january';
switch (temp_month)
{
case 1: curr_month = 'january';
break;
case 2: curr_month = 'february';
break;
case 3: curr_month = 'march';
break;
case 4: curr_month = 'april';
break;
case 5: curr_month = 'may';
break;
case 6: curr_month = 'june';
break;
case 7: curr_month = 'july';
break;
case 8: curr_month = 'august';
break;
case 9: curr_month = 'september';
break;
case 10: curr_month = 'october';
break;
case 11: curr_month = 'november';
break;
case 12: curr_mont = 'december';
break;
}
var curr_year = d.getFullYear();
scope.formattedDate = curr_date + " " + curr_month + " " + curr_year;
});
//Date picker ends
scope.submit = function() {
this.formData.locale = 'en';
this.formData.dateFormat = 'dd MMMM yyyy';
this.formData.activationDate = scope.formattedDate;
this.formData.active = this.formData.active || false;
resourceFactory.centerResource.save(this.formData,function(data){
location.path('/viewcenter/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('CreateCenterController', ['$scope', 'ResourceFactory', '$location','$timeout', mifosX.controllers.CreateCenterController]).run(function($log) {
$log.info("CreateCenterController initialized");
});
}(mifosX.controllers || {}));

View File

@ -0,0 +1,37 @@
(function(module) {
mifosX.controllers = _.extend(module, {
EditCenterController: function(scope, resourceFactory,location, routeParams ) {
scope.managecode = routeParams.managecode;
resourceFactory.centerResource.get({centerId: routeParams.id,template: 'true'} , function(data) {
scope.edit = data;
scope.staffs = data.staffOptions;
scope.formData = {
name:data.name,
externalId:data.externalId,
staffId:data.staffId
};
});
scope.updateGroup = function(){
this.formData.locale = "en";
this.formData.dateFormat = 'dd MMMM yyyy';
resourceFactory.centerResource.update({centerId:routeParams.id},this.formData , function(data) {
location.path('/viewcenter/'+routeParams.id);
});
};
scope.activate = function(){
var newActivation = new Object();
newActivation.locale = 'en' ;
newActivation.dateFormat = 'dd MMMM yyyy';
newActivation.activationDate = this.formData.activationDate;
resourceFactory.centerResource.save({centerId : routeParams.id,command:'activate'},newActivation, function(data){
location.path('/viewcenter/'+routeParams.id);
});
};
}
});
mifosX.ng.application.controller('EditCenterController', ['$scope','ResourceFactory','$location','$routeParams', mifosX.controllers.EditCenterController]).run(function($log) {
$log.info("EditCenterController initialized");
});
}(mifosX.controllers || {}));

View File

@ -5,6 +5,7 @@
resourceFactory.centerResource.get({centerId: routeParams.id,associations:'groupMembers,collectionMeetingCalendar'} , function(data) {
scope.center = data;
scope.meeting = data.collectionMeetingCalendar;
});
resourceFactory.runReportsResource.get({reportSource: 'GroupSummaryCounts',genericResultSet: 'false',R_groupId: routeParams.id} , function(data) {
scope.summary = data[0];
@ -15,7 +16,14 @@
resourceFactory.groupNotesResource.getAllNotes({groupId: routeParams.id} , function(data) {
scope.notes = data;
});
scope.deletecenterpop = function(){
scope.choice = 3;
} ;
scope.delete = function(id){
resourceFactory.centerResource.delete({centerId: id}, {}, function(data) {
location.path('/centers');
});
};
scope.resetNote = function() {
this.formData = '';
};

View File

@ -99,7 +99,12 @@ define(['underscore', 'mifosX'], function() {
'groups/MemberManageController',
'groups/TransferClientsController',
'centers/CenterController',
'centers/ViewCenterController'
'centers/ViewCenterController',
'centers/CreateCenterController',
'centers/EditCenterController',
'centers/CloseCenterController',
'centers/AddGroupController',
'centers/CenterAttendanceController'
],
filters: [
'StatusLookup'

View File

@ -285,6 +285,21 @@
})
.when('/viewcenter/:id', {
templateUrl:'views/centers/viewcenter.html'
})
.when('/createcenter', {
templateUrl: 'views/centers/createcenter.html'
})
.when('/editcenter/:id', {
templateUrl: 'views/centers/editcenter.html'
})
.when('/closecenter/:id', {
templateUrl: 'views/centers/closecenter.html'
})
.when('/addgroup', {
templateUrl: 'views/centers/addgroup.html'
})
.when('/centerattendance', {
templateUrl: 'views/centers/centerattendance.html'
});
$locationProvider.html5Mode(false);
};

View File

@ -185,7 +185,14 @@
centerResource: defineResource(apiVer + "/centers/:centerId/:anotherresource", {centerId:'@centerId',anotherresource:'@anotherresource'}, {
get: {method: 'GET', params: {}},
update: { method: 'PUT'}
}),
centerMeetingResource:defineResource(apiVer + "/centers/:centerId/meetings/:templateSource", {centerId:'@centerId',templateSource:'@templateSource'}, {
getMeetingInfo: {method:'GET', params: {}}
}),
centerTemplateResource: defineResource(apiVer + "/centers/template", {}, {
get: {method: 'GET', params: {}}
})
};
}];
}

View File

@ -0,0 +1,54 @@
<form class="form-horizontal well" ng-controller="AddGroupController">
<fieldset>
<legend>{{'label.addgroup' | translate}}</legend>
<div class="control-group">
<label class="control-label" for="staffid">{{ 'label.form.staff' | translate }}</label>
<div class="controls">
<select ng-model="formData.staffId" id="staffid">
<option ng-repeat="staff in groupTemplate.staffOptions" value="{{staff.id}}">{{staff.displayName}}</option>
</select>
</div>
</div>
<div>
<div class="control-group">
<label class="control-label" for="fullname">{{ 'label.form.name' | translate }}</label>
<div class="controls">
<input type="text" id="fullname" ng-model="formData.name">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="externalid">{{ 'label.externalid' | translate }}</label>
<div class="controls">
<input type="text" id="externalid" ng-model="formData.externalId">
</div>
</div>
<div class="control-group">
<label class="control-label">{{ 'label.clients' | translate }}</label>
<div class="controls">
<select multiple ng-model="formData.clientMembers">
<option ng-repeat="client in groupTemplate.clientOptions" value="{{client.id}}">{{client.displayName}}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="activationdate">{{ 'label.form.activationdate' | translate }}</label>
<div class="controls">
<input type="text" id="activationdate" ng-model="formData.activationDate">
</div>
</div>
<div class="control-group">
<label class="control-label" for="active">{{ 'label.active' | translate }}</label>
<div class="controls">
<input type="checkbox" id="active" ng-model="formData.active">
</div>
</div>
<div class="offset2 paddedleft120">
<a href="#/viewcenter/{{groupTemplate.centerId}}" class="btn">{{ 'label.cancel' | translate }}</a>
<button type="button" class="btn btn-primary" data-ng-click="addGroup()">{{ 'label.save' | translate }}</button>
</div>
</fieldset>
</form>

View File

@ -0,0 +1,38 @@
<div ng-controller="CenterAttendanceController">
<form class="form-horizontal well">
<fieldset>
<legend>{{'label.attendance' | translate}}</legend>
<div class="control-group">
<label class="control-label">{{'label.meetingdate' | translate}}</label>
<div class="controls">
<input type="text" id="name" ng-model="formData.meetingDate">Next Meeting on:{{meeting.nextTenRecurringDates[0]}}
</div>
</div>
<table class="table table-striped" width="100%">
<thead>
<tr><td colspan="5">&nbsp;</td></tr>
<tr class="graybg">
<th>{{ 'label.code.name' | translate }}</th>
<th>{{ 'label.attendance' | translate }}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="client in clients">
<td>{{client.displayName}}</td>
<td>
<div>
<select ng-model="tempData[client.id]">
<option data-ng-repeat="attendance in attendanceOptions" value="{{attendance.id}}">{{attendance.value}}</option>
</select>
</div>
</td>
</tr>
</tbody>
</table>
<div class="offset2 paddedleft120">
<a href="#/viewcenter/{{center.id}}" class="btn">{{'label.cancel' | translate}}</a>
<button type="button" class="btn btn-primary" data-ng-click="attendanceUpdate(meeting.id)">{{'label.save' | translate}}</button>
</div>
</fieldset>
</form>
</div>

View File

@ -25,7 +25,7 @@
</tbody>
</table>
<ul class="pager">
<li class="previous"><a ng-click="centers.previous()" ng-disabled="!centers.hasPrevious()">&larr; {{'label.prev' | translate}}</a></li>
<li class="next" ><a ng-click="centers.next()" ng-disabled="!centers.hasNext()">{{'label.next' | translate}} &rarr;</a></li>
<li class="previous"><a ng-click="centers.previous()" ng-hide="!centers.hasPrevious()">&larr; {{'label.prev' | translate}}</a></li>
<li class="next" ><a ng-click="centers.next()" ng-hide="!centers.hasNext()">{{'label.next' | translate}} &rarr;</a></li>
</ul>
</div>

View File

@ -0,0 +1,21 @@
<form data-ng-controller="CloseCenterController">
<div class="paddedleft">
<h3>{{ 'label.confirm' | translate }}</h3>
<div>
<label class="control-label">{{ 'label.closuredate' | translate }}</label>
<input type="text" data-ng-model="formData.closureDate" required/>
</div>
<div>
<label class="control-label">{{ 'label.closurereasons' | translate }}</label>
<select ng-model="formData.closureReasonId">
<option ng-repeat="reason in template.closureReasons" value="{{reason.id}}">{{reason.name}}</option>
</select>
</div>
<br/>
<div>
<a href="#/viewcenter/{{center.id}}" class="btn">{{ 'label.cancel' | translate }}</a>
<button type="button" class="btn btn-primary" data-ng-click="closeGroup()">{{ 'label.confirm' | translate }}</button>
</div>
</div>
<hr/>
</form>

View File

@ -0,0 +1,50 @@
<form class="form-horizontal well" ng-controller="CreateCenterController" ng-submit="submit()">
<fieldset>
<legend>{{'label.createcenter' | translate}}</legend>
<div class="control-group">
<label class="control-label" for="name">{{'label.form.name' | translate}}</label>
<div class="controls">
<input type="text" id="name" ng-model="formData.name">
</div>
</div>
<div class="control-group info">
<label class="control-label" for="office">{{'label.form.office' | translate}}</label>
<div class="controls">
<select id="office" ng-model="formData.officeId">
<option ng-repeat="office in offices" value="{{office.id}}" ng-click="changeOffice(office.id)">{{office.name}}</option>
</select>
</div>
</div>
<div class="control-group info">
<label class="control-label" for="staffs">{{'label.staff' | translate}}</label>
<div class="controls">
<select id="staffs" ng-model="formData.staffId">
<option ng-repeat="staff in staffs" value="{{staff.id}}">{{staff.displayName}}</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="active">{{'label.active' | translate}}</label>
<div class="controls">
<input type="checkbox" id="active" ng-model="formData.active">
</div>
</div>
<div class="control-group">
<label class="control-label">{{'label.form.activationdate' | translate}}</label>
<div class="controls">
<input type="text" datepicker-popup="dd MMMM yyyy" ng-model="dt" min="'1950-06-22'" max="'2050-06-22'" datepicker-options="dateOptions" date-disabled="disabled(date, mode)" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="externalid">{{'label.externalid' | translate}}</label>
<div class="controls">
<input type="text" id="externalid" ng-model="formData.externalId">
</div>
</div>
<div class="offset2 paddedleft120">
<a href="#/centers" class="btn">{{'label.cancel' | translate}}</a>
<button type="submit" class="btn btn-primary">{{'label.save' | translate}}</button>
</div>
</fieldset>
</form>

View File

@ -0,0 +1,50 @@
<div ng-controller="EditCenterController">
<div data-ng-switch on="managecode">
<form class="form-horizontal well" data-ng-switch-when="2">
<fieldset>
<legend>{{'label.editcenter' | translate}}</legend>
<div class="control-group">
<label class="control-label" for="name">{{'label.name' | translate}}</label>
<div class="controls">
<input type="text" id="name" placeholder="{{edit.name}}" ng-model="formData.name">
</div>
</div>
<div class="control-group info">
<label class="control-label" for="staffs">{{'label.staff' | translate}}</label>
<div class="controls">
<select id="staffs" ng-model="formData.staffId" data-ng-options="staff.id as staff.displayName for staff in staffs" value="{{staff.id}}">
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="externalid">{{'label.externalid' | translate}}</label>
<div class="controls">
<input type="text" id="externalid" ng-model="formData.externalId">
</div>
</div>
<div class="control-group">
<label class="control-label" for="activationDate">{{'label.form.activationdate' | translate}}</label>
<div class="controls">
<input type="text" id="activationDate" ng-model="formData.activationDate">
</div>
</div>
<div class="offset2 paddedleft120">
<a href="#/viewcenter/{{edit.id}}" class="btn">{{'label.cancel' | translate}}</a>
<button type="button" class="btn btn-primary" data-ng-click="updateGroup()">{{'label.save' | translate}}</button>
</div>
</fieldset>
</form>
<form ng-switch-when="1">
<div class="paddedleft">
<div>
<label class="control-label">{{ 'label.enteractivationdate' | translate }}</label>
<input type="text" data-ng-model="formData.activationDate" required/>
</div>
<br/>
<a href="#/viewgroup/{{edit.id}}" class="btn">{{'label.cancel' | translate}}</a>
<button type="button" class="btn btn-primary" data-ng-click="activate()"><i class="icon-check-sign icon-white"></i>{{ 'label.activate' | translate }}</button>
</div>
<hr/>
</form>
</div>
</div>

View File

@ -29,10 +29,10 @@
<div class="row-fluid">
<div class="row-fluid primarydiv">
<div class="btn-group pull-right" data-ng-hide="center.status.value == 'Closed'">
<a href="#/" class="btn btn-primary" data-ng-hide="center.status.value=='Active'"><i class="icon-check-sign icon-white"></i>{{ 'label.activate' | translate }}</a>
<a href="#/" class="btn btn-primary"><i class="icon-edit icon-white"></i>{{ 'label.edit' | translate }}</a>
<a href="#/editcenter/{{center.id}}?managecode=1" class="btn btn-primary" data-ng-hide="center.status.value=='Active'"><i class="icon-check-sign icon-white"></i>{{ 'label.activate' | translate }}</a>
<a href="#/editcenter/{{center.id}}?managecode=2" class="btn btn-primary"><i class="icon-edit icon-white"></i>{{ 'label.edit' | translate }}</a>
<a ng-show="center.active" href="#/" class="btn btn-primary"><i class="icon-plus icon-white"></i>{{ 'label.centersavingapplication' | translate }}</a>
<a href="#/" class="btn btn-primary"><i class="icon-remove-circle icon-white"></i>{{ 'label.close' | translate }}</a>
<a href="#/closecenter/{{center.id}}" class="btn btn-primary"><i class="icon-remove-circle icon-white"></i>{{ 'label.close' | translate }}</a>
<button class="btn btn-primary" data-ng-click="deletecenterpop()" data-ng-hide="center.status.value=='Active'"><i class="icon-trash icon-white"></i>{{ 'label.delete' | translate }}</button>
</div>
</div>
@ -137,8 +137,8 @@
<tab heading="{{ 'label.groups' | translate }}">
<div class="row-fluid">
<div class="row-fluid primarydiv" data-ng-hide="center.status.value == 'Closed'">
<a href="#/" class="btn btn-primary pull-right"><i class="icon-plus-sign-alt icon-white"></i>{{ 'label.add' | translate }}</a>
<a href="#/" class="btn btn-primary pull-right">{{ 'label.attendance' | translate }}</a>
<a href="#/addgroup?centerId={{center.id}}&officeId={{center.officeId}}" class="btn btn-primary pull-right"><i class="icon-plus-sign-alt icon-white"></i>{{ 'label.add' | translate }}</a>
<a href="#/centerattendance?centerId={{center.id}}&calendarId={{meeting.id}}" class="btn btn-primary pull-right">{{ 'label.attendance' | translate }}</a>
</div>
</div>
<table class="table table-striped" width="100%">

View File

@ -67,7 +67,7 @@
</div>
</div>
<div class="offset2 paddedleft120">
<a href="#/viewgroup/{{group.id}}" class="btn btn-primary">{{ 'label.cancel' | translate }}</a>
<a href="#/viewgroup/{{clientTemplate.groupid}}" class="btn btn-primary">{{ 'label.cancel' | translate }}</a>
<button type="button" class="btn btn-primary" data-ng-click="addMember()">{{ 'label.save' | translate }}</button>
</div>
</fieldset>

View File

@ -25,7 +25,7 @@
</tbody>
</table>
<ul class="pager">
<li class="previous"><a ng-click="groups.previous()" ng-disabled="!groups.hasPrevious()">&larr; {{'label.prev' | translate}}</a></li>
<li class="next" ><a ng-click="groups.next()" ng-disabled="!groups.hasNext()">{{'label.next' | translate}} &rarr;</a></li>
<li class="previous"><a ng-click="groups.previous()" data-ng-hide="!groups.hasPrevious()">&larr; {{'label.prev' | translate}}</a></li>
<li class="next" ><a ng-click="groups.next()" data-ng-hide="!groups.hasNext()">{{'label.next' | translate}} &rarr;</a></li>
</ul>
</div>