Commit b805cf98 authored by phùng văn dung's avatar phùng văn dung

update 15/06/2019

parent 88c1bc04
......@@ -21,10 +21,12 @@
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
......@@ -52,6 +54,22 @@
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.2.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.jsonwebtoken</groupId>-->
<!-- <artifactId>jjwt</artifactId>-->
<!-- <version>0.9.1</version>-->
<!-- </dependency>-->
</dependencies>
<build>
......
......@@ -11,5 +11,4 @@ public class QuantrivanphongApplication {
public static void main(String[] args) {
SpringApplication.run(QuantrivanphongApplication.class, args);
}
}
package com.itsol.quantrivanphong.access.login.bussiness;
import com.itsol.quantrivanphong.report.issue.common.WrapperResultObject;
public interface LoginBussiness {
WrapperResultObject checkUserAndPass(String username, String passworld);
}
package com.itsol.quantrivanphong.access.login.bussiness;
import com.itsol.quantrivanphong.access.login.repository.EmployeeRepositorys;
import com.itsol.quantrivanphong.access.login.repository.EmployeeRoleRepository;
import com.itsol.quantrivanphong.access.login.repository.LoginRepositoy;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.EmployeeRole;
import com.itsol.quantrivanphong.report.issue.common.WrapperResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class LoginBussunessImpl implements LoginBussiness {
@Autowired
private LoginRepositoy loginRepositoy;
@Autowired
private EmployeeRoleRepository employeeRoleRepository;
@Autowired
private EmployeeRepositorys employeeRepositorys;
@Override
public WrapperResultObject checkUserAndPass(String username, String password) {
String views = "";
int status = 113;
List<String> lstRole = new ArrayList<String>();
String Role = null;
Employee login = loginRepositoy.findEmployeeByUsernameAndPassword(username, password);
if (login != null) {
Employee userId = employeeRepositorys.findEmployeeByUsername(username);
lstRole = findRoleNameByUserId(userId.getId());
Role = lstRole.get(0);
status = 200;
views = "Chúc mừng bạn dăng nhập thành công!";
} else {
views = "Mật khẩu hoặc pass không đúng!";
}
return new WrapperResultObject(status, views,lstRole,Role);
}
public List<String> findRoleNameByUserId(Integer userId) {
List<String> lst = new ArrayList<>();
List<EmployeeRole> lstUR = employeeRoleRepository.findByEmployeeId(userId);
for (EmployeeRole employeeRole : lstUR) {
lst.add(employeeRole.getRole().getRoleCode());
}
return lst;
}
}
package com.itsol.quantrivanphong.access.login.controller;
import com.itsol.quantrivanphong.access.login.bussiness.LoginBussiness;
import com.itsol.quantrivanphong.report.issue.common.WrapperResultObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class LoginControllers {
@Autowired
private LoginBussiness loginBussiness;
@PostMapping(value = "qtvp/login")
public ResponseEntity Login(@RequestBody LoginDTO loginDTO){
WrapperResultObject wrapperResult = loginBussiness.checkUserAndPass(loginDTO.getUsername(),loginDTO.getPassworld());
return ResponseEntity.ok(wrapperResult);
}
}
package com.itsol.quantrivanphong.access.login.controller;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class LoginDTO {
private String username;
private String passworld;
}
package com.itsol.quantrivanphong.access.login.repository;
import com.itsol.quantrivanphong.model.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
public interface EmployeeRepositorys extends JpaRepository<Employee,Integer> {
Employee findEmployeeByUsername(String username);
}
package com.itsol.quantrivanphong.access.login.repository;
import com.itsol.quantrivanphong.model.EmployeeRole;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface EmployeeRoleRepository extends JpaRepository<EmployeeRole,Integer> {
// tìm kiếm danh sách Role theo UserId
List<EmployeeRole> findByEmployeeId(Integer userId);
}
package com.itsol.quantrivanphong.access.login.repository;
import com.itsol.quantrivanphong.model.Employee;
import org.springframework.data.jpa.repository.JpaRepository;
public interface LoginRepositoy extends JpaRepository<Employee,Integer> {
Employee findEmployeeByUsernameAndPassword(String username,String passWorld);
}
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 phân theo trang
List<ProjectDTO> findProjectPage(String property, Object value, String sortExperssion, String sortDirection, Integer offset, Integer limit);
// 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.text.SimpleDateFormat;
import java.util.ArrayList;
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> findProjectPage(String property, Object value, String sortExperssion, String sortDirection, Integer offset, Integer limit) {
List<ProjectDTO> projectDTOList = new ArrayList<ProjectDTO>();
Object[] objects = projectRepository.getEntityPage(property,value,sortExperssion,sortDirection,offset,limit);
projectDTOList = lstDTO((List<Project>) objects[1]);
return projectDTOList;
}
@Override
public List<ProjectDTO> findAllProject() {
try {
return lstDTO(projectRepository.finAllEntity());
return lstDTO(projectRepository.findAll());
} catch (Exception e) {
logger.info("Lỗi findAll " + e.getMessage());
}
......@@ -37,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";
......@@ -56,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.setStatus(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;
}
......@@ -91,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) {
......
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.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
......@@ -18,74 +18,32 @@ public class ProjectController {
@Autowired
private ProjectBussiness projectBussiness;
@GetMapping(value = "/danh-sach-du-an/{offset}/{limit}")
public ResponseEntity<List<ProjectDTO>> getProjectPage(@PathVariable("offset") Integer offset,@PathVariable("limit") Integer limit){
return ResponseEntity.ok(projectBussiness.findProjectPage(null,null,null,null,offset,limit));
}
@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(new WrapperResult(200, 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(new WrapperResult(200, 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(new WrapperResult(200, views));
}
static 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;
}
WrapperResult wrapperResult = projectBussiness.deleteProjectById(projectDTO.getId());
return ResponseEntity.ok(wrapperResult);
}
}
package com.itsol.quantrivanphong.manager.project.project.repository;
import com.itsol.quantrivanphong.report.issue.common.GennericeEntityManagerDao;
import com.itsol.quantrivanphong.model.Project;
public interface ProjectRepository extends GennericeEntityManagerDao<Integer, Project> {
}
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ành viên out dự án
String deleteEmployeeProject(Integer id);
// 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 {
Logger logger = Logger.getLogger(ProjectGroupBussinessImpl.class);
private Logger logger = Logger.getLogger(ProjectGroupBussinessImpl.class);
@Autowired
private ProjectGroupRepository projectGroupRepository;
......@@ -23,94 +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) {
logger.info("getGroupByProjectId");
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;
List<Eproject> lstModels = projectGroupRepository.findByProjectId(projectId);
List<ProjectGroupDTO> lstDTO = utils.getListDTO(lstModels);
return lstDTO;
}
public boolean checkEmployeeInGroupProject(ProjectGroupDTO dto){
List<Eproject> lst = projectGroupRepository.finByProperty("project",projectRepository.findByEmtityId(dto.getProjectId()),null,null);
for (Eproject eproject:lst) {
if(eproject.getEmployee().getId()==dto.getUserId()){
return true;
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) {
logger.info("saveEmployeeProject");
public WrapperResult saveEmployeeProject(ProjectGroupDTO dto) {
String views = "";
if(!checkEmployeeInGroupProject(dto)) {
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 {
projectGroupRepository.saveEntity(utils.Model(dto));
views = "thêm thành công nhân viên vào nhóm dự án";
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) {
views = "thêm không thành công!";
logger.info("Lỗi " + e.getMessage());
}
}else {
} 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) {
public WrapperResult updateEmployeeProject(ProjectGroupDTO dto) {
String views = "";
int status = 113;
logger.info("updateEmployeeProject");
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";
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) {
logger.info("outProjectGroup");
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 views;
return new WrapperResult(status, views);
}
@Override
public String deleteEmployeeProject(Integer id) {
logger.info("deleteEmployeeProject");
public WrapperResult updateEmployeeOutGroup(ProjectGroupDTO dto) {
String views = "";
int count=0;
count = projectGroupRepository.deleteEntityByID(id);
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("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.manager.project.project.controller.ProjectController;
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 {
......@@ -18,64 +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(new WrapperResult(200, 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")
public ResponseEntity deleteMembersProject(@RequestBody ProjectGroupDTO projectGroupDTO){
String views = projectGroupBussiness.outProjectGroup(projectGroupDTO.getIds());
return ResponseEntity.ok(views);
@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.deleteEmployeeProject(projectGroupDTO.getId());
return ResponseEntity.ok(new WrapperResult(200, views));
}
static 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;
}
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;
......@@ -34,6 +31,9 @@ public class Eproject {
@Column(name = "out_date",nullable = true)
private Timestamp outDate;
@Column(name = "status",nullable = false)
private int status;
@ManyToOne(fetch = FetchType.EAGER)
private Employee employee;
......
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
......@@ -17,7 +20,7 @@ public class Issues {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false, unique = true)
private int id;
private Integer id;
// tiêu đề liên quan
@Column(name = "title")
private String title;
......@@ -26,8 +29,15 @@ public class Issues {
private String actionCode;
// 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<IssuesComment>();
}
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 int userCreate;
@Column(name = "createdate")
private Timestamp createDate;
@ManyToOne(fetch = FetchType.EAGER)
private Issues issues;
}
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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AbstractDao<T> {
private List<T> lstResult = new ArrayList<T>();
// Số page đang đứng
private Integer page;
// Tổng sô page trong 1 item
private Integer maxPageItem;
// Tổng số page hiện tại
private Integer totalPage;
// Tổng số item
private Integer totalItem;
// kiểu sort
private String sortName;
// sort theo
private String sortBy;
}
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.Query;
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 {
if (entityManager != null) {
entityManager.close();
}
}
return list;
}
@Override
public Object[] getEntityPage(String property, Object value, String sortExperssion, String sortDirection, Integer offset, Integer limit) {
List<T> list = new ArrayList<T>();
Object totalItem = 0;
try {
entityManager = entityManagerFactory.createEntityManager();
entityManager.getTransaction().begin();
// HQL
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);
if (value != null) {
query1.setParameter(1,value);
}
if(offset!=null &&offset>=0){
query1.setFirstResult(offset);
}
if(limit!=null && limit>0){
query1.setMaxResults(limit);
}
list = query1.getResultList();
// số phần tử trong list
// StringBuilder sql2 = new StringBuilder("Select count(*) from ");
// sql2.append(getPersistenceClass());
// if (value != null && property != null) {
// sql2.append(" where ").append(property).append("= ?1");
// }
// TypedQuery<T> query2 = entityManager.createQuery(sql2.toString(),persistenceClass);
// if (value != null) {
// query2.setParameter(1,value);
// }
//
//// trả về size
totalItem = finAllEntity().size();
entityManager.getTransaction().commit();
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return new Object[]{totalItem, 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);
Object[] getEntityPage(String property, Object value, String sortExperssion, String sortDirection,Integer offset, Integer limit);
// Integer getCount();
}
package com.itsol.quantrivanphong.report.issue.common;
public interface Pageble {
Integer getPage();
Integer getOffset();
Integer getLimit();
Sorter getSorter();
}
package com.itsol.quantrivanphong.report.issue.common;
public class PagebleRequest implements Pageble {
private Integer page;
private Integer maxPageItem;
private Sorter sorter;
@Override
public Integer getPage() {
return this.page;
}
public PagebleRequest(Integer page, Integer maxPageItem, Sorter sorter) {
this.page = page;
this.maxPageItem = maxPageItem;
this.sorter = sorter;
}
@Override
public Integer getOffset() {
// tính vị trí đầu của 1 page
if (this.page != null && this.maxPageItem != null) {
return ((this.page - 1) * this.maxPageItem);
}
return null;
}
@Override
public Integer getLimit() {
return (this.getOffset() + this.maxPageItem);
}
@Override
public Sorter getSorter() {
return this.sorter;
}
}
package com.itsol.quantrivanphong.report.issue.common;
public class Sorter {
private String sortName;
private String sortBy;
public Sorter(String sortName, String sortBy) {
this.sortName = sortName;
this.sortBy = sortBy;
}
public String getSortName() {
return sortName;
}
public void setSortName(String sortName) {
this.sortName = sortName;
}
public String getSortBy() {
return sortBy;
}
public void setSortBy(String sortBy) {
this.sortBy = sortBy;
}
}
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 AbstractPage<T> {
// tổng số item trong 1 trang
private int maxPageItems;
// tổng số item trả về list đó
private int totalItems=0;
// phần tử cuối cùng của 1 trang
private int firstItem=0;
private String sortExpression;
private String sortDirection;
// vị trí trang đang đứng
private int page = 1;
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.security;
//
//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.itsol.quantrivanphong.access.login.dto.EmployeeDTO;
//import io.jsonwebtoken.Jwts;
//import io.jsonwebtoken.SignatureAlgorithm;
//import org.apache.log4j.Logger;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
//import org.springframework.security.core.Authentication;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
//
//import javax.servlet.FilterChain;
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.Date;
//
//public class AuthenticationFilter extends UsernamePasswordAuthenticationFilter{
// private Logger logger = Logger.getLogger(AuthenticationFilter.class);
// private final AuthenticationManager authenticationManager;
//
// public AuthenticationFilter(AuthenticationManager authenticationManager) {
// this.authenticationManager = authenticationManager;
// }
//
//// Login
// @Override
// public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response)
// throws AuthenticationException {
// try {
// EmployeeDTO userLogin = new ObjectMapper().readValue(request.getInputStream(), EmployeeDTO.class);
// return authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(
// userLogin.getUsername(), userLogin.getPassword(), new ArrayList<>()));
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// }
//
//// parse Token ra ngoài header
// @Override
// protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain,
// Authentication authResult) throws IOException, ServletException {
// String userName = ((User) authResult.getPrincipal()).getUsername();
// String token = Jwts.builder()
// .setSubject(userName).setExpiration(new Date(System.currentTimeMillis() + SecurityConstants.EXPIRATION_TIME))
// .signWith(SignatureAlgorithm.HS512, SecurityConstants.TOKEN_SECRET)
// .compact();
// response.addHeader(SecurityConstants.HEADER_STRING, SecurityConstants.TOKEN_PREFIX + token);
// }
//}
//package com.itsol.quantrivanphong.security;
//
//import io.jsonwebtoken.Jwts;
//import org.apache.log4j.Logger;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.authentication.AuthenticationManager;
//import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
//import org.springframework.security.core.context.SecurityContextHolder;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
//
//import javax.servlet.FilterChain;
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//import java.util.ArrayList;
//
//public class AuthorizationFilter extends BasicAuthenticationFilter {
//
// private Logger logger = Logger.getLogger(AuthorizationFilter.class);
//
// public AuthorizationFilter(AuthenticationManager authManager) {
// super(authManager);
// }
//
// @Autowired
// private UserDetailsServiceImpl userDetailsService;
//
// @Override
// protected void doFilterInternal(HttpServletRequest request,
// HttpServletResponse response, FilterChain chain)
// throws IOException, ServletException {
// String header = request.getHeader(SecurityConstants.HEADER_STRING);
// if(header==null||!header.startsWith(SecurityConstants.TOKEN_PREFIX)){
// chain.doFilter(request,response);
// return;
// }
// UsernamePasswordAuthenticationToken authenticationToken = getAuthentication(request);
// SecurityContextHolder.getContext().setAuthentication(authenticationToken);
// chain.doFilter(request,response);
// }
//
//
//
// private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request){
// String token = request.getHeader(SecurityConstants.HEADER_STRING);
// if(token!=null){
// token = token.replace(SecurityConstants.TOKEN_PREFIX,"");
// String user = getUsername(token);
// if(user!=null){
// try{
//// UserDetails userDetails = userDetailsService.loadUserByUsername(user);
//// return new UsernamePasswordAuthenticationToken(userDetails, "", userDetails.getAuthorities());
// return new UsernamePasswordAuthenticationToken(user,null,new ArrayList<>());
// }catch (Exception e){
// logger.info("Lỗi "+e.getMessage());
// }
// }
// }
// return null;
// }
// public String getUsername(String token) {
// return Jwts.parser()
// .setSigningKey(SecurityConstants.TOKEN_SECRET)
// .parseClaimsJws(token)
// .getBody()
// .getSubject();
// }
//}
//package com.itsol.quantrivanphong.security;
//import io.jsonwebtoken.Jwts;
//import io.jsonwebtoken.SignatureAlgorithm;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.userdetails.UserDetails;
//
//import java.util.Date;
//
//public class SecurityConstants {
// @Autowired
// private static UserDetailsServiceImpl userDetailsService;
//
// public static final String Member = "Member";
// public static final String TeamLead = "TeamLead";
// public static final String Manager = "Manager";
// public static final String HR = "HR";
//
// public static final long EXPIRATION_TIME = 860000;
// public static final String TOKEN_PREFIX ="Bearer ";
// public static final String HEADER_STRING ="Authorization";
// public static final String TOKEN_SECRET ="jf9i4jgu83nfl10";
//
//
// public static String getToken(String userName){
// String token = Jwts.builder()
// .setSubject(userName).setExpiration(new Date(System.currentTimeMillis() + SecurityConstants.EXPIRATION_TIME))
// .signWith(SignatureAlgorithm.HS512, SecurityConstants.TOKEN_SECRET)
// .compact();
// return token;
// }
//}
//package com.itsol.quantrivanphong.security;
//
//import org.springframework.beans.BeansException;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.ApplicationContextAware;
//
//public class SpringApplicationContext implements ApplicationContextAware {
// private static ApplicationContext CONTEXT;
//
// @Override
// public void setApplicationContext(ApplicationContext context) throws BeansException {
// CONTEXT = context;
// }
// public static Object getBean(String beanName){
// return CONTEXT.getBean(beanName);
// }
//}
//package com.itsol.quantrivanphong.security;
//import com.itsol.quantrivanphong.access.login.repository.EmployeeRepositorys;
//import com.itsol.quantrivanphong.access.login.repository.EmployeeRoleRepository;
//import com.itsol.quantrivanphong.model.Employee;
//import com.itsol.quantrivanphong.model.EmployeeRole;
//import org.apache.log4j.Logger;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.GrantedAuthority;
//import org.springframework.security.core.authority.SimpleGrantedAuthority;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.stereotype.Service;
//
//import java.util.ArrayList;
//import java.util.List;
//
//@Service
//public class UserDetailsServiceImpl implements UserDetailsService {
//
//
// private static Logger logger = Logger.getLogger(UserDetailsServiceImpl.class);
//
// @Autowired
// private EmployeeRepositorys employeeRepositorys;
//
// @Autowired
// private EmployeeRoleRepository employeeRoleRepository;
//
// @Override
// public UserDetails loadUserByUsername(String user) throws UsernameNotFoundException {
// Employee userModels = employeeRepositorys.findEmployeeByUsername(user);
// if (userModels == null) {
// logger.info("User not found!" + user);
// throw new UsernameNotFoundException("User " + user + " was not found in the database");
// }
// List<String> lstRole = findRoleNameByUserId(userModels.getId());
//
// List<GrantedAuthority> lstGrant = new ArrayList<GrantedAuthority>();
// if (!lstRole.isEmpty() && lstRole.size() != 0) {
// for (String role : lstRole) {
// GrantedAuthority authority = new SimpleGrantedAuthority(role);
// lstGrant.add(authority);
// }
// }
// UserDetails userDetails = (UserDetails) new User(userModels.getUsername(), encrytePassword(userModels.getPassword()), lstGrant);
// return userDetails;
// }
//// Tìm kiếm Danh sách Role theo userId
// public List<String> findRoleNameByUserId(Integer userId) {
// List<String> lst = new ArrayList<String>();
// List<EmployeeRole> lstUR = employeeRoleRepository.findByEmployeeId(userId);
// for (EmployeeRole employeeRole:lstUR) {
// lst.add(employeeRole.getRole().getRoleCode());
// }
// return lst;
// }
// public String encrytePassword(String password) {
// BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
// return encoder.encode(password);
// }
//}
//package com.itsol.quantrivanphong.security;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.HttpMethod;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.security.crypto.password.PasswordEncoder;
//
//// xác định lớp WebSecurityConfig của ta là một lớp dùng để cấu hình.
//@Configuration
////tích hợp Spring Security với Spring MVC.
//@EnableWebSecurity
//public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
//
// // interface UserDetailsService để cấu hình
// @Autowired
// private UserDetailsServiceImpl userDetailsService;
//
// //
// @Bean
// public PasswordEncoder passwordEncoder() {
// return new BCryptPasswordEncoder();
// }
//
// //
// @Autowired
// public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
// auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
// }
//
// @Override
// protected void configure(HttpSecurity http) throws Exception {
// http.csrf().disable();
//// các trang không yêu cầu login
// http
// .authorizeRequests()
// .antMatchers(HttpMethod.POST, "/login").permitAll()
// .antMatchers(HttpMethod.POST, "/register/dang-ky-tai-khoan").permitAll()
// .antMatchers(HttpMethod.GET, "/homepage/**").permitAll()
//// các trang yêu cầu login
// .antMatchers("/api/EmployeeTimekeeping/**").hasAnyRole(SecurityConstants.Member, SecurityConstants.Manager, SecurityConstants.TeamLead, SecurityConstants.HR)
// .antMatchers(HttpMethod.GET, "/api/quan-ly/danh-sach-xin-phep").hasRole(SecurityConstants.TeamLead)
// .antMatchers("/api/quan-ly/**").hasAnyRole(SecurityConstants.Manager, SecurityConstants.HR)
// .anyRequest().authenticated()
// .and().addFilter(getAuthenticationFilter())
// .addFilter(new AuthorizationFilter(authenticationManager()));
// }
//// đổi tên cổng login
// public AuthenticationFilter getAuthenticationFilter() throws Exception{
// final AuthenticationFilter filter = new AuthenticationFilter(authenticationManager());
// filter.setFilterProcessesUrl("/quan-tri-van-phong/login");
// return filter;
// }
//}
//
server.port=8081
spring.datasource.driver-class-name= com.mysql.jdbc.Driver
spring.datasource.driver-class-name= com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/qtvp_01
spring.datasource.username=root
spring.datasource.password=12345678
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
server.servlet.session.timeout=30s
# ===============================
# SEND EMAIL
# ==============================
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,21 +12,23 @@
<link href="common/css/all.min.css" rel="stylesheet"
type="text/css">
<!-- Page level plugin CSS-->
<link href="common/css/dataTables.bootstrap4.css"
rel="stylesheet">
<!-- Custom styles for this template-->
<link href="common/css/sb-admin.css" rel="stylesheet">
<!-- angular -->
<script src="js/angular.js"></script>
<script src="js/angular-ui-router.min.js"></script>
<script src="js/app.js"></script>
<script src="pages/project/groupproject/groupProjectController.js"></script>
<link rel="stylesheet" href="css/bootstrap-combined.min.css">
<script data-require="angular-ui-bootstrap@0.3.0" data-semver="0.3.0" src="js/ui-bootstrap-tpls-0.3.0.min.js"></script>
<script src="pages/issue/IssueController.js"></script>
<script src="pages/issue/IssueAddControlelr.js"></script>
<script src="pages/issue/IssuesDeleteController.js"></script>
<script src="pages/issue/IssuesDetailController.js"></script>
</head>
<body ng-app="myApp">
......@@ -35,11 +37,13 @@
<!-- Js -->
<!-- Bootstrap core JavaScript-->
<script src="pages/project/groupproject/groupProjectViewController.js"></script>
<script src="pages/project/project/projectViewController.js"></script>
<script src="pages/project/directives/pagerDirective.js"></script>
<script src="pages/employee/employeeController.js"></script>
<script src="pages/project/project/projectController.js"></script>
<script src="pages/login/loginsController.js"></script>
<script src="pages/adminhome/admin.js"></script>
<script src="common/js/jquery.min.js"></script>
<script src="common/js/bootstrap.bundle.min.js"></script>
......
/**
*
*/
angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
angular.module("myApp", ["ui.router","ui.bootstrap"]).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix('');
//trở về trang mặc định
$urlRouterProvider.otherwise("/admin");
$urlRouterProvider.otherwise("/admin-home");
$stateProvider
.state("layout3", {
......@@ -24,13 +24,12 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
}
}
})
.state("admin", {
.state("admin-home", {
parent: 'layout3',
url: "/admin",
url: "/admin-home",
views: {
"content": {
templateUrl: "pages/adminhome/admin-home.html",
controller:"adminController"
}
}
})
......@@ -74,16 +73,18 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
}
}
})
//danh sách các dự án
.state("project", {
parent: 'layout3',
url: "/project",
views: {
"content": {
templateUrl: "pages/project/project/projectListViews.html",
controller: "showProject"
controller: "projectViewsController"
}
}
})
//thêm mới dự án
.state("addproject", {
parent: 'layout3',
url: "/addproject",
......@@ -94,6 +95,7 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
}
}
})
//sửa thông tin dự án
.state("editproject", {
parent: 'layout3',
url: "/editproject/:ID",
......@@ -104,16 +106,19 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
}
}
})
//danh sách thành viên trong nhóm dự án
.state("groupProjectByProjectId", {
parent: 'layout3',
url: "/groupProjectByProjectId/:ID",
params: {ID: null},
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectView.html",
controller: "loadGroupProjectByProjectId"
controller: "groupProjectShowController"
}
}
})
//thêm thành viên vào nhóm dự án
.state("addEmployeeProject", {
parent: 'layout3',
url: "/addEmployeeProject",
......@@ -124,4 +129,48 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
}
}
})
//sửa thông tin nhân viên trong nhóm
.state("editEmployeeProject", {
parent: 'layout3',
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: 'layout3',
url: "/issues",
views: {
"content": {
templateUrl: "pages/issue/IssueView.html",
controller: "IssuesShowController"
}
}
})
// thêm mới issues
.state("addIssues", {
parent: 'layout3',
url: "/addIssues",
views: {
"content": {
templateUrl: "pages/issue/IssueAdd.html",
controller: "IssuesAddController"
}
}
})
// thêm mới issues
.state("IssuesComment", {
parent: 'layout3',
url: "/issuescomment/:IssuesId",
views: {
"content": {
templateUrl: "pages/issue/IssueDetailViews.html",
controller: "loadIssuesDetail"
}
}
})
});
angular.module("ui.bootstrap",["ui.bootstrap.tpls","ui.bootstrap.transition","ui.bootstrap.collapse","ui.bootstrap.accordion","ui.bootstrap.alert","ui.bootstrap.buttons","ui.bootstrap.carousel","ui.bootstrap.dialog","ui.bootstrap.dropdownToggle","ui.bootstrap.modal","ui.bootstrap.pagination","ui.bootstrap.position","ui.bootstrap.tooltip","ui.bootstrap.popover","ui.bootstrap.progressbar","ui.bootstrap.rating","ui.bootstrap.tabs","ui.bootstrap.typeahead"]),angular.module("ui.bootstrap.tpls",["template/accordion/accordion-group.html","template/accordion/accordion.html","template/alert/alert.html","template/carousel/carousel.html","template/carousel/slide.html","template/dialog/message.html","template/pagination/pagination.html","template/tooltip/tooltip-html-unsafe-popup.html","template/tooltip/tooltip-popup.html","template/popover/popover.html","template/progressbar/bar.html","template/progressbar/progress.html","template/rating/rating.html","template/tabs/pane.html","template/tabs/tabs.html","template/typeahead/typeahead.html"]),angular.module("ui.bootstrap.transition",[]).factory("$transition",["$q","$timeout","$rootScope",function(t,e,n){function o(t){for(var e in t)if(void 0!==i.style[e])return t[e]}var a=function(o,i,r){r=r||{};var l=t.defer(),s=a[r.animation?"animationEndEventName":"transitionEndEventName"],c=function(){n.$apply(function(){o.unbind(s,c),l.resolve(o)})};return s&&o.bind(s,c),e(function(){angular.isString(i)?o.addClass(i):angular.isFunction(i)?i(o):angular.isObject(i)&&o.css(i),s||l.resolve(o)}),l.promise.cancel=function(){s&&o.unbind(s,c),l.reject("Transition cancelled")},l.promise},i=document.createElement("trans"),r={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"},l={WebkitTransition:"webkitAnimationEnd",MozTransition:"animationend",OTransition:"oAnimationEnd",transition:"animationend"};return a.transitionEndEventName=o(r),a.animationEndEventName=o(l),a}]),angular.module("ui.bootstrap.collapse",["ui.bootstrap.transition"]).directive("collapse",["$transition",function(t){var e=function(t,e,n){e.removeClass("collapse"),e.css({height:n}),e[0].offsetWidth,e.addClass("collapse")};return{link:function(n,o,a){var i,r=!0;n.$watch(function(){return o[0].scrollHeight},function(){0!==o[0].scrollHeight&&(i||(r?e(n,o,o[0].scrollHeight+"px"):e(n,o,"auto")))}),n.$watch(a.collapse,function(t){t?u():c()});var l,s=function(e){return l&&l.cancel(),l=t(o,e),l.then(function(){l=void 0},function(){l=void 0}),l},c=function(){r?(r=!1,i||e(n,o,"auto")):s({height:o[0].scrollHeight+"px"}).then(function(){i||e(n,o,"auto")}),i=!1},u=function(){i=!0,r?(r=!1,e(n,o,0)):(e(n,o,o[0].scrollHeight+"px"),s({height:"0"}))}}}}]),angular.module("ui.bootstrap.accordion",["ui.bootstrap.collapse"]).constant("accordionConfig",{closeOthers:!0}).controller("AccordionController",["$scope","$attrs","accordionConfig",function(t,e,n){this.groups=[],this.closeOthers=function(o){var a=angular.isDefined(e.closeOthers)?t.$eval(e.closeOthers):n.closeOthers;a&&angular.forEach(this.groups,function(t){t!==o&&(t.isOpen=!1)})},this.addGroup=function(t){var e=this;this.groups.push(t),t.$on("$destroy",function(){e.removeGroup(t)})},this.removeGroup=function(t){var e=this.groups.indexOf(t);-1!==e&&this.groups.splice(this.groups.indexOf(t),1)}}]).directive("accordion",function(){return{restrict:"EA",controller:"AccordionController",transclude:!0,replace:!1,templateUrl:"template/accordion/accordion.html"}}).directive("accordionGroup",["$parse","$transition","$timeout",function(t){return{require:"^accordion",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/accordion/accordion-group.html",scope:{heading:"@"},controller:["$scope",function(){this.setHeading=function(t){this.heading=t}}],link:function(e,n,o,a){var i,r;a.addGroup(e),e.isOpen=!1,o.isOpen&&(i=t(o.isOpen),r=i.assign,e.$watch(function(){return i(e.$parent)},function(t){e.isOpen=t}),e.isOpen=i?i(e.$parent):!1),e.$watch("isOpen",function(t){t&&a.closeOthers(e),r&&r(e.$parent,t)})}}}]).directive("accordionHeading",function(){return{restrict:"E",transclude:!0,template:"",replace:!0,require:"^accordionGroup",compile:function(t,e,n){return function(t,e,o,a){a.setHeading(n(t,function(){}))}}}}).directive("accordionTransclude",function(){return{require:"^accordionGroup",link:function(t,e,n,o){t.$watch(function(){return o[n.accordionTransclude]},function(t){t&&(e.html(""),e.append(t))})}}}),angular.module("ui.bootstrap.alert",[]).directive("alert",function(){return{restrict:"EA",templateUrl:"template/alert/alert.html",transclude:!0,replace:!0,scope:{type:"=",close:"&"},link:function(t,e,n){t.closeable="close"in n}}}),angular.module("ui.bootstrap.buttons",[]).constant("buttonConfig",{activeClass:"active",toggleEvent:"click"}).directive("btnRadio",["buttonConfig",function(t){var e=t.activeClass||"active",n=t.toggleEvent||"click";return{require:"ngModel",link:function(t,o,a,i){var r=t.$eval(a.btnRadio);t.$watch(function(){return i.$modelValue},function(t){angular.equals(t,r)?o.addClass(e):o.removeClass(e)}),o.bind(n,function(){o.hasClass(e)||t.$apply(function(){i.$setViewValue(r)})})}}}]).directive("btnCheckbox",["buttonConfig",function(t){var e=t.activeClass||"active",n=t.toggleEvent||"click";return{require:"ngModel",link:function(t,o,a,i){var r=t.$eval(a.btnCheckboxTrue),l=t.$eval(a.btnCheckboxFalse);r=angular.isDefined(r)?r:!0,l=angular.isDefined(l)?l:!1,t.$watch(function(){return i.$modelValue},function(t){angular.equals(t,r)?o.addClass(e):o.removeClass(e)}),o.bind(n,function(){t.$apply(function(){i.$setViewValue(o.hasClass(e)?l:r)})})}}}]),angular.module("ui.bootstrap.carousel",["ui.bootstrap.transition"]).controller("CarouselController",["$scope","$timeout","$transition","$q",function(t,e,n){function o(){function n(){i?(t.next(),o()):t.pause()}a&&e.cancel(a);var r=+t.interval;!isNaN(r)&&r>=0&&(a=e(n,r))}var a,i,r=this,l=r.slides=[],s=-1;r.currentSlide=null,r.select=function(a,i){function c(){r.currentSlide&&angular.isString(i)&&!t.noTransition&&a.$element?(a.$element.addClass(i),a.$element[0].offsetWidth=a.$element[0].offsetWidth,angular.forEach(l,function(t){angular.extend(t,{direction:"",entering:!1,leaving:!1,active:!1})}),angular.extend(a,{direction:i,active:!0,entering:!0}),angular.extend(r.currentSlide||{},{direction:i,leaving:!0}),t.$currentTransition=n(a.$element,{}),function(e,n){t.$currentTransition.then(function(){u(e,n)},function(){u(e,n)})}(a,r.currentSlide)):u(a,r.currentSlide),r.currentSlide=a,s=p,o()}function u(e,n){angular.extend(e,{direction:"",active:!0,leaving:!1,entering:!1}),angular.extend(n||{},{direction:"",active:!1,leaving:!1,entering:!1}),t.$currentTransition=null}var p=l.indexOf(a);void 0===i&&(i=p>s?"next":"prev"),a&&a!==r.currentSlide&&(t.$currentTransition?(t.$currentTransition.cancel(),e(c)):c())},r.indexOfSlide=function(t){return l.indexOf(t)},t.next=function(){var t=(s+1)%l.length;return r.select(l[t],"next")},t.prev=function(){var t=0>s-1?l.length-1:s-1;return r.select(l[t],"prev")},t.select=function(t){r.select(t)},t.isActive=function(t){return r.currentSlide===t},t.slides=function(){return l},t.$watch("interval",o),t.play=function(){i||(i=!0,o())},t.pause=function(){i=!1,a&&e.cancel(a)},r.addSlide=function(e,n){e.$element=n,l.push(e),1===l.length||e.active?(r.select(l[l.length-1]),1==l.length&&t.play()):e.active=!1},r.removeSlide=function(t){var e=l.indexOf(t);l.splice(e,1),l.length>0&&t.active&&(e>=l.length?r.select(l[e-1]):r.select(l[e]))}}]).directive("carousel",[function(){return{restrict:"EA",transclude:!0,replace:!0,controller:"CarouselController",require:"carousel",templateUrl:"template/carousel/carousel.html",scope:{interval:"=",noTransition:"="}}}]).directive("slide",[function(){return{require:"^carousel",restrict:"EA",transclude:!0,replace:!0,templateUrl:"template/carousel/slide.html",scope:{active:"="},link:function(t,e,n,o){o.addSlide(t,e),t.$on("$destroy",function(){o.removeSlide(t)}),t.$watch("active",function(e){e&&o.select(t)})}}}]);var dialogModule=angular.module("ui.bootstrap.dialog",["ui.bootstrap.transition"]);dialogModule.controller("MessageBoxController",["$scope","dialog","model",function(t,e,n){t.title=n.title,t.message=n.message,t.buttons=n.buttons,t.close=function(t){e.close(t)}}]),dialogModule.provider("$dialog",function(){var t={backdrop:!0,dialogClass:"modal",backdropClass:"modal-backdrop",transitionClass:"fade",triggerClass:"in",dialogOpenClass:"modal-open",resolve:{},backdropFade:!1,dialogFade:!1,keyboard:!0,backdropClick:!0},e={},n={value:0};this.options=function(t){e=t},this.$get=["$http","$document","$compile","$rootScope","$controller","$templateCache","$q","$transition","$injector",function(o,a,i,r,l,s,c,u,p){function d(t){var e=angular.element("<div>");return e.addClass(t),e}function f(n){var o=this,a=this.options=angular.extend({},t,e,n);this._open=!1,this.backdropEl=d(a.backdropClass),a.backdropFade&&(this.backdropEl.addClass(a.transitionClass),this.backdropEl.removeClass(a.triggerClass)),this.modalEl=d(a.dialogClass),a.dialogFade&&(this.modalEl.addClass(a.transitionClass),this.modalEl.removeClass(a.triggerClass)),this.handledEscapeKey=function(t){27===t.which&&(o.close(),t.preventDefault(),o.$scope.$apply())},this.handleBackDropClick=function(t){o.close(),t.preventDefault(),o.$scope.$apply()},this.handleLocationChange=function(){o.close()}}var g=a.find("body");return f.prototype.isOpen=function(){return this._open},f.prototype.open=function(t,e){var n=this,o=this.options;if(t&&(o.templateUrl=t),e&&(o.controller=e),!o.template&&!o.templateUrl)throw Error("Dialog.open expected template or templateUrl, neither found. Use options or open method to specify them.");return this._loadResolves().then(function(t){var e=t.$scope=n.$scope=t.$scope?t.$scope:r.$new();if(n.modalEl.html(t.$template),n.options.controller){var o=l(n.options.controller,t);n.modalEl.children().data("ngControllerController",o)}i(n.modalEl)(e),n._addElementsToDom(),g.addClass(n.options.dialogOpenClass),setTimeout(function(){n.options.dialogFade&&n.modalEl.addClass(n.options.triggerClass),n.options.backdropFade&&n.backdropEl.addClass(n.options.triggerClass)}),n._bindEvents()}),this.deferred=c.defer(),this.deferred.promise},f.prototype.close=function(t){function e(t){t.removeClass(o.options.triggerClass)}function n(){o._open&&o._onCloseComplete(t)}var o=this,a=this._getFadingElements();if(g.removeClass(o.options.dialogOpenClass),a.length>0)for(var i=a.length-1;i>=0;i--)u(a[i],e).then(n);else this._onCloseComplete(t)},f.prototype._getFadingElements=function(){var t=[];return this.options.dialogFade&&t.push(this.modalEl),this.options.backdropFade&&t.push(this.backdropEl),t},f.prototype._bindEvents=function(){this.options.keyboard&&g.bind("keydown",this.handledEscapeKey),this.options.backdrop&&this.options.backdropClick&&this.backdropEl.bind("click",this.handleBackDropClick),this.$scope.$on("$locationChangeSuccess",this.handleLocationChange)},f.prototype._unbindEvents=function(){this.options.keyboard&&g.unbind("keydown",this.handledEscapeKey),this.options.backdrop&&this.options.backdropClick&&this.backdropEl.unbind("click",this.handleBackDropClick)},f.prototype._onCloseComplete=function(t){this._removeElementsFromDom(),this._unbindEvents(),this.deferred.resolve(t)},f.prototype._addElementsToDom=function(){g.append(this.modalEl),this.options.backdrop&&(0===n.value&&g.append(this.backdropEl),n.value++),this._open=!0},f.prototype._removeElementsFromDom=function(){this.modalEl.remove(),this.options.backdrop&&(n.value--,0===n.value&&this.backdropEl.remove()),this._open=!1},f.prototype._loadResolves=function(){var t,e=[],n=[],a=this;return this.options.template?t=c.when(this.options.template):this.options.templateUrl&&(t=o.get(this.options.templateUrl,{cache:s}).then(function(t){return t.data})),angular.forEach(this.options.resolve||[],function(t,o){n.push(o),e.push(angular.isString(t)?p.get(t):p.invoke(t))}),n.push("$template"),e.push(t),c.all(e).then(function(t){var e={};return angular.forEach(t,function(t,o){e[n[o]]=t}),e.dialog=a,e})},{dialog:function(t){return new f(t)},messageBox:function(t,e,n){return new f({templateUrl:"template/dialog/message.html",controller:"MessageBoxController",resolve:{model:function(){return{title:t,message:e,buttons:n}}}})}}}]}),angular.module("ui.bootstrap.dropdownToggle",[]).directive("dropdownToggle",["$document","$location","$window",function(t){var e=null,n=angular.noop;return{restrict:"CA",link:function(o,a){o.$watch("$location.path",function(){n()}),a.parent().bind("click",function(){n()}),a.bind("click",function(o){o.preventDefault(),o.stopPropagation();var i=a===e;e&&n(),i||(a.parent().addClass("open"),e=a,n=function(o){o&&(o.preventDefault(),o.stopPropagation()),t.unbind("click",n),a.parent().removeClass("open"),n=angular.noop,e=null},t.bind("click",n))})}}}]),angular.module("ui.bootstrap.modal",["ui.bootstrap.dialog"]).directive("modal",["$parse","$dialog",function(t,e){return{restrict:"EA",terminal:!0,link:function(n,o,a){var i,r=angular.extend({},n.$eval(a.uiOptions||a.bsOptions||a.options)),l=a.modal||a.show;r=angular.extend(r,{template:o.html(),resolve:{$scope:function(){return n}}});var s=e.dialog(r);o.remove(),i=a.close?function(){t(a.close)(n)}:function(){angular.isFunction(t(l).assign)&&t(l).assign(n,!1)},n.$watch(l,function(t){t?s.open().then(function(){i()}):s.isOpen()&&s.close()})}}}]),angular.module("ui.bootstrap.pagination",[]).constant("paginationConfig",{boundaryLinks:!1,directionLinks:!0,firstText:"First",previousText:"Previous",nextText:"Next",lastText:"Last"}).directive("pagination",["paginationConfig",function(t){return{restrict:"EA",scope:{numPages:"=",currentPage:"=",maxSize:"=",onSelectPage:"&"},templateUrl:"template/pagination/pagination.html",replace:!0,link:function(e,n,o){function a(t,e,n,o){return{number:t,text:e,active:n,disabled:o}}var i=angular.isDefined(o.boundaryLinks)?e.$eval(o.boundaryLinks):t.boundaryLinks,r=angular.isDefined(o.directionLinks)?e.$eval(o.directionLinks):t.directionLinks,l=angular.isDefined(o.firstText)?o.firstText:t.firstText,s=angular.isDefined(o.previousText)?o.previousText:t.previousText,c=angular.isDefined(o.nextText)?o.nextText:t.nextText,u=angular.isDefined(o.lastText)?o.lastText:t.lastText;e.$watch("numPages + currentPage + maxSize",function(){e.pages=[];var t=1,n=e.numPages;e.maxSize&&e.maxSize<e.numPages&&(t=Math.max(e.currentPage-Math.floor(e.maxSize/2),1),n=t+e.maxSize-1,n>e.numPages&&(n=e.numPages,t=n-e.maxSize+1));for(var o=t;n>=o;o++){var p=a(o,o,e.isActive(o),!1);e.pages.push(p)}if(r){var d=a(e.currentPage-1,s,!1,e.noPrevious());e.pages.unshift(d);var f=a(e.currentPage+1,c,!1,e.noNext());e.pages.push(f)}if(i){var g=a(1,l,!1,e.noPrevious());e.pages.unshift(g);var m=a(e.numPages,u,!1,e.noNext());e.pages.push(m)}e.currentPage>e.numPages&&e.selectPage(e.numPages)}),e.noPrevious=function(){return 1===e.currentPage},e.noNext=function(){return e.currentPage===e.numPages},e.isActive=function(t){return e.currentPage===t},e.selectPage=function(t){!e.isActive(t)&&t>0&&e.numPages>=t&&(e.currentPage=t,e.onSelectPage({page:t}))}}}}]),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(t,e){function n(t,n){return t.currentStyle?t.currentStyle[n]:e.getComputedStyle?e.getComputedStyle(t)[n]:t.style[n]}function o(t){return"static"===(n(t,"position")||"static")}var a=function(e){for(var n=t[0],a=e.offsetParent||n;a&&a!==n&&o(a);)a=a.offsetParent;return a||n};return{position:function(e){var n=this.offset(e),o={top:0,left:0},i=a(e[0]);return i!=t[0]&&(o=this.offset(angular.element(i)),o.top+=i.clientTop,o.left+=i.clientLeft),{width:e.prop("offsetWidth"),height:e.prop("offsetHeight"),top:n.top-o.top,left:n.left-o.left}},offset:function(n){var o=n[0].getBoundingClientRect();return{width:n.prop("offsetWidth"),height:n.prop("offsetHeight"),top:o.top+(e.pageYOffset||t[0].body.scrollTop),left:o.left+(e.pageXOffset||t[0].body.scrollLeft)}}}}]),angular.module("ui.bootstrap.tooltip",["ui.bootstrap.position"]).provider("$tooltip",function(){function t(t){var e=/[A-Z]/g,n="-";return t.replace(e,function(t,e){return(e?n:"")+t.toLowerCase()})}var e={placement:"top",animation:!0,popupDelay:0},n={mouseenter:"mouseleave",click:"click",focus:"blur"},o={};this.options=function(t){angular.extend(o,t)},this.$get=["$window","$compile","$timeout","$parse","$document","$position",function(a,i,r,l,s,c){return function(a,u,p){function d(t){var e,o;return e=t||f.trigger||p,o=angular.isDefined(f.trigger)?n[f.trigger]||e:n[e]||e,{show:e,hide:o}}var f=angular.extend({},e,o),g=t(a),m=d(void 0),h="<"+g+"-popup "+'title="{{tt_title}}" '+'content="{{tt_content}}" '+'placement="{{tt_placement}}" '+'animation="tt_animation()" '+'is-open="tt_isOpen"'+">"+"</"+g+"-popup>";return{restrict:"EA",scope:!0,link:function(t,e,n){function o(){t.tt_isOpen?g():p()}function p(){t.tt_popupDelay?y=r(v,t.tt_popupDelay):t.$apply(v)}function g(){t.$apply(function(){b()})}function v(){var n,o,a,i;if(t.tt_content){switch($&&r.cancel($),C.css({top:0,left:0,display:"block"}),f.appendToBody?(k=k||s.find("body"),k.append(C)):e.after(C),n=c.position(e),o=C.prop("offsetWidth"),a=C.prop("offsetHeight"),t.tt_placement){case"right":i={top:n.top+n.height/2-a/2+"px",left:n.left+n.width+"px"};break;case"bottom":i={top:n.top+n.height+"px",left:n.left+n.width/2-o/2+"px"};break;case"left":i={top:n.top+n.height/2-a/2+"px",left:n.left-o+"px"};break;default:i={top:n.top-a+"px",left:n.left+n.width/2-o/2+"px"}}C.css(i),t.tt_isOpen=!0}}function b(){t.tt_isOpen=!1,r.cancel(y),angular.isDefined(t.tt_animation)&&t.tt_animation()?$=r(function(){C.remove()},500):C.remove()}var $,y,k,C=i(h)(t);t.tt_isOpen=!1,n.$observe(a,function(e){t.tt_content=e}),n.$observe(u+"Title",function(e){t.tt_title=e}),n.$observe(u+"Placement",function(e){t.tt_placement=angular.isDefined(e)?e:f.placement}),n.$observe(u+"Animation",function(e){t.tt_animation=angular.isDefined(e)?l(e):function(){return f.animation}}),n.$observe(u+"PopupDelay",function(e){var n=parseInt(e,10);t.tt_popupDelay=isNaN(n)?f.popupDelay:n}),n.$observe(u+"Trigger",function(t){e.unbind(m.show),e.unbind(m.hide),m=d(t),m.show===m.hide?e.bind(m.show,o):(e.bind(m.show,p),e.bind(m.hide,g))})}}}}]}).directive("tooltipPopup",function(){return{restrict:"E",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-popup.html"}}).directive("tooltip",["$tooltip",function(t){return t("tooltip","tooltip","mouseenter")}]).directive("tooltipHtmlUnsafePopup",function(){return{restrict:"E",replace:!0,scope:{content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/tooltip/tooltip-html-unsafe-popup.html"}}).directive("tooltipHtmlUnsafe",["$tooltip",function(t){return t("tooltipHtmlUnsafe","tooltip","mouseenter")}]),angular.module("ui.bootstrap.popover",["ui.bootstrap.tooltip"]).directive("popoverPopup",function(){return{restrict:"EA",replace:!0,scope:{title:"@",content:"@",placement:"@",animation:"&",isOpen:"&"},templateUrl:"template/popover/popover.html"}}).directive("popover",["$compile","$timeout","$parse","$window","$tooltip",function(t,e,n,o,a){return a("popover","popover","click")}]),angular.module("ui.bootstrap.progressbar",["ui.bootstrap.transition"]).constant("progressConfig",{animate:!0,autoType:!1,stackedTypes:["success","info","warning","danger"]}).controller("ProgressBarController",["$scope","$attrs","progressConfig",function(t,e,n){function o(t){return r[t]}var a=angular.isDefined(e.animate)?t.$eval(e.animate):n.animate,i=angular.isDefined(e.autoType)?t.$eval(e.autoType):n.autoType,r=angular.isDefined(e.stackedTypes)?t.$eval("["+e.stackedTypes+"]"):n.stackedTypes;this.makeBar=function(t,e,n){var r=angular.isObject(t)?t.value:t||0,l=angular.isObject(e)?e.value:e||0,s=angular.isObject(t)&&angular.isDefined(t.type)?t.type:i?o(n||0):null;return{from:l,to:r,type:s,animate:a}},this.addBar=function(e){t.bars.push(e),t.totalPercent+=e.to},this.clearBars=function(){t.bars=[],t.totalPercent=0},this.clearBars()}]).directive("progress",function(){return{restrict:"EA",replace:!0,controller:"ProgressBarController",scope:{value:"=",onFull:"&",onEmpty:"&"},templateUrl:"template/progressbar/progress.html",link:function(t,e,n,o){t.$watch("value",function(t,e){if(o.clearBars(),angular.isArray(t))for(var n=0,a=t.length;a>n;n++)o.addBar(o.makeBar(t[n],e[n],n));else o.addBar(o.makeBar(t,e))},!0),t.$watch("totalPercent",function(e){e>=100?t.onFull():0>=e&&t.onEmpty()},!0)}}}).directive("progressbar",["$transition",function(t){return{restrict:"EA",replace:!0,scope:{width:"=",old:"=",type:"=",animate:"="},templateUrl:"template/progressbar/bar.html",link:function(e,n){e.$watch("width",function(o){e.animate?(n.css("width",e.old+"%"),t(n,{width:o+"%"})):n.css("width",o+"%")})}}}]),angular.module("ui.bootstrap.rating",[]).constant("ratingConfig",{max:5}).directive("rating",["ratingConfig","$parse",function(t,e){return{restrict:"EA",scope:{value:"="},templateUrl:"template/rating/rating.html",replace:!0,link:function(n,o,a){var i=angular.isDefined(a.max)?n.$eval(a.max):t.max;n.range=[];for(var r=1;i>=r;r++)n.range.push(r);n.rate=function(t){n.readonly||(n.value=t)},n.enter=function(t){n.readonly||(n.val=t)},n.reset=function(){n.val=angular.copy(n.value)},n.reset(),n.$watch("value",function(t){n.val=t}),n.readonly=!1,a.readonly&&n.$parent.$watch(e(a.readonly),function(t){n.readonly=!!t})}}}]),angular.module("ui.bootstrap.tabs",[]).controller("TabsController",["$scope","$element",function(t){var e=t.panes=[];this.select=t.select=function(t){angular.forEach(e,function(t){t.selected=!1}),t.selected=!0},this.addPane=function(n){e.length||t.select(n),e.push(n)},this.removePane=function(n){var o=e.indexOf(n);e.splice(o,1),n.selected&&e.length>0&&t.select(e[e.length>o?o:o-1])}}]).directive("tabs",function(){return{restrict:"EA",transclude:!0,scope:{},controller:"TabsController",templateUrl:"template/tabs/tabs.html",replace:!0}}).directive("pane",["$parse",function(t){return{require:"^tabs",restrict:"EA",transclude:!0,scope:{heading:"@"},link:function(e,n,o,a){var i,r;e.selected=!1,o.active&&(i=t(o.active),r=i.assign,e.$watch(function(){return i(e.$parent)},function(t){e.selected=t}),e.selected=i?i(e.$parent):!1),e.$watch("selected",function(t){t&&a.select(e),r&&r(e.$parent,t)}),a.addPane(e),e.$on("$destroy",function(){a.removePane(e)})},templateUrl:"template/tabs/pane.html",replace:!0}}]),angular.module("ui.bootstrap.typeahead",["ui.bootstrap.position"]).factory("typeaheadParser",["$parse",function(t){var e=/^\s*(.*?)(?:\s+as\s+(.*?))?\s+for\s+(?:([\$\w][\$\w\d]*))\s+in\s+(.*)$/;return{parse:function(n){var o=n.match(e);if(!o)throw Error("Expected typeahead specification in form of '_modelValue_ (as _label_)? for _item_ in _collection_' but got '"+n+"'.");return{itemName:o[3],source:t(o[4]),viewMapper:t(o[2]||o[1]),modelMapper:t(o[1])}}}}]).directive("typeahead",["$compile","$parse","$q","$document","$position","typeaheadParser",function(t,e,n,o,a,i){var r=[9,13,27,38,40];return{require:"ngModel",link:function(l,s,c,u){var p,d=l.$eval(c.typeaheadMinLength)||1,f=i.parse(c.typeahead),g=l.$eval(c.typeaheadEditable)!==!1,m=e(c.typeaheadLoading).assign||angular.noop,h=angular.element("<typeahead-popup matches='matches' active='activeIdx' select='select(activeIdx)' query='query' position='position'></typeahead-popup>"),v=l.$new();l.$on("$destroy",function(){v.$destroy()});var b=function(){v.matches=[],v.activeIdx=-1},$=function(t){var e={$viewValue:t};m(l,!0),n.when(f.source(v,e)).then(function(n){if(t===u.$viewValue){if(n.length>0){v.activeIdx=0,v.matches.length=0;for(var o=0;n.length>o;o++)e[f.itemName]=n[o],v.matches.push({label:f.viewMapper(v,e),model:n[o]});v.query=t,v.position=a.position(s),v.position.top=v.position.top+s.prop("offsetHeight")}else b();m(l,!1)}},function(){b(),m(l,!1)})};b(),v.query=void 0,u.$parsers.push(function(t){return b(),p?t:(t&&t.length>=d&&$(t),g?t:void 0)}),u.$render=function(){var t={};t[f.itemName]=p||u.$viewValue,s.val(f.viewMapper(v,t)||u.$viewValue),p=void 0},v.select=function(t){var e={};e[f.itemName]=p=v.matches[t].model,u.$setViewValue(f.modelMapper(v,e)),u.$render()},s.bind("keydown",function(t){0!==v.matches.length&&-1!==r.indexOf(t.which)&&(t.preventDefault(),40===t.which?(v.activeIdx=(v.activeIdx+1)%v.matches.length,v.$digest()):38===t.which?(v.activeIdx=(v.activeIdx?v.activeIdx:v.matches.length)-1,v.$digest()):13===t.which||9===t.which?v.$apply(function(){v.select(v.activeIdx)}):27===t.which&&(t.stopPropagation(),b(),v.$digest()))}),o.bind("click",function(){b(),v.$digest()}),s.after(t(h)(v))}}}]).directive("typeaheadPopup",function(){return{restrict:"E",scope:{matches:"=",query:"=",active:"=",position:"=",select:"&"},replace:!0,templateUrl:"template/typeahead/typeahead.html",link:function(t){t.isOpen=function(){return t.matches.length>0},t.isActive=function(e){return t.active==e},t.selectActive=function(e){t.active=e},t.selectMatch=function(e){t.select({activeIdx:e})}}}}).filter("typeaheadHighlight",function(){function t(t){return t.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")}return function(e,n){return n?e.replace(RegExp(t(n),"gi"),"<strong>$&</strong>"):n}}),angular.module("template/accordion/accordion-group.html",[]).run(["$templateCache",function(t){t.put("template/accordion/accordion-group.html",'<div class="accordion-group">\n <div class="accordion-heading" ><a class="accordion-toggle" ng-click="isOpen = !isOpen" accordion-transclude="heading">{{heading}}</a></div>\n <div class="accordion-body" collapse="!isOpen">\n <div class="accordion-inner" ng-transclude></div> </div>\n</div>')}]),angular.module("template/accordion/accordion.html",[]).run(["$templateCache",function(t){t.put("template/accordion/accordion.html",'<div class="accordion" ng-transclude></div>')}]),angular.module("template/alert/alert.html",[]).run(["$templateCache",function(t){t.put("template/alert/alert.html","<div class='alert' ng-class='type && \"alert-\" + type'>\n <button ng-show='closeable' type='button' class='close' ng-click='close()'>&times;</button>\n <div ng-transclude></div>\n</div>\n")}]),angular.module("template/carousel/carousel.html",[]).run(["$templateCache",function(t){t.put("template/carousel/carousel.html",'<div ng-mouseenter="pause()" ng-mouseleave="play()" class="carousel">\n <ol class="carousel-indicators" ng-show="slides().length > 1">\n <li ng-repeat="slide in slides()" ng-class="{active: isActive(slide)}" ng-click="select(slide)"></li>\n </ol>\n <div class="carousel-inner" ng-transclude></div>\n <a ng-click="prev()" class="carousel-control left" ng-show="slides().length > 1">&lsaquo;</a>\n <a ng-click="next()" class="carousel-control right" ng-show="slides().length > 1">&rsaquo;</a>\n</div>\n')}]),angular.module("template/carousel/slide.html",[]).run(["$templateCache",function(t){t.put("template/carousel/slide.html","<div ng-class=\"{\n 'active': leaving || (active && !entering),\n 'prev': (next || active) && direction=='prev',\n 'next': (next || active) && direction=='next',\n 'right': direction=='prev',\n 'left': direction=='next'\n }\" class=\"item\" ng-transclude></div>\n")}]),angular.module("template/dialog/message.html",[]).run(["$templateCache",function(t){t.put("template/dialog/message.html",'<div class="modal-header">\n <h1>{{ title }}</h1>\n</div>\n<div class="modal-body">\n <p>{{ message }}</p>\n</div>\n<div class="modal-footer">\n <button ng-repeat="btn in buttons" ng-click="close(btn.result)" class=btn ng-class="btn.cssClass">{{ btn.label }}</button>\n</div>\n')}]),angular.module("template/pagination/pagination.html",[]).run(["$templateCache",function(t){t.put("template/pagination/pagination.html",'<div class="pagination"><ul>\n <li ng-repeat="page in pages" ng-class="{active: page.active, disabled: page.disabled}"><a ng-click="selectPage(page.number)">{{page.text}}</a></li>\n </ul>\n</div>\n')}]),angular.module("template/tooltip/tooltip-html-unsafe-popup.html",[]).run(["$templateCache",function(t){t.put("template/tooltip/tooltip-html-unsafe-popup.html",'<div class="tooltip {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner" ng-bind-html-unsafe="content"></div>\n</div>\n')}]),angular.module("template/tooltip/tooltip-popup.html",[]).run(["$templateCache",function(t){t.put("template/tooltip/tooltip-popup.html",'<div class="tooltip {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n <div class="tooltip-arrow"></div>\n <div class="tooltip-inner" ng-bind="content"></div>\n</div>\n')}]),angular.module("template/popover/popover.html",[]).run(["$templateCache",function(t){t.put("template/popover/popover.html",'<div class="popover {{placement}}" ng-class="{ in: isOpen(), fade: animation() }">\n <div class="arrow"></div>\n\n <div class="popover-inner">\n <h3 class="popover-title" ng-bind="title" ng-show="title"></h3>\n <div class="popover-content" ng-bind="content"></div>\n </div>\n</div>\n')}]),angular.module("template/progressbar/bar.html",[]).run(["$templateCache",function(t){t.put("template/progressbar/bar.html",'<div class="bar" ng-class=\'type && "bar-" + type\'></div>')}]),angular.module("template/progressbar/progress.html",[]).run(["$templateCache",function(t){t.put("template/progressbar/progress.html",'<div class="progress"><progressbar ng-repeat="bar in bars" width="bar.to" old="bar.from" animate="bar.animate" type="bar.type"></progressbar></div>')}]),angular.module("template/rating/rating.html",[]).run(["$templateCache",function(t){t.put("template/rating/rating.html",'<span ng-mouseleave="reset()">\n <i ng-repeat="number in range" ng-mouseenter="enter(number)" ng-click="rate(number)" ng-class="{\'icon-star\': number <= val, \'icon-star-empty\': number > val}"></i>\n</span>\n')}]),angular.module("template/tabs/pane.html",[]).run(["$templateCache",function(t){t.put("template/tabs/pane.html",'<div class="tab-pane" ng-class="{active: selected}" ng-show="selected" ng-transclude></div>\n')}]),angular.module("template/tabs/tabs.html",[]).run(["$templateCache",function(t){t.put("template/tabs/tabs.html",'<div class="tabbable">\n <ul class="nav nav-tabs">\n <li ng-repeat="pane in panes" ng-class="{active:pane.selected}">\n <a ng-click="select(pane)">{{pane.heading}}</a>\n </li>\n </ul>\n <div class="tab-content" ng-transclude></div>\n</div>\n')}]),angular.module("template/typeahead/match.html",[]).run(["$templateCache",function(t){t.put("template/typeahead/match.html",'<a tabindex="-1" ng-bind-html-unsafe="match.label | typeaheadHighlight:query"></a>')}]),angular.module("template/typeahead/typeahead.html",[]).run(["$templateCache",function(t){t.put("template/typeahead/typeahead.html",'<ul class="typeahead dropdown-menu" ng-style="{display: isOpen()&&\'block\' || \'none\', top: position.top+\'px\', left: position.left+\'px\'}">\n <li ng-repeat="match in matches" ng-class="{active: isActive($index) }" ng-mouseenter="selectActive($index)">\n <a tabindex="-1" ng-click="selectMatch($index)" ng-bind-html-unsafe="match.label | typeaheadHighlight:query"></a>\n </li>\n</ul>')}]);
\ No newline at end of file
......@@ -3,8 +3,9 @@
<!-- header -->
<nav class="navbar navbar-expand navbar-dark bg-dark static-top">
<a class="navbar-brand mr-1" ui-sref="">Trang Chủ</a>
<a class="navbar-brand mr-1" ui-sref="admin-home" style="margin-left: 40%">Trang Quản Trị</a>
<a class="navbar-brand mr-1" href="index.html">Trang Quản Trị</a>
<!-- Navbar Search -->
<form class="d-none d-md-inline-block form-inline ml-auto mr-0 mr-md-3 my-2 my-md-0">
</form>
......@@ -12,7 +13,7 @@
<!-- Navbar -->
<ul class="navbar-nav ml-auto ml-md-0">
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown"
<a class="nav-link dropdown-toggle" id="userDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user-circle fa-fw"></i>Admin
</a>
......@@ -50,7 +51,7 @@
<h6 class="dropdown-header">Báo Cáo</h6>
<a class="dropdown-item" href="#">Xin Phép</a>
<a class="dropdown-item" href="#">Time Sheet</a>
<a class="dropdown-item" href="#">Quản lý Issuses</a>
<a class="dropdown-item" ui-sref="issues">Quản lý Issuses</a>
</div>
</li>
</ul>
......
<div class="container" style="text-align: center">
<h1>Chào Mừng bạn đến với trang ADMIN</h1>
<div class="container">
</div>
\ No newline at end of file
angular.module("myApp").controller("adminController", function($scope, $http,$window) {
console.log("adminController");
});
\ 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">
<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 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>
\ No newline at end of file
angular.module("myApp").controller('IssuesAddController', function ($scope,$state,$http) {
$scope.insertIssues = function (Issues) {
$http({
method: 'POST',
url: 'http://localhost:8081/them-issues',
data: angular.toJson($scope.Issues),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('issues');
}
}
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an/").then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listProject = response.data;
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
});
\ No newline at end of file
angular.module("myApp").controller('IssuesShowController', function ($scope,$stateParams,$http,$state) {
$scope.currentPage = 1
,$scope.numPerPage = 5
,$scope.maxSize = 5;
$http.get('http://localhost:8081/danh-sach-issues').then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.ListIssues = response.data;
$scope.numPages = function () {
return Math.ceil($scope.ListIssues.length / $scope.numPerPage);
};
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.pageListIssues = $scope.ListIssues.slice(begin, end);
});
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
$scope.updateIssues = function (issue) {
if (confirm("Bạn có muốn thay đổi trạng thái không ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/sua-issues',
data: angular.toJson(issue),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
//error code
console.log("can't update data!!");
}
}
};
});
\ No newline at end of file
<div class="col-lg-8">
<hr>
<p style="text-align: center">Tên Dự Án : {{loadIssues.project.name | uppercase}}</p>
<hr>
<p class="lead">Tiêu Đề: {{loadIssues.title | uppercase}}</p>
<blockquote class="blockquote">
<p class="mb-0">NỘI DUNG ISSUES : {{loadIssues.actionCode}}</p>
</blockquote>
<hr>
<!-- Comments Form -->
<div class="card my-4">
<h5 class="card-header">Comment:</h5>
<div class="card-body">
<form ng-submit="">
<div class="form-group">
<textarea ng-model="IssuesComment.content" class="form-control" rows="3"></textarea>
</div>
<button type="submit" class="btn btn-primary">Đăng Comments</button>
<input class="btn btn-primary" type="reset" value="Reset">
</form>
</div>
</div>
<!-- Single Comment -->
<div class="media mb-4">
<img class="d-flex mr-3 rounded-circle" src="http://placehold.it/50x50" alt="">
<div class="media-body">
<h5 class="mt-0">UserName</h5><p>Thời gian đăng</p>
-<p>Nội dung comment</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 Issue
</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">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Issue</th>
<th>Ngày Tạo</th>
<th>Trạng Thái</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="issue in pageListIssues|filter:search">
<td>{{ issue.project.name }}</td>
<td>{{ issue.title }}</td>
<td>{{ issue.startDate | date:"dd/MM/yyyy" }}</td>
<td>
<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>
</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>
</div>
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div>
angular.module("myApp").controller('IssuesDeleteController', function($scope, $window, $http,$state) {
$scope.IssuesDelete = function (issue) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8081/xoa-issues',
data: $scope.issue,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
console.log("can't delete data!!");
}
}
};
});
\ No newline at end of file
angular.module("myApp").controller('loadIssuesDetail', function ($scope,$stateParams,$http,$state) {
$http.get('http://localhost:8081/chi-tiet-issues/' + $stateParams.IssuesId).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.loadIssues = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
});
\ No newline at end of file
......@@ -5,13 +5,10 @@
<h4>Lấy lại mật khẩu bằng Email đăng ký?</h4>
</div>
<form>
<div class="form-group">
<div class="form-label-group">
<input type="email" id="inputEmail" class="form-control" placeholder="Enter email address"
required="required" autofocus="autofocus">
<label for="inputEmail">Enter email address</label>
</div>
</div>
<label>Enter email address</label>
<input type="email" id="inputEmail" class="form-control" placeholder="Enter email address"
required="required" autofocus="autofocus">
<a class="btn btn-primary btn-block" href="login.html">Reset Password</a>
</form>
<div class="text-center">
......
<div class="card card-login mx-auto mt-5">
<div class="card-header" style="text-align: center">Đăng Nhập Hệ Thống</div>
<div class="card-body">
<form>
<div class="form-group">
<div class="form-label-group">
<input type="text" id="username" class="form-control" placeholder="Tên Đăng Nhập"
autofocus="autofocus" required>
<label for="username">Tên Đăng Nhập</label>
</div>
</div>
<div class="form-group">
<div class="form-label-group">
<input type="password" id="inputPassword" class="form-control" placeholder="Mật Khẩu"
required="required">
<label for="inputPassword">Mật Khẩu</label>
</div>
</div>
<form ng-submit="loginQTVP(login)">
<label>Tên Đăng Nhập</label>
<input type="text" id="username" ng-model="login.username" class="form-control" placeholder="Tên Đăng Nhập"
autofocus="autofocus" required>
<label>Mật Khẩu</label>
<input type="password" id="inputPassword" ng-model="login.passworld" class="form-control" placeholder="Mật Khẩu"
required="required">
<input class="btn btn-primary btn-block" type="submit" value="Đăng Nhập"/>
</form>
<h4>{{view.message}}</h4>
<div class="text-center">
<a class="d-block small mt-3" ui-sref="register">Đăng Ký</a>
<a class="d-block small" ui-sref="forgot-password">Lấy Lại Mật Khẩu?</a>
......
angular.module("myApp").controller("loginController", function($scope, $http,$window) {
console.log("loginController");
angular.module("myApp").controller("loginController", function ($scope, $http, $window, $state) {
$scope.loginQTVP = function (login) {
$http({
method: 'POST',
url: 'http://localhost:8081/qtvp/login',
data: angular.toJson($scope.login),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200&&($scope.view.role=='HR'||$scope.view.role=='Manager'||$scope.view.role=='TeamLead')) {
$state.go('admin-home');
}
if ($scope.view.status == 200&&$scope.view.role=='Member') {
$state.go('login');
}
}
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
});
\ No newline at end of file
......@@ -2,114 +2,30 @@
<div class="card-header" style="text-align: center">ĐĂNG KÝ TÀI KHOẢN</div>
<div class="card-body">
<form>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="username" id="username" class="form-control" placeholder="Tên truy cập"
required="required" autofocus="autofocus">
<label for="username">Tên Đăng Nhập</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="name" id="name" class="form-control" placeholder="Họ và Tên"
required="required">
<label for="name">Họ và Tên</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="email" ng-model="email" id="email" class="form-control"
placeholder="Email đăng ký" required="required">
<label for="Email">Email đăng ký</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="tel" ng-model="phonenumber" id="phonenumber" class="form-control"
placeholder="SDT" required="required">
<label for="phonenumber">SDT</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="Object" id="Object" class="form-control"
placeholder="Đối tượng" required="required">
<label for="Object">Đối Tượng</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="skype" id="skype" class="form-control"
placeholder="nick skype" required="required">
<label for="skype">Nick Skype</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="facebook" id="facebook" class="form-control"
placeholder="facebook" required="required">
<label for="facebook">facebook</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="HocVan" id="HocVan" class="form-control"
placeholder="Học Vấn" required="required">
<label for="HocVan">Học Vấn</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="QueQuan" id="QueQuan" class="form-control"
placeholder="Quê Quán" required="required">
<label for="QueQuan">Quê Quán</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="Truong" id="Truong" class="form-control"
placeholder="Trường" required="required">
<label for="Truong">Trường</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="Khoa" id="Khoa" class="form-control"
placeholder="Khoa" required="required">
<label for="Khoa">Khoa</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="NamTotNghiep" id="NamTotNghiep" class="form-control"
placeholder="Năm tốt nghiệp" required="required">
<label for="NamTotNghiep">Năm tốt nghiệp</label>
</div>
</div>
</div>
</div>
<input type="text" ng-model="username" id="username" class="form-control" placeholder="Tên truy cập"
required="required" autofocus="autofocus">
<input type="text" ng-model="name" id="name" class="form-control" placeholder="Họ và Tên"
required="required">
<input type="email" ng-model="email" id="email" class="form-control"
placeholder="Email đăng ký" required="required">
<input type="tel" ng-model="phonenumber" id="phonenumber" class="form-control"
placeholder="SDT" required="required">
<input type="text" ng-model="Object" id="Object" class="form-control"
placeholder="Đối tượng" required="required">
<input type="text" ng-model="skype" id="skype" class="form-control"
placeholder="nick skype" required="required">
<input type="text" ng-model="facebook" id="facebook" class="form-control"
placeholder="facebook" required="required">
<input type="text" ng-model="HocVan" id="HocVan" class="form-control"
placeholder="Học Vấn" required="required">
<input type="text" ng-model="QueQuan" id="QueQuan" class="form-control"
placeholder="Quê Quán" required="required">
<input type="text" ng-model="Truong" id="Truong" class="form-control"
placeholder="Trường" required="required">
<input type="text" ng-model="Khoa" id="Khoa" class="form-control"
placeholder="Khoa" required="required">
<input type="text" ng-model="NamTotNghiep" id="NamTotNghiep" class="form-control"
placeholder="Năm tốt nghiệp" required="required">
<a class="btn btn-primary btn-block" href="#">Register</a>
</form>
<div class="text-center">
......
var app = angular.module('myApp');
app.factory('apiService', apiService);
apiService.$inject = ['$http', 'notificationService', 'authenticationService'];
function apiService($http, notificationService, authenticationService) {
return {
get: get,
post: post,
put: put,
del: del
}
function del(url, data, success, failure) {
authenticationService.setHeader();
$http.delete(url, data).then(function (result) {
success(result);
}, function (error) {
console.log(error.status)
if (error.status === 401) {
notificationService.displayError('Authenticate is required.');
} else if (failure != null) {
failure(error);
}
});
}
function post(url, data, success, failure) {
authenticationService.setHeader();
$http.post(url, data).then(function (result) {
success(result);
}, function (error) {
console.log(error.status)
if (error.status === 401) {
notificationService.displayError('Authenticate is required.');
} else if (failure != null) {
failure(error);
}
});
}
function put(url, data, success, failure) {
authenticationService.setHeader();
$http.put(url, data).then(function (result) {
success(result);
}, function (error) {
console.log(error.status)
if (error.status === 401) {
notificationService.displayError('Authenticate is required.');
} else if (failure != null) {
failure(error);
}
});
}
function get(url, params, success, failure) {
authenticationService.setHeader();
$http.get(url, params).then(function (result) {
success(result);
}, function (error) {
failure(error);
});
}
};
\ No newline at end of file
......@@ -3,53 +3,26 @@
</div>
<div class="card-body">
<form ng-controller="insertEmployeeProject" ng-submit="insert_employeeproject(employeeProject)" name="eproject">
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<select ng-model="employeeProject.projectId" class="form-control"
autofocus="autofocus" required="required">
<option value=""> ==> Tên Dự Án</option>
<option ng-repeat="project in pGroupProject" value="{{project.id}}">{{project.name}}
</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<select ng-model="employeeProject.userId" class="form-control" autofocus="autofocus" required="required">
<option value=""> ==> Tên Tài Khoản</option>
<option ng-repeat="em in eProject" value="{{em.id}}">{{em.username}}</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<select ng-model="employeeProject.position" class="form-control" autofocus="autofocus" required="required">
<option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option>
<option value="Member">Member</option>
<option value="HR">HR</option>
<option value="Manager">Manager</option>
</select>
</div>
</div>
</div>
</div>
<h3 ng-show="eproject.$valid" style="text-align: center; color: #1c7430">Bạn Có Thể Lưu</h3>
<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>
<div>
<input type="submit" value="Lưu">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button>
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
......@@ -2,6 +2,8 @@ var app = angular.module('myApp');
app.controller('loadGroupProjectByProjectId', loadGroupProjectByProjectId);
app.controller('insertEmployeeProject', insertEmployeeProject);
app.controller('deleteEmployeeProject', deleteEmployeeProject);
app.controller('updateGroutpProject', updateGroutpProject);
app.controller('loadEmployeeProjectDetail', loadEmployeeProjectDetail);
// controlers tạo Get API
function loadGroupProjectByProjectId($scope,$stateParams,$http) {
$http.get('http://localhost:8081/thong-tin-du-an/'+ $stateParams.ID).then(successCallback, errorCallback);
......@@ -11,14 +13,12 @@ function loadGroupProjectByProjectId($scope,$stateParams,$http) {
$scope.listGruopProject = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
}
// tạo controllers insert API
function insertEmployeeProject($scope, $http, $window) {
function insertEmployeeProject($scope, $http, $state) {
$scope.insert_employeeproject = function () {
$http({
//khai báo type
......@@ -34,29 +34,16 @@ function insertEmployeeProject($scope, $http, $window) {
}
// kết quả trả về (THEN)
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$scope.view = response.data;
if($scope.view.status == 200){
$state.go('groupProjectByProjectId', {ID: $scope.employeeProject.projectId});
}
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
//get Employee
$http({
method : 'GET',
url : "http://localhost:8081/list_employee/"
}).then(function successCallback(response) {
console.log(response);
$scope.eProject=response.data;
}, function errorCallback(response) {
console.log(response)
});
// get Project
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
......@@ -72,7 +59,7 @@ function insertEmployeeProject($scope, $http, $window) {
console.log("can't get data!!");
}
};
function deleteEmployeeProject($scope, $window, $http) {
function deleteEmployeeProject($scope, $window, $http,$state) {
$scope.deleteEmployeeProject = function (gruopProject) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
......@@ -83,17 +70,52 @@ function deleteEmployeeProject($scope, $window, $http) {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$window.location.reload();
$scope.view = response.data;
if($scope.view.status == 200){
// $window.location.reload();
$state.reload();
}
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't delete data!!");
}
}
};
};
\ No newline at end of file
};
function updateGroutpProject($scope, $http,$state,$window) {
$scope.updatePositionProject = function (gruopProject) {
if (confirm("Bạn có chắc chắn muốn sửa ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/cap-nhat-chuc-vu-thanh-vien',
data: $scope.gruopProject,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if($scope.view.status == 200){
$state.go('groupProjectByProjectId', {ID: $scope.gruopProject.projectDTO.id});
// $window.location.href = 'http://localhost:8081/#/groupProjectByProjectId/'+$scope.gruopProject.projectDTO.id;
}
}
function errorCallback(error) {
console.log("can't delete data!!");
}
}
};
};
function loadEmployeeProjectDetail($scope,$stateParams,$http) {
$http.get('http://localhost:8081/chi-tiet-thanh-vien-du-an/'+ $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.gruopProject = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ 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">
<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/>
<select ng-model="gruopProject.position" autofocus="autofocus"
required="required">
<option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option>
<option value="Member">Member</option>
</select><br/>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<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">
<i class="fas fa-table"></i> Danh Sách Dự Án
<div class="card-header" ng-controller="loadGroupProjectByProjectId">
<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" ng-controller="loadGroupProjectByProjectId">
<a ui-sref="addEmployeeProject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm thành viên</a>
<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">
......@@ -21,7 +22,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="gruopProject in listGruopProject">
<tr ng-repeat="gruopProject in pageGroupListProject">
<td>{{ gruopProject.employeeDTO.username }}</td>
<td>{{ gruopProject.employeeDTO.lastName }}</td>
<td>{{ gruopProject.employeeDTO.email}}</td>
......@@ -29,14 +30,19 @@
<td>{{ gruopProject.joinDate | date:"dd/MM/yyyy" }}</td>
<td>{{ gruopProject.outDate | date:"dd/MM/yyyy" }}</td>
<td>
<a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm">
Sửa </a>
<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>
data-ng-click="deleteEmployeeProject(gruopProject)">Xóa Thành Viên</a>
</tr>
</tbody>
</table>
<a ui-sref="project" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Trở Về</a>
<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>
</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
angular.module("myApp").controller('groupProjectShowController', function ($scope,$stateParams,$http) {
$scope.currentPage = 1
,$scope.numPerPage = 2
,$scope.maxSize = 5;
$http.get('http://localhost:8081/thong-tin-du-an/'+ $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listGruopProject = response.data;
$scope.numPages = function () {
return Math.ceil($scope.listGruopProject.length / $scope.numPerPage);
};
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.pageGroupListProject = $scope.listGruopProject.slice(begin, end);
});
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
});
\ No newline at end of file
......@@ -3,50 +3,21 @@
</div>
<div class="card-body">
<form ng-controller="insertProject" ng-submit="insert_project()">
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="project.name" id="name" class="form-control"
placeholder="Tên Dự Án"
required="required" autofocus="autofocus">
<label for="name">Tên Dự Án</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="project.descriptions" id="descriptions"
class="form-control"
placeholder="Mô tả ngắn"
required="required">
<label for="descriptions">Mô tả ngắn</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="project.startDate" id="startDate" class="form-control"
placeholder="Ngày Bắt Đầu" required="required">
<label for="startDate">Ngày Bắt Đầu</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="project.endDate" id="endDate" class="form-control"
placeholder="nick skype" required="required">
<label for="endDate">Ngày Kết Thuc</label>
</div>
</div>
</div>
</div>
<h3 ng-show="formProject.$valid" style="text-align: center; color: #1c7430">Bạn Có Thể Lưu</h3>
<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/>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button>
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
var app = angular.module('myApp');
app.controller('showProject', showProject);
// app.controller('showProject', showProject);
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) {
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listProject = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
};
// 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, $window,$state) {
function insertProject($scope, $http, $state) {
$scope.insert_project = function () {
$http({
//khai báo type
method: 'POST',
//đường dẫn API
url: 'http://localhost:8081/quan-tri/them-du-an',
//truyền dữ liệu nhập trên cline vào data
data: angular.toJson($scope.project),
//kiểu dữ liệu API
headers: {
'Content-Type': 'application/json'
}
// kết quả trả về (THEN)
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
// $window.location.href = "http://localhost:8081/#/project";
$state.go('project');
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('project');
}
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't insert data!!");
......@@ -66,15 +66,14 @@ function deleteProject($scope, $window, $http,$state) {
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
// $state.go('project');
$window.location.reload();
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't delete data!!");
}
}
......@@ -82,7 +81,7 @@ function deleteProject($scope, $window, $http,$state) {
};
//tạo controller sửa theo id
function updateProject($scope, $window, $http,$state) {
function updateProject($scope, $http, $state) {
$scope.updateProject = function (project) {
if (confirm("Bạn có muốn sửa không ?")) {
$http({
......@@ -94,13 +93,13 @@ function updateProject($scope, $window, $http,$state) {
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$state.go('project');
// $window.location.href = "http://localhost:8081/#/project";
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('project');
}
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't update data!!");
......@@ -108,17 +107,18 @@ function updateProject($scope, $window, $http,$state) {
}
};
};
function loadProjectDetail($scope,$stateParams,$http) {
$http.get('http://localhost:8081/quan-tri/chi-tiet-du-an/'+ $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.project = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
function loadProjectDetail($scope, $stateParams, $http) {
$http.get('http://localhost:8081/quan-tri/chi-tiet-du-an/' + $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.project = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
\ No newline at end of file
......@@ -3,69 +3,27 @@
</div>
<div class="card-body">
<form ng-controller="updateProject" ng-submit="updateProject(project)" name="formProject">
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="project.name" id="name" class="form-control"
placeholder="Tên Dự Án"
required="required" autofocus="autofocus" name="txtName">
<label for="name">Tên Dự Án</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="project.descriptions" id="descriptions"
class="form-control"
placeholder="Mô tả ngắn"
required="required" name="txtDescriptions">
<label for="descriptions">Mô tả ngắn</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="hidden" ng-model="project.id" id="id" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<select ng-model="project.status" class="form-control" 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>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="project.startDate" id="startDate" class="form-control"
placeholder="Ngày Bắt Đầu" required="required">
<label for="startDate">Ngày Bắt Đầu</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="project.endDate" id="endDate" class="form-control"
placeholder="nick skype" required="required">
<label for="endDate">Ngày Kết Thúc</label>
</div>
</div>
</div>
</div>
<h3 ng-show="formProject.$valid" style="text-align: center; color: #1c7430">Bạn Có Thể Lưu</h3>
<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/>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button>
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
......@@ -4,8 +4,7 @@
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="showProject">
<a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<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">
......@@ -20,12 +19,16 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="project in listProject|filter:search">
<tr 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>{{ project.status}}</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>
</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">
......@@ -35,6 +38,12 @@
</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>
</div>
</div>
\ No newline at end of file
<!-- <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>
angular.module("myApp").controller('projectViewsController', function ($scope, $http) {
//trang đang đứng trên font-end
$scope.currentPage = 1
//số item hiển thị trong 1 page
, $scope.numPerPage = 4
//tổng số page hiển thị trên thanh chọn
, $scope.maxSize = 5;
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listProject = response.data;
$scope.numPages = function () {
return Math.ceil($scope.listProject.length / $scope.numPerPage);
};
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.pageListProject = $scope.listProject.slice(begin, end);
});
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
});
\ 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