Commit 4755371a authored by đinh thị đầm's avatar đinh thị đầm

t

parent fcb6432d
package com.itsol.quantrivanphong.manager.project.project.bussiness;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.report.issue.common.AbstractDaoPage;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import java.util.List;
public interface ProjectBussiness {
// Danh sách dự án tất cả các dự án
// Danh sách dự án tất cả các dự án
List<ProjectDTO> findAllProject();
// upload thông tin dự án
String updateProject(ProjectDTO dto);
// thêm dự án mới
String saveProject(ProjectDTO dto);
// tìm kiếm dự án theo id
// upload thông tin dự án
WrapperResult updateProject(ProjectDTO dto);
// thêm dự án mới
WrapperResult saveProject(ProjectDTO dto);
// tìm kiếm dự án theo id
ProjectDTO findByProjectId(Integer id);
// xóa list dự án theo arr ids
String deleteProject(Integer[] ids);
// xóa một project
String deleteProjectById(Integer ids);
WrapperResult deleteProjectById(Integer ids);
AbstractDaoPage<ProjectDTO> getPageProject(int page, int pageSize);
}
package com.itsol.quantrivanphong.manager.project.project.bussiness;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.model.Project;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRepository;
import com.itsol.quantrivanphong.model.Project;
import com.itsol.quantrivanphong.report.issue.common.AbstractDaoPage;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
......@@ -13,14 +18,13 @@ import java.util.List;
@Service
public class ProjectBussinessImpl implements ProjectBussiness {
private Logger logger = Logger.getLogger(ProjectBussinessImpl.class);
private String views = "";
@Autowired
private ProjectRepository projectRepository;
@Override
public List<ProjectDTO> findAllProject() {
try {
return lstDTO(projectRepository.finAllEntity());
return lstDTO(projectRepository.findAll());
} catch (Exception e) {
logger.info("Lỗi findAll " + e.getMessage());
}
......@@ -28,17 +32,22 @@ public class ProjectBussinessImpl implements ProjectBussiness {
}
@Override
public String updateProject(ProjectDTO dto) {
public WrapperResult updateProject(ProjectDTO dto) {
String views = null;
int status = 113;
try {
ProjectDTO projectDTO = findByProjectId(dto.getId());
dto.setStartDate(projectDTO.getStartDate());
dto.setEndDate(projectDTO.getEndDate());
if (dto.getStartDate() == null) {
views = "ngày bắt đầu dự án không được null";
} else if (dto.getEndDate() == null) {
views = "ngày dự kiếm kết thúc dự án không được null";
} else if (projectDTO != null) {
ProjectDTO updateProject = modelparseDto(projectRepository.updateEntity(dtoParseModels(dto)));
ProjectDTO updateProject = modelparseDto(projectRepository.save(dtoParseModels(dto)));
if (updateProject != null) {
views = "sửa thành công project";
status = 200;
}
} else {
views = "không tìm thấy project phù hợp";
......@@ -47,32 +56,44 @@ public class ProjectBussinessImpl implements ProjectBussiness {
logger.info("Lỗi update" + e.getMessage());
views = "lỗi update project";
}
return views;
return new WrapperResult(status, views);
}
@Override
public String saveProject(ProjectDTO dto) {
try {
if (dto.getStartDate() == null) {
views = "ngày bắt đầu dự án không được null";
} else if (dto.getEndDate() == null) {
views = "ngày dự kiếm kết thúc dự án không được null";
} else {
dto.setStatusPost(0);
projectRepository.saveEntity(dtoParseModels(dto));
views = "thêm thành công project !";
public WrapperResult saveProject(ProjectDTO dto) {
String views = null;
int status = 113;
if (projectRepository.findByName(dto.getName()) == null) {
try {
if (dto.getStartDate() == null) {
views = "ngày bắt đầu dự án không được null";
} else if (dto.getEndDate() == null) {
views = "ngày dự kiếm kết thúc dự án không được null";
} else {
dto.setStatus(0);
// projectRepository.saveEntity(dtoParseModels(dto));
ProjectDTO saveProject = modelparseDto(projectRepository.save(dtoParseModels(dto)));
if (saveProject != null) {
views = "thêm thành công project !";
status = 200;
} else {
views = "thêm project không thành công!";
}
}
} catch (Exception e) {
logger.info("Lỗi insert " + e.getMessage());
views = "Lỗi thêm dữ liệu";
}
} catch (Exception e) {
logger.info("Lỗi insert " + e.getMessage());
views = "thêm project không thành công!";
} else {
views = "Đã tồn tại Dự Án";
}
return views;
return new WrapperResult(status, views);
}
@Override
public ProjectDTO findByProjectId(Integer id) {
try {
ProjectDTO projectDTO = modelparseDto(projectRepository.findByEmtityId(id));
ProjectDTO projectDTO = modelparseDto(projectRepository.findProjectById(id));
if (projectDTO != null) {
return projectDTO;
}
......@@ -82,30 +103,48 @@ public class ProjectBussinessImpl implements ProjectBussiness {
return null;
}
@Override
public String deleteProject(Integer[] ids) {
int count = 0;
count = projectRepository.deleteEntity(ids);
if (count != 0) {
views = "xóa thành công " + count + " project";
public WrapperResult deleteProjectById(Integer id) {
String views = null;
int status = 113;
logger.info("deleteProjectById");
if (findByProjectId(id) != null) {
try {
projectRepository.deleteById(id);
views = "xóa thành công project";
status = 200;
} catch (Exception e) {
logger.info("lỗi :" + e.getMessage());
views = "Lỗi xóa";
}
} else {
views = "project không tồn tại";
views = "dự án không tồn tại không tồn tại";
}
return views;
return new WrapperResult(status, views);
}
@Override
public String deleteProjectById(Integer id) {
logger.info("deleteProjectById");
int count = 0;
count = projectRepository.deleteEntityByID(id);
if (count != 0) {
views = "xóa thành công " + count + " project";
public AbstractDaoPage<ProjectDTO> getPageProject(int page, int pageSize) {
AbstractDaoPage<ProjectDTO> abstractDaoPage = new AbstractDaoPage<ProjectDTO>();
List<Project> lstM = getListPage(page,pageSize);
List<ProjectDTO> listDTO = lstDTO(lstM);
abstractDaoPage.setLstResult(listDTO);
abstractDaoPage.setPage(page);
abstractDaoPage.setMaxPageItem(pageSize);
abstractDaoPage.setTotalItem(findAllProject().size());
abstractDaoPage.setTotalPage((int)Math.ceil((double) abstractDaoPage.getTotalItem()/abstractDaoPage.getMaxPageItem()));
return abstractDaoPage;
}
public List<Project> getListPage(int page, int pageSize) {
Pageable paging = PageRequest.of(page,pageSize);
Page<Project> pagedResult = projectRepository.findAll(paging);
if(pagedResult.hasContent()) {
return pagedResult.getContent();
} else {
views = "project không tồn tại";
return new ArrayList<Project>();
}
return views;
}
public List<ProjectDTO> lstDTO(List<Project> lstModels) {
......@@ -123,13 +162,7 @@ public class ProjectBussinessImpl implements ProjectBussiness {
dto.setDescriptions(model.getDescriptions());
dto.setStartDate(model.getStartDate());
dto.setEndDate(model.getEndDate());
if(model.getStatus()==0){
dto.setStatusGet("Dự Kiến");
}else if(model.getStatus()==1){
dto.setStatusGet("Đang Tiến Hành");
}else{
dto.setStatusGet("Đã Hoàn Thành");
}
dto.setStatus(model.getStatus());
return dto;
}
......@@ -141,7 +174,7 @@ public class ProjectBussinessImpl implements ProjectBussiness {
project.setDescriptions(projectDTO.getDescriptions());
project.setStartDate(projectDTO.getStartDate());
project.setEndDate(projectDTO.getEndDate());
project.setStatus(projectDTO.getStatusPost());
project.setStatus(projectDTO.getStatus());
return project;
}
}
package com.itsol.quantrivanphong.manager.project.project.controller;
import com.itsol.quantrivanphong.report.issue.common.SystemConstants;
import com.itsol.quantrivanphong.manager.project.project.bussiness.ProjectBussiness;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.report.issue.common.SystemConstants;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
......@@ -16,43 +17,33 @@ public class ProjectController {
@Autowired
private ProjectBussiness projectBussiness;
@GetMapping(value = "/danh-sach-du-an")
public ResponseEntity<List<ProjectDTO>> getAllProject(){
return ResponseEntity.ok(projectBussiness.findAllProject());
}
@GetMapping(value = "/danh-sach-du-an/{page}/{pageSize}")
public ResponseEntity getPageProject(@PathVariable("page") int page, @PathVariable("pageSize") int pageSize){
return ResponseEntity.ok(projectBussiness.getPageProject(page,pageSize));
}
@GetMapping(value = "/chi-tiet-du-an/{id}",produces = SystemConstants.TYPE_JSON)
public ResponseEntity<ProjectDTO> findProjectId(@PathVariable Integer id){
public ResponseEntity findProjectId(@PathVariable Integer id){
ProjectDTO projectDTO = projectBussiness.findByProjectId(id);
return ResponseEntity.ok(projectDTO);
}
@PostMapping(value = "/them-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity saveProject(@RequestBody ProjectDTO projectDTO){
String views = projectBussiness.saveProject(projectDTO);
return ResponseEntity.ok(views);
WrapperResult wrapperResult = projectBussiness.saveProject(projectDTO);
return ResponseEntity.ok(wrapperResult);
}
@PutMapping(value = "/sua-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity updateProject(@RequestBody ProjectDTO projectDTO){
String views = projectBussiness.updateProject(projectDTO);
return ResponseEntity.ok(views);
}
@DeleteMapping(value = "/xoa-danh-sach-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity deleteProject(@RequestBody ProjectDTO projectDTO){
String views ="";
if(projectDTO.getIds()!=null){
views = projectBussiness.deleteProject(projectDTO.getIds());
}else{
views="không tồn tại";
}
return ResponseEntity.ok(views);
WrapperResult wrapperResult = projectBussiness.updateProject(projectDTO);
return ResponseEntity.ok(wrapperResult);
}
@DeleteMapping(value = "/xoa-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity deleteProjectById(@RequestBody ProjectDTO projectDTO){
String views ="";
if(projectDTO.getId()!=null){
views = projectBussiness.deleteProjectById(projectDTO.getId());
}else{
views="không tồn tại";
}
return ResponseEntity.ok(views);
WrapperResult wrapperResult = projectBussiness.deleteProjectById(projectDTO.getId());
return ResponseEntity.ok(wrapperResult);
}
}
......@@ -20,9 +20,7 @@ public class ProjectDTO {
//ngày kết thúc dự án
private Timestamp endDate;
//trạng thái thêm vào dataBase
private Integer statusPost;
//trạng thái lấy dữ liệu lên cline
private String statusGet;
private Integer status;
// danh sách id
private Integer[] ids;
}
package com.itsol.quantrivanphong.manager.project.project.repository;
import com.itsol.quantrivanphong.report.issue.common.GennericeEntityManagerDao;
import com.itsol.quantrivanphong.model.Project;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProjectRepository extends GennericeEntityManagerDao<Integer, Project> {
public interface ProjectRepository extends JpaRepository<Project,Integer> {
Project findProjectById(Integer id);
Project findProjectByName(String nameProject);
Project findByName(String nameProject);
}
package com.itsol.quantrivanphong.manager.project.project.repository;
import com.itsol.quantrivanphong.report.issue.common.AbstractEntityManagerDao;
import com.itsol.quantrivanphong.model.Project;
import org.springframework.stereotype.Repository;
@Repository
public class ProjectRepositoryImpl extends AbstractEntityManagerDao<Integer, Project> implements ProjectRepository{
}
package com.itsol.quantrivanphong.manager.project.projectgroup.bussiness;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import java.util.List;
public interface ProjectGroupBussiness {
// chi tiết nhóm dự án
// chi tiết nhóm dự án
List<ProjectGroupDTO> getGroupByProjectId(Integer projectId);
// thêm thành viên vào nhóm dự án
String saveEmployeeProject(ProjectGroupDTO dto);
// sửa thông tin nhóm dự án, các thành viên out nhóm
String updateEmployeeProject(ProjectGroupDTO dto);
// Tìm kiếm thành viên trong nhóm theo tên đăng nhập
ProjectGroupDTO findEmployeeProject(String username);
// thành viên out dự án
String outProjectGroup(Integer[]ids);
// thêm thành viên vào nhóm dự án
WrapperResult saveEmployeeProject(ProjectGroupDTO dto);
// sửa thông tin nhóm dự án, các thành viên out nhóm
WrapperResult updateEmployeeProject(ProjectGroupDTO dto);
// thành viên out dự án
WrapperResult deleteEmployeeProject(Integer id);
WrapperResult updateEmployeeOutGroup(ProjectGroupDTO dto);
ProjectGroupDTO findEmployeeProjectById(Integer id);
}
package com.itsol.quantrivanphong.manager.project.projectgroup.bussiness;
import com.itsol.quantrivanphong.model.Project;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRepository;
import com.itsol.quantrivanphong.manager.project.projectgroup.common.EmployeeRepositoryImpl;
import com.itsol.quantrivanphong.manager.project.projectgroup.common.EmployeeProject;
import com.itsol.quantrivanphong.manager.project.projectgroup.common.ProjectGroupUtils;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.manager.project.projectgroup.repository.ProjectGroupRepository;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.List;
@Service
public class ProjectGroupBussinessImpl implements ProjectGroupBussiness {
private Logger logger = Logger.getLogger(ProjectGroupBussinessImpl.class);
@Autowired
private ProjectGroupRepository projectGroupRepository;
......@@ -22,64 +26,127 @@ public class ProjectGroupBussinessImpl implements ProjectGroupBussiness {
private ProjectRepository projectRepository;
@Autowired
private EmployeeRepositoryImpl employeeRepository;
private ProjectGroupUtils utils;
@Autowired
private ProjectGroupUtils utils;
private EmployeeProject employeeProject;
@Override
public List<ProjectGroupDTO> getGroupByProjectId(Integer projectId) {
Project project = projectRepository.findByEmtityId(projectId);
if (project != null) {
List<Eproject> lstModels = projectGroupRepository.finByProperty("project", project, "joinDate", "DESC");
List<ProjectGroupDTO> lstDTO = utils.getListDTO(lstModels);
return lstDTO;
}
return null;
logger.info("getGroupByProjectId");
List<Eproject> lstModels = projectGroupRepository.findByProjectId(projectId);
List<ProjectGroupDTO> lstDTO = utils.getListDTO(lstModels);
return lstDTO;
}
public boolean checkEmployeeInGroupProject(ProjectGroupDTO dto) {
if (dto.getProjectId()!=null) {
List<Eproject> lst = projectGroupRepository.findByProjectId(dto.getProjectId());
for (Eproject eproject : lst) {
if (eproject.getEmployee().getUsername().equals(dto.getUserName())) {
return true;
}
}
}
return false;
}
@Override
public String saveEmployeeProject(ProjectGroupDTO dto) {
public WrapperResult saveEmployeeProject(ProjectGroupDTO dto) {
String views = "";
try{
projectGroupRepository.saveEntity(utils.Model(dto));
views="thêm thành công nhân viên vào nhóm dự án";
}catch (Exception e){
views="thêm không thành công!";
int status = 113;
logger.info("saveEmployeeProject");
Employee employee = employeeProject.findByUsername(dto.getUserName());
if (employee == null) {
views = "Nhân viên không tồn tại !";
} else if (!checkEmployeeInGroupProject(dto)) {
try {
dto.setStatus(1);
dto.setUserId(employee.getId());
dto.setJoinDate(new Timestamp(System.currentTimeMillis()));
Eproject eproject = projectGroupRepository.save(utils.Model(dto));
if (eproject != null) {
views = "thêm thành công nhân viên vào nhóm dự án";
status = 200;
} else {
views = "thêm không thành công!";
}
} catch (Exception e) {
logger.info("Lỗi " + e.getMessage());
}
} else {
status = 113;
views = "thành viên đã tồn tại";
}
return views;
return new WrapperResult(status, views);
}
@Override
public String updateEmployeeProject(ProjectGroupDTO dto) {
String views="";
Eproject eproject = projectGroupRepository.findByEmtityId(dto.getId());
if(eproject!=null){
Eproject updateProjectGroup = projectGroupRepository.updateEntity(utils.Model(dto));
if(updateProjectGroup!=null){
views = "Sửa thành công";
public WrapperResult updateEmployeeProject(ProjectGroupDTO dto) {
String views = "";
int status = 113;
logger.info("updateEmployeeProject");
Eproject eproject = projectGroupRepository.findEprojectById(dto.getId());
if (eproject != null) {
eproject.setPosition(dto.getPosition());
Eproject updateProjectGroup = projectGroupRepository.save(eproject);
if (updateProjectGroup != null) {
views = "cập nhật chức vụ thành viên thành công";
status = 200;
}
}else{
} else {
views = "đối tượng không tồn tại";
}
return null;
return new WrapperResult(status, views);
}
@Override
public ProjectGroupDTO findEmployeeProject(String username) {
public ProjectGroupDTO findEmployeeProjectById(Integer id) {
try {
ProjectGroupDTO projectGroupDTO = utils.DTO(projectGroupRepository.findEprojectById(id));
if (projectGroupDTO != null) {
return projectGroupDTO;
}
} catch (Exception e) {
logger.info("Lỗi update EProject " + e.getMessage());
}
return null;
}
@Override
public String outProjectGroup(Integer[] ids) {
public WrapperResult deleteEmployeeProject(Integer id) {
String views = "";
int count=0;
count = projectGroupRepository.deleteEntity(ids);
if(count!=0){
views="Bạn đã cho "+count+" thoát ra khỏi nhóm";
}else{
views=" thành viên không tồn tại";
int status = 113;
logger.info("deleteEmployeeProject");
if (projectGroupRepository.findEprojectById(id) != null) {
projectGroupRepository.deleteById(id);
views = "Bạn đã cho thoát ra khỏi nhóm";
status = 200;
} else {
views = "Thành viên không tồn tại trong nhóm";
}
return new WrapperResult(status, views);
}
@Override
public WrapperResult updateEmployeeOutGroup(ProjectGroupDTO dto) {
String views = "";
int status = 113;
logger.info("updateEmployeeOutGroup");
Eproject eproject = projectGroupRepository.findEprojectById(dto.getId());
if (eproject != null) {
eproject.setStatus(2);
eproject.setOutDate(new Timestamp(System.currentTimeMillis()));
Eproject updateProjectGroup = projectGroupRepository.save(eproject);
if (updateProjectGroup != null) {
views = "thành viên đã out nhóm";
status = 200;
}
} else {
views = "đối tượng không tồn tại";
}
return views;
return new WrapperResult(status, views);
}
}
package com.itsol.quantrivanphong.manager.project.projectgroup.common;
import com.itsol.quantrivanphong.model.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EmployeeProject extends JpaRepository<Employee,Integer> {
Employee findEmployeeById(Integer employeeId);
Employee findByUsername(String username);
}
package com.itsol.quantrivanphong.manager.project.projectgroup.common;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.report.issue.common.AbstractEntityManagerDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
@Service
public class EmployeeRepositoryImpl extends AbstractEntityManagerDao<Integer, Employee> {
private Logger logger = Logger.getLogger(EmployeeRepositoryImpl.class);
public Employee getEmployeeById(Integer employeeId) {
try {
Employee employee = findByEmtityId(employeeId);
if (employee != null) {
return employee;
}
} catch (Exception e) {
logger.info("( Lỗi tìm employee theo ID: )" + e.getMessage());
}
return null;
}
}
package com.itsol.quantrivanphong.manager.project.projectgroup.common;
import com.itsol.quantrivanphong.access.login.dto.EmployeeDTO;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.model.Project;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRepository;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.model.Project;
import org.apache.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -18,9 +18,9 @@ import java.util.List;
public class ProjectGroupUtils {
private static Logger logger = Logger.getLogger(ProjectGroupUtils.class);
@Autowired
private EmployeeRepositoryImpl employeeRepository;
private EmployeeProject employeeRepository;
@Autowired
private ProjectRepository projectRepository;
private ProjectRepository projectRepository;
public Eproject Model(ProjectGroupDTO dto){
......@@ -29,8 +29,9 @@ public class ProjectGroupUtils {
model.setJoinDate(dto.getJoinDate());
model.setOutDate(dto.getOutDate());
model.setPosition(dto.getPosition());
model.setStatus(dto.getStatus());
try{
Employee findEmployee = employeeRepository.getEmployeeById(dto.getUserId());
Employee findEmployee = employeeRepository.findEmployeeById(dto.getUserId());
if(findEmployee!=null){
model.setEmployee(findEmployee);
}
......@@ -38,7 +39,7 @@ public class ProjectGroupUtils {
logger.info("(Lỗi không tìm thấy Employee) "+e.getMessage());
}
try{
Project project = projectRepository.findByEmtityId(dto.getProjectId());
Project project = projectRepository.findProjectById(dto.getProjectId());
if(project!=null){
model.setProject(project);
}
......
package com.itsol.quantrivanphong.manager.project.projectgroup.controller;
import com.itsol.quantrivanphong.report.issue.common.SystemConstants;
import com.itsol.quantrivanphong.manager.project.projectgroup.bussiness.ProjectGroupBussiness;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class ProjectGroupController {
......@@ -17,33 +15,40 @@ public class ProjectGroupController {
// thông tin của 1 nhóm dư án theo id của dự án
// Team lead,Hr
@GetMapping(value = "/thong-tin-du-an/{id}", produces = SystemConstants.TYPE_JSON)
public ResponseEntity<List<ProjectGroupDTO>> getOneProjectGroup(@PathVariable("id") Integer projectId) {
@GetMapping(value = "/thong-tin-du-an/{id}")
public ResponseEntity getOneProjectGroup(@PathVariable("id") Integer projectId) {
return ResponseEntity.ok(projectGroupBussiness.getGroupByProjectId(projectId));
}
@GetMapping(value = "/chi-tiet-thanh-vien-du-an/{id}")
public ResponseEntity getOneEmployeeProject(@PathVariable("id") Integer employeeProjectId) {
return ResponseEntity.ok(projectGroupBussiness.findEmployeeProjectById(employeeProjectId));
}
// thêm thành viên vào dự án
// hr,manager, teamlead thêm thành viên
@PostMapping(value = "/them-thanh-vien", consumes = SystemConstants.TYPE_JSON, produces = SystemConstants.TYPE_JSON)
@PostMapping(value = "/them-thanh-vien")
public ResponseEntity addMemberProject(@RequestBody ProjectGroupDTO projectGroupDTO) {
String views = projectGroupBussiness.saveEmployeeProject(projectGroupDTO);
return ResponseEntity.ok(views);
WrapperResult wrapperResult = projectGroupBussiness.saveEmployeeProject(projectGroupDTO);
return ResponseEntity.ok(wrapperResult);
}
// cập nhật thông tin thành viên
// manager cập nhật chức vụ cho nhân viên vào xét duyệt vào dự án
@PutMapping(value = "/cap-nhat-thong-tin-thanh-vien",consumes = SystemConstants.TYPE_JSON, produces = SystemConstants.TYPE_JSON)
public ResponseEntity updateMemberProject(@RequestBody ProjectGroupDTO projectGroupDTO) {
String views = projectGroupBussiness.updateEmployeeProject(projectGroupDTO);
return ResponseEntity.ok(views);
@PutMapping(value = "/cap-nhat-chuc-vu-thanh-vien")
public ResponseEntity updatePositionProject(@RequestBody ProjectGroupDTO projectGroupDTO) {
WrapperResult wrapperResult = projectGroupBussiness.updateEmployeeProject(projectGroupDTO);
return ResponseEntity.ok(wrapperResult);
}
// xóa thành viên ra khỏi dự án
@DeleteMapping(value = "/thanh-vien-out-du-an")
@PutMapping(value = "/thanh-vien-out-nhom")
public ResponseEntity updateMemberOutProject(@RequestBody ProjectGroupDTO projectGroupDTO) {
WrapperResult wrapperResult = projectGroupBussiness.updateEmployeeOutGroup(projectGroupDTO);
return ResponseEntity.ok(wrapperResult);
}
@DeleteMapping(value = "/xoa-thanh-vien-du-an")
public ResponseEntity deleteMemberProject(@RequestBody ProjectGroupDTO projectGroupDTO){
String views = projectGroupBussiness.outProjectGroup(projectGroupDTO.getIds());
return ResponseEntity.ok(views);
WrapperResult wrapperResult = projectGroupBussiness.deleteEmployeeProject(projectGroupDTO.getId());
return ResponseEntity.ok(wrapperResult);
}
}
......@@ -19,11 +19,11 @@ public class ProjectGroupDTO {
private Timestamp joinDate;
// ngày ra dự án
private Timestamp outDate;
private int status;
private Integer userId;
private Integer projectId;
private String userName;
private String nameProject;
private EmployeeDTO employeeDTO;
private ProjectDTO projectDTO;
private Integer[]ids;
}
package com.itsol.quantrivanphong.manager.project.projectgroup.repository;
import com.itsol.quantrivanphong.report.issue.common.GennericeEntityManagerDao;
import com.itsol.quantrivanphong.model.Eproject;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProjectGroupRepository extends GennericeEntityManagerDao<Integer, Eproject> {
import java.util.List;
public interface ProjectGroupRepository extends JpaRepository<Eproject,Integer> {
List<Eproject> findByProjectId(Integer projectId);
Eproject findEprojectById(Integer eProjectId);
}
package com.itsol.quantrivanphong.manager.project.projectgroup.repository;
import com.itsol.quantrivanphong.report.issue.common.AbstractEntityManagerDao;
import com.itsol.quantrivanphong.model.Eproject;
import org.springframework.stereotype.Repository;
@Repository
public class ProjectGroupRepositoryImpl extends AbstractEntityManagerDao<Integer, Eproject> implements ProjectGroupRepository {
}
package com.itsol.quantrivanphong.manager.project;
public class test {
}
package com.itsol.quantrivanphong.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.TimeSheet;
import com.itsol.quantrivanphong.model.Project;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
......@@ -24,16 +21,19 @@ public class Eproject {
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private int id;
// chức vụ trong project
// chức vụ trong project
@Column(name = "position", nullable = false)
private String position;
//ngày vào dự án
//ngày vào dự án
@Column(name = "join_date",nullable =false)
private Timestamp joinDate;
// ngày ra dự án
// ngày ra dự án
@Column(name = "out_date",nullable = true)
private Timestamp outDate;
@Column(name = "status",nullable = false)
private int status;
@ManyToOne(fetch = FetchType.EAGER)
private Employee employee;
......@@ -43,4 +43,5 @@ public class Eproject {
@JsonIgnore
@OneToMany(mappedBy = "eproject", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<TimeSheet> timeSheetList = new ArrayList<>();
}
package com.itsol.quantrivanphong.model;
import com.itsol.quantrivanphong.model.Project;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "issues")
public class Issues {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private int id;
// tiêu đề liên quan
private Integer id;
// tiêu đề liên quan
@Column(name = "title")
private String title;
//nội dung
//nội dung
@Column(name = "content")
private String actionCode;
// trạng thái vấn đề đó trong project
// trạng thái vấn đề đó trong project
@Column(name = "status")
private boolean status;
private int status;
@Column(name = "startdate")
private Timestamp startDate;
@ManyToOne(fetch = FetchType.EAGER)
private Project project;
@JsonIgnore
@OneToMany(mappedBy = "issues", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<IssuesComment> issuesCommentList = new ArrayList<>();
}
package com.itsol.quantrivanphong.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.sql.Timestamp;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "issuescomment")
public class IssuesComment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private Integer id;
//nội dung
@Column(name = "content")
private String contentIssuse;
@Column(name = "usercreate")
private String userCreate;
@Column(name = "createdate")
private Timestamp createDate;
@ManyToOne(fetch = FetchType.EAGER)
private Issues issues;
}
......@@ -18,25 +18,26 @@ import java.util.List;
@Table(name = "project")
public class Project {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private Integer id;
// tên project
// tên project
@Column(name = "name", nullable = false)
private String name;
//mô tả ngắn
//mô tả ngắn
@Column(name = "descriptions")
private String descriptions;
//ngày bắt đầu của dự án
//ngày bắt đầu của dự án
@Column(name = "start_date", nullable = false)
private Timestamp startDate;
//ngày kết thúc dự án
//ngày kết thúc dự án
@Column(name = "end_date")
private Timestamp endDate;
//trạng thái
//trạng thái
@Column(name = "status",nullable = false)
private Integer status;
......
package com.itsol.quantrivanphong.report.issue.bussiness;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRepository;
import com.itsol.quantrivanphong.model.Issues;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issue.dto.IssueDTO;
import com.itsol.quantrivanphong.report.issue.repository.IssueRepository;
import org.apache.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@Service
public class IssueBussinesImpl implements IssueBussiness {
Logger logger = Logger.getLogger(IssueBussinesImpl.class);
@Autowired
private IssueRepository issueRepository;
@Autowired
private ProjectRepository projectRepository;
@Override
public List<Issues> getAllIssue() {
return issueRepository.findAll();
}
@Override
public WrapperResult saveIssue(IssueDTO issueDTO) {
String views = null;
int status = 113;
try {
issueDTO.setStatus(0);
issueDTO.setStartDate(new Timestamp(System.currentTimeMillis()));
Issues saveIssues = issueRepository.save(dtoParseModels(issueDTO));
if (saveIssues != null) {
views = "thêm thành công Issues !";
status = 200;
} else {
views = "thêm Issues không thành công!";
}
} catch (Exception e) {
logger.info("Lỗi insert " + e.getMessage());
views = "Lỗi thêm dữ liệu";
}
return new WrapperResult(status, views);
}
@Override
public WrapperResult updateIssue(IssueDTO issueDTO) {
String views = null;
int status = 113;
try {
Issues issues = issueRepository.findIssuesById(issueDTO.getId());
if (issues != null) {
if (issues.getStatus() == 0) {
issues.setStatus(1);
}else{
issues.setStatus(0);
}
Issues saveIssues = issueRepository.save(issues);
if (saveIssues != null) {
views = "Cập nhật thành công Issues !";
status = 200;
} else {
views = "không thành công!";
}
} else {
views = "Issue không tồn tại!";
}
} catch (Exception e) {
logger.info("Lỗi Cập nhật " + e.getMessage());
views = "Lỗi Cập nhật dữ liệu";
}
return new WrapperResult(status, views);
}
@Override
public WrapperResult deleteIssue(IssueDTO issueDTO) {
String views = null;
int status = 113;
try {
Issues issues = issueRepository.findIssuesById(issueDTO.getId());
if (issues != null) {
issueRepository.deleteById(issueDTO.getId());
views = "Xóa thành công Issues !";
status = 200;
} else {
views = "Issue không tồn tại!";
}
} catch (Exception e) {
logger.info("Lỗi Delete " + e.getMessage());
views = "Lỗi xóa dữ liệu";
}
return new WrapperResult(status, views);
}
@Override
public Issues findIssueById(Integer id) {
return issueRepository.findIssuesById(id);
}
public IssueDTO modelsParseDTO(Issues models) {
IssueDTO issueDTO = new IssueDTO();
BeanUtils.copyProperties(models, issueDTO);
return issueDTO;
}
public Issues dtoParseModels(IssueDTO dto) {
Issues issues = new Issues();
BeanUtils.copyProperties(dto, issues);
issues.setProject(projectRepository.findProjectById(dto.getProjectId()));
return issues;
}
public List<IssueDTO> lstModel(List<Issues> lstModel) {
if (lstModel.size() != 0 && !lstModel.isEmpty()) {
List<IssueDTO> lstDTO = new ArrayList<IssueDTO>();
for (Issues issues : lstModel) {
lstDTO.add(modelsParseDTO(issues));
}
return lstDTO;
}
return null;
}
}
package com.itsol.quantrivanphong.report.issue.bussiness;
import com.itsol.quantrivanphong.model.Issues;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issue.dto.IssueDTO;
import java.util.List;
public interface IssueBussiness {
List<Issues> getAllIssue();
WrapperResult saveIssue(IssueDTO issueDTO);
WrapperResult updateIssue(IssueDTO issueDTO);
WrapperResult deleteIssue(IssueDTO issueDTO);
Issues findIssueById(Integer id);
}
package com.itsol.quantrivanphong.report.issue.common;
import java.util.ArrayList;
import java.util.List;
public class AbstractDaoPage<T> {
private List<T> lstResult = new ArrayList<T>();
// Số page đang đứng
private int page;
// Tổng sô page trong 1 item
private Integer maxPageItem;
// Tổng số page hiện tại
private int totalPage;
// Tổng số item
private int totalItem;
private int Count;
public List<T> getLstResult() {
return lstResult;
}
public void setLstResult(List<T> lstResult) {
this.lstResult = lstResult;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public Integer getMaxPageItem() {
return maxPageItem;
}
public void setMaxPageItem(Integer maxPageItem) {
this.maxPageItem = maxPageItem;
}
public int getTotalPage() {
return totalPage;
}
public void setTotalPage(int totalPage) {
this.totalPage = totalPage;
}
public int getTotalItem() {
return totalItem;
}
public void setTotalItem(int totalItem) {
this.totalItem = totalItem;
}
public int getCount() {
return (lstResult!=null)?lstResult.size():0;
}
}
package com.itsol.quantrivanphong.report.issue.common;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.springframework.beans.factory.annotation.Autowired;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.TypedQuery;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.List;
public class AbstractEntityManagerDao<ID extends Serializable, T> implements GennericeEntityManagerDao<ID, T> {
@Autowired
EntityManager entityManager;
@Autowired
EntityManagerFactory entityManagerFactory;
private final static Logger log = Logger.getLogger(AbstractEntityManagerDao.class);
private Class<T> persistenceClass;
// Lấy Entity T trong Generic
public AbstractEntityManagerDao() {
this.persistenceClass = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
}
// get persistenceClass
public String getPersistenceClass() {
return persistenceClass.getSimpleName();
}
public List<T> finAllEntity() {
log.info("find All record from db");
List<T> list = new ArrayList<T>();
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
StringBuilder sql = new StringBuilder(" from ");
sql.append(this.getPersistenceClass());
list = entityManager.createQuery(sql.toString(), persistenceClass).getResultList();
} catch (HibernateException e) {
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return list;
}
public void saveEntity(T t) {
log.info("save object");
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
entityManager.persist(t);
entityManager.getTransaction().commit();
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
}
public T updateEntity(T t) {
log.info("update object");
T entity = null;
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
entity = entityManager.merge(t);
entityManager.getTransaction().commit();
return entity;
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return entity;
}
public Integer deleteEntity(ID[] ids) {
log.info("delete by ids ");
Integer count = 0;
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
for (ID id : ids) {
T entity = entityManager.find(persistenceClass, id);
if (entity != null) {
entityManager.remove(entity);
count++;
}
}
entityManager.getTransaction().commit();
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return count;
}
@Override
public Integer deleteEntityByID(Integer id) {
log.info("delete by id ");
Integer count = 0;
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
T entity = entityManager.find(persistenceClass, id);
if (entity != null) {
entityManager.remove(entity);
count++;
}
entityManager.getTransaction().commit();
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return count;
}
@Override
public T findByEmtityId(ID id) {
log.info("find by id");
T entity = null;
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
entity = entityManager.find(persistenceClass,id);
entityManager.getTransaction().commit();
} catch (Exception e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return entity;
}
// Tìm kiếm 1 list danh sách theo value sắp xếp theo ASC or DESC size của list
@Override
public List<T> finByProperty(String property, Object value, String sortExperssion, String sortDirection) {
log.info("find by value");
List<T> list = new ArrayList<T>();
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
StringBuilder sql = new StringBuilder(" from ");
sql.append(getPersistenceClass());
if(property!=null && value !=null) {
sql.append(" where ").append(property).append(" = ?1");
}
if(sortExperssion!=null && sortDirection!=null) {
sql.append(" order by ").append(sortExperssion);
sql.append(" "+(sortDirection.equals("ASC")?"asc":"desc"));
}
TypedQuery<T> query1 = entityManager.createQuery(sql.toString(),persistenceClass);
list = query1.setParameter(1,value).getResultList();
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
}finally {
entityManager.close();
}
return list;
}
}
package com.itsol.quantrivanphong.report.issue.common;
import java.io.Serializable;
import java.util.List;
public interface GennericeEntityManagerDao<ID extends Serializable,T> {
List<T> finAllEntity();
void saveEntity(T entity);
T updateEntity(T entity);
Integer deleteEntity(ID[] ids);
Integer deleteEntityByID(Integer id);
T findByEmtityId(ID id);
List<T> finByProperty(String property, Object value, String sortExperssion, String sortDirection);
}
package com.itsol.quantrivanphong.report.issue.common;
public class WrapperResult {
private int status;
private String message;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public WrapperResult(int status, String message) {
this.status = status;
this.message = message;
}
}
package com.itsol.quantrivanphong.report.issue.common;
import java.util.List;
public class WrapperResultObject {
private int status;
private String message;
private List<String> lstRole;
private String Role;
public String getRole() {
return Role;
}
public void setRole(String role) {
Role = role;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public List<String> getLstRole() {
return lstRole;
}
public void setLstRole(List<String> lstRole) {
this.lstRole = lstRole;
}
public WrapperResultObject(int status, String message, List<String> lstRole) {
this.status = status;
this.message = message;
this.lstRole = lstRole;
}
public WrapperResultObject(int status, String message, List<String> lstRole, String role) {
this.status = status;
this.message = message;
this.lstRole = lstRole;
Role = role;
}
}
package com.itsol.quantrivanphong.report.issue.controller;
import com.itsol.quantrivanphong.model.Issues;
import com.itsol.quantrivanphong.report.issue.bussiness.IssueBussiness;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issue.dto.IssueDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
public class IssueController {
@Autowired
private IssueBussiness issueBussiness;
@GetMapping(value = "/danh-sach-issues")
public ResponseEntity getAllIssue(){
return ResponseEntity.ok(issueBussiness.getAllIssue());
}
@GetMapping(value = "/chi-tiet-issues/{id}")
public ResponseEntity getIssueById(@PathVariable("id")Integer id){
Issues issues = issueBussiness.findIssueById(id);
if(issues!=null){
return ResponseEntity.ok(issues);
}
return ResponseEntity.ok("Issues không tồn tại");
}
@PostMapping(value = "/them-issues")
public ResponseEntity saveIssue(@RequestBody IssueDTO issueDTO){
WrapperResult wrapperResult = issueBussiness.saveIssue(issueDTO);
return ResponseEntity.ok(wrapperResult);
}
@PutMapping(value = "/sua-issues")
public ResponseEntity editIssue(@RequestBody IssueDTO issueDTO){
WrapperResult wrapperResult = issueBussiness.updateIssue(issueDTO);
return ResponseEntity.ok(wrapperResult);
}
@DeleteMapping(value = "/xoa-issues")
public ResponseEntity deleteIssue(@RequestBody IssueDTO issueDTO){
WrapperResult wrapperResult = issueBussiness.deleteIssue(issueDTO);
return ResponseEntity.ok(wrapperResult);
}
}
package com.itsol.quantrivanphong.report.issue.dto;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.sql.Timestamp;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IssueDTO {
private Integer id;
private String title;
private String actionCode;
private Timestamp startDate;
private int status;
private Integer projectId;
private ProjectDTO projectDTO;
}
package com.itsol.quantrivanphong.report.issue.repository;
import com.itsol.quantrivanphong.report.issue.common.GennericeEntityManagerDao;
import com.itsol.quantrivanphong.model.Issues;
import org.springframework.data.jpa.repository.JpaRepository;
public interface IssueRepository extends GennericeEntityManagerDao<Integer, Issues> {
public interface IssueRepository extends JpaRepository<Issues, Integer> {
Issues findIssuesById(Integer id);
}
package com.itsol.quantrivanphong.report.issue.repository;
import com.itsol.quantrivanphong.report.issue.common.AbstractEntityManagerDao;
import com.itsol.quantrivanphong.model.Issues;
import org.springframework.stereotype.Repository;
@Repository
public class IssueRepositoryImpl extends AbstractEntityManagerDao<Integer, Issues> implements IssueRepository{
}
package com.itsol.quantrivanphong.report.issue;
public class test {
}
package com.itsol.quantrivanphong.report.issuescomment.bussiness;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issuescomment.dto.IssuesCommentDTO;
import java.util.List;
public interface IssuesCommentBussiness {
// danh sách comment của issues
List<IssuesCommentDTO> getListComment(Integer issuesId);
WrapperResult createComment(IssuesCommentDTO dto);
WrapperResult updateComment(IssuesCommentDTO dto);
WrapperResult deleteComment(IssuesCommentDTO dto);
IssuesCommentDTO findIssuesCommentById(Integer id);
}
package com.itsol.quantrivanphong.report.issuescomment.bussiness;
import com.itsol.quantrivanphong.model.IssuesComment;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issue.repository.IssueRepository;
import com.itsol.quantrivanphong.report.issuescomment.dto.IssuesCommentDTO;
import com.itsol.quantrivanphong.report.issuescomment.repository.IssuesCommentRepository;
import org.apache.log4j.Logger;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
@Service
public class IssuesCommentBussinessImpl implements IssuesCommentBussiness{
Logger logger = Logger.getLogger(IssuesCommentBussinessImpl.class);
@Autowired
private IssueRepository issueRepository;
@Autowired
private IssuesCommentRepository issuesCommentRepository;
@Override
public List<IssuesCommentDTO> getListComment(Integer issuesId) {
return lstDTO(issuesCommentRepository.findIssuesCommentByIssuesId(issuesId));
}
@Override
public WrapperResult createComment(IssuesCommentDTO dto) {
String views ="";
int status = 113;
dto.setUserCreate("phungdung");
if(dto.getUserCreate()!=null){
try{
dto.setCreateDate(new Timestamp(System.currentTimeMillis()));
IssuesComment issuesComment = issuesCommentRepository.save(Models(dto));
views="tạo comment thành công!";
status = 200;
}catch (Exception e){
logger.info(" Lỗi Insert Comment "+e.getMessage());
views="Lỗi Tạo Comment";
}
}else{
views="Vui lòng đăng nhập để thực hiện chức năng này";
}
return new WrapperResult(status,views);
}
@Override
public WrapperResult updateComment(IssuesCommentDTO dto) {
return null;
}
@Override
public WrapperResult deleteComment(IssuesCommentDTO dto) {
return null;
}
@Override
public IssuesCommentDTO findIssuesCommentById(Integer id) {
return DTO(issuesCommentRepository.findIssuesCommentById(id));
}
public IssuesComment Models(IssuesCommentDTO dto){
IssuesComment issuesComment = new IssuesComment();
BeanUtils.copyProperties(dto,issuesComment);
if(dto.getIssueId()!=null){
issuesComment.setIssues(issueRepository.findIssuesById(dto.getIssueId()));
}
return issuesComment;
}
public IssuesCommentDTO DTO(IssuesComment issuesComment){
IssuesCommentDTO dto = new IssuesCommentDTO();
BeanUtils.copyProperties(issuesComment,dto);
return dto;
}
public List<IssuesCommentDTO> lstDTO(List<IssuesComment> lst){
List<IssuesCommentDTO> lstDTO = new ArrayList<IssuesCommentDTO>();
for (IssuesComment issuesComment:lst) {
lstDTO.add(DTO(issuesComment));
}
return lstDTO;
}
}
package com.itsol.quantrivanphong.report.issuescomment.controller;
import com.itsol.quantrivanphong.report.issue.common.WrapperResult;
import com.itsol.quantrivanphong.report.issuescomment.bussiness.IssuesCommentBussiness;
import com.itsol.quantrivanphong.report.issuescomment.dto.IssuesCommentDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
public class IssuesControllers {
@Autowired
private IssuesCommentBussiness issuesCommentBussiness;
@GetMapping(value = "/Comment/{IssuesId}")
public ResponseEntity getComment(@PathVariable("IssuesId") Integer issuesId){
List<IssuesCommentDTO> listComment = issuesCommentBussiness.getListComment(issuesId);
return ResponseEntity.ok(listComment);
}
@PostMapping(value = "/tao-comment")
public ResponseEntity saveComment(@RequestBody IssuesCommentDTO issuesCommentDTO){
WrapperResult wrapperResult = issuesCommentBussiness.createComment(issuesCommentDTO);
return ResponseEntity.ok(wrapperResult);
}
}
package com.itsol.quantrivanphong.report.issuescomment.dto;
import com.itsol.quantrivanphong.report.issue.dto.IssueDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.sql.Timestamp;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class IssuesCommentDTO {
private Integer id;
private String contentIssuse;
private String userCreate;
private Timestamp createDate;
private Integer issueId;
private IssueDTO issue;
}
package com.itsol.quantrivanphong.report.issuescomment.repository;
import com.itsol.quantrivanphong.model.IssuesComment;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface IssuesCommentRepository extends JpaRepository<IssuesComment,Integer> {
List<IssuesComment> findIssuesCommentByIssuesId(Integer issuesId);
IssuesComment findIssuesCommentById(Integer id);
}
......@@ -37,6 +37,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-sanitize.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.3.3.js"></script>
<script src="js/app.js"></script>
<script src="pages/report/reportController.js"></script>
<script src="pages/employee/employeeController.js"></script>
<!-- <script src="pages/project/projectController.js"></script>-->
<script src="pages/leaveform/leaveFormController.js"></script>
......@@ -45,9 +46,10 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
<script src="pages/timesheet/timeSheetDetailController.js"></script>
<script src="pages/leaveform/leaveFormDetailController.js"></script>
<script src="pages/employee/createEmployeeController.js"></script>
<script src="pages/project/project/projectViewController.js"></script>
<link data-require="bootstrap-css@2.3.2" data-semver="2.3.2" rel="stylesheet"
href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css"/>
`
<!-- end anguarjs app-->
<link href="css/custom.css" rel="stylesheet">
......@@ -109,6 +111,13 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
});
});
</script>
<script src="pages/project/project/projectController.js"></script>
<script src="pages/project/groupproject/groupProjectController.js"></script>
<script src="pages/project/groupproject/groupProjectViewController.js"></script>
<script src="pages/issue/IssueAddControlelr.js"></script>
<script src="pages/issue/IssueController.js"></script>
<script src="pages/issue/IssuesDetailController.js"></script>
<script src="pages/issue/IssuesDeleteController.js"></script>
</head>
<body class="cbp-spmenu-push" ng-app="myApp">
......
......@@ -112,26 +112,210 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
}
})
.state("news",{
parent:'layout1',
url:"/news",
views:{
"content":{
templateUrl:"pages/homepage/catagoriManagements.html",
controller:"homeController"
}
}
})
//report
.state("reportProject", {
parent: 'layout1',
url: "/report/project",
views: {
"content": {
templateUrl: "pages/report/timeSheetReport.html",
controller: "reportController"
}
}
})
.state("reportTimeSheet", {
parent: 'layout1',
url: "/report/project/:ID/timeSheet",
views: {
"content": {
templateUrl: "pages/report/timeSheetListViews.html",
controller: "timeSheetListController"
}
}
})
.state("reportEmployee", {
parent: 'layout1',
url: "/report/project/:ID/employee",
views: {
"content": {
templateUrl: "pages/report/employeeListViews.html",
controller: "listLackOfReportController"
}
}
})
//
.state("report2", {
parent: 'layout1',
url: "/report/project2",
views: {
"content": {
templateUrl: "pages/report/reportPage.html",
controller: "reportController"
}
}
})
.state("allReport", {
parent: 'layout1',
url: "/report/project/:ID/allReport",
views: {
"content": {
templateUrl: "pages/report/reportListPage.html",
controller: "allProjectReportController"
}
}
})
.state("reportDetail", {
parent: 'layout1',
url: "/report/reportDetail/:ID",
views: {
"content": {
templateUrl: "pages/report/reportDetailPage.html",
controller: "projectReportDetailController"
}
}
})
.state("reportEmployeeLack", {
parent: 'layout1',
url: "/report/project/:ID/employeeReport",
views: {
"content": {
templateUrl: "pages/report/employeeListViews1.html",
controller: "listEmployeeLackController"
}
}
})
//end report
// .state("project",{
// parent:'layout1',
// url:"/project",
// views:{
// "content":{
// templateUrl:"pages/project/project/projectListViews.html",
// controller:"projectViewsController"
// }
// }
// })
// Phần của DunPV
//danh sách các dự án
.state("project", {
parent: 'layout1',
url: "/project",
views: {
"content": {
templateUrl: "pages/project/project.html",
controller: "projectController"
templateUrl: "pages/project/project/projectListViews.html",
controller: "projectViewsController"
}
}
})
.state("news",{
parent:'layout1',
url:"/news",
views:{
"content":{
templateUrl:"pages/homepage/catagoriManagements.html",
controller:"homeController"
//thêm mới dự án
.state("addproject", {
parent: 'layout1',
url: "/addproject",
views: {
"content": {
templateUrl: "pages/project/project/projectAddViews.html",
controller: "insertProject"
}
}
})
//sửa thông tin dự án
.state("editproject", {
parent: 'layout1',
url: "/editproject/:ID",
views: {
"content": {
templateUrl: "pages/project/project/projectEditViews.html",
controller: "loadProjectDetail"
}
}
})
//danh sách thành viên trong nhóm dự án
.state("groupProjectByProjectId", {
parent: 'layout1',
url: "/groupProjectByProjectId/:ID",
params: {ID: null},
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectView.html",
controller: "groupProjectShowController"
}
}
})
//thêm thành viên vào nhóm dự án
.state("addEmployeeProject", {
parent: 'layout1',
url: "/addEmployeeProject",
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectAddView.html",
controller: "insertEmployeeProject"
}
}
})
//sửa thông tin nhân viên trong nhóm
.state("editEmployeeProject", {
parent: 'layout1',
url: "/editEmployeeProject/:ID",
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectEditView.html",
controller: "loadEmployeeProjectDetail"
}
}
})
// danh sách project vào các issues
.state("issues", {
parent: 'layout1',
url: "/issues",
views: {
"content": {
templateUrl: "pages/issue/IssueView.html",
controller: "IssuesShowController"
}
}
})
// thêm mới issues
.state("addIssues", {
parent: 'layout1',
url: "/addIssues",
views: {
"content": {
templateUrl: "pages/issue/IssueAdd.html",
controller: "IssuesAddController"
}
}
})
// thêm mới issues
.state("IssuesComment", {
parent: 'layout1',
url: "/issuescomment/:IssuesId",
views: {
"content": {
templateUrl: "pages/issue/IssueDetailViews.html",
controller: "loadIssuesDetail"
}
}
})
// END DUNG PV
});
......
......@@ -30,13 +30,24 @@
<span>Employee</span>
</a>
</li>
<!-- PhungDung-->
<li class="treeview">
<!-- <a ui-sref="project">-->
<a ui-sref="project">
<i class="fa fa-laptop"></i>
<span>Project</span>
</a>
</li>
<li class="treeview">
<a ui-sref="issues">
<i class="fa fa-laptop"></i>
<span>Quản Lý Issues</span>
</a>
</li>
<!-- END DUng-->
<li class="treeview">
<li class="treeview">
<a ui-sref="news">
......@@ -59,14 +70,14 @@
</a>
</li>
<
<li class="treeview">
<a href="#">
<a ui-sref="report2">
<i class="fa fa-envelope"></i>
<span>Mailbox</span>
<i class="fa fa-angle-left pull-right"></i>
<small class="label pull-right label-info1">08</small>
<span class="label label-primary1 pull-right">02</span>
<span>Report</span>
<!-- <i class="fa fa-angle-left pull-right"></i>-->
<!-- <small class="label pull-right label-info1">08</small>-->
<!-- <span class="label label-primary1 pull-right">02</span>-->
</a>
<ul class="treeview-menu">
<li>
......
<div class="card-header">
<i class="fas fa-table"></i> Thêm mới dự án
</div>
<div class="card-body">
<!--<div class="card-header">-->
<!-- <i class="fas fa-table"></i> Thêm mới dự án-->
<!--</div>-->
<!--<div class="card-body">-->
<!-- <form ng-submit="insertIssues(Issues)">-->
<!-- <label>Tên Dự Án</label>-->
<!-- <select ng-model="Issues.projectId" autofocus="autofocus"-->
<!-- required="required">-->
<!-- <option value="">==> Tên Dự Án</option>-->
<!-- <option ng-repeat="project in listProject" value="{{project.id}}">{{project.name}}</option>-->
<!-- </select><br/>-->
<!-- <label>Tiêu đề</label>-->
<!-- <input type="text" ng-model="Issues.title" id="title" placeholder="Tiêu Đề"-->
<!-- required="required"><br/>-->
<!-- <label>Nội Dung</label>-->
<!-- <input type="text" ng-model="Issues.actionCode" id="actionCode" placeholder="Nội dung issues"-->
<!-- required="required"><br/>-->
<!-- <div>-->
<!-- <h1>{{view.message}}</h1>-->
<!-- <input type="submit" value="Save">-->
<!-- <input type="reset" value="Reset">-->
<!-- <button type="button" ui-sref="issues">Back</button>-->
<!-- </div>-->
<!-- </form>-->
<!--</div>-->
<div class="container">
<form ng-submit="insertIssues(Issues)">
<label>Tên Dự Án</label>
<select ng-model="Issues.projectId" autofocus="autofocus"
required="required">
<option value="">==> Trạng Thái</option>
<option value="">==> Tên Dự Án</option>
<option ng-repeat="project in listProject" value="{{project.id}}">{{project.name}}</option>
</select><br/>
<label>Tiêu đề</label>
......@@ -22,4 +44,5 @@
<button type="button" ui-sref="issues">Back</button>
</div>
</form>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="container">
<div class="row">
<div class="col-md-8">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Issue
</div>
<div class="card-body">
<div class="table-responsive">
<tr>
<td><a ui-sref="addIssues" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h4></h4>
<tr></tr>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<tr></tr>
<h2>Danh Sách Issue</h2>
<table class="table">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Issue</th>
......@@ -26,20 +33,35 @@
<span ng-if="issue.status == 0" style="color: #34ce57">Đang fix</span>
<span ng-if="issue.status == 1" style="color: #0e90d2">Đã fix xong</span>
</td>
<td><a ui-sref="IssuesComment({IssuesId : issue.id})" class="btn btn-info btn-circle btn-sm">
Chi Tiết </a>
<a ng-click="updateIssues(issue)" class="btn btn-warning btn-circle btn-sm">
Cập nhật Trạng Thái </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="IssuesDeleteController"
data-ng-click="IssuesDelete(issue)">Xóa</a>
<td style="width: 200px">
<a ui-sref="IssuesComment({IssuesId : issue.id})" class="btn btn-info btn-circle btn-sm">
Chi Tiết </a>
<a ng-click="updateIssues(issue)">
<button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="IssuesDeleteController"
data-ng-click="IssuesDelete(issue)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
</tr>
</tbody>
</table>
<a ui-sref="addIssues" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm Issue Mới</a>
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div>
</div>
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div>
<div class="card-header">
<i class="fas fa-table"></i> Thành thành viên mới của dự án
</div>
<div class="card-body">
<div class="container">
<form ng-controller="insertEmployeeProject" ng-submit="insert_employeeproject(employeeProject)" name="eproject">
<label>Tên Dự Án</label>
<select ng-model="employeeProject.projectId" autofocus="autofocus" required="required">
<option value=""> ==> Tên Dự Án</option>
<option ng-repeat="project in pGroupProject" value="{{project.id}}">{{project.name}}</option>
</select><br/>
<label>Tài khoản nhân viên</label>
<input type="text" ng-model="employeeProject.userName" id="employee"
placeholder="Tài khoản nhân viên" required="required"><br/>
<label>Chức Vụ</label>
<select ng-model="employeeProject.position" autofocus="autofocus"
required="required">
<option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option>
<option value="Member">Member</option>
</select><br/>
<h1>{{view.message}}</h1>
<h1 style="text-align: center">Thành thành viên mới của dự án</h1>
<div class="form-row">
<div class="col">
<label>Tên Dự Án</label>
<select ng-model="employeeProject.projectId" autofocus="autofocus" required="required">
<option value=""> ==> Tên Dự Án</option>
<option ng-repeat="project in pGroupProject" value="{{project.id}}">{{project.name}}</option>
</select>
<label>Tài khoản nhân viên</label>
<input type="text" ng-model="employeeProject.userName" id="employee"
placeholder="Tài khoản nhân viên" required="required">
<label>Chức Vụ</label>
<select ng-model="employeeProject.position" autofocus="autofocus"
required="required">
<option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option>
<option value="Member">Member</option>
</select>
</div>
</div>
<div>
<input type="submit" value="Lưu">
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
<div class="card-header">
<i class="fas fa-table"></i> Cập nhật chức vụ của nhân viên trong nhóm
</div>
<div class="card-body">
<div class="container">
<form ng-controller="updateGroutpProject" ng-submit="updatePositionProject(gruopProject)" name="formProject">
<input type="hidden" ng-model="gruopProject.id" id="id"><br/>
<input type="hidden" ng-model="gruopProject.projectDTO.id" id="idProject"><br/>
<label>Tài khoản nhân viên</label>
<input type="text" ng-model="gruopProject.employeeDTO.username" id="descriptions"
placeholder="Tài khoản nhân viên"
ng-disabled="true"><br/>
<label>Chức Vụ</label><br/>
ng-disabled="true">
<label>Chức Vụ</label>
<select ng-model="gruopProject.position" autofocus="autofocus"
required="required">
<option value="">==> Chức Vụ</option>
......@@ -23,4 +20,5 @@
<button type="button" ui-sref="groupProjectByProjectId({ID: gruopProject.projectDTO.id})">Back</button>
</div>
</form>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header" ng-controller="loadGroupProjectByProjectId">
<div class="container">
<div class="row">
<div class="col-md-8">
<i class="fas fa-table" ></i> Thành Viên Trong Nhóm Dự Án <div ng-model="ProjectName.name"></div>
</div>
<div class="card-body">
<div class="table-responsive" >
<tr>
<td><a ui-sref="addEmployeeProject" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h2 style="text-align: center">Thành Viên Trong Nhóm Dự Án</h2>
<table class="table">
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>Tài khoản</th>
<th>Tên</th>
......@@ -29,20 +31,30 @@
<td>{{ gruopProject.position}}</td>
<td>{{ gruopProject.joinDate | date:"dd/MM/yyyy" }}</td>
<td>{{ gruopProject.outDate | date:"dd/MM/yyyy" }}</td>
<td>
<a ui-sref="editEmployeeProject({ID: gruopProject.id})" class="btn btn-warning btn-circle btn-sm">
Cập Nhật </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="deleteEmployeeProject"
data-ng-click="deleteEmployeeProject(gruopProject)">Xóa Thành Viên</a>
<td style="width: 200px">
<a ui-sref="editEmployeeProject({ID: gruopProject.id})">
<button class="btn btn-primary btn-xs" data-title="Cập Nhật" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="deleteEmployeeProject"
data-ng-click="deleteEmployeeProject(gruopProject)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
</tr>
</tbody>
</table>
<a ui-sref="addEmployeeProject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm thành viên</a>
<a ui-sref="project" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Back</a>
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div>
</div>
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div>
\ No newline at end of file
<div class="card-header">
<i class="fas fa-table"></i> Thêm mới dự án
</div>
<div class="card-body">
<div class="container">
<form ng-controller="insertProject" ng-submit="insert_project()">
<label>Tên Dự Án</label>
<input type="text" ng-model="project.name" id="name" placeholder="Tên Dự Án"
required="required" style="height: 20px;"><br/>
<label>Mô tả ngắn</label>
<input type="text" ng-model="project.descriptions" id="descriptions" placeholder="Mô tả ngắn"
required="required"><br/>
<label>Ngày bắt đầu</label>
<input type="date" ng-model="project.startDate" id="startDate" placeholder="Ngày Bắt Đầu" required="required"><br/>
<label>Ngày kết thúc</label>
<input type="date" ng-model="project.endDate" id="endDate" placeholder="nick skype" required="required"><br/>
<h1 style=" text-align: center">Thêm mới dự án</h1>
<div class="form-row">
<div class="col">
<label>Tên Dự Án</label>
<input type="text" maxlength="29" ng-model="project.name" required="required"/>
<label>Mô tả ngắn</label>
<input type="text" maxlength="29" ng-model="project.descriptions" required="required"/>
<label>Ngày bắt đầu</label>
<input type="date" maxlength="29" ng-model="project.startDate" required="required"/>
<label>Ngày kết thúc</label>
<input type="date" maxlength="29" ng-model="project.endDate" required="required"/>
</div>
</div>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
......@@ -20,4 +25,5 @@
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
</div>
......@@ -4,30 +4,6 @@ app.controller('insertProject', insertProject);
app.controller('deleteProject', deleteProject);
app.controller('updateProject', updateProject);
app.controller('loadProjectDetail', loadProjectDetail);
// controlers tạo Get API
// function showProject($scope, $http) {
// $scope.lstProject = [];
// $scope.page = 0;
// $scope.pagesCount = 0;
// $http.get("http://localhost:8081/quan-tri/danh-sach-du-an/" + $scope.page + "/2").then(successCallback, errorCallback);
//
// function successCallback(response) {
// console.log(response.data);
// {
// $scope.listProject = response.data.lstResult;
// $scope.page = response.data.page;
// $scope.pagesCount = response.data.totalPage;
// $scope.totalCount = response.data.totalItem;
// }
// }
//
// function errorCallback(error) {
// //error code
// console.log("can't get data!!");
// }
// };
// tạo controllers insert API
function insertProject($scope, $http, $state) {
$scope.insert_project = function () {
$http({
......
<div class="card-header">
<i class="fas fa-table"></i> Sửa Dự Án
</div>
<div class="card-body">
<div class="container">
<form ng-controller="updateProject" ng-submit="updateProject(project)" name="formProject">
<label>Tên Dự Án</label>
<input type="text" ng-model="project.name" id="name"
placeholder="Tên Dự Án"
required="required" autofocus="autofocus" name="txtName"><br/>
<label>Mô tả ngắn</label>
<input type="text" ng-model="project.descriptions" id="descriptions"
placeholder="Mô tả ngắn"
required="required" name="txtDescriptions"><br/>
<select ng-model="project.status" autofocus="autofocus"
required="required">
<option value="">==> Trạng Thái</option>
<option value="0">Dự Kiến</option>
<option value="1">Đang Tiến Hành</option>
<option value="2">Đã Hoàn Thành</option>
</select><br/>
<input type="hidden" ng-model="project.id" id="id"><br/>
<H1 style="text-align: center">Cập nhật dự án dự án<h1>
<div class="form-row">
<div class="col">
<label>Tên Dự Án</label>
<input type="text" maxlength="29" ng-model="project.name" required="required"/>
<label>Mô tả ngắn</label>
<input type="text" maxlength="29" ng-model="project.descriptions" required="required"/>
<label>Trạng Thái</label>
<select ng-model="project.status" autofocus="autofocus"
required="required">
<option value="">==> Trạng Thái</option>
<option value="0">Dự Kiến</option>
<option value="1">Đang Tiến Hành</option>
<option value="2">Đã Hoàn Thành</option>
</select><br/>
<input type="hidden" ng-model="project.id" id="id"><br/>
</div>
</div>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
......@@ -26,4 +28,5 @@
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body">
<div class="table-responsive" >
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<div class="container">
<div class="row">
<div class="col-md-8">
<tr>
<td><a ui-sref="addproject" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h4></h4>
<tr></tr>
<input type="text" ng-model="search" placeholder="Search">
<tr></tr>
<h2>Thông tin dự án</h2>
<table class="table">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Mô tả ngắn</th>
<th>Ngày bắt đầu</th>
<th>Hạn giao</th>
<th>Trạng Thái</th>
<th>Thao Tác</th>
<th style="width: 200px">Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="project in pageListProject|filter:search">
<tr class="vide"
ng-repeat="project in pageListProject|filter:search">
<td>{{ project.name }}</td>
<td>{{ project.descriptions }}</td>
<td>{{ project.startDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.endDate | date:"dd/MM/yyyy" }}</td>
<td>
<span ng-if="project.status == 0" style="color: #34ce57">Dự Kiến</span>
<span ng-if="project.status == 1" style="color: #0e90d2">Đang Tiến Hành</span>
<span ng-if="project.status == 2" style="color: #b21f2d" >Hoàn Thành</span>
<span ng-if="project.status == 1" style="color: #0e90d2">Đang Tiến Hành</span>
<span ng-if="project.status == 2" style="color: #b21f2d">Hoàn Thành</span>
</td>
<!-- thao tác-->
<td style="width: 200px">
<a ui-sref="groupProjectByProjectId({ID: project.id})" class="btn btn-info btn-circle btn-sm">
Xem </a>
<a ui-sref="editproject({ID: project.id})">
<button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="deleteProject" data-ng-click="deleteProject(project.id)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
<td><a ui-sref="groupProjectByProjectId({ID: project.id})" class="btn btn-info btn-circle btn-sm">
Xem </a>
<a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm">
Sửa </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="deleteProject"
data-ng-click="deleteProject(project.id)">Xóa</a>
</tr>
</tbody>
</table>
<a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm Dự Án Mới</a>
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div>
</div>
<!-- <pager-directive page="{{page}}" custom-path="{{customPath}}" pages-count="{{pagesCount}}" total-count="{{totalCount}}" search-func="getProject(page)"></pager-directive>-->
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Thành viên thiếu TimeSheet
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="updateTimeSheetCheckedController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Ảnh</th>
<th>Username</th>
<th>Họ và tên</th>
<th>Địa chỉ email</th>
<th>SDT</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="emp in employeesList|filter:search">
<td>{{$index+1}}</td>
<td>{{emp.picture}}</td>
<td>{{emp.firstName+" "+emp.lastName}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.phoneNumber}}</td>
<td><a ui-sref="" class="btn btn-info btn-circle btn-sm">Xem </a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Thành viên thiếu TimeSheet
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="listEmployeeLackController">
<form>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;"> <br>
<div ng-show="detail">
<div>
Số lần thiếu báo cáo: {{listEmployeeLackDetails.numberOflack}}
</div>
<div>
<table class="table table-bordered" id="" width="100%" cellspacing="0">
<tbody>
<tr>
<th>Ngày thiếu:</th>
<td data-ng-repeat="dt in listEmployeeLackDetails.timeSheetList" >{{dt.createdAt | date:"dd/MM/yyyy"}} </td>
</tr>
</tbody>
</table>
</div>
</div>
<div ng-show="inputDate">
<label for="startDate">Ngày Bắt Đầu</label>
<input type="date" ng-model="request.firstDate" id="startDate" class="form-control"
placeholder="điểm đầu" required="required" style="width: auto">
<label for="endDate">Ngày Kết Thúc</label>
<input type="date" ng-model="request.finalDate" id="endDate" class="form-control"
placeholder="điểm cuối" required="required" style="width: auto">
</div>
<div>
<a ng-click="listEmployeeLacks($stateParams.ID,request.firstDate, request.finalDate)" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" ng-show="show"> Hiển thị </a>
<a ng-click="cancelView()" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" ng-show="cancel"> Đóng </a>
</div>
</form>
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Ảnh</th>
<th>Username</th>
<th>Họ và tên</th>
<th>Địa chỉ email</th>
<th>SDT</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="emp in listEmployee|filter:search">
<td>{{$index+1}}</td>
<td>{{emp.picture}}</td>
<td>{{emp.firstName+" "+emp.lastName}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.phoneNumber}}</td>
<td><a ng-click="listEmployeeLackDetail(emp.id)" class="btn btn-info btn-circle btn-sm">Xem </a></td>
</tr>
</tbody>
</table>
<div><a ng-click="history.go(-1);" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" > Trở Về</a></div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<!--<div class="container">-->
<!-- <div class="row">-->
<!-- <div class="col-md-8">-->
<!-- <div>-->
<!-- <legend>Employee Details</legend>-->
<!-- <table>-->
<!-- <tr>-->
<!-- <td><label>User Name</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="emp.username"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>First Name</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="emp.firstName"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Last Name</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="emp.lastName"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label id="email" for="email">Email</label> </td>-->
<!-- <td>-->
<!-- <input type="email" maxlength="150" ng-model="emp.emailAddress"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Phone</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="10" value="" ng-model="emp.phoneNumber"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>education:</label></td>-->
<!-- <td>-->
<!-- <input ng-model="emp.education"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label >home town:</label></td>-->
<!-- <td> <input type="text" ng-model="emp.homeTown"/></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td></td>-->
<!-- <td>-->
<!-- <input type="submit" name="submit" value="submit" ng-click="save();"/>-->
<!-- <input type="submit" name="clear" value="clear" ng-click=" emp = null"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<!-- </div>-->
<!-- <div>-->
<!-- <table class="table">-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <th>ID</th>-->
<!-- <th>User Name</th>-->
<!-- <th>First Name</th>-->
<!-- <th>Last Name</th>-->
<!-- <th>EmailAddress</th>-->
<!-- <th>Phone</th>-->
<!-- <th>Education</th>-->
<!-- <th>Home Town</th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<!-- <tr class="vide" ng-repeat="emp in employess">-->
<!-- <td>{{$index + 1}}</td>-->
<!-- <td>{{emp.username}}</td>-->
<!-- <td>{{emp.firstName}}</td>-->
<!-- <td>{{emp.lastName}}</td>-->
<!-- <td>{{emp.emailAddress}}</td>-->
<!-- <td>{{emp.phoneNumber}}</td>-->
<!-- <td>{{emp.education}}</td>-->
<!-- <td>{{emp.homeTown}}</td>-->
<!-- <td><a href="#" ng-click="update(emp);">Update</a>-->
<!-- <td><a href="#" confirmed-click="delete(employee);" ng-confirm-click=" Do you want to delete this user?">Delete</a></td>-->
<!-- </tr>-->
<!-- </tbody>-->
<!-- </table>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
// /**
// *
// */
// angular.module("myApp").controller("employeeController", function($scope, $http,$window) {
// console.log("Employee controller");
//
// $scope.emp= {
// "username": "",
// "password": "",
// "firstName": "",
// "lastName": "",
// "emailAddress": "",
// "phoneNumber": "",
// "homeTown": "",
// "education": ""
// };
//
//
//
// $scope.save = save;
//
// function save(){
// console.log($scope.emp);
// $http({
// method : 'POST',
// url : "http://localhost:8080/list_employee/",
// data: $scope.emp
// }).then(function successCallback(response) {
// console.log(response);
// $window.location.href ='http://localhost:8080/#/tintuc';
// }, function errorCallback(response) {
// console.log(response)
// });
// }
// $scope.update = update;
// function update(employee){
// $scope.employee = employee;
// list_employee();
// }
// $scope.deleteEmployee = function (employee) {
// $http({
// method : 'DELETE',
// url : 'http://localhost:8080/employee/' + employee.id
// }).then(_success, _error);
// }
//
//
// $http({
// method : 'GET',
// url : "http://localhost:8080/list_employee/",
// }).then(function successCallback(response) {
// console.log(response)
// $scope.employess=response.data;
// }, function errorCallback(response) {
// console.log(response)
// });
// });
\ No newline at end of file
var app = angular.module('myApp');
app.controller('reportController',projectList);
app.controller('timeSheetListController' , timeSheetList);
app.controller('updateTimeSheetStatusController',updateTimeSheetStatus);
app.controller('updateTimeSheetCheckedController', updateTimeSheetChecked);
app.controller('listLackOfReportController',employeeList);
app.controller('insertProjectReportController', insertProjectReport);
app.controller('allProjectReportController',allProjectReport);
app.controller('projectReportDetailController', projectReportDetail);
app.controller('deleteReportController',deleteReport);
app.controller('listEmployeeLackController',listEmployeeLack);
// app.controller('listEmployeeLackDetailController',listEmployeeLackDetail);
// Danh sách các dự án đang triển khai
function projectList($scope, $http) {
$http({
method: 'GET',
url:"http://localhost:8081/admin/report/project",
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.projects = response.data;
}, function errorCallback(response) {
console.log(response)
});
}
//======================================================================================================================
// Danh Sách Báo cáo ngày của dự án đó
function timeSheetList($scope, $http, $stateParams){
$scope.request = {
"currentDate": ""
};
var date = new Date();
$scope.request.currentDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/"+$stateParams.ID+"/timeSheet/"+$scope.request.currentDate,
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.timeSheets= response.data;
console.log($scope.timeSheets);
}, function errorCallback(error) {
console.log(error)
});
}
function updateTimeSheetStatus($scope, $window, $http) {
$scope.request = {
"currentDate": ""
};
var date = new Date();
$scope.request.currentDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
$scope.updateTimeSheetStatus = function (id) {
if (confirm("Bạn có muốn thực hiện ?")) {
$http({
method: 'POST',
url: "http://localhost:8081/admin/report/project/" + id + "/update/" + $scope.request.currentDate,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.timeSheetsMessages=response.data;
alert($scope.timeSheetsMessages.view);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("Update False !!!");
}
}
};
};
function updateTimeSheetChecked($scope, $window, $http) {
$scope.updateTimeSheetChecked = function (id, check) {
if (confirm("Bạn có muốn thực hiện ?")) {
$http({
method: 'POST',
url: "http://localhost:8081/admin/report/project/timeSheet/update/" + id ,
data: check,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.timeSheetsMessages=response.data;
alert($scope.timeSheetsMessages.view);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("UPDATE FALSE !!!");
}
}
};
};
// Danh Sách Các Thành viên Thiếu Báo Cáo Ngày Của Dự Án
function employeeList($scope, $http, $stateParams){
$scope.request = {
"currentDate": ""
};
var date = new Date();
$scope.request.currentDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
console.log($scope.request.currentDate);
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/"+$stateParams.ID+"/employee/"+$scope.request.currentDate,
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.employeesList= response.data;
console.log($scope.employeesList);
}, function errorCallback(response) {
console.log(response)
});
}
//======================================================================================================================
function insertProjectReport($scope, $window, $http) {
$scope.insertReport = function (id, firstDate, finalDate) {
$scope.request = {
"projectId": id,
"firstPoint": "",
"finalPoint": ""
}
$scope.request.firstPoint = firstDate.getFullYear() + '-' + ('0' + (firstDate.getMonth() + 1)).slice(-2) + '-' + ('0' + firstDate.getDate()).slice(-2);
$scope.request.finalPoint = finalDate.getFullYear() + '-' + ('0' + (finalDate.getMonth() + 1)).slice(-2) + '-' + ('0' + finalDate.getDate()).slice(-2);
if (confirm("Bạn có muốn thực hiện ?")) {
$http({
method: 'POST',
url: "http://localhost:8081/admin/report/project/newReport",
data: $scope.request,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.messages=response.data;
alert($scope.messages.view);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("Create FALSE !!!");
}
}
};
};
function allProjectReport($scope, $http, $stateParams){
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/"+$stateParams.ID +"/allReport",
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.ProjectReports= response.data;
console.log($scope.ProjectReports);
}, function errorCallback(response) {
console.log(response)
});
}
function projectReportDetail($scope, $http, $stateParams){
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/report/"+$stateParams.ID,
headers: {
'Content-Type': 'application/json'
}
}).then(function successCallback(response) {
console.log(response);
$scope.projectReportDetails= response.data;
console.log($scope.projectReportDetails);
}, function errorCallback(response) {
console.log(response)
});
}
function deleteReport($scope, $window, $http, $state) {
$scope.deleteReport = function (id) {
if (confirm("Bạn có muốn xóa ?")) {
$http({
method: 'POST',
url: "http://localhost:8081/admin/report/project/report/delete/" + id,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.messages=response.data;
$state.reload();
alert($scope.messages.view);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("Delete FALSE !!!");
}
}
};
};
//======================================================================================================================
function listEmployeeLack($scope, $window, $http, $stateParams) {
//button setting
$scope.inputDate = true;
$scope.cancel = false;
$scope.show = true;
$scope.detail = false;
//Date
$scope.request = {
"firstPoint": "",
"finalPoint": ""
}
$scope.listEmployeeLacks = function (id, firstDate, finalDate) {
$scope.request.firstPoint = firstDate.getFullYear() + '-' + ('0' + (firstDate.getMonth() + 1)).slice(-2) + '-' + ('0' + firstDate.getDate()).slice(-2);
$scope.request.finalPoint = finalDate.getFullYear() + '-' + ('0' + (finalDate.getMonth() + 1)).slice(-2) + '-' + ('0' + finalDate.getDate()).slice(-2);
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/" + $stateParams.ID + "/employee/" + $scope.request.firstPoint + "/" + $scope.request.finalPoint,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.listEmployee = response.data;
console.log($scope.listEmployee);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log(error);
}
};
$scope.listEmployeeLackDetail = function (employeeId) {
//button setting
$scope.inputDate = false;
$scope.cancel = true;
$scope.show = false;
$scope.detail = true;
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/" + $stateParams.ID + "/employee/" + employeeId + "/" + $scope.request.firstPoint + "/" + $scope.request.finalPoint,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.listEmployeeLackDetails = response.data;
console.log($scope.listEmployeeLackDetails);
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log(error);
}
};
$scope.cancelView = function(){
$scope.inputDate = true;
$scope.cancel = false;
$scope.show = true;
$scope.detail = false;
};
};
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Báo cáo chi tiết
</div>
<div class="card-body" ng-controller="projectReportDetailController">
<div>
<h4>Tên Dự Án:</h4><br>
<p>{{projectReportDetails.projectName}}</p>
<h4>Team Leader</h4>
<p>{{projectReportDetails.teamLeader}}</p>
<h4>Số Thành Viên</h4>
<p>{{projectReportDetails.numberOfMember}}</p>
<h4>Điểm</h4>
<p>{{projectReportDetails.calendarEffort}}</p>
<h4>Số Thành Viên Thiếu Báo Cáo</h4>
<p>{{projectReportDetails.lackOfReport}}</p>
<h4>Khoảng Thời Gian</h4>
<p>{{projectReportDetails.firstDate}} --> {{projectReportDetails.firstDate}}</p>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh sách báo cáo theo thời gian của dự án
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="allProjectReportController">
<div ng-controller="deleteReportController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{messages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tên Dự Án</th>
<th>Team Leader</th>
<th>Số Thành Viên</th>
<th>Điểm Nỗ Lực</th>
<th>Số TV Thiếu Báo Cáo</th>
<th>Thời gian</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="pr in ProjectReports|filter:search">
<td>{{$index+1}}</td>
<td>{{pr.projectName}}</td>
<td>{{pr.teamLeader}}</td>
<td>{{pr.numberOfMember}}</td>
<td>{{pr.calendarEffort}}</td>
<td>{{pr.lackOfReport}}</td>
<td>{{pr.firstDate | date:"dd/MM/yyyy"}} <br>--> {{pr.finalDate | date:"dd/MM/yyyy"}}</td>
<td><a ui-sref="reportDetail({ID: pr.id})" class="btn btn-info btn-circle btn-sm">Xem </a>
<a ng-click="deleteReport(pr.id)" class="btn btn-warning btn-circle btn-sm">Xóa </a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<!--<div class="card mb-3">-->
<!-- <div class="card-header">-->
<!-- <i class="fas fa-table"></i>Danh Sách Dự án (Đang được triển khai)-->
<!-- </div>-->
<!-- <div class="card-body">-->
<!-- <div class="table-responsive" ng-controller="reportController">-->
<!-- <div ng-controller="insertProjectReportController">-->
<!--&lt;!&ndash; <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;">&ndash;&gt;-->
<!--&lt;!&ndash; Thêm </a>&ndash;&gt;-->
<!-- <input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">-->
<!-- {{messages.view}}-->
<!-- <table class="table table-bordered" id="dataTable" width="100%"-->
<!-- cellspacing="0">-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <th>STT</th>-->
<!-- <th>Tên dự án</th>-->
<!-- <th>Mô tả</th>-->
<!-- <th>Thời gian </th>-->
<!-- <th>Trạng thái</th>-->
<!-- <th>Chọn khoảng thời gian</th>-->
<!-- <th>Menu</th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<!-- <form>-->
<!-- <tr data-ng-repeat="pro in projects|filter:search">-->
<!-- <td>{{$index+1}}</td>-->
<!-- <td>{{pro.name}}</td>-->
<!-- <td>{{pro.descriptions}}</td>-->
<!-- <td>{{pro.startDate | date:"dd/MM/yyyy"}} <br>&ndash;&gt; {{pro.endDate | date:"dd/MM/yyyy"}}</td>-->
<!-- <td>{{pro.status}}</td>-->
<!-- <td class="form-label-group" >-->
<!--&lt;!&ndash; <label for="startDate">Ngày Bắt Đầu</label>&ndash;&gt;-->
<!-- <input type="date" ng-model="request.firstDate" id="startDate" class="form-control"-->
<!-- placeholder="điểm đầu" required="required">-->
<!--&lt;!&ndash; <label for="endDate">Ngày Kết Thúc</label>&ndash;&gt;-->
<!-- <input type="date" ng-model="request.finalDate" id="endDate" class="form-control"-->
<!-- placeholder="điểm cuối" required="required">-->
<!-- </td>-->
<!-- <td>-->
<!-- <a ng-click="insertReport(pro.id, request.firstDate, request.finalDate)" class="btn btn-info btn-circle btn-sm">Thêm mới báo cáo></a><br>-->
<!-- <a ui-sref="allReport({ID: pro.id})" class="btn btn-warning btn-circle btn-sm">Danh sách báo cáo</a> <br>-->
<!-- <a ui-sref="reportEmployeeLack({ID: pro.id})" class="btn btn-danger btn-circle btn-sm" data-ng-click="">Ds thành viên thiếu báo cáo</a>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </form>-->
<!-- </tbody>-->
<!-- </table>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
<div class="container">
<div class="row" ng-controller="reportController" >
<div class="col-md-8" ng-controller="insertProjectReportController">
<h4>{{messages.view}}</h4>
<tr></tr>
<input class="search" ng-model="search" type="text" placeholder="Search" ng-change="currentPage =1">
<tr></tr>
<h2>Danh Sách Dự án (Đang được triển khai)</h2>
<table class="table">
<thead>
<tr>
<th>STT</th>
<th>Tên dự án</th>
<th>Mô tả</th>
<th>Thời gian </th>
<th>Trạng thái</th>
<th>Chọn khoảng thời gian</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr class="vide"
data-ng-repeat="pro in projects|filter:search">
<td>{{$index+1}}</td>
<td>{{pro.name}}</td>
<td>{{pro.descriptions}}</td>
<td>{{pro.startDate | date:"dd/MM/yyyy"}} <br>--> {{pro.endDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.status}}</td>
<td class="form-label-group" >
<!-- <label for="startDate">Ngày Bắt Đầu</label>-->
<input type="date" ng-model="request.firstDate" id="startDate" class="form-control"
placeholder="điểm đầu" required="required">
<!-- <label for="endDate">Ngày Kết Thúc</label>-->
<input type="date" ng-model="request.finalDate" id="endDate" class="form-control"
placeholder="điểm cuối" required="required">
</td>
<td>
<a ng-click="insertReport(pro.id, request.firstDate, request.finalDate)" class="btn btn-info btn-circle btn-sm">Thêm mới báo cáo></a><br>
<a ui-sref="allReport({ID: pro.id})" class="btn btn-warning btn-circle btn-sm">Danh sách báo cáo</a> <br>
<a ui-sref="reportEmployeeLack({ID: pro.id})" class="btn btn-danger btn-circle btn-sm" data-ng-click="">Ds thành viên thiếu báo cáo</a>
</td>
</tr>
</tbody>
</table>
<uib-pagination total-items="getTotalItems()" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pageChangedIndex()" rotate="true"
items-per-page="employeePerPage"></uib-pagination>
</div>
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Timesheet Dự án
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="updateTimeSheetCheckedController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tiêu đề</th>
<th>Nội dung</th>
<th>Ghi chú</th>
<th>Ngày tạo</th>
<th>trạng thái duyệt</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="item in timeSheets|filter:search">
<td>{{$index+1}}</td>
<td>{{item.title}}</td>
<td>{{item.content}}</td>
<td>{{item.note}}</td>
<td>{{item.createdAt | date:"dd/MM/yyyy" }}</td>
<td>
<select ng-model="item.checked" class="form-control" autofocus="autofocus" required="required">
<!-- <option value="">==> Trạng Thái</option>-->
<option value="unapproved">Chưa duyệt</option>
<option value="approved">Đã duyệt</option>
<option value="deny">Từ chối</option>
</select>
</td>
<td><a ui-sref="" class="btn btn-info btn-circle btn-sm">Xem </a>
<a ng-click="updateTimeSheetChecked(item.id, item.checked)" class="btn btn-warning btn-circle btn-sm">Duyệt </a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i>Danh Sách Dự án (Đang được triển khai)
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="reportController">
<div ng-controller="updateTimeSheetStatusController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;">-->
<!-- Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tên dự án</th>
<th>Mô tả</th>
<th>Thời gian bắt đầu</th>
<th>Thời gian kết thúc</th>
<th>Trạng thái</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="pro in projects|filter:search">
<td>{{$index+1}}</td>
<td>{{pro.name}}</td>
<td>{{pro.descriptions}}</td>
<td>{{pro.startDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.endDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.status}}</td>
<td><a ui-sref="reportTimeSheet({ID: pro.id})" class="btn btn-info btn-circle btn-sm">Ds báo cáo ngày </a><br>
<a ng-click="updateTimeSheetStatus(pro.id)" class="btn btn-warning btn-circle btn-sm">khởi tạo tv thiếu báo cáo</a> <br>
<a ui-sref="reportEmployee({ID: pro.id})" class="btn btn-danger btn-circle btn-sm" data-ng-click="">Ds thành viên thiếu báo cáo</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
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