MIFOSX-1468 - Added field 'Joining Date' for Staff

This commit is contained in:
Binny G Sreevas 2014-08-03 14:16:05 +05:30
parent aacc70ec5e
commit 064c4bd809
6 changed files with 43 additions and 5 deletions

View File

@ -1810,6 +1810,7 @@
"label.heading.editoffice": "Edit Office",
"label.heading.isLoanOfficer": "Is Loan Officer",
"label.heading.mobileNo": "Mobile Number for SMS",
"label.heading.joiningDate": "Joined On",
"label.heading.holidayname": "Holiday Name",
"label.heading.alternateworkingday": "Alternate Working Day",
"label.heading.managefunds": "Manage Funds",
@ -2003,6 +2004,7 @@
"label.input.jobname": "Job name",
"label.input.filterbyversion":"Filter by Version",
"label.input.resourceid":"Resource id",
"label.input.joinedon":"Joined On",
"#Localize system defined codes":"...",
"Customer Identifier":"Customer identifier",

View File

@ -1,7 +1,8 @@
(function (module) {
mifosX.controllers = _.extend(module, {
CreateEmployeeController: function (scope, resourceFactory, location) {
CreateEmployeeController: function (scope, resourceFactory, location, dateFilter) {
scope.offices = [];
scope.restrictDate = new Date();
resourceFactory.officeResource.getAllOffices(function (data) {
scope.offices = data;
scope.formData = {
@ -11,13 +12,17 @@
});
scope.submit = function () {
this.formData.locale = scope.optlang.code;
var joiningDate = dateFilter(scope.formData.joiningDate, scope.df);
this.formData.dateFormat = scope.df;
this.formData.joiningDate = joiningDate;
resourceFactory.employeeResource.save(this.formData, function (data) {
location.path('/viewemployee/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('CreateEmployeeController', ['$scope', 'ResourceFactory', '$location', mifosX.controllers.CreateEmployeeController]).run(function ($log) {
mifosX.ng.application.controller('CreateEmployeeController', ['$scope', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.CreateEmployeeController]).run(function ($log) {
$log.info("CreateEmployeeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -1,30 +1,40 @@
(function (module) {
mifosX.controllers = _.extend(module, {
EditEmployeeController: function (scope, routeParams, resourceFactory, location) {
EditEmployeeController: function (scope, routeParams, resourceFactory, location, dateFilter) {
scope.offices = [];
scope.restrictDate = new Date();
resourceFactory.employeeResource.get({staffId: routeParams.id, template: 'true'}, function (data) {
scope.offices = data.allowedOffices;
scope.staffId = data.id;
if (data.joiningDate) {
var editDate = dateFilter(data.joiningDate, scope.df);
data.joiningDate = new Date(editDate);
}
scope.formData = {
firstname: data.firstname,
lastname: data.lastname,
isLoanOfficer: data.isLoanOfficer,
officeId: data.officeId,
mobileNo: data.mobileNo,
isActive: data.isActive
isActive: data.isActive,
joiningDate: data.joiningDate
};
});
scope.submit = function () {
this.formData.locale = scope.optlang.code;
var joiningDate = dateFilter(scope.formData.joiningDate, scope.df);
this.formData.dateFormat = scope.df;
this.formData.joiningDate = joiningDate;
resourceFactory.employeeResource.update({'staffId': routeParams.id}, this.formData, function (data) {
location.path('/viewemployee/' + data.resourceId);
});
};
}
});
mifosX.ng.application.controller('EditEmployeeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', mifosX.controllers.EditEmployeeController]).run(function ($log) {
mifosX.ng.application.controller('EditEmployeeController', ['$scope', '$routeParams', 'ResourceFactory', '$location', 'dateFilter', mifosX.controllers.EditEmployeeController]).run(function ($log) {
$log.info("EditEmployeeController initialized");
});
}(mifosX.controllers || {}));

View File

@ -65,6 +65,14 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">{{ 'label.input.joinedon' | translate }}</label>
<div class="col-sm-3">
<input id="joiningDate" sort type="text" datepicker-pop="dd MMMM yyyy" ng-model="formData.joiningDate"
class="form-control" is-open="opened" min="minDate" max="restrictDate"/>
</div>
</div>
<div class="col-md-offset-3">
<a id="cancel" href="#/employees">
<button type="reset" class="btn btn-default">{{'label.button.cancel'| translate}}</button>

View File

@ -75,6 +75,15 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2">{{ 'label.input.joinedon' | translate }}</label>
<div class="col-sm-3">
<input id="joiningDate" sort type="text" datepicker-pop="dd MMMM yyyy" ng-model="formData.joiningDate"
class="form-control" is-open="opened" min="minDate" max="restrictDate"/>
</div>
</div>
<div class="col-md-offset-3">
<a id="cancel" href="#/viewemployee/{{staffId}}">
<button type="reset" class="btn btn-default">{{'label.button.cancel' | translate}}</button>

View File

@ -38,6 +38,10 @@
<td>{{ 'label.active' | translate }}</td>
<td>{{employee.isActive}}</td>
</tr>
<tr>
<td>{{ 'label.heading.joiningDate' | translate }}</td>
<td>{{employee.joiningDate | DateFormat}}</td>
</tr>
</table>
</div>
</div>