Commit cd729356 authored by Rajeshekar's avatar Rajeshekar

MT-55: Charts

parent dee0916e
package com.nisum.mytime.controller;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.group;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.newAggregation;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.project;
import static org.springframework.data.mongodb.core.aggregation.Aggregation.sort;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
import org.springframework.data.mongodb.core.aggregation.MatchOperation;
import org.springframework.data.mongodb.core.aggregation.ProjectionOperation;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.BillingDetails;
import com.nisum.mytime.model.ColumnChartData;
import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.GroupByCount;
import com.nisum.mytime.model.ReportSeriesRecord;
import com.nisum.mytime.repository.EmployeeVisaRepo;
import com.nisum.mytime.repository.TeamMatesBillingRepo;
import com.nisum.mytime.service.ProjectService;
import com.nisum.mytime.service.UserService;
@RestController
@RequestMapping("/reports")
public class ReportsController {
@Autowired
private UserService userService;
@Autowired
private ProjectService projectService;
@Autowired
private EmployeeVisaRepo employeeVisaRepo;
@Autowired
private MongoTemplate mongoTemplate;
@Autowired
private TeamMatesBillingRepo teamMatesBillingRepo;
@RequestMapping(value = "/functioNalGroup", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List> getEmployeeRole() throws MyTimeException {
Map m = new HashMap();
m.put("name", "ES");
m.put("y", "50");
Map m1 = new HashMap();
m1.put("name", "CI");
m1.put("y", "45");
Map m2 = new HashMap();
m2.put("name", "APPS");
m2.put("y", "5");
List l = new ArrayList();
l.add(m);
l.add(m1);
l.add(m2);
return new ResponseEntity<>(l, HttpStatus.OK);
}
/*
* [{ name: "ES", y: 20 }, { name: "CI", y: 12, sliced: true, selected: true
* }, { name: "APPS", y: 43 }]
*/
// [{"name":"ES","total":154},{"name":"ACI -
// QE","total":137},{"name":"","total":71},{"name":"ACI -
// Support","total":53},{"name":"APPS","total":46},{"name":"CI","total":40},{"name":"ACI
// - DevOps","total":37},{"name":"I&A","total":32},{"name":"PE","total":6}]
// [{ name: 'billable2222',data: [5, 3, 4, 7]}, {name: 'nonbillable',data:
// [2, 2, 3, 2]}, {name: 'Shadow', data: [3, 4, 4, 2]}]
@RequestMapping(value = "/getEmployeesByFunctionalGroup1",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<GroupByCount>> getEmployeesByFunctionalGroup()
throws MyTimeException {
ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y")
.as("y");
Aggregation agg = newAggregation(
// match(Criteria.where("employeeId").gt(10)),
group("functionalGroup").count().as("y"),
project("y").and("functionalGroup").previousOperation(),
projectToMatchModel,
sort(Sort.Direction.DESC, "y")
);
// Convert the aggregation result into a List
AggregationResults<GroupByCount> groupResults = mongoTemplate
.aggregate(agg, EmployeeRoles.class, GroupByCount.class);
List<GroupByCount> result = groupResults.getMappedResults();
return new ResponseEntity<>(result, HttpStatus.OK);
}
@RequestMapping(value = "/getEmployeesByFunctionalGroupForReport",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ColumnChartData> getEmployeesByFunctionalGroupForReport()
throws MyTimeException {
ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y")
.as("y");
Aggregation agg = newAggregation(
// match(Criteria.where("employeeId").gt(10)),
group("functionalGroup").count().as("y"),
project("y").and("functionalGroup").previousOperation(),
projectToMatchModel,
sort(Sort.Direction.DESC, "y")
);
// Convert the aggregation result into a List
AggregationResults<GroupByCount> groupResults = mongoTemplate
.aggregate(agg, EmployeeRoles.class, GroupByCount.class);
List<GroupByCount> result = groupResults.getMappedResults();
ColumnChartData reportData = new ColumnChartData();
reportData.setCategories("data");
reportData.setSeriesDataList(result);
return new ResponseEntity<>(reportData, HttpStatus.OK);
}
@RequestMapping(value = "/getBillabilityDetailsByAccount",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ColumnChartData> getBillabilityDetailsByAccount()
throws MyTimeException {
ProjectionOperation projectToMatchModel = project()
.andExpression("account").as("categories")
.andExpression("billableStatus").as("seriesName")
.andExpression("count").as("count");
MatchOperation matchStage = Aggregation
.match(new Criteria("active").is(true));
Aggregation aggregate = Aggregation.newAggregation(matchStage,
Aggregation.group("account", "billableStatus").count()
.as("count"),
projectToMatchModel);
// Convert the aggregation result into a List
AggregationResults<ColumnChartData> groupResults = mongoTemplate
.aggregate(aggregate, BillingDetails.class,
ColumnChartData.class);
List<ColumnChartData> result = groupResults.getMappedResults();
List<String> statusList = new ArrayList();
statusList.add("Billable");
statusList.add("Shadow");
statusList.add("Reserved");
statusList.add("Non-Billable");
List<String> catagories = new ArrayList();
List<ReportSeriesRecord> seriesDetails = new ArrayList<ReportSeriesRecord>();
List<Account> accounts = userService.getAccounts();
ColumnChartData reportData = new ColumnChartData();
for (String status : statusList) {
catagories = new ArrayList();
long seriesData[] = new long[accounts.size()];
int i = 0;
for (Account acct : accounts) {
boolean seriesDataExists = false;
catagories.add(acct.getAccountName());
for (ColumnChartData columnChartData : result) {
if (columnChartData.getCategories() != null
&& columnChartData.getSeriesName() != null
& columnChartData.getCategories()
.equalsIgnoreCase(
acct.getAccountName())
&& columnChartData.getSeriesName()
.equalsIgnoreCase(status)) {
seriesDataExists = true;
seriesData[i] = columnChartData.getCount();
}
}
if (!seriesDataExists) {
// seriesData[i] = 0;
}
i++;
}
ReportSeriesRecord reportSeriesRecord = new ReportSeriesRecord();
reportSeriesRecord.setName(status);
reportSeriesRecord.setData(seriesData);
seriesDetails.add(reportSeriesRecord);
}
System.out.println(seriesDetails);
reportData.setCategoriesList(catagories);
reportData.setSeriesDataList(seriesDetails);
return new ResponseEntity<>(reportData, HttpStatus.OK);
}
@RequestMapping(value = "/getBillabilityDetailsByMonth",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ColumnChartData> getBillabilityDetailsByMonth()
throws MyTimeException {
Date reportDate = new Date();
Map m = new HashMap();
ReportSeriesRecord reportSeriesRecordBillable = new ReportSeriesRecord();
reportSeriesRecordBillable.setName("Billable");
reportSeriesRecordBillable.setData(new long[12]);
m.put("Billable", reportSeriesRecordBillable);
ReportSeriesRecord reportSeriesRecordShadow = new ReportSeriesRecord();
reportSeriesRecordShadow.setName("Shadow");
reportSeriesRecordShadow.setData(new long[12]);
m.put("Shadow", reportSeriesRecordShadow);
ReportSeriesRecord reportSeriesRecordReserved = new ReportSeriesRecord();
reportSeriesRecordReserved.setName("Reserved");
reportSeriesRecordReserved.setData(new long[12]);
m.put("Reserved", reportSeriesRecordReserved);
ReportSeriesRecord reportSeriesRecordNBillable = new ReportSeriesRecord();
reportSeriesRecordNBillable.setName("Non-Billable");
reportSeriesRecordNBillable.setData(new long[12]);
m.put("Non-Billable", reportSeriesRecordNBillable);
List<String> catagories = new ArrayList();
for (int i = 0; i < 12; i++) {
reportDate = new Date();
reportDate.setDate(1);
reportDate.setMonth(i);
Calendar calendar = Calendar.getInstance();
calendar.setTime(reportDate);
int lastDate = calendar.getActualMaximum(Calendar.DATE);
reportDate.setDate(lastDate);
String pattern = "MM-dd-yyyy";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String date = simpleDateFormat.format(reportDate);
catagories.add(date);
Criteria criteriaV1 = Criteria.where("billingStartDate")
.lt(reportDate);
Criteria criteriaV21 = Criteria.where("billingEndDate").is(null);
Criteria criteriaV22 = Criteria.where("billingEndDate")
.gt(reportDate);
Criteria criteriaV221 = criteriaV1.orOperator(criteriaV21,
criteriaV22);
/*
* MatchOperation matchStage = Aggregation.match(new Criteria()
* .andOperator(criteriaV1).andOperator(criteriaV221));
*/
MatchOperation matchStage = Aggregation.match(criteriaV221);
Aggregation agg1 = newAggregation(matchStage,
group("billableStatus").count().as("count"),
project("count").and("billableStatus").previousOperation());
// Convert the aggregation result into a List
AggregationResults<ColumnChartData> groupResults1 = mongoTemplate
.aggregate(agg1, BillingDetails.class,
ColumnChartData.class);
List<ColumnChartData> result1 = groupResults1.getMappedResults();
// List<ColumnChartData> result2 = groupResults.getMappedResults();
List<String> statusList = new ArrayList();
statusList.add("Billable");
statusList.add("Shadow");
statusList.add("Reserved");
statusList.add("Non-Billable");
for (String status : statusList) {
for (ColumnChartData columnChartData : result1) {
if (columnChartData.getBillableStatus() != null
&& columnChartData.getBillableStatus()
.equalsIgnoreCase(status)) {
ReportSeriesRecord record = (ReportSeriesRecord) m
.get(status);
record.getData()[i] = columnChartData.getCount();
}
}
}
}
ColumnChartData reportData = new ColumnChartData();
System.out.println("catagories" + catagories);
System.out.println("m.values()" + m.values());
reportData.setCategoriesList(catagories);
reportData.setSeriesDataList(new ArrayList<String>(m.values()));
return new ResponseEntity<>(reportData, HttpStatus.OK);
}
@RequestMapping(value = "/getEmployeesByFunctionalGroup",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<Map<String, List<GroupByCount>>>> getEmployeesByFunctionalGroup1()
throws MyTimeException {
ProjectionOperation projectToMatchModel = project()
.andExpression("functionalGroup").as("name").andExpression("y")
.as("y");
Aggregation agg = newAggregation(
// match(Criteria.where("employeeId").gt(10)),
group("functionalGroup").count().as("y"),
project("y").and("functionalGroup").previousOperation(),
projectToMatchModel,
sort(Sort.Direction.DESC, "y")
);
// Convert the aggregation result into a List
AggregationResults<GroupByCount> groupResults = mongoTemplate
.aggregate(agg, EmployeeRoles.class, GroupByCount.class);
List<GroupByCount> result = groupResults.getMappedResults();
Map<String, List<GroupByCount>> map = new HashMap<String, List<GroupByCount>>();
map.put("data", result);
List<Map<String, List<GroupByCount>>> list = new ArrayList<Map<String, List<GroupByCount>>>();
list.add(map);
return new ResponseEntity<>(list, HttpStatus.OK);
}
}
\ No newline at end of file
...@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account; import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Designation; import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmployeeLocationDetails;
import com.nisum.mytime.model.EmployeeRoles; import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Location; import com.nisum.mytime.model.Location;
import com.nisum.mytime.model.MasterData; import com.nisum.mytime.model.MasterData;
...@@ -85,6 +86,15 @@ public class UserController { ...@@ -85,6 +86,15 @@ public class UserController {
return new ResponseEntity<>(employeesRole, HttpStatus.OK); return new ResponseEntity<>(employeesRole, HttpStatus.OK);
} }
@RequestMapping(value = "/getEmployeeLocations", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeLocationDetails>> getEmployeeLocations(
@RequestParam("employeeId") String empId) throws MyTimeException {
List<EmployeeLocationDetails> employeeLocationDetails = userService
.getEmployeeLocationDetails(empId);
return new ResponseEntity<>(employeeLocationDetails, HttpStatus.OK);
}
@RequestMapping(value = "/getManagers", method = RequestMethod.GET, @RequestMapping(value = "/getManagers", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeRoles>> getManagers() public ResponseEntity<List<EmployeeRoles>> getManagers()
...@@ -157,35 +167,41 @@ public class UserController { ...@@ -157,35 +167,41 @@ public class UserController {
@RequestMapping(value = "/getAccounts", method = RequestMethod.GET, @RequestMapping(value = "/getAccounts", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getAccounts() throws MyTimeException { public ResponseEntity<List<Account>> getAccounts() throws MyTimeException {
List<String> technologies = userService.getAccounts().stream() List<Account> technologies = userService.getAccounts().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getStatus())) .filter(e -> "Y".equalsIgnoreCase(e.getStatus()))
.map(Account::getAccountName).sorted() // .map(Account::getAccountName).sorted()
.collect(Collectors.toList()); .collect(Collectors.toList());
return new ResponseEntity<>(technologies, HttpStatus.OK); return new ResponseEntity<>(technologies, HttpStatus.OK);
} }
@RequestMapping(value = "/getEmployeeRoleDataForSearchCriteria",
method = RequestMethod.GET,
@RequestMapping(value = "/getEmployeeRoleDataForSearchCriteria", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<EmployeeRoles> getEmployeeRoleDataForSearchCriteria( public ResponseEntity<EmployeeRoles> getEmployeeRoleDataForSearchCriteria(
@RequestParam("searchId") String searchId, @RequestParam("searchAttribute") String searchAttribute) throws MyTimeException { @RequestParam("searchId") String searchId,
EmployeeRoles employeesRole = userService.getEmployeeRoleDataForSearchCriteria(searchId, searchAttribute); @RequestParam("searchAttribute") String searchAttribute)
throws MyTimeException {
EmployeeRoles employeesRole = userService
.getEmployeeRoleDataForSearchCriteria(searchId,
searchAttribute);
return new ResponseEntity<>(employeesRole, HttpStatus.OK); return new ResponseEntity<>(employeesRole, HttpStatus.OK);
} }
@RequestMapping(value = "/getEmployeeDetailsForAutocomplete", method = RequestMethod.GET, @RequestMapping(value = "/getEmployeeDetailsForAutocomplete",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getEmployeeDetailsForAutocomplete() throws MyTimeException { public ResponseEntity<List<String>> getEmployeeDetailsForAutocomplete()
throws MyTimeException {
List<String> details = userService.getEmployeeDetailsForAutocomplete(); List<String> details = userService.getEmployeeDetailsForAutocomplete();
return new ResponseEntity<>(details, HttpStatus.OK); return new ResponseEntity<>(details, HttpStatus.OK);
} }
@RequestMapping(value = "/getMasterData", method = RequestMethod.GET,
@RequestMapping(value = "/getMasterData", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE) produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, List<String>>> getMasterData() public ResponseEntity<Map<String, List<String>>> getMasterData()
throws MyTimeException { throws MyTimeException {
Map<String, List<String>> masterDataMap = new HashMap<>(); Map<String, List<String>> masterDataMap = new HashMap<>();
Map<String, List<MasterData>> result = userService.getMasterData() Map<String, List<MasterData>> result = userService.getMasterData()
.stream().filter(e -> (e.isActiveStatus() == true)) .stream().filter(e -> (e.isActiveStatus() == true))
.collect(Collectors.groupingBy(MasterData::getMasterDataType)); .collect(Collectors.groupingBy(MasterData::getMasterDataType));
......
package com.nisum.mytime.model; package com.nisum.mytime.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
...@@ -20,13 +21,15 @@ import lombok.ToString; ...@@ -20,13 +21,15 @@ import lombok.ToString;
@Document(collection = "Accounts") @Document(collection = "Accounts")
public class Account implements Serializable { public class Account implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
private ObjectId id; private ObjectId id;
private String accountId; private String accountId;
private String accountName; private String accountName;
private int accountProjectSequence; private int accountProjectSequence;
private String status; private String status;
private String domain;
List<String> subDomains;
} }
...@@ -23,12 +23,17 @@ import lombok.ToString; ...@@ -23,12 +23,17 @@ import lombok.ToString;
@Document(collection = "BillingDetails") @Document(collection = "BillingDetails")
public class BillingDetails implements Serializable { public class BillingDetails implements Serializable {
public Date getBillingEndDate() {
return billingEndDate;
}
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
private ObjectId id; private ObjectId id;
private String employeeId; private String employeeId;
private String employeeName; private String employeeName;
private String account;
private String projectId; private String projectId;
private String projectName; private String projectName;
private String billableStatus; private String billableStatus;
...@@ -38,7 +43,7 @@ public class BillingDetails implements Serializable { ...@@ -38,7 +43,7 @@ public class BillingDetails implements Serializable {
private Date billingEndDate; private Date billingEndDate;
private String comments; private String comments;
private boolean active; private boolean active;
@DateTimeFormat(iso = ISO.DATE) @DateTimeFormat(pattern = "dd-MM-yyyy")
private Date createDate; private Date createDate;
} }
package com.nisum.mytime.model;
import java.io.Serializable;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ColumnChartData implements Serializable {
private String categories; // GAP
private String seriesName; // Billable
private long count; // count
private List categoriesList;
private List seriesDataList;
private String billableStatus;
}
\ No newline at end of file
package com.nisum.mytime.model;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import com.poiji.annotation.ExcelCellName;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document(collection = "EmployeeLocationDetails")
public class EmployeeLocationDetails implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private ObjectId id;
private String employeeId;
private String employeeName;
private String empLocation;
private Date startDate;
private Date endDate;
private Date createDate;
private Date updatedDate;
private boolean active;
}
...@@ -5,8 +5,6 @@ import java.util.Date; ...@@ -5,8 +5,6 @@ import java.util.Date;
import org.springframework.data.annotation.Id; import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;
import com.poiji.annotation.ExcelCellName; import com.poiji.annotation.ExcelCellName;
...@@ -78,16 +76,26 @@ public class EmployeeRoles implements Serializable { ...@@ -78,16 +76,26 @@ public class EmployeeRoles implements Serializable {
private String employmentType; private String employmentType;
@ExcelCellName("Date Of Joining") @ExcelCellName("Date Of Joining")
@DateTimeFormat(iso = ISO.DATE)
private Date dateOfJoining; private Date dateOfJoining;
@ExcelCellName("Date Of Birth") @ExcelCellName("Date Of Birth")
@DateTimeFormat(iso = ISO.DATE)
private Date dateOfBirth; private Date dateOfBirth;
@ExcelCellName("Gender") @ExcelCellName("Gender")
private String gender; private String gender;
@ExcelCellName("Has Passport")
private String hasPassort;
@ExcelCellName("Passport Expiry Date")
private Date passportExpiryDate;
@ExcelCellName("Has B1")
private String hasB1;
@ExcelCellName("B1 Expiry Date")
private Date B1ExpiryDate;
@ExcelCellName("Created") @ExcelCellName("Created")
private Date createdOn; private Date createdOn;
......
package com.nisum.mytime.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class GroupByCount implements Serializable {
private String name;
private long y;
}
\ No newline at end of file
...@@ -30,6 +30,7 @@ public class Project implements Serializable { ...@@ -30,6 +30,7 @@ public class Project implements Serializable {
private String managerId; private String managerId;
private String managerName; private String managerName;
private String account; private String account;
private String domain;
private String status; private String status;
private List<String> employeeIds; private List<String> employeeIds;
......
package com.nisum.mytime.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class ReportSeriesRecord implements Serializable {
private String name;
private long[] data;
}
\ No newline at end of file
package com.nisum.mytime.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.EmployeeLocationDetails;
public interface EmployeeLocationDetailsRepo extends MongoRepository<EmployeeLocationDetails, String> {
List<EmployeeLocationDetails> findByEmployeeId(String employeeId);
EmployeeLocationDetails findByEmployeeName(String employeeName);
}
...@@ -7,18 +7,27 @@ import org.springframework.data.mongodb.repository.MongoRepository; ...@@ -7,18 +7,27 @@ import org.springframework.data.mongodb.repository.MongoRepository;
import com.nisum.mytime.model.ProjectTeamMate; import com.nisum.mytime.model.ProjectTeamMate;
public interface ProjectTeamMatesRepo extends MongoRepository<ProjectTeamMate, String> { public interface ProjectTeamMatesRepo
extends MongoRepository<ProjectTeamMate, String> {
List<ProjectTeamMate> findByProjectId(String projectId); List<ProjectTeamMate> findByProjectId(String projectId);
List<ProjectTeamMate> findByManagerId(String projectId); List<ProjectTeamMate> findByManagerId(String projectId);
List<ProjectTeamMate> findByEmployeeId(String employeeId); List<ProjectTeamMate> findByEmployeeId(String employeeId);
ProjectTeamMate findById(ObjectId id);
ProjectTeamMate findByEmployeeIdAndManagerId(String employeeId, String managerId); ProjectTeamMate findById(ObjectId id);
ProjectTeamMate findByEmployeeIdAndProjectId(String employeeId, String projectId); ProjectTeamMate findByEmployeeIdAndManagerId(String employeeId,
String managerId);
ProjectTeamMate findByEmployeeIdAndProjectId(String employeeId,
String projectId);
List<ProjectTeamMate> findByEmployeeIdAndActive(String employeeId,
boolean status);
List<ProjectTeamMate> findByEmployeeIdAndProjectIdAndActive(
String employeeId, String projectId, boolean status);
} }
package com.nisum.mytime.service; package com.nisum.mytime.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
...@@ -8,6 +9,7 @@ import java.util.List; ...@@ -8,6 +9,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.lang.time.DateUtils;
import org.bson.types.ObjectId; import org.bson.types.ObjectId;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -139,9 +141,9 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -139,9 +141,9 @@ public class ProjectServiceImpl implements ProjectService {
List<BillingDetails> listBD = getEmployeeActiveNisumBench( List<BillingDetails> listBD = getEmployeeActiveNisumBench(
pT.getEmployeeId()); pT.getEmployeeId());
for (BillingDetails b : listBD) { for (BillingDetails b : listBD) {
Date d = new Date(); Date d = pT.getStartDate() != null ? pT.getStartDate() : new Date();
d.setDate(d.getDate() - 1); d.setDate(d.getDate() - 1);
b.setBillingEndDate(d); b.setBillingEndDate(DateUtils.truncate(d, Calendar.DATE));
b.setActive(false); b.setActive(false);
updateEmployeeBilling(b); updateEmployeeBilling(b);
} }
...@@ -151,12 +153,27 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -151,12 +153,27 @@ public class ProjectServiceImpl implements ProjectService {
billings.setProjectId(pT.getProjectId()); billings.setProjectId(pT.getProjectId());
billings.setProjectName(pT.getProjectName()); billings.setProjectName(pT.getProjectName());
billings.setBillableStatus(pT.getBillableStatus()); billings.setBillableStatus(pT.getBillableStatus());
billings.setAccount(pT.getAccount());
billings.setActive(true); billings.setActive(true);
billings.setBillingStartDate(pT.getStartDate()); billings.setBillingStartDate(
billings.setBillingEndDate(pT.getEndDate()); DateUtils.truncate(pT.getStartDate(), Calendar.DATE));
billings.setBillingEndDate(
DateUtils.truncate(pT.getEndDate(), Calendar.DATE));
billings.setCreateDate(new Date()); billings.setCreateDate(new Date());
addEmployeeBillingDetails(billings); addEmployeeBillingDetails(billings);
if (projectTeamMate.getProjectId() != null && !projectTeamMate
.getProjectId().equalsIgnoreCase("Nisum0000")) {
List<ProjectTeamMate> activeBenchProject = projectTeamMatesRepo
.findByEmployeeIdAndProjectIdAndActive(
projectTeamMate.getEmployeeId(), "Nisum0000", true);
if (activeBenchProject != null || activeBenchProject.size() != 0) {
for (ProjectTeamMate pteamMate : activeBenchProject) {
pteamMate.setActive(false);
projectTeamMatesRepo.save(pteamMate);
}
}
}
return pT; return pT;
} }
...@@ -181,7 +198,8 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -181,7 +198,8 @@ public class ProjectServiceImpl implements ProjectService {
BillingDetails billingDetails = listBD.get(0); BillingDetails billingDetails = listBD.get(0);
Date d = new Date(); Date d = new Date();
d.setDate(d.getDate() - 1); d.setDate(d.getDate() - 1);
billingDetails.setBillingEndDate(d); billingDetails.setBillingEndDate(
DateUtils.truncate(d, Calendar.DATE));
billingDetails.setActive(false); billingDetails.setActive(false);
updateEmployeeBilling(billingDetails); updateEmployeeBilling(billingDetails);
} }
...@@ -189,11 +207,14 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -189,11 +207,14 @@ public class ProjectServiceImpl implements ProjectService {
billings.setEmployeeId(projectTeamMate.getEmployeeId()); billings.setEmployeeId(projectTeamMate.getEmployeeId());
billings.setEmployeeName(projectTeamMate.getEmployeeName()); billings.setEmployeeName(projectTeamMate.getEmployeeName());
billings.setProjectId(projectTeamMate.getProjectId()); billings.setProjectId(projectTeamMate.getProjectId());
billings.setAccount(existingTeammate.getAccount());
billings.setProjectName(projectTeamMate.getProjectName()); billings.setProjectName(projectTeamMate.getProjectName());
billings.setBillableStatus(projectTeamMate.getBillableStatus()); billings.setBillableStatus(projectTeamMate.getBillableStatus());
billings.setActive(true); billings.setActive(true);
billings.setBillingStartDate(new Date()); billings.setBillingStartDate(
billings.setBillingEndDate(projectTeamMate.getEndDate()); DateUtils.truncate(new Date(), Calendar.DATE));
billings.setBillingEndDate(DateUtils
.truncate(projectTeamMate.getEndDate(), Calendar.DATE));
billings.setCreateDate(new Date()); billings.setCreateDate(new Date());
addEmployeeBillingDetails(billings); addEmployeeBillingDetails(billings);
// TODO // TODO
...@@ -214,28 +235,61 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -214,28 +235,61 @@ public class ProjectServiceImpl implements ProjectService {
public void deleteTeammate(String empId, String projectId, ObjectId id) { public void deleteTeammate(String empId, String projectId, ObjectId id) {
ProjectTeamMate existingTeammate = projectTeamMatesRepo.findById(id); ProjectTeamMate existingTeammate = projectTeamMatesRepo.findById(id);
existingTeammate.setActive(false); existingTeammate.setActive(false);
existingTeammate.setEndDate(new Date()); Calendar c = Calendar.getInstance();
BillingDetails billingDetails = new BillingDetails(); c.add(Calendar.DAY_OF_MONTH, -1);
billingDetails.setBillableStatus("Bench"); existingTeammate.setEndDate(c.getTime());
billingDetails.setBillingStartDate(new Date()); /*
billingDetails.setActive(true); * BillingDetails billingDetails = new BillingDetails();
billingDetails.setEmployeeId(existingTeammate.getEmployeeId()); * billingDetails.setBillableStatus("Bench");
billingDetails.setEmployeeName(existingTeammate.getEmployeeName()); * billingDetails.setBillingStartDate(new Date());
billingDetails.setCreateDate(new Date()); * billingDetails.setActive(true);
billingDetails.setProjectId("Nisum0000"); * billingDetails.setEmployeeId(existingTeammate.getEmployeeId());
billingDetails.setProjectName("Free Pool"); * billingDetails.setEmployeeName(existingTeammate.getEmployeeName());
addEmployeeBillingDetails(billingDetails); * billingDetails.setCreateDate(new Date());
* billingDetails.setProjectId("Nisum0000");
* billingDetails.setProjectName("Free Pool");
* addEmployeeBillingDetails(billingDetails);
*/
List<BillingDetails> listBD = getEmployeeActiveBillingDetails(empId, List<BillingDetails> listBD = getEmployeeActiveBillingDetails(empId,
projectId); projectId);
if (listBD != null && !listBD.isEmpty()) { if (listBD != null && !listBD.isEmpty()) {
BillingDetails billingDetailsExisting = listBD.get(0); BillingDetails billingDetailsExisting = listBD.get(0);
Date d = new Date(); Date d = new Date();
d.setDate(d.getDate() - 1); d.setDate(d.getDate() - 1);
billingDetailsExisting.setBillingEndDate(d); billingDetailsExisting
.setBillingEndDate(DateUtils.truncate(d, Calendar.DATE));
billingDetailsExisting.setActive(false); billingDetailsExisting.setActive(false);
updateEmployeeBilling(billingDetailsExisting); updateEmployeeBilling(billingDetailsExisting);
} }
projectTeamMatesRepo.save(existingTeammate); projectTeamMatesRepo.save(existingTeammate);
List<ProjectTeamMate> activeProjects = projectTeamMatesRepo
.findByEmployeeIdAndActive(existingTeammate.getEmployeeId(),
true);
if (activeProjects == null || activeProjects.size() == 0) {
ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
newBenchAllocation.setAccount("Nisum");
newBenchAllocation.setBillableStatus("Non-Billable");
newBenchAllocation
.setDesignation(existingTeammate.getDesignation());
newBenchAllocation.setEmailId(existingTeammate.getEmailId());
newBenchAllocation.setEmployeeId(existingTeammate.getEmployeeId());
newBenchAllocation
.setEmployeeName(existingTeammate.getEmployeeName());
newBenchAllocation.setProjectId("Nisum0000");
newBenchAllocation.setStartDate(new Date());
Project p = projectRepo.findByProjectId("Nisum0000");
newBenchAllocation.setProjectName(p.getProjectName());
newBenchAllocation.setManagerId(p.getManagerId());
newBenchAllocation.setManagerName(p.getManagerName());
try {
addProjectTeamMate(newBenchAllocation);
} catch (MyTimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
@Override @Override
...@@ -422,12 +476,13 @@ public class ProjectServiceImpl implements ProjectService { ...@@ -422,12 +476,13 @@ public class ProjectServiceImpl implements ProjectService {
@Override @Override
public BillingDetails addEmployeeBillingDetails(BillingDetails teamMate) { public BillingDetails addEmployeeBillingDetails(BillingDetails teamMate) {
List<BillingDetails> billingsPast = getEmployeeBillingDetails(
teamMate.getEmployeeId(), teamMate.getProjectId());
/* /*
* for (BillingDetails tB : billingsPast) { tB.setActive(false); * List<BillingDetails> billingsPast = getEmployeeBillingDetails(
* teamMatesBillingRepo.save(tB); } * teamMate.getEmployeeId(), teamMate.getProjectId());
*/ */ /*
* for (BillingDetails tB : billingsPast) { tB.setActive(false);
* teamMatesBillingRepo.save(tB); }
*/
teamMate.setCreateDate(new Date()); teamMate.setCreateDate(new Date());
return teamMatesBillingRepo.save(teamMate); return teamMatesBillingRepo.save(teamMate);
} }
......
...@@ -6,6 +6,7 @@ import com.nisum.mytime.exception.handler.MyTimeException; ...@@ -6,6 +6,7 @@ import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account; import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.Designation; import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmpLoginData; import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmployeeLocationDetails;
import com.nisum.mytime.model.EmployeeRoles; import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Location; import com.nisum.mytime.model.Location;
import com.nisum.mytime.model.MasterData; import com.nisum.mytime.model.MasterData;
...@@ -34,8 +35,15 @@ public interface UserService { ...@@ -34,8 +35,15 @@ public interface UserService {
EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles); EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles);
void updateEmployeeLocationDetails(EmployeeRoles employeeRoles,
boolean delete);
void saveEmployeeLocationDetails(EmployeeRoles employeeRoles);
EmployeeRoles getEmployeesRoleData(String empId); EmployeeRoles getEmployeesRoleData(String empId);
List<EmployeeLocationDetails> getEmployeeLocationDetails(String empId);
List<Shift> getAllShifts() throws MyTimeException; List<Shift> getAllShifts() throws MyTimeException;
List<Designation> getAllDesignations() throws MyTimeException; List<Designation> getAllDesignations() throws MyTimeException;
...@@ -49,10 +57,10 @@ public interface UserService { ...@@ -49,10 +57,10 @@ public interface UserService {
List<Location> getLocations() throws MyTimeException; List<Location> getLocations() throws MyTimeException;
EmployeeRoles getEmployeeRoleDataForSearchCriteria(String searchId,
String searchAttribute);
EmployeeRoles getEmployeeRoleDataForSearchCriteria(String searchId, String searchAttribute); List<String> getEmployeeDetailsForAutocomplete();
List<String> getEmployeeDetailsForAutocomplete();
List<MasterData> getMasterData() throws MyTimeException; List<MasterData> getMasterData() throws MyTimeException;
} }
package com.nisum.mytime.service; package com.nisum.mytime.service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -15,20 +16,23 @@ import org.springframework.stereotype.Service; ...@@ -15,20 +16,23 @@ import org.springframework.stereotype.Service;
import com.nisum.mytime.exception.handler.MyTimeException; import com.nisum.mytime.exception.handler.MyTimeException;
import com.nisum.mytime.model.Account; import com.nisum.mytime.model.Account;
import com.nisum.mytime.model.BillingDetails;
import com.nisum.mytime.model.Designation; import com.nisum.mytime.model.Designation;
import com.nisum.mytime.model.EmpLoginData; import com.nisum.mytime.model.EmpLoginData;
import com.nisum.mytime.model.EmployeeLocationDetails;
import com.nisum.mytime.model.EmployeeRoles; import com.nisum.mytime.model.EmployeeRoles;
import com.nisum.mytime.model.Location; import com.nisum.mytime.model.Location;
import com.nisum.mytime.model.MasterData; import com.nisum.mytime.model.MasterData;
import com.nisum.mytime.model.Project;
import com.nisum.mytime.model.ProjectTeamMate; import com.nisum.mytime.model.ProjectTeamMate;
import com.nisum.mytime.model.Shift; import com.nisum.mytime.model.Shift;
import com.nisum.mytime.model.Skill; import com.nisum.mytime.model.Skill;
import com.nisum.mytime.repository.AccountRepo; import com.nisum.mytime.repository.AccountRepo;
import com.nisum.mytime.repository.DesignationRepo; import com.nisum.mytime.repository.DesignationRepo;
import com.nisum.mytime.repository.EmployeeLocationDetailsRepo;
import com.nisum.mytime.repository.EmployeeRolesRepo; import com.nisum.mytime.repository.EmployeeRolesRepo;
import com.nisum.mytime.repository.LocationRepo; import com.nisum.mytime.repository.LocationRepo;
import com.nisum.mytime.repository.MasterDataRepo; import com.nisum.mytime.repository.MasterDataRepo;
import com.nisum.mytime.repository.ProjectRepo;
import com.nisum.mytime.repository.ProjectTeamMatesRepo; import com.nisum.mytime.repository.ProjectTeamMatesRepo;
import com.nisum.mytime.repository.ShiftRepo; import com.nisum.mytime.repository.ShiftRepo;
import com.nisum.mytime.repository.TechnologyRepo; import com.nisum.mytime.repository.TechnologyRepo;
...@@ -40,6 +44,8 @@ public class UserServiceImpl implements UserService { ...@@ -40,6 +44,8 @@ public class UserServiceImpl implements UserService {
@Autowired @Autowired
private EmployeeRolesRepo employeeRolesRepo; private EmployeeRolesRepo employeeRolesRepo;
@Autowired
private ProjectRepo projectRepo;
@Autowired @Autowired
private ProjectTeamMatesRepo projectTeamMatesRepo; private ProjectTeamMatesRepo projectTeamMatesRepo;
...@@ -72,6 +78,9 @@ public class UserServiceImpl implements UserService { ...@@ -72,6 +78,9 @@ public class UserServiceImpl implements UserService {
@Autowired @Autowired
private MongoTemplate mongoTemplate; private MongoTemplate mongoTemplate;
@Autowired
private EmployeeLocationDetailsRepo employeeLocationDetailsRepo;
@Override @Override
public Boolean fetchEmployeesData(String perticularDate, public Boolean fetchEmployeesData(String perticularDate,
boolean resynchFlag) throws MyTimeException { boolean resynchFlag) throws MyTimeException {
...@@ -103,19 +112,44 @@ public class UserServiceImpl implements UserService { ...@@ -103,19 +112,44 @@ public class UserServiceImpl implements UserService {
employeeRoles.setCreatedOn(new Date()); employeeRoles.setCreatedOn(new Date());
employeeRoles.setEmpStatus("Active"); employeeRoles.setEmpStatus("Active");
employeeRoles.setEmploymentType("Full Time"); employeeRoles.setEmploymentType("Full Time");
BillingDetails billingDetails = new BillingDetails();
billingDetails.setBillableStatus("Bench"); ProjectTeamMate newBenchAllocation = new ProjectTeamMate();
billingDetails newBenchAllocation.setAccount("Nisum");
.setBillingStartDate(employeeRoles.getDateOfJoining() != null newBenchAllocation.setBillableStatus("Non-Billable");
? employeeRoles.getDateOfJoining() newBenchAllocation.setDesignation(employeeRoles.getDesignation());
: new Date()); newBenchAllocation.setEmailId(employeeRoles.getEmailId());
billingDetails.setActive(true); newBenchAllocation.setEmployeeId(employeeRoles.getEmployeeId());
billingDetails.setEmployeeId(employeeRoles.getEmployeeId()); newBenchAllocation.setActive(true);
billingDetails.setEmployeeName(employeeRoles.getEmployeeName()); newBenchAllocation.setEmployeeName(employeeRoles.getEmployeeName());
billingDetails.setCreateDate(new Date()); newBenchAllocation.setProjectId("Nisum0000");
billingDetails.setProjectId("Nisum0000"); newBenchAllocation.setStartDate(employeeRoles.getDateOfJoining() != null
billingDetails.setProjectName("Free Pool"); ? employeeRoles.getDateOfJoining()
projectService.addEmployeeBillingDetails(billingDetails); : new Date());
Project p = projectRepo.findByProjectId("Nisum0000");
newBenchAllocation.setProjectName(p.getProjectName());
newBenchAllocation.setManagerId(p.getManagerId());
newBenchAllocation.setManagerName(p.getManagerName());
try {
projectService.addProjectTeamMate(newBenchAllocation);
} catch (MyTimeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/*
* BillingDetails billingDetails = new BillingDetails();
* billingDetails.setBillableStatus("Bench"); billingDetails
* .setBillingStartDate(employeeRoles.getDateOfJoining() != null ?
* employeeRoles.getDateOfJoining() : new Date());
* billingDetails.setActive(true);
* billingDetails.setEmployeeId(employeeRoles.getEmployeeId());
* billingDetails.setEmployeeName(employeeRoles.getEmployeeName());
* billingDetails.setCreateDate(new Date());
* billingDetails.setProjectId("Nisum0000");
* billingDetails.setProjectName("Free Pool");
* projectService.addEmployeeBillingDetails(billingDetails);
*/
saveEmployeeLocationDetails(employeeRoles);
return employeeRolesRepo.save(employeeRoles); return employeeRolesRepo.save(employeeRoles);
} }
...@@ -133,6 +167,7 @@ public class UserServiceImpl implements UserService { ...@@ -133,6 +167,7 @@ public class UserServiceImpl implements UserService {
@Override @Override
public EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles) { public EmployeeRoles updateEmployeeRole(EmployeeRoles employeeRoles) {
// TODO update all emp details to inactive if employee is inactive
Query query = new Query( Query query = new Query(
Criteria.where("employeeId").is(employeeRoles.getEmployeeId())); Criteria.where("employeeId").is(employeeRoles.getEmployeeId()));
Update update = new Update(); Update update = new Update();
...@@ -148,12 +183,41 @@ public class UserServiceImpl implements UserService { ...@@ -148,12 +183,41 @@ public class UserServiceImpl implements UserService {
update.set("dateOfBirth", employeeRoles.getDateOfBirth()); update.set("dateOfBirth", employeeRoles.getDateOfBirth());
update.set("dateOfJoining", employeeRoles.getDateOfJoining()); update.set("dateOfJoining", employeeRoles.getDateOfJoining());
update.set("lastModifiedOn", new Date()); update.set("lastModifiedOn", new Date());
// update employee location
if (employeeRoles.getEmpLocation() != null
&& !employeeRoles.getEmpLocation().equals("")) {
EmployeeRoles existingEmployee = employeeRolesRepo
.findByEmployeeId(employeeRoles.getEmployeeId());
if (!existingEmployee.getEmpLocation()
.equals(employeeRoles.getEmpLocation())) {
updateEmployeeLocationDetails(employeeRoles, false);
}
}
// update employee details
FindAndModifyOptions options = new FindAndModifyOptions(); FindAndModifyOptions options = new FindAndModifyOptions();
options.returnNew(true); options.returnNew(true);
options.upsert(true); options.upsert(true);
EmployeeRoles emp = mongoTemplate.findAndModify(query, update, options, EmployeeRoles emp = mongoTemplate.findAndModify(query, update, options,
EmployeeRoles.class); EmployeeRoles.class);
try { try {
// update employee location
if (employeeRoles.getEmpLocation() != null
&& !employeeRoles.getEmpLocation().equals("")) {
EmployeeRoles existingEmployee = employeeRolesRepo
.findByEmployeeId(employeeRoles.getEmployeeId());
if (!existingEmployee.getEmpLocation()
.equals(employeeRoles.getEmpLocation())) {
updateEmployeeLocationDetails(employeeRoles, false);
}
}
// update employee details
List<ProjectTeamMate> employeeProfiles = projectTeamMatesRepo List<ProjectTeamMate> employeeProfiles = projectTeamMatesRepo
.findByEmployeeId(emp.getEmployeeId()); .findByEmployeeId(emp.getEmployeeId());
if (employeeProfiles != null && !employeeProfiles.isEmpty()) { if (employeeProfiles != null && !employeeProfiles.isEmpty()) {
...@@ -202,12 +266,10 @@ public class UserServiceImpl implements UserService { ...@@ -202,12 +266,10 @@ public class UserServiceImpl implements UserService {
public EmployeeRoles updateProfile(EmployeeRoles employeeRoles) public EmployeeRoles updateProfile(EmployeeRoles employeeRoles)
throws MyTimeException { throws MyTimeException {
boolean mobileNumberChnaged = false; boolean mobileNumberChnaged = false;
boolean designationChnaged = false;
employeeRoles.setLastModifiedOn(new Date()); employeeRoles.setLastModifiedOn(new Date());
EmployeeRoles existingEmployee = employeeRolesRepo EmployeeRoles existingEmployee = employeeRolesRepo
.findByEmployeeId(employeeRoles.getEmployeeId()); .findByEmployeeId(employeeRoles.getEmployeeId());
String newMobileNumber = employeeRoles.getMobileNumber(); String newMobileNumber = employeeRoles.getMobileNumber();
String designation = employeeRoles.getDesignation();
if (newMobileNumber != null && !newMobileNumber.equalsIgnoreCase("")) { if (newMobileNumber != null && !newMobileNumber.equalsIgnoreCase("")) {
if ((existingEmployee != null if ((existingEmployee != null
&& existingEmployee.getMobileNumber() != null && existingEmployee.getMobileNumber() != null
...@@ -217,16 +279,7 @@ public class UserServiceImpl implements UserService { ...@@ -217,16 +279,7 @@ public class UserServiceImpl implements UserService {
mobileNumberChnaged = true; mobileNumberChnaged = true;
} }
} }
if (designation != null && !designation.equalsIgnoreCase("")) {
if ((existingEmployee != null
&& existingEmployee.getDesignation() != null
&& !existingEmployee.getDesignation()
.equalsIgnoreCase(newMobileNumber))
|| (existingEmployee.getDesignation() == null)) {
designationChnaged = true;
}
}
existingEmployee.setDesignation(employeeRoles.getDesignation());
existingEmployee.setMobileNumber(employeeRoles.getMobileNumber()); existingEmployee.setMobileNumber(employeeRoles.getMobileNumber());
existingEmployee.setAlternateMobileNumber( existingEmployee.setAlternateMobileNumber(
employeeRoles.getAlternateMobileNumber()); employeeRoles.getAlternateMobileNumber());
...@@ -235,14 +288,12 @@ public class UserServiceImpl implements UserService { ...@@ -235,14 +288,12 @@ public class UserServiceImpl implements UserService {
existingEmployee.setTechnologyKnown(employeeRoles.getTechnologyKnown()); existingEmployee.setTechnologyKnown(employeeRoles.getTechnologyKnown());
EmployeeRoles employeeRolesDB = employeeRolesRepo EmployeeRoles employeeRolesDB = employeeRolesRepo
.save(existingEmployee); .save(existingEmployee);
if (mobileNumberChnaged || designationChnaged) { if (mobileNumberChnaged) {
try { try {
List<ProjectTeamMate> employeeProfiles = projectTeamMatesRepo List<ProjectTeamMate> employeeProfiles = projectTeamMatesRepo
.findByEmployeeId(employeeRoles.getEmployeeId()); .findByEmployeeId(employeeRoles.getEmployeeId());
if (employeeProfiles != null && !employeeProfiles.isEmpty()) { if (employeeProfiles != null && !employeeProfiles.isEmpty()) {
for (ProjectTeamMate profile : employeeProfiles) { for (ProjectTeamMate profile : employeeProfiles) {
profile.setDesignation(
employeeRolesDB.getDesignation());
profile.setMobileNumber( profile.setMobileNumber(
employeeRolesDB.getMobileNumber()); employeeRolesDB.getMobileNumber());
projectTeamMatesRepo.save(profile); projectTeamMatesRepo.save(profile);
...@@ -310,4 +361,53 @@ public class UserServiceImpl implements UserService { ...@@ -310,4 +361,53 @@ public class UserServiceImpl implements UserService {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return masterDataRepo.findAll(); return masterDataRepo.findAll();
} }
@Override
public void updateEmployeeLocationDetails(EmployeeRoles employeeRoles,
boolean delete) {
try {
Query getQuery = new Query();
getQuery.addCriteria(new Criteria().andOperator(
Criteria.where("active").is(true),
Criteria.where("employeeId")
.is(employeeRoles.getEmployeeId())));
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -1);
EmployeeLocationDetails existingLocation = mongoTemplate
.findOne(getQuery, EmployeeLocationDetails.class);
if (existingLocation != null) {
existingLocation.setActive(false);
existingLocation.setEndDate(cal.getTime());
existingLocation.setUpdatedDate(new Date());
mongoTemplate.save(existingLocation);
}
if (!delete)
saveEmployeeLocationDetails(employeeRoles);
} catch (Exception ex) {
System.out.println(ex);
}
}
@Override
public void saveEmployeeLocationDetails(EmployeeRoles employeeRoles) {
EmployeeLocationDetails employeeLocationDetails = new EmployeeLocationDetails();
employeeLocationDetails.setActive(true);
employeeLocationDetails.setEmployeeId(employeeRoles.getEmployeeId());
employeeLocationDetails
.setEmployeeName(employeeRoles.getEmployeeName());
employeeLocationDetails.setCreateDate(new Date());
employeeLocationDetails.setEndDate(new Date());
employeeLocationDetails.setUpdatedDate(new Date());
employeeLocationDetails.setStartDate(new Date());
employeeLocationDetails.setEmpLocation(employeeRoles.getEmpLocation());
employeeLocationDetailsRepo.save(employeeLocationDetails);
}
@Override
public List<EmployeeLocationDetails> getEmployeeLocationDetails(
String empId) {
// TODO Auto-generated method stub
return employeeLocationDetailsRepo.findByEmployeeId(empId);
}
} }
...@@ -19,6 +19,7 @@ import com.nisum.mytime.repository.TravelRepo; ...@@ -19,6 +19,7 @@ import com.nisum.mytime.repository.TravelRepo;
import com.nisum.mytime.repository.VisaRepo; import com.nisum.mytime.repository.VisaRepo;
import com.poiji.bind.Poiji; import com.poiji.bind.Poiji;
import com.poiji.exception.PoijiExcelType; import com.poiji.exception.PoijiExcelType;
import com.poiji.option.PoijiOptions;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -92,11 +93,16 @@ public class VisaServiceImpl implements VisaService { ...@@ -92,11 +93,16 @@ public class VisaServiceImpl implements VisaService {
String result = "Failure"; String result = "Failure";
int counter = 0; int counter = 0;
try { try {
PoijiOptions options = PoijiOptions.PoijiOptionsBuilder.settings()
.preferNullOverDefault(true).datePattern("dd-MMM-yyyy")
.build();
List<EmployeeRoles> employees = Poiji.fromExcel( List<EmployeeRoles> employees = Poiji.fromExcel(
file.getInputStream(), PoijiExcelType.XLS, file.getInputStream(), PoijiExcelType.XLS,
EmployeeRoles.class); EmployeeRoles.class, options);
if (!employees.isEmpty()) { if (!employees.isEmpty()) {
for (EmployeeRoles employee : employees) { for (EmployeeRoles employee : employees) {
System.out.println("test employee" + employee);
if (null != employee.getEmployeeId()) if (null != employee.getEmployeeId())
findAndModifyEmployeeRole(employee); findAndModifyEmployeeRole(employee);
else else
...@@ -151,6 +157,7 @@ public class VisaServiceImpl implements VisaService { ...@@ -151,6 +157,7 @@ public class VisaServiceImpl implements VisaService {
* log.info("Inserted Employee record with Id: {}", * log.info("Inserted Employee record with Id: {}",
* employee.getEmployeeId()); * employee.getEmployeeId());
*/ */
employee.setRole("Employee");
EmployeeRoles emp = userService EmployeeRoles emp = userService
.getEmployeesRoleData(employee.getEmployeeId()); .getEmployeesRoleData(employee.getEmployeeId());
if (emp == null) { if (emp == null) {
......
...@@ -79,6 +79,23 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -79,6 +79,23 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.refreshPageOrg = function(){ $scope.refreshPageOrg = function(){
$scope.getOrgEmps(); $scope.getOrgEmps();
} }
var gridOptionsReport = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10,
pageNumber: 1,
pageSize:10,
enableFiltering: true,
columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false},
{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},
{field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100}
]
};
$scope.getUserRoles = function(){ $scope.getUserRoles = function(){
$http({ $http({
method : "GET", method : "GET",
...@@ -90,6 +107,19 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $ ...@@ -90,6 +107,19 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope.gridOptions.data = []; $scope.gridOptions.data = [];
}); });
}; };
$scope.getReportData = function(){
$http({
method : "GET",
url : appConfig.appUri + "reports/functioNalGroup"
}).then(function mySuccess(response) {
$scope.reportData= response.data;
alert("reportData"+reportData)
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
alert("reportData1"+reportData)
$scope.reportData = [];
});
};
$scope.getOrgEmps = function(){ $scope.getOrgEmps = function(){
$http({ $http({
method : "GET", method : "GET",
......
myApp.directive('hcPieChart', function () {
return {
restrict: 'E',
template: '<div></div>',
link: function (scope, element) {
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByMonth','line',element,"Employees By Functional Group");
scope.clickMe= function() {
// if(scope.reportId == 1234){
// scope.result = [{data:[{name:"ES", y:279},{name: "SAMP", y: 2},{name: "APPS", y: 1}]}]
// scope.drawChart(element,'column');
// }
if(scope.reportId == 123){
getEmployeeDetails(scope,element[0].baseURI+'reports/getEmployeesByFunctionalGroup','pie',element,"Employees By Functional Group");
}else {
getEmployeeDetails(scope,element[0].baseURI+'reports/getBillabilityDetailsByMonth','line',element," Billability Monthly Trends");
}
}
}
};
}).controller('chartsController', function ($scope, $http, myFactory, $mdDialog, appConfig) {
$scope.name = [];
$scope.records = [];
$scope.empSearchId = "";
//$scope.reports = $scope.reportId;
$scope.reports=[ {Name:"Employee Overview Report",Id:"1234"},{Name:"Employees By Functional Group",Id:"123"},{Name:"Billability Monthly Trends",Id:"12345"}];
$scope.parentData = {
"employeeId": "",
"employeeName": "",
"emailId":"",
"role": "",
"shift": "",
"projectId":"",
"projectName":"",
"managerId":"",
"managerName":"",
"experience":"",
"designation":"",
"action":""
};
$scope.employees = [];
$scope.projects = [];
var getCellTemplate = '<p 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;<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],
paginationPageSize : 10,
pageNumber: 1,
pageSize:10,
columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false},
{field : 'emailId',displayName: 'Email', enableColumnMenu: false, enableSorting: false},
{field : 'projectName',displayName: 'Project', enableColumnMenu: false, enableSorting: false},
{field : 'mobileNumber',displayName: 'Mobile No', enableColumnMenu: false, enableSorting: false}
]
};
$scope.gridOptions.data = $scope.records;
$scope.getRowData = function(row, action){
$scope.parentData.employeeId = row.entity.employeeId;
$scope.parentData.employeeName = row.entity.employeeName;
$scope.parentData.emailId = row.entity.emailId;
$scope.parentData.role = row.entity.role;
$scope.parentData.shift = row.entity.shift;
$scope.parentData.projectId = row.entity.projectId;
$scope.parentData.projectName = row.entity.projectName;
$scope.parentData.managerId = row.entity.managerId;
$scope.parentData.managerName = row.entity.managerName;
$scope.parentData.experience = row.entity.experience;
$scope.parentData.designation = row.entity.designation;
}
$scope.getMyTeamDetails = function(empid){
$http({
method : "GET",
url : appConfig.appUri + "/projectTeam/getMyTeamDetails?employeeId="+empid
}).then(function mySuccess(response) {
$scope.gridOptions.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
$scope.gridOptions.data = [];
});
};
$scope.drawChart = function(element,chartName,result,title){
Highcharts.chart(element[0], {
chart: {
type: chartName
},
title: {
text: title
},
xAxis: {
categories: ['Plan', 'Retail', 'Buy', 'Sell'],
labels:{
formatter: function() {
if (chartName != 'pie' || chartName != 'line') {
return this.value;
} else{
return '(Not Designated)';
}
}
},
},
legend: {
align: 'right',
x: -30,
verticalAlign: 'top',
y: 25,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}'
},
plotOptions: {
series:{
events:{
click: function(event) {
$scope.custom(event);
}
}
}
},
series: result
});
}
$scope.custom = function(category){
alert('custome method')
$scope.getMyTeamDetails('16207');
}
});
function getEmployeeDetails(scope,uri,chart,element,title){
var result = [];
Highcharts.ajax({
url: uri,
success: function(data) {
if(chart=='line'){
result = data.seriesDataList;
scope.drawChart(element,chart,result,title);
}else if(chart == 'pie'){
result = data;
scope.drawChart(element,chart,result,title);
}
}
});
}
\ No newline at end of file
...@@ -151,6 +151,15 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -151,6 +151,15 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
$scope.showOrHidePA="Show"; $scope.showOrHidePA="Show";
} }
}; };
$scope.toggleEmpLocationDetails = function() {
$scope.showEmplocations = !$scope.showEmplocations;
if($scope.showOrHidePA=="Show"){
$scope.showOrHidePA="Hide";
}else {
$scope.showOrHidePA="Show";
}
};
$scope.toggleVisaDisplay = function() { $scope.toggleVisaDisplay = function() {
$scope.showVisaDisplay= !$scope.showVisaDisplay; $scope.showVisaDisplay= !$scope.showVisaDisplay;
if($scope.showOrHidePV=="Show"){ if($scope.showOrHidePV=="Show"){
...@@ -167,32 +176,51 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -167,32 +176,51 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
pageNumber: 1, pageNumber: 1,
pageSize:10, pageSize:10,
columnDefs : [ columnDefs : [
{field : 'projectName',displayName: 'Project', enableColumnMenu: true, enableSorting: true}, {field : 'projectName',displayName: 'Project', enableColumnMenu: true, enableSorting: true,minWidth : 100,width: 150},
{field : 'account',displayName: 'Account', enableColumnMenu: false, enableSorting: false}, {field : 'account',displayName: 'Account', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'managerName',displayName: 'Manager Name', enableColumnMenu: false, enableSorting: false}, {field : 'managerName',displayName: 'Manager Name', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'billableStatus',displayName: 'Billability', enableColumnMenu: false, enableSorting: false}, {field : 'billableStatus',displayName: 'Billability', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'startDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"'}, {field : 'startDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150},
{field : 'endDate',displayName: 'End Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"' }, {field : 'endDate',displayName: 'End Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"' ,minWidth : 100,width: 150},
{field : 'active',displayName: 'Active', enableColumnMenu: false,cellTemplate:getCellActiveTemplate,enableSorting: false} {field : 'active',displayName: 'Active', enableColumnMenu: false,cellTemplate:getCellActiveTemplate,enableSorting: false,minWidth : 100,width: 150}
] ]
}; };
$scope.gridOptionsEmpLocationDetails = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10,
pageNumber: 1,
pageSize:10,
columnDefs : [
{field : 'employeeName',displayName: 'Employee Name', enableColumnMenu: true, enableSorting: true,minWidth : 100,width: 150},
{field : 'employeeId',displayName: 'EmployeeId', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'empLocation',displayName: 'Location', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'startDate',displayName: 'Start Date', enableColumnMenu: false, enableSorting: false,cellFilter: 'date:"dd-MMM-yyyy"', minWidth : 100,width: 150 },
{field : 'endDate',displayName: 'End Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150 },
{field : 'updatedDate',displayName: 'Updated Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"' ,minWidth : 100,width: 150},
{field : 'createDate',displayName: 'Create Date', enableColumnMenu: false, enableSorting: false, cellFilter: 'date:"dd-MMM-yyyy"' ,minWidth : 100,width: 150},
{field : 'active',displayName: 'Active', enableColumnMenu: false,cellTemplate:getCellActiveTemplate,enableSorting: false,minWidth : 100,width: 150}
]
};
$scope.gridOptionsVisaDetails = { $scope.gridOptionsVisaDetails = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100], paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10, paginationPageSize : 10,
pageNumber: 1, pageNumber: 1,
pageSize:10, pageSize:10,
columnDefs : [ columnDefs : [
{field : 'visa',displayName: 'Visa', enableColumnMenu: true, enableSorting: true}, {field : 'visa',displayName: 'Visa', enableColumnMenu: true, enableSorting: true,minWidth : 100,width: 150},
{field : 'country',displayName: 'Country', enableColumnMenu: false, enableSorting: false}, {field : 'country',displayName: 'Country', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'visaNo',displayName: 'Visa No', enableColumnMenu: false, enableSorting: false}, {field : 'visaNo',displayName: 'Visa No', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'visaStatus',displayName: 'Status', enableColumnMenu: false, enableSorting: false}, {field : 'visaStatus',displayName: 'Status', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field: 'visaExpiryDate', {field: 'visaExpiryDate',
displayName: 'Expiry Date', displayName: 'Expiry Date',
cellFilter: 'date:"dd-MMM-yyyy"' cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150
}, },
{field : 'comments',displayName: 'Comments', enableColumnMenu: false, enableSorting: false} {field : 'comments',displayName: 'Comments', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150}
] ]
}; };
var getCellActiveTemplateBilling='<div ng-show="COL_FIELD==true"><p class="col-lg-12">Y</P></div><div ng-show="COL_FIELD==false"><p class="col-lg-12">N</p></div>'; var getCellActiveTemplateBilling='<div ng-show="COL_FIELD==true"><p class="col-lg-12">Y</P></div><div ng-show="COL_FIELD==false"><p class="col-lg-12">N</p></div>';
$scope.gridOptionsEmpBillability= { $scope.gridOptionsEmpBillability= {
...@@ -202,19 +230,18 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -202,19 +230,18 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
pageSize:10, pageSize:10,
enableCellEditOnFocus: true, enableCellEditOnFocus: true,
columnDefs : [ columnDefs : [
{field : 'projectName',displayName: 'Project', enableColumnMenu: true, enableSorting: true}, {field : 'projectName',displayName: 'Project', enableColumnMenu: true, enableSorting: true,minWidth : 100,width: 150},
{field : 'account',displayName: 'Account', enableColumnMenu: false, enableSorting: false}, {field : 'account',displayName: 'Account', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field: 'billingStartDate', {field: 'billingStartDate',displayName: 'Start Date',
displayName: 'Start Date', cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150
cellFilter: 'date:"dd-MMM-yyyy"'
}, },
{ {
field: 'billingEndDate', field: 'billingEndDate',
displayName: 'End Date', displayName: 'End Date',
cellFilter: 'date:"dd-MMM-yyyy"' cellFilter: 'date:"dd-MMM-yyyy"',minWidth : 100,width: 150
}, },
{field : 'comments',displayName: 'Comments', enableColumnMenu: false, enableSorting: false}, {field : 'comments',displayName: 'Comments', enableColumnMenu: false, enableSorting: false,minWidth : 100,width: 150},
{field : 'active',displayName: 'Active',enableColumnMenu: false, enableSorting: false,cellTemplate:getCellActiveTemplateBilling,enableCellEdit: false} {field : 'active',displayName: 'Active',enableColumnMenu: false, enableSorting: false,cellTemplate:getCellActiveTemplateBilling,enableCellEdit: false,minWidth : 100,width: 150}
] ]
}; };
...@@ -238,6 +265,16 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export ...@@ -238,6 +265,16 @@ myApp.controller("dashboardController", function($scope, $http, myFactory,export
}, function myError(response) { }, function myError(response) {
showAlert("Something went wrong while fetching data!!!"); showAlert("Something went wrong while fetching data!!!");
}); });
$http({
method : "GET",
url : appConfig.appUri + "user/getEmployeeLocations?employeeId="+$scope.profile.employeeId
}).then(function mySuccess(response) {
//alert("response"+response);
// alert("response"+response.data);
$scope.gridOptionsEmpLocationDetails.data = response.data;
}, function myError(response) {
showAlert("Something went wrong while fetching data!!!");
});
//$scope.gridOptionsProjectAllocatons.data = $scope.dataToPass; //$scope.gridOptionsProjectAllocatons.data = $scope.dataToPass;
//$scope.gridOptionsEmpBillability.data = $scope.dataToPass; //$scope.gridOptionsEmpBillability.data = $scope.dataToPass;
// $scope.gridOptionsVisaDetails.data = $scope.dataToPass; // $scope.gridOptionsVisaDetails.data = $scope.dataToPass;
......
...@@ -294,6 +294,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window ...@@ -294,6 +294,8 @@ myApp.controller("loginController",function($scope, myFactory, $compile, $window
menuItems.push({"menu" : "Attendance Report","icon" : "fa fa-bar-chart fa-2x","path" : "templates/attendanceReport.html"}); menuItems.push({"menu" : "Attendance Report","icon" : "fa fa-bar-chart fa-2x","path" : "templates/attendanceReport.html"});
menuItems.push({"menu" : "Shift Details","icon" : "fa fa-superpowers fa-2x","path" : "templates/shiftdetails.html"}); menuItems.push({"menu" : "Shift Details","icon" : "fa fa-superpowers fa-2x","path" : "templates/shiftdetails.html"});
menuItems.push({"menu" : "Dashboard","icon" : "fa fa-television fa-2x","path" : "templates/dashboard.html"}); menuItems.push({"menu" : "Dashboard","icon" : "fa fa-television fa-2x","path" : "templates/dashboard.html"});
menuItems.push({"menu" : "Charts","icon" : "fa fa-television fa-2x","path" : "templates/charts.html"});
menuItems.push({"menu" : "Utilization Report","icon" : "fa fa-television fa-2x","path" : "templates/charts3.html"});
menuItems.push({"menu" : "My Project Allocations","icon" : "fa fa-life-ring fa-2x","path" : "templates/myProjectAllocations.html"}); menuItems.push({"menu" : "My Project Allocations","icon" : "fa fa-life-ring fa-2x","path" : "templates/myProjectAllocations.html"});
menuItems.push({"menu" : "My Org","icon" : "fa fa-address-card-o fa-2x","path" : "templates/myOrg.html"}); menuItems.push({"menu" : "My Org","icon" : "fa fa-address-card-o fa-2x","path" : "templates/myOrg.html"});
menuItems.push({"menu" : "My Profile","icon" : "fa fa-address-book-o fa-2x","path" : "templates/profile.html"}); menuItems.push({"menu" : "My Profile","icon" : "fa fa-address-book-o fa-2x","path" : "templates/profile.html"});
......
...@@ -66,7 +66,7 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial ...@@ -66,7 +66,7 @@ myApp.controller("profileController", function($scope, $http, myFactory, $mdDial
$scope.validateFields = function(){ $scope.validateFields = function(){
var mobileNumber = $scope.mobileNumber; var mobileNumber = $scope.mobileNumber;
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"employeeId":myFactory.getEmpId(),"designation": $scope.designationEmp, "mobileNumber": mobileNumber, "alternateMobileNumber": $scope.alternateMobileNumber, "personalEmailId": $scope.personalEmailId, "baseTechnology": $scope.baseTechnology, "technologyKnown": $scope.technologyKnown}; var record = {"employeeId":myFactory.getEmpId(), "mobileNumber": mobileNumber, "alternateMobileNumber": $scope.alternateMobileNumber, "personalEmailId": $scope.personalEmailId, "baseTechnology": $scope.baseTechnology, "technologyKnown": $scope.technologyKnown};
var urlRequest = ""; var urlRequest = "";
urlRequest = appConfig.appUri+ "user/updateProfile"; urlRequest = appConfig.appUri+ "user/updateProfile";
......
...@@ -41,11 +41,12 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -41,11 +41,12 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
$scope.parentData.account = row.entity.account; $scope.parentData.account = row.entity.account;
$scope.parentData.managerId = row.entity.managerId; $scope.parentData.managerId = row.entity.managerId;
$scope.parentData.managerName = row.entity.managerName; $scope.parentData.managerName = row.entity.managerName;
$scope.parentData.domain= row.entity.domain;
$scope.parentData.status = row.entity.status; $scope.parentData.status = row.entity.status;
if(action == "Update") if(action == "Update")
$scope.addProject(action, $scope.parentData); $scope.addProject(action, $scope.parentData);
else if(action == "Delete") else if(action == "Delete")
$scope.deleteRole(row); $scope.deleteRole(row);
else if(action == "View") else if(action == "View")
$scope.viewTeamDetails(action, $scope.parentData); $scope.viewTeamDetails(action, $scope.parentData);
} }
...@@ -267,7 +268,14 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -267,7 +268,14 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
$scope.projectName = dataToPass.projectName; $scope.projectName = dataToPass.projectName;
$scope.managerId = dataToPass.managerId; $scope.managerId = dataToPass.managerId;
$scope.managerName = dataToPass.managerName; $scope.managerName = dataToPass.managerName;
$scope.account = dataToPass.account; var accounts1=myFactory.getAccounts();
for (var i = 0; i < accounts1.length; i++) {
if (accounts1[i].accountName=dataToPass.account) {
$scope.account = accounts1[i];
}
}
$scope.domain = dataToPass.domain;
$scope.projectStatus = dataToPass.status; $scope.projectStatus = dataToPass.status;
$scope.managerModel = { $scope.managerModel = {
'employeeName': dataToPass.managerName, 'employeeName': dataToPass.managerName,
...@@ -416,12 +424,18 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -416,12 +424,18 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
$scope.getAccountText = function(){ $scope.getAccountText = function(){
if ($scope.account !== undefined) { if ($scope.account !== undefined) {
return $scope.account; return $scope.account.accountName;
} else { } else {
return "Please select account"; return "Please select account";
} }
}; };
$scope.getDomainText = function(){
if ($scope.domain !== undefined) {
return $scope.domain;
} else {
return "Please select domain";
}
};
$scope.validateEmpId = function(){ $scope.validateEmpId = function(){
var searchId = $scope.empId; var searchId = $scope.empId;
if(searchId != "" && isNaN(searchId)){ if(searchId != "" && isNaN(searchId)){
...@@ -489,12 +503,16 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ ...@@ -489,12 +503,16 @@ myApp.controller("projectController",function($scope, myFactory,exportUiGridServ
}else if(account == undefined || account == ""){ }else if(account == undefined || account == ""){
$scope.alertMsg = "Account is mandatory"; $scope.alertMsg = "Account is mandatory";
document.getElementById('account').focus(); document.getElementById('account').focus();
}
}else if(domain == undefined || domain == ""){
$scope.alertMsg = "Domain is mandatory";
document.getElementById('domain').focus();
}
else if(managerModel == undefined){ else if(managerModel == undefined){
$scope.alertMsg = "Please select a manager"; $scope.alertMsg = "Please select a manager";
}else{ }else{
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"projectId":$scope.projectId, "projectName": $scope.projectName, "managerId": $scope.managerModel.employeeId, "managerName": $scope.managerModel.employeeName, "status": $scope.projectStatus,"account": $scope.account}; var record = {"projectId":$scope.projectId, "projectName": $scope.projectName, "managerId": $scope.managerModel.employeeId, "managerName": $scope.managerModel.employeeName, "status": $scope.projectStatus,"account": $scope.account.accountName,"domain": $scope.domain};
addOrUpdateProject(record, $scope.templateTitle); addOrUpdateProject(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500); $timeout(function(){updateGrid($scope.templateTitle, record)},500);
} }
......
...@@ -569,7 +569,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -569,7 +569,7 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
} }
$scope.designations = myFactory.getDesignations(); $scope.designations = myFactory.getDesignations();
$scope.billableStatuses = ["Billable","Shadow","Bench","Reserved","NA"]; $scope.billableStatuses = ["Billable","Shadow","Non-Billable","Reserved"];
$scope.shifts =myFactory.getShifts(); $scope.shifts =myFactory.getShifts();
$scope.getSelectedDesignation = function(){ $scope.getSelectedDesignation = function(){
if ($scope.empDesignation !== undefined) { if ($scope.empDesignation !== undefined) {
...@@ -625,23 +625,43 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog, ...@@ -625,23 +625,43 @@ myApp.controller("projectTeamController",function($scope, myFactory, $mdDialog,
$scope.alertMsg = "Please select a billable status"; $scope.alertMsg = "Please select a billable status";
document.getElementById('empBillableStatus').focus(); document.getElementById('empBillableStatus').focus();
}else if($scope.startDate == undefined) { }else if($scope.startDate == undefined) {
$scope.alertMsg = "Please select StartDate"; $scope.alertMsg = "Please select Start Date";
document.getElementById('startDate').focus(); document.getElementById('startDate').focus();
}else if($scope.endDate == undefined) { }else if($scope.endDate == undefined) {
$scope.alertMsg = "Please select EndDate"; $scope.alertMsg = "Please select End Date";
document.getElementById('endDate').focus(); document.getElementById('endDate').focus();
} }
else { else {
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "role": employeeModel.role, "designation":employeeModel.designation,"shift": employeeModel.shift,"projectId":projectModel.projectId,"projectName":projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"mobileNumber":employeeModel.mobileNumber,"active":true,"billableStatus":$scope.empBillableStatus,"startDate":$scope.startDate,"endDate":$scope.endDate}; var record = {"employeeId":employeeModel.employeeId, "employeeName":employeeModel.employeeName, "emailId": employeeModel.emailId, "role": employeeModel.role, "designation":employeeModel.designation,"shift": employeeModel.shift,"projectId":projectModel.projectId,"projectName":projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"mobileNumber":employeeModel.mobileNumber,"active":true,"billableStatus":$scope.empBillableStatus,"startDate":$scope.startDate,"endDate":$scope.endDate};
addOrUpdateRole(record, $scope.templateTitle); addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500); $timeout(function(){updateGrid($scope.templateTitle, record)},500);
} }
}else{ }
else{
var projectModel = $scope.projectModel;
if(projectModel == undefined){
$scope.alertMsg = "Please select a project";
document.getElementById('selectProject').focus();
}else if($scope.empBillableStatus == undefined){
$scope.alertMsg = "Please select a billable status";
document.getElementById('empBillableStatus').focus();
}else if($scope.shift == undefined || $scope.shift =="") {
$scope.alertMsg = "Please select shift";
document.getElementById('shift').focus();
}else if($scope.startDate == undefined) {
$scope.alertMsg = "Please select Start Date";
document.getElementById('startDate').focus();
}else if($scope.endDate == undefined) {
$scope.alertMsg = "Please select End Date";
document.getElementById('endDate').focus();
}else{
$scope.alertMsg = ""; $scope.alertMsg = "";
var record = {"id":$scope.id,"employeeId":$scope.employeeId, "employeeName":$scope.employeeName, "emailId": $scope.emailId, "role": $scope.role, "shift": $scope.shift,"projectId":$scope.projectModel.projectId,"projectName":$scope.projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"designation":$scope.empDesignation,"billableStatus":$scope.empBillableStatus,"experience":$scope.experience,"mobileNumber":$scope.mobileNumber,"startDate":$scope.startDate,"endDate":$scope.endDate}; var record = {"id":$scope.id,"employeeId":$scope.employeeId, "employeeName":$scope.employeeName, "emailId": $scope.emailId, "role": $scope.role, "shift": $scope.shift,"projectId":$scope.projectModel.projectId,"projectName":$scope.projectModel.projectName,"account":$scope.projectModel.account,"managerId":myFactory.getEmpId(),"managerName":myFactory.getEmpName(),"designation":$scope.empDesignation,"billableStatus":$scope.empBillableStatus,"experience":$scope.experience,"mobileNumber":$scope.mobileNumber,"startDate":$scope.startDate,"endDate":$scope.endDate};
addOrUpdateRole(record, $scope.templateTitle); addOrUpdateRole(record, $scope.templateTitle);
$timeout(function(){updateGrid($scope.templateTitle, record)},500); $timeout(function(){updateGrid($scope.templateTitle, record)},500);
}
} }
......
myApp.directive('highchartxyz', function () {
return {
restrict: 'E',
template: '<div></div>',
replace: true,
link: function (scope, element, attrs) {
scope.$watch(function () { return attrs.chart; }, function () {
if (!attrs.chart) return;
var charts = JSON.parse(attrs.chart);
$(element[0]).highcharts(charts);
});
}
};
});
myApp.controller('Ctrl', function ($scope, $http, $timeout,appConfig) {
$timeout($scope.fetch, 1000);
$scope.reports=["Employee Overview Report","Billability Report","Billability Monthly Trends"];
$scope.getReport = function(){
if ($scope.report !== undefined) {
return $scope.report;
} else {
return "Please select a report";
}
}
$scope.triggerRport1 = function(){
alert('series clicked');
}
$scope.triggerRport2 = function(){
alert('pie clicked');
}
function custom(){
alert('called');
}
$scope.customCall = function(){
alert('customCall called');
}
$scope.triggerRport = function(){
if($scope.report== 'Employee Overview Report'){
$http({
method : "GET",
url : appConfig.appUri + "reports/getEmployeesByFunctionalGroup1"
}).then(function mySuccess(response) {
$scope.options =response.data;
$scope.renderChart = {
chart: {
type: 'pie'
},
title: {
text:'test'
},
plotOptions: {
pie: {
// allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
},
events: {
click: function(event) {
custom();
}
}
},
series: {
cursor: 'pointer',
point: {
events: {
click: function() {
customCall();
}
}
}
}
},
series: [{
data: $scope.options
}]
};
}, function myError(response) {
});
}else if($scope.report== 'Billability Report'){
$http({
method : "GET",
url : appConfig.appUri + "reports/getBillabilityDetailsByAccount"
}).then(function mySuccess(response) {
$scope.options = response.data.seriesDataList;
/*[{
name: 'Billable',
data: [5, 3, 4, 7]
}, {
name: 'Shadow',
data: [2, 2, 3, 2]
}, {
name: 'Reserved',
data: [3, 4, 4, 2]
},
{
name: 'Bench',
data: [3, 4, 4, 2]
}
];*/
$scope.catagories=response.data.categoriesList; //['Gap', 'Macys', 'X', 'Y']
$scope.renderChart = {
chart: {
type: 'column'
},
title: {
text: 'Monthly Average Temperature'
},
xAxis: {
categories: $scope.catagories
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
align: 'right',
x: -30,
verticalAlign: 'top',
y: 25,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
},
series:{
cursor: 'pointer',
point: {
events: {
click: function () {
alert('Category: ' + this.category + ', value: ' + this.y);
}
}
}
}
},
series: $scope.options
};
}, function myError(response) {
});
} else if($scope.report== 'Billability Monthly Trends'){
$http({
method : "GET",
url : appConfig.appUri + "reports/getBillabilityDetailsByMonth"
}).then(function mySuccess(response) {
$scope.options = response.data.seriesDataList;
/*[{
name: 'Billable',
data: [5, 3, 4, 7]
}, {
name: 'Shadow',
data: [2, 2, 3, 2]
}, {
name: 'Reserved',
data: [3, 4, 4, 2]
},
{
name: 'Bench',
data: [3, 4, 4, 2]
}
];*/
$scope.catagories=response.data.categoriesList; //['Gap', 'Macys', 'X', 'Y']
$scope.renderChart = {
chart: {
type: 'line'
},
title: {
text: 'Monthly Average Temperature'
},
xAxis: {
categories: $scope.catagories
},
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
stackLabels: {
enabled: true,
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
}
},
legend: {
align: 'right',
x: -30,
verticalAlign: 'top',
y: 25,
floating: true,
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || 'white',
borderColor: '#CCC',
borderWidth: 1,
shadow: false
},
tooltip: {
headerFormat: '<b>{point.x}</b><br/>',
pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
},
plotOptions: {
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color: (Highcharts.theme && Highcharts.theme.dataLabelsColor) || 'white'
}
},
series:{
events:{
click: function(event) {
alert('test');
}
}
}
},
series: $scope.options
};
}, function myError(response) {
});
}
}
});
...@@ -357,7 +357,7 @@ myApp.controller("travelController",function($scope, myFactory, $mdDialog, $http ...@@ -357,7 +357,7 @@ myApp.controller("travelController",function($scope, myFactory, $mdDialog, $http
}else if(dataToPass.action == "ViewTeamDetail"){}else if(dataToPass.action == "ViewBillability"){} }else if(dataToPass.action == "ViewTeamDetail"){}else if(dataToPass.action == "ViewBillability"){}
$scope.designations = myFactory.getDesignations(); $scope.designations = myFactory.getDesignations();
$scope.billableStatuses = ["Billable","Shadow","Bench","Reserved","NA"]; $scope.billableStatuses = ["Billable","Shadow","Non-Billable","Reserved"];
$scope.shifts =myFactory.getShifts(); $scope.shifts =myFactory.getShifts();
$scope.getSelectedDesignation = function(){ $scope.getSelectedDesignation = function(){
if ($scope.empDesignation !== undefined) { if ($scope.empDesignation !== undefined) {
......
...@@ -328,7 +328,7 @@ myApp.controller("visaController",function($scope, myFactory, $mdDialog, $http, ...@@ -328,7 +328,7 @@ myApp.controller("visaController",function($scope, myFactory, $mdDialog, $http,
}else if(dataToPass.action == "ViewTeamDetail"){}else if(dataToPass.action == "ViewBillability"){} }else if(dataToPass.action == "ViewTeamDetail"){}else if(dataToPass.action == "ViewBillability"){}
$scope.designations = myFactory.getDesignations(); $scope.designations = myFactory.getDesignations();
$scope.billableStatuses = ["Billable","Shadow","Bench","Reserved","NA"]; $scope.billableStatuses = ["Billable","Shadow","Non-Billable","Reserved"];
$scope.shifts =myFactory.getShifts(); $scope.shifts =myFactory.getShifts();
$scope.getSelectedDesignation = function(){ $scope.getSelectedDesignation = function(){
if ($scope.empDesignation !== undefined) { if ($scope.empDesignation !== undefined) {
......
<html>
<body>
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer" ng-controller="chartsController" ng-init="getMyTeamDetails()">
<div style="margin: 4% 0% 3% 64%;">
Report Type:
<select ng-model="reportId" ng-change="clickMe()" ng-options="report.Id as report.Name for report in reports"></select>
</div>
<hc-pie-chart style="width: 100%; padding: 3px 0px 0px 0px;" title="Browser usage" data="pieData" options="chartOptions">Placeholder for pie chart</hc-pie-chart>
<div >
<div class="row">
<div class="col-lg-12">
<p align="right" class="col-xs-1"
style="vertical-align: middle; font-weight: bold; font-size: 1.5em; margin-top: 8px; cursor: pointer;">
</p>
</div>
</div>
</div>
<div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12">
<div class="col-lg-1" style="float: left;padding-left:20px;">
</div>
<div class="col-lg-1"
style="cursor: pointer; float: right; right: 75px;">
</div>
</div>
<div class="row col-lg-12" style="height: 15px;"></div>
<div class="row col-lg-12" style="padding-top: 4%;margin-left:0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer333" ng-controller="myController"
>
<md-button class="md-icon-button" ng-click="loadData(19)"> <i
class="fa fa-times fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left">ReportData</i> </md-button>
<hc-chart options="chartOptions">Placeholder for generic chart</hc-chart>
<hc-pie-chart1 title="Browser usage" data="pieData" callback-fn="loadData(45)" ">Placeholder for pie chart</hc-pie-chart>
</div>
\ No newline at end of file
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer333" ng-controller="Ctrl"
ng-init="loadData(29)">
<div class="container-fluid mainDivHeaderClass">
<div class="row">
<div class="col-lg-12">
<p align="center" class="col-xs-11"
style="vertical-align: middle; font-weight: bold; font-size: 30px;">Reports</p>
<p align="right" class="col-xs-1"
style="vertical-align: middle; font-weight: bold; font-size: 1.5em; margin-top: 8px; cursor: pointer;">
<i class="fa fa-refresh" aria-hidden="true"
ng-click="refreshPage()"></i>
</p>
</div>
</div>
</div>
<div class="row col-lg-12 col-xs-12">
<div class="row col-lg-12 col-xs-12">
<div class="col-lg-5 col-xs-6">
<p>
<b>Report</b>
</p>
</div>
<div class="col-lg-7 col-xs-6">
<p>
<b>:</b><md-select ng-model="report" md-selected-text="getReport()" id="report" ng-change="triggerRport()">
<md-optgroup label="report"> <md-option ng-value="report"
ng-repeat="report in reports">{{report}}</md-option> </md-optgroup> </md-select>
</p>
</div>
</div>
<div class="row col-lg-12" style="padding-top: 4%;margin-left:0px;">
<div><highchartxyz chart='{{renderChart}}'></highchartxyz></div>
</div>
<div class="row col-lg-12" style="padding-top: 4%;margin-left:0px;">
<div id="gridTest" ui-grid="gridOptions" ui-grid-pagination
class="myGrid" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptions.data.length">No
data available</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer333" ng-controller="assignRoleController"
ng-init="getUserRoles()">
<button ng-click="getUserRoles()">click Me</button>
<md-button class="md-icon-button" ng-click="getUserRoles()"> <i
class="fa fa-times fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left">ReportData</i> </md-button>
<table>
<tr>
<td><div id="gridTest1" ui-grid="gridOptionsReport" ui-grid-pagination
class="" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptionsReport.data.length">No
data available</div>
</div></td>
</tr>
<tr>
<td><div id="container1Pie" style="width:99%;height:370px;margin-left:0px;min-width: 800px;
max-width: 800px;">
</div></td>
</tr>
</table>
</div>
<div class="md-padding" style="width: 100%; padding: 3px 0px 0px 0px;"
id="popupContainer333" ng-controller="assignRoleController"
ng-init="getUserRoles()">
<script type="text/javascript">
/* document.addEventListener('DOMContentLoaded', function () {
alert('called')
var options = {
chart: {
type: 'pie'
},
series: [{}]
};
Highcharts.ajax({
url: '/myTime/reports/functioNalGroup',
success: function(data) {
alert("fg data"+data)
options.series[0].data = data;
Highcharts.Chart('container1Pie', options);
}
});
}); */
var result;
function requestData() {
alert('requestData');
Highcharts.ajax({
url: '/myTime/reports/functioNalGroup',
success: function(data) {
alert("fg data"+data)
result = data;
alert('requestData result'+result);
}
});
/* $http({
method : "GET",
url : "/myTime/reports/functioNalGrou"
}).then(function mySuccess(response) {
result = response.data;
alert('requestData result'+result);
}, function myError(response) {
alert('requestData error');
result = [];
}); */
}
Highcharts.chart('container1Pie', {
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
type: 'pie',
},
title: {
text: 'Browser market shares in January, 2018'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
},
series: {
cursor: 'pointer',
point: {
events: {
click: function () {
alert('this.series.name'+this.series.name);
alert(' this.category111'+ this.options.name);
// tableFilter(this.series.name,this.category,this.y);
}
}
}
}
},
series: [{
name: 'Functional Group',
colorByPoint: true,
data: result
}]
});
var gridOptionsReport = {
paginationPageSizes : [ 10, 20, 30, 40, 50, 100],
paginationPageSize : 10,
pageNumber: 1,
pageSize:10,
enableFiltering: true,
columnDefs : [
{field : 'employeeId',displayName: 'Employee ID', enableColumnMenu: true, enableSorting: true,enableFiltering: true, width:120},
{field : 'employeeName',displayName: 'Name', enableColumnMenu: false, enableSorting: false,enableFiltering: true},
{field : 'mobileNumber',displayName: 'Mobile', enableColumnMenu: false, enableSorting: false,enableFiltering: false},
{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},
{field : 'role',displayName: 'Role', enableColumnMenu: false, enableSorting: true,enableFiltering: true, width:100},
{name : 'Actions', displayName: 'Actions',cellTemplate: getCellTemplate, enableColumnMenu: false, enableSorting: false,enableFiltering: false, width:100}
]
};
/* Highcharts.chart('companyfunctionalGroupReport', {
title: {
text: 'Solar Employment Growth by Sector, 2010-2016'
},
subtitle: {
text: 'Source: thesolarfoundation.com'
},
yAxis: {
title: {
text: 'Number of Employees'
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle'
},
plotOptions: {
series: {
label: {
connectorAllowed: false
},
pointStart: 2010
}
},
series: [{
name: 'Installation',
data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
}, {
name: 'Manufacturing',
data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
}, {
name: 'Sales & Distribution',
data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
}, {
name: 'Project Development',
data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
}, {
name: 'Other',
data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
}],
responsive: {
rules: [{
condition: {
maxWidth: 500
},
chartOptions: {
legend: {
layout: 'horizontal',
align: 'center',
verticalAlign: 'bottom'
}
}
}]
}
}); */
</script><button ng-click="getUserRoles()">click Me</button>
<md-button class="md-icon-button" ng-click="getUserRoles()"> <i
class="fa fa-times fa-2x"
style="margin-top: 5px; font-size: 1.5em; float: left">ReportData</i> </md-button>
<table>
<tr>
<td><div id="gridTest1" ui-grid="gridOptionsReport" ui-grid-pagination
class="" style="width:99%;height:370px;margin-left:0px;">
<div class="watermark" ng-show="!gridOptionsReport.data.length">No
data available</div>
</div></td>
</tr>
<tr>
<td><div id="container1Pie" style="width:99%;height:370px;margin-left:0px;min-width: 800px;
max-width: 800px;">
</div></td>
</tr>
</table>
</div>
...@@ -212,7 +212,19 @@ ...@@ -212,7 +212,19 @@
</div> </div>
</div> </div>
<br/><br/> <br/><br/>
</fieldset>
<fieldset>
<legend style="font-size: 18px;">Location Details <i style="margin-top:3px;color:blue;cursor:pointer;font-size: 14px;" ng-click="toggleEmpLocationDetails()">{{showOrHideBD}}</i></legend>
<div class="row col-lg-12" style="margin-left: 0px;">
<div id="gridEmpLocationDetails" ui-grid="gridOptionsEmpLocationDetails"
class="myGrid" style="width:99%;height:200px;" ng-show="showEmplocations">
<div class="watermark" ng-show="!gridOptionsEmpLocationDetails.data.length">No
data available</div>
</div>
</div>
<br/><br/>
</fieldset> </fieldset>
</div> </div>
......
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-aria.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-aria.min.js"></script>
<script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-2.5.0.js"></script> <script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-2.5.0.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/series-label.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css"></link> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css"></link>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"></link> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"></link>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"></link> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"></link>
...@@ -70,6 +75,8 @@ ...@@ -70,6 +75,8 @@
<script src="controllers/TravelController.js"></script> <script src="controllers/TravelController.js"></script>
<script src="controllers/SessionHandlerController.js"></script> <script src="controllers/SessionHandlerController.js"></script>
<script src="controllers/ExportDataController.js"></script> <script src="controllers/ExportDataController.js"></script>
<script src="controllers/ChartsController.js"></script>
<script src="controllers/TestController2.js"></script>
</head> </head>
<body> <body>
<ng-include src="'templates/login.html'" id="home"></ng-include> <ng-include src="'templates/login.html'" id="home"></ng-include>
......
...@@ -14,24 +14,61 @@ ...@@ -14,24 +14,61 @@
<md-dialog-content> <md-dialog-content>
<div class="md-dialog-content"> <div class="md-dialog-content">
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" id="projectId" name="projectId" <div class="row" >
ng-model="projectId" placeholder="Project Id Auto Generates" ng-blur="" ng-disabled="true"/> <br> <table width="450px">
<input type="text" class="form-control" id="projectName" name="projectName" <tr>
ng-model="projectName" placeholder="Project Name" /><br> <td colspan="4">
<md-select ng-model="account" md-selected-text="getAccountText()" id="account"> <b >Project ID</b></td>
<md-optgroup label="account"> <md-option ng-value="account" <td colspan="8"><input type="text" class="form-control" id="projectId" name="projectId"
ng-repeat="account in accounts">{{account}}</md-option> </md-optgroup> </md-select> ng-model="projectId" placeholder="Project Id Auto Generates" ng-blur="" ng-disabled="true"/>
<md-select ng-model="managerModel" md-selected-text="getManagers()" > </td>
<tr>
<td colspan="4">
<b >Project Name</b></td>
<td colspan="8"><input type="text" class="form-control" id="projectName" name="projectName"
ng-model="projectName" placeholder="Project Name"/>
</td>
</tr>
<tr>
<td colspan="4">
<b >Account</b></td>
<td colspan="8"><md-select ng-model="account" md-selected-text="getAccountText()" id="account">
<md-optgroup label="account"> <md-option ng-value="account1"
ng-repeat="account1 in accounts">{{account1.accountName}}</md-option> </md-optgroup> </md-select>
</td>
</tr>
<tr>
<td colspan="4">
<b >Domain</b></td>
<td colspan="8"><md-select ng-model="domain" md-selected-text="getDomainText()" id="domain">
<md-optgroup label="domain"> <md-option ng-value="domain"
ng-repeat="domain in account.subDomains">{{domain}}</md-option> </md-optgroup> </md-select>
</td>
</tr>
<tr>
<td colspan="4">
<b >Manager</b></td>
<td colspan="8"><md-select ng-model="managerModel" md-selected-text="getManagers()" >
<md-optgroup label="managers"> <md-option ng-value="manager" <md-optgroup label="managers"> <md-option ng-value="manager"
ng-repeat="manager in managerDetails">{{manager.employeeName}}</md-option> </md-optgroup> </md-select> ng-repeat="manager in managerDetails">{{manager.employeeName}}</md-option> </md-optgroup> </md-select>
<md-select ng-model="projectStatus" md-selected-text="getProjectStatus()" id="projectStatus"> </td>
</tr>
<tr>
<td colspan="4">
<b >Project Status</b></td>
<td colspan="8"><md-select ng-model="projectStatus" md-selected-text="getProjectStatus()" id="projectStatus">
<md-optgroup label="projectStatus"> <md-option ng-value="prjctSts" <md-optgroup label="projectStatus"> <md-option ng-value="prjctSts"
ng-repeat="prjctSts in prjctStses">{{prjctSts}}</md-option> </md-optgroup> </md-select> ng-repeat="prjctSts in prjctStses">{{prjctSts}}</md-option> </md-optgroup> </md-select>
</td>
</tr>
</table>
<div role="alert"> <div role="alert">
<span class="error" style="color: red;">{{alertMsg}}</span> <span class="error" style="color: red;">{{alertMsg}}</span>
</div> </div>
</div> </div>
</div> </div>
</div>
</md-dialog-content> </md-dialog-content>
<md-dialog-actions layout="row"> <md-button <md-dialog-actions layout="row"> <md-button
......
<md-dialog aria-label="Role Template" style="width:700px;height:900px;"> <md-dialog aria-label="Role Template" style="width:700px;height:1200px;">
<form ng-cloak name="myForm"> <form ng-cloak name="myForm">
<md-toolbar> <md-toolbar>
<div class="md-toolbar-tools" <div class="md-toolbar-tools"
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
<div class="md-dialog-content"> <div class="md-dialog-content">
<div class="form-group"> <div class="form-group">
<md-select ng-model="designationEmp" md-selected-text="getDesignationText()" id="designationEmp" >
<md-optgroup label="designations"> <md-option ng-value="designation"
ng-repeat="designation in designations">{{designation}}</md-option> </md-optgroup> </md-select>
<input type="text" class="form-control" id="mobileNumber" name="mobileNumber" <input type="text" class="form-control" id="mobileNumber" name="mobileNumber"
ng-model="mobileNumber" placeholder="Mobile Number" alt="Mobile Number"/> <br> ng-model="mobileNumber" placeholder="Mobile Number" alt="Mobile Number"/> <br>
<input type="text" class="form-control" id="alternateMobileNumber" name="alternateMobileNumber" <input type="text" class="form-control" id="alternateMobileNumber" name="alternateMobileNumber"
......
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_ID">
<display-name>mytime</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
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