Commit d84b248e authored by Prasad Innamuri's avatar Prasad Innamuri

download and upload function is implemented

parent aee3615f
package com.nisum.myteam.controller;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
......@@ -8,6 +11,7 @@ import java.util.List;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.nisum.myteam.model.dao.EmployeeSubStatus;
import com.nisum.myteam.model.dao.EmployeeVisa;
......@@ -34,6 +38,7 @@ import com.nisum.myteam.model.dao.Employee;
import com.nisum.myteam.service.IEmployeeRoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.multipart.MultipartFile;
@RestController
@Slf4j
......@@ -309,6 +314,26 @@ public class EmployeeController {
return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
@RequestMapping(value = "/employees/uploadProfile/{empid}", method = RequestMethod.POST)
public ResponseEntity<Employee> handleFileUpload(@PathVariable("empid") String empid, @RequestParam(value = "file") MultipartFile file) throws MyTeamException, IOException {
Employee employeeUpdated = empService.uploadProfile(empid, file);
return new ResponseEntity<>(null, HttpStatus.OK);
}
@RequestMapping(value = "/employees/downloadFile/{empId}", method = RequestMethod.GET)
public void downloadFile(@PathVariable("empId") String empId, HttpServletResponse response) throws IOException {
InputStream is = null;
is = new ByteArrayInputStream(empService.getUploadFile(empId));
response.setContentType("application/msword");
byte[] bytes = new byte[1024];
int bytesRead;
while ((bytesRead = is.read(bytes)) != -1) {
response.getOutputStream().write(bytes, 0, bytesRead);
}
is.close();
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
......@@ -44,4 +45,35 @@ public class OrgLocationController {
return new ResponseEntity<>(getRespDetails, HttpStatus.OK);
}
@RequestMapping(value = "/organization/locations/{country}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getSelectedLocations(@PathVariable("country") String country, HttpServletRequest request) throws MyTeamException {
List<String> locationsList = orgLocationService.getLocations().stream()
.filter(e -> (e.isActiveStatus() == true)&&(e.getCountry().equalsIgnoreCase(country))).map(OrgLocation::getLocation).sorted()
.collect(Collectors.toList());
log.info("getLocations " + locationsList);
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 905,
"Retrieved Organization Locations successfully", "Organization Locations List", locationsList,
request.getRequestURI(), "Organization Location Details", null);
return new ResponseEntity<>(getRespDetails, HttpStatus.OK);
}
@RequestMapping(value = "/organization/countrys/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getCountrys(HttpServletRequest request) throws MyTeamException {
log.info("getCountrys Start ");
List<String> countryList = orgLocationService.getLocations().stream()
.filter(e -> (e.isActiveStatus() == true)).map(OrgLocation::getCountry).distinct().sorted()
.collect(Collectors.toList());
log.info("getLocations " + countryList);
ResponseDetails getRespDetails = new ResponseDetails(new Date(), 905,
"Retrieved Organization Locations successfully", "Organization Country List", countryList,
request.getRequestURI(), "Organization Country Details", null);
log.info("getCountrys End ");
return new ResponseEntity<>(getRespDetails, HttpStatus.OK);
}
}
......@@ -20,6 +20,7 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.mongodb.core.mapping.Field;
@Setter
@Getter
......@@ -134,6 +135,10 @@ public class Employee implements Serializable {
private String createdBy;
private String modifiedBy;
private String country;
private Date lastUpdateProfile;
@Field
private byte[] updateProfile;
......
......@@ -5,7 +5,9 @@ import com.nisum.myteam.model.FunctionalGroup;
import com.nisum.myteam.model.dao.Account;
import com.nisum.myteam.model.dao.Employee;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.text.ParseException;
import java.util.Date;
import java.util.HashMap;
......@@ -63,4 +65,8 @@ public interface IEmployeeService {
public int getEmployeesCountByDesignation(String designation);
Employee uploadProfile(String empId, MultipartFile file) throws MyTeamException, IOException;
byte[] getUploadFile(String empId);
}
......@@ -21,6 +21,8 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -370,7 +372,8 @@ public class EmployeeService implements IEmployeeService {
} else if (status.equals("Resigned")) {
return employeeRepo.findByEmpSubStatusOrderByEmployeeNameAsc("Resigned");
} else {
return employeesList.stream().filter(e -> e.getEmpStatus().equals(status)).collect(Collectors.toList());
return employeesList.stream().filter(e->Optional.ofNullable(e.getEmpStatus()).isPresent() && e.getEmpStatus().equals(status)).collect(Collectors.toList());
}
}
......@@ -495,4 +498,22 @@ public class EmployeeService implements IEmployeeService {
return onDate.after(e.getDateOfJoining()) && Optional.ofNullable(e.getEndDate()).isPresent() ? onDate.before(e.getEndDate()):true;
}
@Override
public Employee uploadProfile(String empId, MultipartFile file) throws MyTeamException, IOException {
Employee existingEmployee = employeeRepo.findByEmployeeId(empId);
// Employee employee=new Employee();
// employee.setEmployeeId(empId);
existingEmployee.setUpdateProfile(file.getBytes());
existingEmployee.setLastUpdateProfile(new Date());
Employee employeePersisted = employeeRepo.save(existingEmployee);
return employeePersisted;
}
@Override
public byte[] getUploadFile(String empId) {
Employee emp= employeeRepo.findByEmployeeId(empId);
return emp.getUpdateProfile();
}
}
......@@ -13,6 +13,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
var getCellTemplate = '<p ng-show="row.entity.empStatus == \'Active\'" class="col-lg-12"><i class="fa fa-pencil-square-o fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Update\')"></i>'+
'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
var getDownloadTemplate = '<a target="_self" class="add-btn md-raised md-primary" href ng-click="grid.appScope.download(row)"> Download</a>';
// <i class="fa fa-minus-circle fa-2x" aria-hidden="true" style="font-size:1.5em;margin-top:3px;cursor:pointer;" ng-click="grid.appScope.getRowData(row,\'Delete\')"></i></p>
$scope.gridOptions = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
......@@ -50,7 +51,8 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
{field : 'functionalGroup',displayName: 'Func. Org', enableColumnMenu: false, enableSorting: false,enableFiltering:true,width:'*', cellClass: 'grid-align'},
{field : 'dateOfJoining',displayName: 'DOJ', enableColumnMenu: true, enableSorting: true,enableFiltering:true,cellFilter:'date:"dd-MMM-yyyy"',width:'*', cellClass: 'grid-align'},
{field : 'endDate',displayName: 'DOL', enableColumnMenu: true, enableSorting: true,enableFiltering:true,cellFilter:'date:"dd-MMM-yyyy"',width:'*', cellClass: 'grid-align'},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false}
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false} ,
{name : 'Dowload Profile', displayName: 'Dowload',cellTemplate: getDownloadTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100,cellClass: 'grid-align'}
]
};
......@@ -81,6 +83,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.parentData.mobileNumber = row.entity.mobileNumber;
$scope.parentData.emailId = row.entity.emailId;
$scope.parentData.role = row.entity.role;
$scope.parentData.empCountry = row.entity.empCountry;
$scope.parentData.empLocation = row.entity.empLocation;
$scope.parentData.designation = row.entity.designation;
$scope.parentData.functionalGroup = row.entity.functionalGroup;
......@@ -103,6 +106,30 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.deleteRole(row);
}
$scope.download = function(row){
var employeeId = row.entity.employeeId;
var urlRequest = appConfig.appUri+ "/employees/downloadFile/"+employeeId;
$http({
method : "GET",
url : urlRequest,
headers:{'Content-type': 'application/msword'},
responseType : 'arraybuffer',
}).then(function mySuccess(response) {
var value=response.data;
var fileName=employeeId+".doc"
var file = new Blob([value], {type: 'application/msword'});
var url = window.URL || window.webkitURL;
var downloadLink = angular.element('<a></a>');
downloadLink.attr('href',url.createObjectURL(file));
downloadLink.attr('target','_self');
downloadLink.attr('download', fileName);
downloadLink[0].click();
}, function myError(response) {
showAlert(" Unable to find the profile , Please Upload profile in my Profile link");
});
}
$scope.refreshPage = function(){
$scope.empSearchId = "";
$scope.getUserRoles();
......@@ -125,7 +152,8 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'baseTechnology',displayName: 'Skill', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'designation',displayName: 'Designation', enableColumnMenu: false, enableSorting: true,enableFiltering: true},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100}
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100} ,
{name : 'Dowload Profile', displayName: 'Dowload',downloadTemplate: getDownloadTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100}
]
};
$scope.getUserRoles = function(){
......@@ -271,6 +299,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.empSubStatus;
$scope.employmentType;
$scope.designation;
$scope.empCountry ;
$scope.empLocation;
$scope.dateOfJoining;
$scope.domain = "";
......@@ -293,6 +322,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.empRole = dataToPass.role;
$scope.empMobileNo = dataToPass.mobileNumber;
$scope.empEmail = dataToPass.emailId;
$scope.empCountry = dataToPass.empCountry;
$scope.empLocation = dataToPass.empLocation;
$scope.functionalGroup = dataToPass.functionalGroup;
$scope.empStatus = dataToPass.empStatus;
......@@ -313,6 +343,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}
$scope.domains = myFactory.getDomains();
$scope.roles = myFactory.getRoles();
$scope.countrys=myFactory.getCountrys();
$scope.locations=myFactory.getLocations();
$scope.designations=myFactory.getDesignations();
$scope.functionalGroups=myFactory.getFunctionalgroups();
......@@ -326,6 +357,26 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
return "Please select a role";
}
};
$scope.getSelectedCountry = function(){
if ($scope.empCountry !== undefined) {
$scope.empLocation="";
$scope.locations="";
getAllLocationsCountry($scope.empCountry );
return $scope.empCountry;
} else {
return "Please select a Country";
}
};
function getAllLocationsCountry(country){
$http({
method : "GET",
url : appConfig.appUri +"/organization/locations/"+country
}).then(function mySuccess(response) {
$scope.locations=response.data.records;
}, function myError(response) {
});
};
$scope.getSelectedLocation = function(){
if ($scope.empLocation !== undefined) {
return $scope.empLocation;
......@@ -539,6 +590,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
var empEmail = $scope.empEmail;
var empMobileNo = $scope.empMobileNo;
var designation = $scope.designation;
var empCountry = $scope.empCountry;
var empLocation = $scope.empLocation;
var employmentType = $scope.employmentType;
var functionalGroup = $scope.functionalGroup;
......@@ -619,7 +671,10 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}else if(designation == undefined){
$scope.alertMsg = "Please select a designation";
document.getElementById('designation').focus();
}else if(empLocation == undefined){
}else if(empCountry == undefined){
$scope.alertMsg = "Please select a Country";
document.getElementById('empCountry').focus();
}else if(empLocation == undefined || empLocation==""){
$scope.alertMsg = "Please select a location";
document.getElementById('empLocation').focus();
}else if(employmentType == undefined){
......@@ -665,7 +720,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}else{
$scope.alertMsg = "";
var record = {"employeeId":$scope.empId, "employeeName": $scope.empName, "gender": $scope.gender,"mobileNumber": $scope.empMobileNo, "emailId": $scope.empEmail,
"role": $scope.empRole, "empLocation": $scope.empLocation,"designation": $scope.designation,"functionalGroup": $scope.functionalGroup,
"role": $scope.empRole,"country":$scope.empCountry, "empLocation": $scope.empLocation,"designation": $scope.designation,"functionalGroup": $scope.functionalGroup,
"empStatus": $scope.empStatus,"employmentType": $scope.employmentType,"dateOfJoining":$scope.dateOfJoining,
"dateOfBirth":$scope.dateOfBirth,"hasPassort":$scope.hasPassort,"hasB1":$scope.hasB1,"passportExpiryDate":$scope.passportExpiryDate,
"b1ExpiryDate":$scope.b1ExpiryDate, "endDate":$scope.exitDate,"empSubStatus":empSubStatusObj
......@@ -676,7 +731,7 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
}
else{
var recordFromDb = {"employeeId":dataToPass.employeeId, "employeeName": dataToPass.employeeName, "gender": dataToPass.gender,"mobileNumber": dataToPass.mobileNumber,"emailId": dataToPass.emailId,
"role": dataToPass.role, "empLocation": dataToPass.empLocation,"designation": dataToPass.designation,"functionalGroup": dataToPass.functionalGroup,
"role": dataToPass.role,"country":dataToPass.empCountry, "empLocation": dataToPass.empLocation,"designation": dataToPass.designation,"functionalGroup": dataToPass.functionalGroup,
"empStatus": dataToPass.empStatus,"empSubStatus":dataToPass.empSubStatus, "employmentType": dataToPass.employmentType,"dateOfJoining":new Date(dataToPass.dateOfJoining),
"dateOfBirth":new Date(dataToPass.dateOfBirth),"hasPassort":dataToPass.hasPassort,"hasB1":dataToPass.hasB1,"passportExpiryDate":new Date(dataToPass.passportExpiryDate),
"b1ExpiryDate":new Date(dataToPass.b1ExpiryDate), "endDate":new Date(dataToPass.endDate) ,"empSubStatus": prevEmpSubStatusObj
......@@ -745,14 +800,14 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
};
var record = {
"employeeId":$scope.empId, "employeeName": $scope.empName, "gender": $scope.gender,"mobileNumber": $scope.empMobileNo,"emailId": $scope.empEmail,
"role": $scope.empRole, "empLocation": $scope.empLocation,"designation": $scope.designation,"functionalGroup": $scope.functionalGroup,
"role": $scope.empRole,"country":$scope.empCountry, "empLocation": $scope.empLocation,"designation": $scope.designation,"functionalGroup": $scope.functionalGroup,
"empStatus": $scope.empStatus, "empSubStatus":$scope.empSubStatus, "employmentType": $scope.employmentType,"dateOfJoining":$scope.dateOfJoining,
"dateOfBirth":$scope.dateOfBirth,"hasPassort":$scope.hasPassort,"hasB1":$scope.hasB1,"passportExpiryDate":$scope.passportExpiryDate,
"b1ExpiryDate":$scope.b1ExpiryDate, "endDate":$scope.exitDate ,"empSubStatus":empSubStatusObj
};
var recordFromDb = {
"employeeId":dataToPass.employeeId, "employeeName": dataToPass.employeeName, "gender": dataToPass.gender,"mobileNumber": dataToPass.mobileNumber,"emailId": dataToPass.emailId,
"role": dataToPass.role, "empLocation": dataToPass.empLocation,"designation": dataToPass.designation,"functionalGroup": dataToPass.functionalGroup,
"role": dataToPass.role,"country":dataToPass.empCountry, "empLocation": dataToPass.empLocation,"designation": dataToPass.designation,"functionalGroup": dataToPass.functionalGroup,
"empStatus": dataToPass.empStatus, "empSubStatus":dataToPass.empSubStatus, "employmentType": dataToPass.employmentType,"dateOfJoining":new Date(dataToPass.dateOfJoining),
"dateOfBirth":new Date(dataToPass.dateOfBirth),"hasPassort":dataToPass.hasPassort,"hasB1":dataToPass.hasB1,"passportExpiryDate":new Date(dataToPass.passportExpiryDate),
"b1ExpiryDate":new Date(dataToPass.b1ExpiryDate), "endDate":new Date(dataToPass.endDate) , "empSubStatus":prevEmpSubStatusObj
......
......@@ -11,6 +11,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
getAllLocations();
getAllAccounts();
getMasterData();
getAllCountrys();
$("#start").trigger("click");
}
......@@ -86,6 +87,16 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
});
};
function getAllCountrys(){
$http({
method : "GET",
url : appConfig.appUri +"/organization/countrys/"
}).then(function mySuccess(response) {
myFactory.setCountrys(response.data.records);
}, function myError(response) {
});
};
function getAllAccounts(){
$http({
method : "GET",
......@@ -132,13 +143,20 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
$scope.empShift;
$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.country=myFactory.getAllCountrys();
$scope.getSelectedShift = function(){
if ($scope.empShift !== undefined) {
return $scope.empShift;
} else {
return "Please select primary skill";
}
};
$scope.getSelectedCountry = function(){
if ($scope.empCountry !== undefined) {
return $scope.empCountry;
} else {
return "Please select work Country";
}
};
$scope.getSelectedLocation = function(){
if ($scope.empLocation !== undefined) {
......@@ -205,13 +223,15 @@ 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){
}else if($scope.country == ""){
$scope.alertMsg = "Country is mandatory";
document.getElementById('empName').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,"empLocation": $scope.empLocation};
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,"country": $scope.country};
addEmployee(record);
}
};
......@@ -372,7 +392,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
auth2.disconnect();
//Clear if any values set to factory
var menuItems = [], designations = [], accounts = [], technologies = [], shifts = [],locations=[];
var menuItems = [], designations = [], accounts = [], technologies = [], shifts = [],locations=[], countrys = [];
myFactory.setEmpId("");
myFactory.setEmpName("");
myFactory.setEmpEmailId("");
......@@ -384,6 +404,7 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
myFactory.setAccounts(accounts);
myFactory.setTechnologies(technologies);
myFactory.setShifts(shifts);
myFactory.setCountrys(countrys);
myFactory.setLocations(locations);
var element = document.getElementById('home');
var path = "'templates/login.html'";
......
myApp.controller("profileController", function($scope, $http, myFactory, $mdDialog, appConfig) {
myApp.controller("profileController", function($scope, $http, myFactory, $mdDialog, appConfig,$window) {
$scope.records = [];
$scope.empId = myFactory.getEmpId();
$scope.empName = myFactory.getEmpName();
......@@ -34,6 +34,29 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial
$scope.refreshPage();
});
};
$scope.download = function(){
var empId = $scope.empId;
var urlRequest = appConfig.appUri+ "/employees/downloadFile/"+empId;
$http({
method : "GET",
url : urlRequest,
headers:{'Content-type': 'application/msword'},
responseType : 'arraybuffer',
}).then(function mySuccess(response) {
var value=response.data;
var fileName=empId+".doc"
var file = new Blob([value], {type: 'application/msword'});
var url = window.URL || window.webkitURL;
var downloadLink = angular.element('<a></a>');
downloadLink.attr('href',url.createObjectURL(file));
downloadLink.attr('target','_self');
downloadLink.attr('download', fileName);
downloadLink[0].click();
}, function myError(response) {
showAlert(" Unable to find the profile , Please Upload profile ");
});
};
function UpdateProfileController($scope, $mdDialog, dataToPass) {
$scope.profile = dataToPass;
......@@ -45,6 +68,7 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial
$scope.personalEmailId=dataToPass.personalEmailId;
$scope.technologyKnown=dataToPass.technologyKnown;
$scope.designationEmp=(dataToPass.designation == null ? undefined: dataToPass.designation);
$scope.uploadFile=dataToPass.uploadFile;
$scope.cancel = function() {
$mdDialog.hide();
};
......@@ -63,6 +87,43 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial
return "Please select designation";
}
};
$scope.uploadFile = function(){
var file =$scope.file;
if(this.file == undefined ){
showAlert("Please Upload profile .DOC or .DOCX");
}
var ext=this.file.name.split(".").pop();
if(this.file == undefined &&(ext!="docx" || ext!="doc")){
showAlert("Please Upload profile .DOC and .DOCX");
}
var formData = new FormData();
formData.append('file',$scope.file);
$scope.alertMsg = "";
var empid=$scope.profile.employeeId
// var record = {"employeeId":$scope.profile.employeeId, "mobileNumber": $scope.mobileNumber, "alternateMobileNumber": $scope.alternateMobileNumber, "personalEmailId": $scope.personalEmailId, "baseTechnology": $scope.baseTechnology, "technologyKnown": $scope.technologyKnown};
var urlRequest = "";
urlRequest = appConfig.appUri+ "/employees/uploadProfile/"+$scope.profile.employeeId;
var req = {
method : 'POST',
url : urlRequest,
headers : {
"Content-type" : undefined
},
transformRequest: angular.identity,
data : formData
}
$http(req).then(function mySuccess(response) {
$mdDialog.hide('Success');
$scope.dataToPass=response.data;
}, function myError(response){
$mdDialog.hide('Error');
});
};
$scope.validateFields = function(){
var mobileNumber = $scope.mobileNumber;
$scope.alertMsg = "";
......
......@@ -46,6 +46,7 @@ myApp.factory('myFactory', function() {
var employeeSubStatus="";
var employementTypes="";
var domains="";
var countrys="";
function setEmpId(id) {
empId = id;
}
......@@ -178,6 +179,12 @@ myApp.factory('myFactory', function() {
}
return false;
}
function setCountrys(country1) {
countrys = country1;
}
function getCountrys() {
return countrys;
}
// function addFormDataCheck(form){
// var obj = {};
......@@ -255,6 +262,8 @@ myApp.factory('myFactory', function() {
getDomains : getDomains,
setTechnologies : setTechnologies,
getTechnologies : getTechnologies,
setCountrys : setCountrys,
getCountrys : getCountrys,
setLocations : setLocations,
getLocations : getLocations,
setFunctionalgroups : setFunctionalgroups,
......
......@@ -161,6 +161,14 @@
ng-value="designation" ng-repeat="designation in designations">{{designation}}</md-option>
</md-optgroup> </md-select></td>
</tr>
<tr>
<td colspan="4"><b>Country:</b><span class="mandatory"></span></td>
<td colspan="8"><md-select ng-model="empCountry" ng-blur="validateMessage()" name="empCountry"
md-selected-text="getSelectedCountry()" id="empCountry">
<md-optgroup label="countrys"> <md-option
ng-value="country" ng-repeat="country in countrys">{{country}}</md-option>
</md-optgroup> </md-select></td>
</tr>
<tr>
<td colspan="4"><b>Work &nbsp;Location:</b><span class="mandatory"></span></td>
......
<div class="md-padding my-profile" id="popupContainer" ng-controller="profileController" ng-init="getProfileData()">
<h1 class="no-padding">My Profile
<span class="right">
<md-button class="add-btn md-raised md-primary" ng-click="download()"> <i class="fa fa-pencil-square-o fa-1x"></i> Download Profile
</md-button>
<md-button class="add-btn md-raised md-primary" ng-click="updateProfile()"> <i class="fa fa-pencil-square-o fa-1x"></i> Update Profile
</md-button>
<i class="fa fa-refresh" aria-hidden="true" ng-click="refreshPage()"></i>
......@@ -244,6 +246,30 @@
</p>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-xs-6">
<p>
<b>Country</b> <b class="right">:</b>
</p>
</div>
<div class="col-lg-7 col-xs-6">
<p>
{{profile.country}}
</p>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-xs-6">
<p>
<b>Last Update Profile</b> <b class="right">:</b>
</p>
</div>
<div class="col-lg-7 col-xs-6">
<p>
{{profile.lastUpdateProfile | date:'dd-MMM-yyyy'}}
</p>
</div>
</div>
</div>
</div>
<div class="col-lg-2 col-xs-12"></div>
......
......@@ -24,6 +24,7 @@
ng-repeat="tech in technologies">{{tech}}</md-option> </md-optgroup> </md-select>
<textarea rows="4" cols="10" class="form-control" id="technologyKnown" name="technologyKnown"
ng-model="technologyKnown" placeholder="Technologies Known" />
<input type="file" file-model="file" class="form-control" id="uploadFile" name="uploadFile" ng-model="uploadFile" placeholder="Upload Profile" multiple/>
<div role="alert">
<span class="error" style="color: red;">{{alertMsg}}</span>
</div>
......@@ -31,10 +32,10 @@
</md-dialog-content>
<md-dialog-actions layout="row"> <md-button
class="md-raised" data-ng-click="validateFields()">
Update </md-button> <md-button class="md-raised" ng-click="cancel()">
Cancel </md-button> </md-dialog-actions>
<md-dialog-actions layout="row">
<md-button class="md-raised" data-ng-click="uploadFile()">Upload </md-button>
<md-button class="md-raised" data-ng-click="validateFields()"> Update </md-button>
<md-button class="md-raised" ng-click="cancel()"> Cancel </md-button> </md-dialog-actions>
</form>
</md-dialog>
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