Unverified Commit 3a919a10 authored by rsayannagari-nisum-com's avatar rsayannagari-nisum-com Committed by GitHub

Merge pull request #2 from nisum-inc/MT-43

MT-43[Rajeshekar]: Added work location feature
parents 00b2f4e0 1b5f9eab
......@@ -20,25 +20,26 @@ import lombok.ToString;
@Document(collection = "EmployeeRoles")
public class EmployeeRoles implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
private String id;
private String employeeId;
private String employeeName;
private String emailId;
private String role;
private String designation;
private String shift;
private String baseTechnology;
private String empLocation;
private String technologyKnown;
private String mobileNumber;
private String alternateMobileNumber;
private String personalEmailId;
private Date createdOn;
private Date lastModifiedOn;
@Id
private String id;
private String employeeId;
private String employeeName;
private String emailId;
private String role;
private String designation;
private String shift;
private String baseTechnology;
private String technologyKnown;
private String mobileNumber;
private String alternateMobileNumber;
private String personalEmailId;
private Date createdOn;
private Date lastModifiedOn;
}
package com.nisum.mytime.model;
import java.io.Serializable;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "Locations")
public class Location implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String locationCode;
private String location;
private String country;
private String state;
private String city;
private boolean activeStatus;
private String comments;
}
package com.nisum.mytime.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.Location;
public interface LocationRepo extends MongoRepository<Location, String> {
}
\ No newline at end of file
......@@ -7,36 +7,44 @@ import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Location;
import com.nisum.mytime.model.Shift;
import com.nisum.mytime.model.Skill;
public interface UserService {
Boolean fetchEmployeesData(String perticularDate,boolean resynchFlag) throws MyTimeException;
Boolean fetchEmployeesData(String perticularDate, boolean resynchFlag)
throws MyTimeException;
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate, String toDate) throws MyTimeException;
List<EmpLoginData> employeeLoginsBasedOnDate(long id, String fromDate,
String toDate) throws MyTimeException;
List<EmployeeRoles> getEmployeeRoles() throws MyTimeException;
List<EmployeeRoles> getEmployeeRoles() throws MyTimeException;
EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles) throws MyTimeException;
EmployeeRoles assigingEmployeeRole(EmployeeRoles employeeRoles)
throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate) throws MyTimeException;
String generatePdfReport(long id, String fromDate, String toDate)
throws MyTimeException;
EmployeeRoles getEmployeesRole(String emailId);
EmployeeRoles getEmployeesRole(String emailId);
void deleteEmployee(String empId);
void deleteEmployee(String empId);
EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles);
EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles);
EmployeeRoles getEmployeesRoleData(String empId);
List<Shift> getAllShifts() throws MyTimeException;
List<Designation> getAllDesignations() throws MyTimeException;
List<Skill> getTechnologies() throws MyTimeException;
public EmployeeRoles updateProfile(EmployeeRoles employeeRoles) throws MyTimeException;
public List<Account> getAccounts() throws MyTimeException;
EmployeeRoles getEmployeesRoleData(String empId);
List<Shift> getAllShifts() throws MyTimeException;
List<Designation> getAllDesignations() throws MyTimeException;
List<Skill> getTechnologies() throws MyTimeException;
public EmployeeRoles updateProfile(EmployeeRoles employeeRoles)
throws MyTimeException;
public List<Account> getAccounts() throws MyTimeException;
List<Location> getLocations() throws MyTimeException;
}
......@@ -11,6 +11,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
getAllShifts();
getAllDesignations();
getAllTechnologies();
getAllLocations();
getAllAccounts();
$("#start").trigger("click");
}
......@@ -86,6 +87,16 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
});
};
function getAllLocations(){
$http({
method : "GET",
url : appConfig.appUri + "user/getLocations"
}).then(function mySuccess(response) {
myFactory.setLocations(response.data);
}, function myError(response) {
});
};
function getAllAccounts(){
$http({
method : "GET",
......@@ -125,7 +136,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
$scope.empName = dataToPass.getName();
$scope.empEmail = dataToPass.getEmail();
$scope.empShift;
$scope.shifts = myFactory.getTechnologies(); //["Shift 1(09:00 AM - 06:00 PM)","Shift 2(03:30 PM - 12:30 PM)", "Shift 3(09:00 PM - 06:00 AM)"];
$scope.shifts = myFactory.getTechnologies();
$scope.locations = myFactory.getLocations();//["Shift 1(09:00 AM - 06:00 PM)","Shift 2(03:30 PM - 12:30 PM)", "Shift 3(09:00 PM - 06:00 AM)"];
$scope.getSelectedShift = function(){
if ($scope.empShift !== undefined) {
......@@ -134,6 +146,13 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
return "Please select primary skill";
}
};
$scope.getSelectedLocation = function(){
if ($scope.empLocation !== undefined) {
return $scope.empLocation;
} else {
return "Please select work location";
}
};
$scope.validateEmpId = function(){
var searchId = $scope.empId;
......@@ -171,6 +190,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
var searchId = $scope.empId;
var empName = $scope.empName;
var empShift = $scope.empShift;
var empLocation = $scope.empLocation;
var mobileNumber = $scope.mobileNumber;
if(searchId == ""){
......@@ -191,9 +211,13 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
}else if(empShift == undefined){
$scope.alertMsg = "Please select a primary skill";
document.getElementById('empShift').focus();
}
else if(empLocation == undefined){
$scope.alertMsg = "Please select a work location";
document.getElementById('empLocation').focus();
}else{
$scope.alertMsg = "";
var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "emailId": $scope.empEmail, "role": "Employee", "shift": "Shift 1(09:00 AM - 06:00 PM)","mobileNumber":$scope.mobileNumber,"baseTechnology": $scope.empShift};
var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "emailId": $scope.empEmail, "role": "Employee", "shift": "Shift 1(09:00 AM - 06:00 PM)","mobileNumber":$scope.mobileNumber,"baseTechnology": $scope.empShift,"empLocation": $scope.empLocation};
addEmployee(record);
}
};
......@@ -313,7 +337,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
auth2.disconnect();
//Clear if any values set to factory
var menuItems = [], designations = [], accounts = [], technologies = [], shifts = [];
var menuItems = [], designations = [], accounts = [], technologies = [], shifts = [],locations=[];
myFactory.setEmpId("");
myFactory.setEmpName("");
myFactory.setEmpEmailId("");
......@@ -325,7 +349,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
myFactory.setAccounts(accounts);
myFactory.setTechnologies(technologies);
myFactory.setShifts(shifts);
myFactory.setLocations(locations);
var element = document.getElementById('home');
var path = "'templates/login.html'";
element.setAttribute("src", path);
......
......@@ -35,6 +35,7 @@ myApp.factory('myFactory', function() {
var profileUrl = "";
var designations="";
var technologies="";
var locations="";
var shifts="";
var accounts="";
function setEmpId(id) {
......@@ -95,6 +96,12 @@ myApp.factory('myFactory', function() {
function getTechnologies() {
return technologies;
}
function setLocations(locations1) {
locations = locations1;
}
function getLocations() {
return locations;
}
function setShifts(shifts1) {
shifts = shifts1;
}
......@@ -135,6 +142,8 @@ myApp.factory('myFactory', function() {
getAccounts : getAccounts,
setTechnologies : setTechnologies,
getTechnologies : getTechnologies,
setLocations : setLocations,
getLocations : getLocations,
setShifts : setShifts,
getShifts : getShifts,
setTemplateUrl : setTemplateUrl,
......
......@@ -158,6 +158,20 @@
</div>
</div>
<div class="row col-lg-12 col-xs-12">
<div class="col-lg-5 col-xs-6">
<p>
<b>Work Location</b>
</p>
</div>
<div class="col-lg-7 col-xs-6">
<p>
<b>:</b> {{profile.empLocation}}
</p>
</div>
</div>
</div>
......
......@@ -25,6 +25,9 @@
<md-select ng-model="empShift" md-selected-text="getSelectedShift()" id="empShift">
<md-optgroup label="skills"> <md-option ng-value="shift"
ng-repeat="shift in shifts">{{shift}}</md-option> </md-optgroup> </md-select>
<md-select ng-model="empLocation" md-selected-text="getSelectedLocation()" id="empLocation">
<md-optgroup label="locations"> <md-option ng-value="location"
ng-repeat="location in locations">{{location}}</md-option> </md-optgroup> </md-select>
<div role="alert">
<span class="error" style="color: red;">{{alertMsg}}</span>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment