Commit c5a6bd0a authored by ='s avatar =

new

parents cdff04b0 bf8a6933
......@@ -17,6 +17,7 @@
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
......@@ -24,7 +25,6 @@
<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>
......@@ -35,21 +35,18 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
<version>8.0.16</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
......
......@@ -5,6 +5,8 @@ import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
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
List<ProjectDTO> findAllProject();
// upload thông tin dự án
......
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 org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -17,6 +17,14 @@ public class ProjectBussinessImpl implements ProjectBussiness {
@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 {
......@@ -58,7 +66,7 @@ public class ProjectBussinessImpl implements ProjectBussiness {
} else if (dto.getEndDate() == null) {
views = "ngày dự kiếm kết thúc dự án không được null";
} else {
dto.setStatusPost(0);
dto.setStatus(0);
projectRepository.saveEntity(dtoParseModels(dto));
views = "thêm thành công project !";
}
......@@ -123,13 +131,7 @@ public class ProjectBussinessImpl implements ProjectBussiness {
dto.setDescriptions(model.getDescriptions());
dto.setStartDate(model.getStartDate());
dto.setEndDate(model.getEndDate());
if(model.getStatus()==0){
dto.setStatusGet("Dự Kiến");
}else if(model.getStatus()==1){
dto.setStatusGet("Đang Tiến Hành");
}else{
dto.setStatusGet("Đã Hoàn Thành");
}
dto.setStatus(model.getStatus());
return dto;
}
......@@ -141,7 +143,7 @@ public class ProjectBussinessImpl implements ProjectBussiness {
project.setDescriptions(projectDTO.getDescriptions());
project.setStartDate(projectDTO.getStartDate());
project.setEndDate(projectDTO.getEndDate());
project.setStatus(projectDTO.getStatusPost());
project.setStatus(projectDTO.getStatus());
return project;
}
}
package com.itsol.quantrivanphong.manager.project.project.controller;
import com.itsol.quantrivanphong.report.issue.common.SystemConstants;
import com.itsol.quantrivanphong.manager.project.project.bussiness.ProjectBussiness;
import com.itsol.quantrivanphong.manager.project.project.dto.ProjectDTO;
import com.itsol.quantrivanphong.report.issue.common.SystemConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
......@@ -16,6 +16,12 @@ 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());
......@@ -28,12 +34,12 @@ public class ProjectController {
@PostMapping(value = "/them-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity saveProject(@RequestBody ProjectDTO projectDTO){
String views = projectBussiness.saveProject(projectDTO);
return ResponseEntity.ok(views);
return ResponseEntity.ok(new WrapperResult(200, views));
}
@PutMapping(value = "/sua-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity updateProject(@RequestBody ProjectDTO projectDTO){
String views = projectBussiness.updateProject(projectDTO);
return ResponseEntity.ok(views);
return ResponseEntity.ok(new WrapperResult(200, views));
}
@DeleteMapping(value = "/xoa-danh-sach-du-an",consumes = SystemConstants.TYPE_JSON)
public ResponseEntity deleteProject(@RequestBody ProjectDTO projectDTO){
......@@ -53,6 +59,32 @@ public class ProjectController {
}else{
views="không tồn tại";
}
return ResponseEntity.ok(views);
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;
}
}
}
......@@ -20,9 +20,7 @@ public class ProjectDTO {
//ngày kết thúc dự án
private Timestamp endDate;
//trạng thái thêm vào dataBase
private Integer statusPost;
//trạng thái lấy dữ liệu lên cline
private String statusGet;
private Integer status;
// danh sách id
private Integer[] ids;
}
......@@ -8,7 +8,7 @@ import java.util.List;
public interface ProjectRRepository extends JpaRepository<Project, Integer> {
@Query(value = "SELECT p.id, p.name, p.descriptions, p.start_date, p.end_date, p.status FROM project p where p.status = 2", nativeQuery = true)
@Query(value = "SELECT p.id, p.name, p.descriptions, p.start_date, p.end_date, p.status FROM project p where p.status = 1", nativeQuery = true)
List<Project> listProjectWorking();
@Query(value = "SELECT p.name FROM project p where p.id = ?1", nativeQuery = true)
......
......@@ -15,4 +15,6 @@ public interface ProjectGroupBussiness {
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);
}
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.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.Eproject;
import com.itsol.quantrivanphong.model.Project;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -14,7 +15,7 @@ import java.util.List;
@Service
public class ProjectGroupBussinessImpl implements ProjectGroupBussiness {
Logger logger = Logger.getLogger(ProjectGroupBussinessImpl.class);
@Autowired
private ProjectGroupRepository projectGroupRepository;
......@@ -29,6 +30,7 @@ public class ProjectGroupBussinessImpl implements ProjectGroupBussiness {
@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");
......@@ -37,21 +39,35 @@ public class ProjectGroupBussinessImpl implements ProjectGroupBussiness {
}
return null;
}
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;
}
}
return false;
}
@Override
public String saveEmployeeProject(ProjectGroupDTO dto) {
logger.info("saveEmployeeProject");
String views = "";
try{
projectGroupRepository.saveEntity(utils.Model(dto));
views="thêm thành công nhân viên vào nhóm dự án";
}catch (Exception e){
views="thêm không thành công!";
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";
} catch (Exception e) {
views = "thêm không thành công!";
}
}else {
views = "thành viên đã tồn tại";
}
return views;
}
@Override
public String updateEmployeeProject(ProjectGroupDTO dto) {
logger.info("updateEmployeeProject");
String views="";
Eproject eproject = projectGroupRepository.findByEmtityId(dto.getId());
if(eproject!=null){
......@@ -72,6 +88,7 @@ public class ProjectGroupBussinessImpl implements ProjectGroupBussiness {
@Override
public String outProjectGroup(Integer[] ids) {
logger.info("outProjectGroup");
String views = "";
int count=0;
count = projectGroupRepository.deleteEntity(ids);
......@@ -82,4 +99,18 @@ public class ProjectGroupBussinessImpl implements ProjectGroupBussiness {
}
return views;
}
@Override
public String deleteEmployeeProject(Integer id) {
logger.info("deleteEmployeeProject");
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";
}
return views;
}
}
package com.itsol.quantrivanphong.manager.project.projectgroup.controller;
import com.itsol.quantrivanphong.report.issue.common.SystemConstants;
import com.itsol.quantrivanphong.manager.project.projectgroup.bussiness.ProjectGroupBussiness;
import com.itsol.quantrivanphong.manager.project.projectgroup.dto.ProjectGroupDTO;
import com.itsol.quantrivanphong.report.issue.common.SystemConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
......@@ -27,7 +27,7 @@ public class ProjectGroupController {
@PostMapping(value = "/them-thanh-vien", consumes = SystemConstants.TYPE_JSON, produces = SystemConstants.TYPE_JSON)
public ResponseEntity addMemberProject(@RequestBody ProjectGroupDTO projectGroupDTO) {
String views = projectGroupBussiness.saveEmployeeProject(projectGroupDTO);
return ResponseEntity.ok(views);
return ResponseEntity.ok(new WrapperResult(200, views));
}
// cập nhật thông tin thành viên
......@@ -41,9 +41,40 @@ public class ProjectGroupController {
// xóa thành viên ra khỏi dự án
@DeleteMapping(value = "/thanh-vien-out-du-an")
public ResponseEntity deleteMemberProject(@RequestBody ProjectGroupDTO projectGroupDTO){
public ResponseEntity deleteMembersProject(@RequestBody ProjectGroupDTO projectGroupDTO){
String views = projectGroupBussiness.outProjectGroup(projectGroupDTO.getIds());
return ResponseEntity.ok(views);
}
@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;
}
}
}
......@@ -4,7 +4,6 @@ package com.itsol.quantrivanphong.manager.reportdetail.bussiness;
import com.itsol.quantrivanphong.manager.employee.repository.EmployeeRepository;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRRepository;
import com.itsol.quantrivanphong.manager.reportdetail.dto.request.ReportDTO;
import com.itsol.quantrivanphong.manager.reportdetail.dto.request.TimesheetRequestDTO;
import com.itsol.quantrivanphong.manager.reportdetail.repository.ProjectReportRepository;
import com.itsol.quantrivanphong.model.*;
import com.itsol.quantrivanphong.report.timesheet.repository.EProjectRepository;
......@@ -55,14 +54,18 @@ public class ReportProjectBussiness {
String mess;
try {
List<Eproject> eprojectList = eProjectRepository.listEprojectLack(projectId, currentDate);
List<Integer> list = new ArrayList<>();
for (Eproject eproject: eprojectList) {
list.add(eproject.getId());
if(eprojectList.isEmpty()){
mess = "Đã khởi tạo những thành viên chưa viết timeSheet rồi";
}else {
List<Integer> list = new ArrayList<>();
for (Eproject eproject : eprojectList) {
list.add(eproject.getId());
}
for (Integer i : list) {
timeSheetRepository.updateLack(i, false, "approved");
}
mess = "Tạo tự động thành công !";
}
for (Integer i: list){
timeSheetRepository.updateLack(i,false,"checked");
}
mess = "OK !";
}catch (Exception e){
mess = e.getMessage();
}
......@@ -78,7 +81,7 @@ public class ReportProjectBussiness {
String mess;
try {
timeSheetRepository.updateTimeSheetChecked(check, timeSheetId);
mess = "OK !";
mess = "Đã đổi trạng thái thành công !";
}catch (Exception e){
mess = e.getMessage();
}
......@@ -114,11 +117,11 @@ public class ReportProjectBussiness {
projectReport.setLackOfReport(timeSheetRepository.numberEmployeeLack(reportDTO.getProjectId(), reportDTO.getFirstPoint(), reportDTO.getFinalPoint()));
projectReport.setFirstDate(reportDTO.getFirstPoint());
projectReport.setFinalDate(reportDTO.getFinalPoint());
projectReport.setStatus(reportDTO.isStatus());
projectReportRepository.insertProjectReport(projectReport.getProjectName(),projectReport.getTeamLeader(), projectReport.getNumberOfMember(), projectReport.getCalendarEffort(), projectReport.getLackOfReport(), projectReport.isStatus(),reportDTO.getProjectId(), projectReport.getFirstDate(), projectReport.getFinalDate());
mess = "Ok !";
projectReportRepository.insertProjectReport(projectReport.getProjectName(),projectReport.getTeamLeader(), projectReport.getNumberOfMember(), projectReport.getCalendarEffort(), projectReport.getLackOfReport(), reportDTO.getProjectId(), projectReport.getFirstDate(), projectReport.getFinalDate());
mess = "Đã tạo mới báo cáo!";
}catch (Exception e){
mess = e.getMessage();
}
......@@ -127,6 +130,27 @@ public class ReportProjectBussiness {
}
public ProjectReport findProjectReportById(int id){
return projectReportRepository.findById(id);
}
public String deleteProjectReportById(int id){
String mess;
ProjectReport pr = projectReportRepository.findById(id);
if (pr == null){
mess = "Không tìm thấy BC cần xóa";
}else {
projectReportRepository.deleteById(id);
pr = projectReportRepository.findById(id);
if(pr==null){
mess = "Xóa thành công !";
}else {
mess = "Xóa thất bại";
}
}
return mess;
}
//======================================================================================================================
public List<Employee> listEmployeeLack(String firstDate, String finalDate, int projectId) {
......
......@@ -2,12 +2,8 @@ package com.itsol.quantrivanphong.manager.reportdetail.controller;
import com.itsol.quantrivanphong.manager.reportdetail.bussiness.ReportProjectBussiness;
import com.itsol.quantrivanphong.manager.reportdetail.dto.request.ReportDTO;
import com.itsol.quantrivanphong.manager.reportdetail.dto.request.TimesheetRequestDTO;
import com.itsol.quantrivanphong.manager.reportdetail.dto.response.ReportResponseDTO;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.Project;
import com.itsol.quantrivanphong.model.ProjectReport;
import com.itsol.quantrivanphong.model.TimeSheet;
import com.itsol.quantrivanphong.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
......@@ -25,9 +21,9 @@ public class ReportProjectController {
//Danh sách các dự án đang trong thời gian triển khai
@GetMapping(path = "/project")
public ResponseEntity<List<Project>> listProjectWorking(){
public ResponseEntity<List<Project>> listProjectWorking() {
List<Project> projectList = reportProjectBussiness.listProjectWorking();
if (projectList==null){
if (projectList == null) {
return (ResponseEntity<List<Project>>) ResponseEntity.status(HttpStatus.NOT_FOUND);
}
return ResponseEntity.ok(projectList);
......@@ -38,40 +34,40 @@ public class ReportProjectController {
//Hiển thị danh sách timesheet của các thành viên đã viết báo cáo trong ngày hôm đó
@GetMapping(path = "/project/{projectId}/timeSheet/{currentDate}")
public ResponseEntity<List<TimeSheet>> findAllTimeSheetStatusTrue(@PathVariable("projectId") int projectId, @PathVariable("currentDate") String currentDate){
public ResponseEntity<List<TimeSheet>> findAllTimeSheetStatusTrue(@PathVariable("projectId") int projectId, @PathVariable("currentDate") String currentDate) {
List<TimeSheet> timeSheetList = reportProjectBussiness.findAllTimeSheetStatusTrue(projectId, currentDate);
if(timeSheetList == null){
if (timeSheetList == null) {
return (ResponseEntity<List<TimeSheet>>) ResponseEntity.status(HttpStatus.NOT_FOUND);
}
return ResponseEntity.ok(timeSheetList);
return ResponseEntity.ok(timeSheetList);
}
//Nút "kiểm tra" : Lọc các thành viên chưa viết báo cáo và tự khởi tạo timesheet với trạng thái thái = false
@PostMapping(path = "/project/{projectId}/update/{currentDate}")
public ResponseEntity<String> updateTimeSheetStatus(@PathVariable("projectId") int projectId, @PathVariable("currentDate") String currentDate){
public ResponseEntity updateTimeSheetStatus(@PathVariable("projectId") int projectId, @PathVariable("currentDate") String currentDate) {
String mess = reportProjectBussiness.updateTimeSheetStatus(projectId, currentDate);
return ResponseEntity.ok(mess);
return ResponseEntity.ok(new notification(200,mess));
}
//Quản trị viên duyệt và đánh dấu (đã duyệt, từ chối) mặc định là chưa duyệt (update bảng timesheet theo id)
@PostMapping(path = "/project/timeSheet/update/{timeSheetId}")
public ResponseEntity<String> updateTimeSheetChecked(@RequestBody String check, @PathVariable("timeSheetId") int timeSheetId){
public ResponseEntity updateTimeSheetChecked(@RequestBody String check, @PathVariable("timeSheetId") int timeSheetId) {
String mess = reportProjectBussiness.updateTimeSheetChecked(timeSheetId, check);
return ResponseEntity.ok(mess);
return ResponseEntity.ok(new notification(200, mess));
}
//Danh sách thành viên trong Dự án thiếu báo cáo ngày hôm đó
@GetMapping(path = "/project/{projectId}/allLack/{currentDate}")
public ResponseEntity<List<Employee>> listLackOfReport(@PathVariable("projectId") int projectId, @PathVariable("currentDate") String currentDate){
@GetMapping(path = "/project/{projectId}/employee/{currentDate}")
public ResponseEntity<List<Employee>> listLackOfReport(@PathVariable("projectId") int projectId, @PathVariable("currentDate") String currentDate) {
List<Employee> employeeList = reportProjectBussiness.listLackOfReport(projectId, currentDate);
if(employeeList==null){
if (employeeList == null) {
return (ResponseEntity<List<Employee>>) ResponseEntity.status(HttpStatus.NOT_FOUND);
}
return ResponseEntity.ok(employeeList);
return ResponseEntity.ok(employeeList);
}
......@@ -80,27 +76,41 @@ public class ReportProjectController {
//Tạo một báo cáo mới
@PostMapping(path = "/project/newReport")
public ResponseEntity<String> insertProjectReport(@RequestBody ReportDTO reportDTO ){
public ResponseEntity insertProjectReport(@RequestBody ReportDTO reportDTO) {
String mess = reportProjectBussiness.insertProjectReport(reportDTO);
return ResponseEntity.ok(mess);
return ResponseEntity.ok(new notification(200,mess));
}
//Báo cáo gần nhất của dự án
@GetMapping(path = "/project/{projectId}/latest")
public ResponseEntity<ProjectReport> latestReport(@PathVariable("projectId") int projectId){
ProjectReport projectReport = reportProjectBussiness.latestReport(projectId);
return ResponseEntity.ok(projectReport);
public ResponseEntity<ProjectReport> latestReport(@PathVariable("projectId") int projectId) {
ProjectReport projectReport = reportProjectBussiness.latestReport(projectId);
return ResponseEntity.ok(projectReport);
}
// Tất cả các báo cáo của dự án
@GetMapping(path = "/project/{projectId}/allReport")
public ResponseEntity<List<ProjectReport>> allProjectReport(@PathVariable("projectId") int projectId){
List<ProjectReport> projectReportList = reportProjectBussiness.allProjectReport(projectId);
if (projectReportList==null){
return (ResponseEntity<List<ProjectReport>>) ResponseEntity.status(HttpStatus.NOT_FOUND);
}
return ResponseEntity.ok(projectReportList);
public ResponseEntity<List<ProjectReport>> allProjectReport(@PathVariable("projectId") int projectId) {
List<ProjectReport> projectReportList = reportProjectBussiness.allProjectReport(projectId);
if (projectReportList == null) {
return (ResponseEntity<List<ProjectReport>>) ResponseEntity.status(HttpStatus.NOT_FOUND);
}
return ResponseEntity.ok(projectReportList);
}
//Xem chi tiết một báo cáo theo id
@GetMapping(path = "/project/report/{id}")
public ResponseEntity<ProjectReport> findProjectReportById(@PathVariable("id") int projectId) {
ProjectReport projectReport = reportProjectBussiness.findProjectReportById(projectId);
return ResponseEntity.ok(projectReport);
}
// Xóa 1 báo cáo theo id
@PostMapping(path = "/project/report/delete/{id}")
public ResponseEntity deleteProjectReportById(@PathVariable("id") int projectId) {
String mess = reportProjectBussiness.deleteProjectReportById(projectId);
return ResponseEntity.ok(new notification(200,mess));
}
......@@ -110,26 +120,24 @@ public class ReportProjectController {
// Danh sách thành viên không viết timesheet
@GetMapping(path = "/project/{projectId}/employee/{firstDate}/{finalDate}")
public ResponseEntity<List<Employee>> listEmployeeLack(@PathVariable("projectId") int projectId, @PathVariable("firstDate") String firstDate, @PathVariable("finalDate") String finalDate){
public ResponseEntity<List<Employee>> listEmployeeLack(@PathVariable("projectId") int projectId, @PathVariable("firstDate") String firstDate, @PathVariable("finalDate") String finalDate) {
List<Employee> employeeList = reportProjectBussiness.listEmployeeLack(firstDate, finalDate, projectId);
if (employeeList==null){
if (employeeList == null) {
return (ResponseEntity<List<Employee>>) ResponseEntity.status(HttpStatus.NOT_FOUND);
}
return ResponseEntity.ok(employeeList);
return ResponseEntity.ok(employeeList);
}
// Chi tiết thiếu timesheet của mỗi thành viên
@GetMapping(path = "/project/{projectId}/employee/{employeeId}/{firstDate}/{finalDate}")
public ResponseEntity<ReportResponseDTO> listEmployeeLackDetail(@PathVariable("projectId") int projectId,@PathVariable("employeeId") int employeeId, @PathVariable("firstDate") String firstDate, @PathVariable("finalDate") String finalDate){
public ResponseEntity<ReportResponseDTO> listEmployeeLackDetail(@PathVariable("projectId") int projectId, @PathVariable("employeeId") int employeeId, @PathVariable("firstDate") String firstDate, @PathVariable("finalDate") String finalDate) {
ReportResponseDTO reportResponseDTO = new ReportResponseDTO();
reportResponseDTO.setTimeSheetList(reportProjectBussiness.listDateOfLack(firstDate, finalDate, projectId, employeeId));
reportResponseDTO.setNumberOflack(reportProjectBussiness.numberLack(firstDate, finalDate, projectId, employeeId));
return ResponseEntity.ok(reportResponseDTO);
return ResponseEntity.ok(reportResponseDTO);
}
//=================================================================================================================
......
......@@ -11,6 +11,10 @@ import java.util.List;
public interface ProjectReportRepository extends JpaRepository<ProjectReport, Integer> {
ProjectReport findById(int id);
void deleteById(int id);
@Query(value = "SELECT * FROM project_report pr WHERE pr.project_id = ?1 ORDER BY pr.created_at DESC limit 1", nativeQuery = true)
ProjectReport latestReport(int projectId);
......@@ -20,6 +24,6 @@ public interface ProjectReportRepository extends JpaRepository<ProjectReport, In
@Transactional
@Modifying
@Query(value = "INSERT INTO project_report(project_name, team_leader, number_of_members, calendar_effort, lack_of_reports, created_at, updated_at, status, project_id, first_date, final_date) VALUES (?1, ?2, ?3, ?4, ?5, CURRENT_DATE(), CURRENT_DATE() ,?6, ?7, ?8, ?9)",nativeQuery = true)
void insertProjectReport(String projectName, String teamLeader, int NumberOfMember, int CalendarEffort, int LackOfReport, boolean status, int projectId, String firstDate, String finalDate);
@Query(value = "INSERT INTO project_report(project_name, team_leader, number_of_members, calendar_effort, lack_of_reports, created_at, updated_at, project_id, first_date, final_date) VALUES (?1, ?2, ?3, ?4, ?5, CURRENT_DATE(), CURRENT_DATE() ,?6, ?7, ?8)",nativeQuery = true)
void insertProjectReport(String projectName, String teamLeader, int NumberOfMember, int CalendarEffort, int LackOfReport, int projectId, String firstDate, String finalDate);
}
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,9 +31,11 @@ public class Eproject {
@Column(name = "out_date",nullable = true)
private Timestamp outDate;
@JsonIgnore
@ManyToOne(fetch = FetchType.EAGER)
private Employee employee;
@JsonIgnore
@ManyToOne(fetch = FetchType.EAGER)
private Project project;
......
......@@ -38,9 +38,6 @@ public class ProjectReport extends DateAudit {
@Column(name = "lack_of_reports")
private int lackOfReport;
@Column(name = "status")
private boolean status;
@Column(name = "first_date")
private String firstDate;
......
package com.itsol.quantrivanphong.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.itsol.quantrivanphong.audit.DateAudit;
import lombok.AllArgsConstructor;
......@@ -39,7 +40,7 @@ public class TimeSheet extends DateAudit {
@Column(name = "status")
private boolean status;
// @JsonIgnore
@JsonIgnore
@ManyToOne(fetch = FetchType.EAGER)
private Eproject eproject;
}
package com.itsol.quantrivanphong.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class notification {
private int status;
private String view;
}
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;
}
......@@ -44,10 +44,6 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
} catch (HibernateException e) {
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return list;
}
......@@ -62,10 +58,6 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
}
......@@ -81,10 +73,6 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return entity;
}
......@@ -106,10 +94,6 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return count;
}
......@@ -130,10 +114,6 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return count;
}
......@@ -150,10 +130,6 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
} catch (Exception e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
} finally {
if (entityManager != null) {
entityManager.close();
}
}
return entity;
}
......@@ -180,9 +156,45 @@ public class AbstractEntityManagerDao<ID extends Serializable, T> implements Gen
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
log.info(e.getMessage());
}finally {
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();
totalItem = finAllEntity().size();
entityManager.getTransaction().commit();
} catch (HibernateException e) {
entityManager.getTransaction().rollback();
}
return new Object[]{totalItem, list};
}
}
......@@ -11,4 +11,6 @@ public interface GennericeEntityManagerDao<ID extends Serializable,T> {
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;
public class WrapperResult {
private int status;
private String message;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public WrapperResult(int status, String message) {
this.status = status;
this.message = message;
}
}
package com.itsol.quantrivanphong.report.issue.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@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;
}
server.port=8081
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/quantrivanphong
spring.datasource.username=root
......@@ -8,7 +9,8 @@ spring.datasource.password=
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
server.servlet.session.timeout=30s
# ===============================
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* jQuery Easing v1.4.1 - http://gsgd.co.uk/sandbox/jquery/easing/
* Open source under the BSD License.
* Copyright © 2008 George McGinley Smith
* All rights reserved.
* https://raw.github.com/gdsmith/jquery-easing/master/LICENSE
*/
(function (factory) {
if (typeof define === "function" && define.amd) {
define(['jquery'], function ($) {
return factory($);
});
} else if (typeof module === "object" && typeof module.exports === "object") {
exports = factory(require('jquery'));
} else {
factory(jQuery);
}
})(function($){
// Preserve the original jQuery "swing" easing as "jswing"
$.easing.jswing = $.easing.swing;
var pow = Math.pow,
sqrt = Math.sqrt,
sin = Math.sin,
cos = Math.cos,
PI = Math.PI,
c1 = 1.70158,
c2 = c1 * 1.525,
c3 = c1 + 1,
c4 = ( 2 * PI ) / 3,
c5 = ( 2 * PI ) / 4.5;
// x is the fraction of animation progress, in the range 0..1
function bounceOut(x) {
var n1 = 7.5625,
d1 = 2.75;
if ( x < 1/d1 ) {
return n1*x*x;
} else if ( x < 2/d1 ) {
return n1*(x-=(1.5/d1))*x + 0.75;
} else if ( x < 2.5/d1 ) {
return n1*(x-=(2.25/d1))*x + 0.9375;
} else {
return n1*(x-=(2.625/d1))*x + 0.984375;
}
}
$.extend( $.easing,
{
def: 'easeOutQuad',
swing: function (x) {
return $.easing[$.easing.def](x);
},
easeInQuad: function (x) {
return x * x;
},
easeOutQuad: function (x) {
return 1 - ( 1 - x ) * ( 1 - x );
},
easeInOutQuad: function (x) {
return x < 0.5 ?
2 * x * x :
1 - pow( -2 * x + 2, 2 ) / 2;
},
easeInCubic: function (x) {
return x * x * x;
},
easeOutCubic: function (x) {
return 1 - pow( 1 - x, 3 );
},
easeInOutCubic: function (x) {
return x < 0.5 ?
4 * x * x * x :
1 - pow( -2 * x + 2, 3 ) / 2;
},
easeInQuart: function (x) {
return x * x * x * x;
},
easeOutQuart: function (x) {
return 1 - pow( 1 - x, 4 );
},
easeInOutQuart: function (x) {
return x < 0.5 ?
8 * x * x * x * x :
1 - pow( -2 * x + 2, 4 ) / 2;
},
easeInQuint: function (x) {
return x * x * x * x * x;
},
easeOutQuint: function (x) {
return 1 - pow( 1 - x, 5 );
},
easeInOutQuint: function (x) {
return x < 0.5 ?
16 * x * x * x * x * x :
1 - pow( -2 * x + 2, 5 ) / 2;
},
easeInSine: function (x) {
return 1 - cos( x * PI/2 );
},
easeOutSine: function (x) {
return sin( x * PI/2 );
},
easeInOutSine: function (x) {
return -( cos( PI * x ) - 1 ) / 2;
},
easeInExpo: function (x) {
return x === 0 ? 0 : pow( 2, 10 * x - 10 );
},
easeOutExpo: function (x) {
return x === 1 ? 1 : 1 - pow( 2, -10 * x );
},
easeInOutExpo: function (x) {
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
pow( 2, 20 * x - 10 ) / 2 :
( 2 - pow( 2, -20 * x + 10 ) ) / 2;
},
easeInCirc: function (x) {
return 1 - sqrt( 1 - pow( x, 2 ) );
},
easeOutCirc: function (x) {
return sqrt( 1 - pow( x - 1, 2 ) );
},
easeInOutCirc: function (x) {
return x < 0.5 ?
( 1 - sqrt( 1 - pow( 2 * x, 2 ) ) ) / 2 :
( sqrt( 1 - pow( -2 * x + 2, 2 ) ) + 1 ) / 2;
},
easeInElastic: function (x) {
return x === 0 ? 0 : x === 1 ? 1 :
-pow( 2, 10 * x - 10 ) * sin( ( x * 10 - 10.75 ) * c4 );
},
easeOutElastic: function (x) {
return x === 0 ? 0 : x === 1 ? 1 :
pow( 2, -10 * x ) * sin( ( x * 10 - 0.75 ) * c4 ) + 1;
},
easeInOutElastic: function (x) {
return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ?
-( pow( 2, 20 * x - 10 ) * sin( ( 20 * x - 11.125 ) * c5 )) / 2 :
pow( 2, -20 * x + 10 ) * sin( ( 20 * x - 11.125 ) * c5 ) / 2 + 1;
},
easeInBack: function (x) {
return c3 * x * x * x - c1 * x * x;
},
easeOutBack: function (x) {
return 1 + c3 * pow( x - 1, 3 ) + c1 * pow( x - 1, 2 );
},
easeInOutBack: function (x) {
return x < 0.5 ?
( pow( 2 * x, 2 ) * ( ( c2 + 1 ) * 2 * x - c2 ) ) / 2 :
( pow( 2 * x - 2, 2 ) *( ( c2 + 1 ) * ( x * 2 - 2 ) + c2 ) + 2 ) / 2;
},
easeInBounce: function (x) {
return 1 - bounceOut( 1 - x );
},
easeOutBounce: bounceOut,
easeInOutBounce: function (x) {
return x < 0.5 ?
( 1 - bounceOut( 1 - 2 * x ) ) / 2 :
( 1 + bounceOut( 2 * x - 1 ) ) / 2;
}
});
});
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],function($){return factory($)})}else if(typeof module==="object"&&typeof module.exports==="object"){exports=factory(require("jquery"))}else{factory(jQuery)}})(function($){$.easing.jswing=$.easing.swing;var pow=Math.pow,sqrt=Math.sqrt,sin=Math.sin,cos=Math.cos,PI=Math.PI,c1=1.70158,c2=c1*1.525,c3=c1+1,c4=2*PI/3,c5=2*PI/4.5;function bounceOut(x){var n1=7.5625,d1=2.75;if(x<1/d1){return n1*x*x}else if(x<2/d1){return n1*(x-=1.5/d1)*x+.75}else if(x<2.5/d1){return n1*(x-=2.25/d1)*x+.9375}else{return n1*(x-=2.625/d1)*x+.984375}}$.extend($.easing,{def:"easeOutQuad",swing:function(x){return $.easing[$.easing.def](x)},easeInQuad:function(x){return x*x},easeOutQuad:function(x){return 1-(1-x)*(1-x)},easeInOutQuad:function(x){return x<.5?2*x*x:1-pow(-2*x+2,2)/2},easeInCubic:function(x){return x*x*x},easeOutCubic:function(x){return 1-pow(1-x,3)},easeInOutCubic:function(x){return x<.5?4*x*x*x:1-pow(-2*x+2,3)/2},easeInQuart:function(x){return x*x*x*x},easeOutQuart:function(x){return 1-pow(1-x,4)},easeInOutQuart:function(x){return x<.5?8*x*x*x*x:1-pow(-2*x+2,4)/2},easeInQuint:function(x){return x*x*x*x*x},easeOutQuint:function(x){return 1-pow(1-x,5)},easeInOutQuint:function(x){return x<.5?16*x*x*x*x*x:1-pow(-2*x+2,5)/2},easeInSine:function(x){return 1-cos(x*PI/2)},easeOutSine:function(x){return sin(x*PI/2)},easeInOutSine:function(x){return-(cos(PI*x)-1)/2},easeInExpo:function(x){return x===0?0:pow(2,10*x-10)},easeOutExpo:function(x){return x===1?1:1-pow(2,-10*x)},easeInOutExpo:function(x){return x===0?0:x===1?1:x<.5?pow(2,20*x-10)/2:(2-pow(2,-20*x+10))/2},easeInCirc:function(x){return 1-sqrt(1-pow(x,2))},easeOutCirc:function(x){return sqrt(1-pow(x-1,2))},easeInOutCirc:function(x){return x<.5?(1-sqrt(1-pow(2*x,2)))/2:(sqrt(1-pow(-2*x+2,2))+1)/2},easeInElastic:function(x){return x===0?0:x===1?1:-pow(2,10*x-10)*sin((x*10-10.75)*c4)},easeOutElastic:function(x){return x===0?0:x===1?1:pow(2,-10*x)*sin((x*10-.75)*c4)+1},easeInOutElastic:function(x){return x===0?0:x===1?1:x<.5?-(pow(2,20*x-10)*sin((20*x-11.125)*c5))/2:pow(2,-20*x+10)*sin((20*x-11.125)*c5)/2+1},easeInBack:function(x){return c3*x*x*x-c1*x*x},easeOutBack:function(x){return 1+c3*pow(x-1,3)+c1*pow(x-1,2)},easeInOutBack:function(x){return x<.5?pow(2*x,2)*((c2+1)*2*x-c2)/2:(pow(2*x-2,2)*((c2+1)*(x*2-2)+c2)+2)/2},easeInBounce:function(x){return 1-bounceOut(1-x)},easeOutBounce:bounceOut,easeInOutBounce:function(x){return x<.5?(1-bounceOut(1-2*x))/2:(1+bounceOut(2*x-1))/2}})});
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -4,19 +4,23 @@
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<!-- <meta http-equiv="X-UA-Compatible" content="ie=edge">-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Document</title>
<link href="css/bootstrap.css" rel='stylesheet' type='text/css'/>
<!-- Custom Theme files -->
<!-- <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700" rel='stylesheet' type='text/css'>-->
<!-- <link href="https://fonts.googleapis.com/css?family=Open+Sans" type='text/css'>-->
<link href="css/style.css" rel='stylesheet' type='text/css'/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- Custom fonts for this template-->
<link href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
rel="stylesheet" type="text/css">
<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>
......@@ -24,16 +28,45 @@
</head>
<body ng-app="myApp">
<div ui-view="layout"></div>
<script src="js/app.js"></script>
<script src="pages/employee/employeeController.js"></script>
<script src="pages/project/projectController.js"></script>
<script src="pages/report/reportController.js"></script>
<script src="pages/report/timeSheetReportController.js"></script>
<script src="pages/project/groupproject/groupProjectController.js"></script>
<!-- Js -->
<!-- Bootstrap core JavaScript-->
<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>
<!-- Core plugin JavaScript-->
<script src="common/js/jquery.easing.min.js"></script>
<!-- Page level plugin JavaScript-->
<script src="common/js/Chart.min.js"></script>
<script src="common/js/jquery.dataTables.js"></script>
<script src="common/js/dataTables.bootstrap4.js"></script>
<!-- Custom scripts for all pages-->
<script src="common/js/sb-admin.min.js"></script>
</body>
</html>
\ No newline at end of file
......@@ -5,37 +5,65 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
$locationProvider.hashPrefix('');
//trở về trang mặc định
$urlRouterProvider.otherwise("/employees");
$urlRouterProvider.otherwise("/admin");
$stateProvider
.state("layout1", {
.state("layout3", {
abstract: true,
views: {
"layout": {
templateUrl: "layout/layout1.html"
templateUrl: "layout/layout3.html"
}
}
})
.state("layout2", {
.state("layout4", {
abstract: true,
views: {
"layout": {
templateUrl: "layout/layout2.html"
templateUrl: "layout/layout4.html"
}
}
})
.state("layout3", {
abstract: true,
.state("admin", {
parent: 'layout3',
url: "/admin",
views: {
"layout": {
templateUrl: "layout/layout3.html"
"content": {
templateUrl: "pages/adminhome/admin-home.html",
controller:"adminController"
}
}
})
.state("login", {
parent: 'layout4',
url: "/login",
views: {
"content": {
templateUrl: "pages/login/login.html",
controller: "loginController"
}
}
})
.state("register", {
parent: 'layout4',
url: "/register",
views: {
"content": {
templateUrl: "pages/login/register.html",
controller: "loginController"
}
}
})
.state("forgot-password", {
parent: 'layout4',
url: "/forgot-password",
views: {
"content": {
templateUrl: "pages/login/forgot-password.html",
controller: "loginController"
}
}
})
.state("employees", {
parent: 'layout3',
url: "/employees",
......@@ -52,31 +80,132 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
views: {
"content": {
templateUrl: "pages/project/project/projectListViews.html",
controller: "projectController"
controller: "showProject"
}
}
})
.state("addproject", {
parent: 'layout3',
url: "/addproject",
views: {
"content": {
templateUrl: "pages/project/project/projectAddViews.html",
controller: "insertProject"
}
}
})
.state("report", {
//======================================================================================================================
//Hieunv
.state("reportProject", {
parent: 'layout3',
url: "/report",
url: "/report/project",
views: {
"content": {
templateUrl: "pages/report/report.html",
templateUrl: "pages/report/timeSheetReport.html",
controller: "reportController"
}
}
})
.state("timeSheet", {
.state("reportTimeSheet", {
parent: 'layout3',
url: "/timeSheet",
url: "/report/project/:ID/timeSheet",
views: {
"content": {
templateUrl: "pages/report/detailReport.html",
controller: "timeSheetReportController"
templateUrl: "pages/report/timeSheetListViews.html",
controller: "timeSheetListController"
}
}
})
.state("reportEmployee", {
parent: 'layout3',
url: "/report/project/:ID/employee",
views: {
"content": {
templateUrl: "pages/report/employeeListViews.html",
controller: "listLackOfReportController"
}
}
})
.state("report2", {
parent: 'layout3',
url: "/report/project2",
views: {
"content": {
templateUrl: "pages/report/reportPage.html",
controller: "reportController"
}
}
})
.state("allReport", {
parent: 'layout3',
url: "/report/project/:ID/allReport",
views: {
"content": {
templateUrl: "pages/report/reportListPage.html",
controller: "allProjectReportController"
}
}
})
.state("reportDetail", {
parent: 'layout3',
url: "/report/reportDetail/:ID",
views: {
"content": {
templateUrl: "pages/report/reportDetailPage.html",
controller: "projectReportDetailController"
}
}
})
.state("reportEmployeeLack", {
parent: 'layout3',
url: "/report/project/:ID/employeeReport",
views: {
"content": {
templateUrl: "pages/report/employeeListViews1.html",
controller: "listEmployeeLackController"
}
}
})
//Hieunv
//======================================================================================================================
.state("editproject", {
parent: 'layout3',
url: "/editproject/:ID",
views: {
"content": {
templateUrl: "pages/project/project/projectEditViews.html",
controller: "loadProjectDetail"
}
}
})
.state("groupProjectByProjectId", {
parent: 'layout3',
url: "/groupProjectByProjectId/:ID",
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectView.html",
controller: "loadGroupProjectByProjectId"
}
}
})
.state("addEmployeeProject", {
parent: 'layout3',
url: "/addEmployeeProject",
views: {
"content": {
templateUrl: "pages/project/groupproject/groupProjectAddView.html",
controller: "insertEmployeeProject"
}
}
})
});
<div>
layout2
Không có menu
<div ui-view="content"></div>
</div>
\ No newline at end of file
<nav>
<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>
<body>
<!-- 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"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user-circle fa-fw"></i>Admin
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">
<a class="dropdown-item" href="#">Profile</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">Logout</a>
</div>
</li>
</ul>
<div>
<div ui-view="content"></div>
</div>
</body>
</nav>
<!--end header -->
<div id="wrapper">
<!-- menu -->
<!-- Sidebar -->
<ul class="sidebar navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" id="pagesDropdown" role="button" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<i class="fas fa-fw fa-folder"></i>
<span>Quản Trị Văn Phòng</span>
</a>
<div class="dropdown-menu" aria-labelledby="pagesDropdown">
<h6 class="dropdown-header">Quản Trị</h6>
<a class="dropdown-item" ui-sref="project">Dự Án</a>
<a class="dropdown-item" ui-sref="employees">Nhân Viên</a>
<a class="dropdown-item" ui-sref="reportProject">Báo Cáo</a>
<a class="dropdown-item" href="#">Tin Tức</a>
<div class="dropdown-divider"></div>
<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>
<h6 class="dropdown-header">Báo Cáo</h6>
<a class="dropdown-item" ui-sref="reportProject">TimeSheet</a>
<a class="dropdown-item" ui-sref="report2">Báo Cáo Chung</a>
</div>
</li>
</ul>
<!-- end menu -->
<div class="container-fluid">
<!-- Content -->
<div ui-view="content">
</div>
<!-- footer -->
</div>
</div>
<!-- Footer -->
<footer class="py-5 bg-dark">
<div class="container">
<p class="m-0 text-center text-white">ps: Mock 1</p>
</div>
</footer>
<!--Layout Login-->
<div class="container">
Project works
</div>
<div ui-view="content"/>
</div>
\ No newline at end of file
<div class="container" style="text-align: center">
<h1>Chào Mừng bạn đến với trang ADMIN</h1>
</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
......@@ -26,7 +26,7 @@ angular.module("myApp").controller("employeeController", function($scope, $http)
console.log($scope.emp);
$http({
method : 'POST',
url : "http://localhost:8080/list_employee/",
url : "http://localhost:8081/list_employee/",
data: $scope.emp
}).then(function successCallback(response) {
console.log(response);
......@@ -79,7 +79,7 @@ angular.module("myApp").controller("employeeController", function($scope, $http)
$http({
method : 'GET',
url : "http://localhost:8080/list_employee/"
url : "http://localhost:8081/list_employee/"
}).then(function successCallback(response) {
console.log(response);
......
<div class="card card-login mx-auto mt-5">
<div class="card-header">Reset Password</div>
<div class="card-body">
<div class="text-center mb-4">
<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>
<a class="btn btn-primary btn-block" href="login.html">Reset Password</a>
</form>
<div class="text-center">
<a class="d-block small mt-3" ui-sref="register">Đăng ký tài khoản</a>
<a class="d-block small" ui-sref="login">Đăng Nhập</a>
</div>
</div>
</div>
\ No newline at end of file
<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>
<input class="btn btn-primary btn-block" type="submit" value="Đăng Nhập"/>
</form>
<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>
</div>
</div>
</div>
\ No newline at end of file
angular.module("myApp").controller("loginController", function($scope, $http,$window) {
console.log("loginController");
});
\ No newline at end of file
<div class="card card-register mx-auto mt-5">
<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>
<a class="btn btn-primary btn-block" href="#">Register</a>
</form>
<div class="text-center">
<a class="d-block small mt-3" ui-sref="login">Dăng Nhập</a>
<a class="d-block small" ui-sref="forgot-password">Lấy lại mật khẩu?</a>
</div>
</div>
</div>
\ No newline at end of file
<div class="card-header">
<i class="fas fa-table"></i> Thành thành viên mới của dự án
</div>
<div class="card-body">
<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>
<h1>{{view.message}}</h1>
<div>
<input type="submit" value="Lưu">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button>
</div>
</form>
</div>
\ No newline at end of file
var app = angular.module('myApp');
app.controller('loadGroupProjectByProjectId', loadGroupProjectByProjectId);
app.controller('insertEmployeeProject', insertEmployeeProject);
app.controller('deleteEmployeeProject', deleteEmployeeProject);
// controlers tạo Get API
function loadGroupProjectByProjectId($scope,$stateParams,$http) {
$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
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
}
// tạo controllers insert API
function insertEmployeeProject($scope, $http, $window) {
$scope.insert_employeeproject = function () {
$http({
//khai báo type
method: 'POST',
//đường dẫn API
url: 'http://localhost:8081/them-thanh-vien',
//truyền dữ liệu nhập trên cline vào data
data: angular.toJson($scope.employeeProject),
//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) {
$scope.view = response.data;
}
//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);
function successCallback(response) {
console.log(response.data);
{
$scope.pGroupProject = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
};
function deleteEmployeeProject($scope, $window, $http) {
$scope.deleteEmployeeProject = function (gruopProject) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8081/xoa-thanh-vien-du-an',
data: $scope.gruopProject,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$window.location.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
<!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 mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body">
<div class="table-responsive" 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>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>Tài khoản</th>
<th>Tên</th>
<th>Email</th>
<th>Chức Vụ</th>
<th>Ngày Vào</th>
<th>Ngày Ra</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="gruopProject in listGruopProject">
<td>{{ gruopProject.employeeDTO.username }}</td>
<td>{{ gruopProject.employeeDTO.lastName }}</td>
<td>{{ gruopProject.employeeDTO.email}}</td>
<td>{{ gruopProject.position}}</td>
<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 class="btn btn-danger btn-circle btn-sm" ng-controller="deleteEmployeeProject"
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>
</div>
</div>
</div>
\ No newline at end of file
<div class="card-header">
<i class="fas fa-table"></i> Thêm mới dự án
</div>
<div class="card-body" ng-app="ProjectApiModule">
<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="lstProject.name" id="name" class="form-control"
<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>
<span>{{lstProject.name}}</span>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.descriptions" id="descriptions"
<input type="text" ng-model="project.descriptions" id="descriptions"
class="form-control"
placeholder="Mô tả ngắn"
required="required">
......@@ -29,24 +28,25 @@
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="lstProject.startDate" id="startDate" class="form-control"
<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="lstProject.endDate" id="endDate" class="form-control"
<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>
<div>
<input type="submit" value="Lưu">
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button>
</div>
</form>
</div>
<script src="pages/project/project/projectController.js"></script>
\ No newline at end of file
</div>
\ No newline at end of file
......@@ -2,13 +2,13 @@ var app = angular.module('myApp');
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) {
//success code
console.log(response.data);
{
$scope.listProject = response.data
......@@ -21,8 +21,8 @@ function showProject($scope, $http) {
}
};
// tạo controllers insert APT
function insertProject($scope, $http) {
// tạo controllers insert API
function insertProject($scope, $http, $window,$state) {
$scope.insert_project = function () {
$http({
//khai báo type
......@@ -31,7 +31,7 @@ function insertProject($scope, $http) {
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.lstProject),
data: angular.toJson($scope.project),
//kiểu dữ liệu API
headers: {
'Content-Type': 'application/json'
......@@ -41,7 +41,8 @@ function insertProject($scope, $http) {
//tạo funtion nếu thành công!
function successCallback(response) {
$window.location.href = 'http://localhost:8081';
// $window.location.href = "http://localhost:8081/#/project";
$state.go('project');
}
//tạo funtion kiểm tra nếu thất bại
......@@ -52,8 +53,8 @@ function insertProject($scope, $http) {
}
};
//delete project theo id
function deleteProject($scope, $window, $http) {
// delete project theo id
function deleteProject($scope, $window, $http,$state) {
$scope.deleteProject = function (project) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
......@@ -63,22 +64,61 @@ function deleteProject($scope, $window, $http) {
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
$window.location.href = 'http://localhost:8081';
}, function (data, status) {
});
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
// $state.go('project');
$window.location.reload();
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't delete data!!");
}
}
};
};
//tạo controller sửa theo id
function updateProject($scope, $window, $http,$state) {
$scope.updateProject = function (project) {
if (confirm("Bạn có muốn sửa không ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/quan-tri/sua-du-an',
data: angular.toJson($scope.project),
headers: {
'Content-Type': 'application/json'
}
}).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";
}
//tạo service lấy id của đường dẫn
angular.module('ProjectApiModule.Services', []).factory('projectGetService', function ($resource) {
return $resource('http://localhost:8081/quan-tri/chi-tiet-du-an/:id', {id: '@myCarId'}, {
update: {
method: 'PUT'
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't update 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
}
}
});
});
//service kiểm tra id có tồn tại không
\ No newline at end of file
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
}
\ No newline at end of file
<div class="card-header">
<i class="fas fa-table"></i> Sửa Dự Án
</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>
<div>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button>
</div>
</form>
</div>
\ No newline at end of file
......@@ -3,9 +3,9 @@
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body" ng-app="ProjectApiModule">
<div class="card-body">
<div class="table-responsive" ng-controller="showProject">
<a href="#" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
......@@ -25,12 +25,13 @@
<td>{{ project.descriptions }}</td>
<td>{{ project.startDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.endDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.statusGet }}</td>
<td><a data-ng-href="#" class="btn btn-info btn-circle btn-sm">
Xem </a> <a data-ng-href="#" class="btn btn-warning btn-circle btn-sm">
<td>{{ project.status}}</td>
<td><a ui-sref="groupProjectByProjectId({ID: project.id})" class="btn btn-info btn-circle btn-sm">
Xem </a>
<a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm">
Sửa </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="deleteProject"
data-ng-click="deleteProject(project)">Xóa</a>
data-ng-click="deleteProject(project.id)">Xóa</a>
</tr>
</tbody>
</table>
......
/**
*
*/
angular.module("myApp").controller("projectController", function($scope, $http,$window) {
console.log("projectController");
});
\ No newline at end of file
<div ng-repeat="a in timeSheets">
{{a.id}}
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Thành viên thiếu TimeSheet
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="updateTimeSheetCheckedController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Ảnh</th>
<th>Username</th>
<th>Họ và tên</th>
<th>Địa chỉ email</th>
<th>SDT</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="emp in employeesList|filter:search">
<td>{{$index+1}}</td>
<td>{{emp.picture}}</td>
<td>{{emp.firstName+" "+emp.lastName}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.phoneNumber}}</td>
<td><a ui-sref="" class="btn btn-info btn-circle btn-sm">Xem </a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Thành viên thiếu TimeSheet
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="listEmployeeLackController">
<form>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;"> <br>
<div ng-show="detail">
<div>
Số lần thiếu báo cáo: {{listEmployeeLackDetails.numberOflack}}
</div>
<div>
<table class="table table-bordered" id="" width="100%" cellspacing="0">
<tbody>
<tr>
<th>Ngày thiếu:</th>
<td data-ng-repeat="dt in listEmployeeLackDetails.timeSheetList" >{{dt.createdAt | date:"dd/MM/yyyy"}} </td>
</tr>
</tbody>
</table>
</div>
</div>
<div ng-show="inputDate">
<label for="startDate">Ngày Bắt Đầu</label>
<input type="date" ng-model="request.firstDate" id="startDate" class="form-control"
placeholder="điểm đầu" required="required" style="width: auto">
<label for="endDate">Ngày Kết Thúc</label>
<input type="date" ng-model="request.finalDate" id="endDate" class="form-control"
placeholder="điểm cuối" required="required" style="width: auto">
</div>
<div>
<a ng-click="listEmployeeLacks($stateParams.ID,request.firstDate, request.finalDate)" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" ng-show="show"> Hiển thị </a>
<a ng-click="cancelView()" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" ng-show="cancel"> Đóng </a>
</div>
</form>
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Ảnh</th>
<th>Username</th>
<th>Họ và tên</th>
<th>Địa chỉ email</th>
<th>SDT</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="emp in listEmployee|filter:search">
<td>{{$index+1}}</td>
<td>{{emp.picture}}</td>
<td>{{emp.firstName+" "+emp.lastName}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.emailAddress}}</td>
<td>{{emp.phoneNumber}}</td>
<td><a ng-click="listEmployeeLackDetail(emp.id)" class="btn btn-info btn-circle btn-sm">Xem </a></td>
</tr>
</tbody>
</table>
<div><a ng-click="history.go(-1);" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;" > Trở Về</a></div>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="container">
<div class="row">
<div class="col-md-10">
<div>
<legend>Báo Cáo</legend>
</div>
<div>
<table class="table">
<thead>
<tr>
<tr>
<td colspan="12">Danh Sách Dự án (Đang được triển khai)</td>
</tr>
<th>ID</th>
<th>Tên dự án</th>
<th>Mô tả</th>
<th>Thời gian bắt đầu</th>
<th>Thời gian kết thúc</th>
<th>Trạng thái</th>
<th colspan="2">Menu</th>
</tr>
</thead>
<tbody>
<tr class="vide" data-ng-repeat="pro in projects">
<td>{{$index + 1}}</td>
<td>{{pro.name}}</td>
<td>{{pro.descriptions}}</td>
<td>{{pro.startDate}}</td>
<td>{{pro.endDate}}</td>
<td>{{pro.status}}</td>
<td><a ui-sref="timeSheet" ng-click="timeSheetList(pro);">Detail</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Báo cáo chi tiết
</div>
<div class="card-body" ng-controller="projectReportDetailController">
<div>
<h4>Tên Dự Án:</h4><br>
<p>{{projectReportDetails.projectName}}</p>
<h4>Team Leader</h4>
<p>{{projectReportDetails.teamLeader}}</p>
<h4>Số Thành Viên</h4>
<p>{{projectReportDetails.numberOfMember}}</p>
<h4>Điểm</h4>
<p>{{projectReportDetails.calendarEffort}}</p>
<h4>Số Thành Viên Thiếu Báo Cáo</h4>
<p>{{projectReportDetails.lackOfReport}}</p>
<h4>Khoảng Thời Gian</h4>
<p>{{projectReportDetails.firstDate}} --> {{projectReportDetails.firstDate}}</p>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh sách báo cáo theo thời gian của dự án
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="allProjectReportController">
<div ng-controller="deleteReportController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{messages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tên Dự Án</th>
<th>Team Leader</th>
<th>Số Thành Viên</th>
<th>Điểm Nỗ Lực</th>
<th>Số TV Thiếu Báo Cáo</th>
<th>Thời gian</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="pr in ProjectReports|filter:search">
<td>{{$index+1}}</td>
<td>{{pr.projectName}}</td>
<td>{{pr.teamLeader}}</td>
<td>{{pr.numberOfMember}}</td>
<td>{{pr.calendarEffort}}</td>
<td>{{pr.lackOfReport}}</td>
<td>{{pr.firstDate | date:"dd/MM/yyyy"}} <br>--> {{pr.finalDate | date:"dd/MM/yyyy"}}</td>
<td><a ui-sref="reportDetail({ID: pr.id})" class="btn btn-info btn-circle btn-sm">Xem </a>
<a ng-click="deleteReport(pr.id)" class="btn btn-warning btn-circle btn-sm">Xóa </a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i>Danh Sách Dự án (Đang được triển khai)
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="reportController">
<div ng-controller="insertProjectReportController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;">-->
<!-- Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{messages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tên dự án</th>
<th>Mô tả</th>
<th>Thời gian </th>
<th>Trạng thái</th>
<th>Chọn khoảng thời gian</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<form>
<tr data-ng-repeat="pro in projects|filter:search">
<td>{{$index+1}}</td>
<td>{{pro.name}}</td>
<td>{{pro.descriptions}}</td>
<td>{{pro.startDate | date:"dd/MM/yyyy"}} <br>--> {{pro.endDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.status}}</td>
<td class="form-label-group" >
<!-- <label for="startDate">Ngày Bắt Đầu</label>-->
<input type="date" ng-model="request.firstDate" id="startDate" class="form-control"
placeholder="điểm đầu" required="required">
<!-- <label for="endDate">Ngày Kết Thúc</label>-->
<input type="date" ng-model="request.finalDate" id="endDate" class="form-control"
placeholder="điểm cuối" required="required">
</td>
<td>
<a ng-click="insertReport(pro.id, request.firstDate, request.finalDate)" class="btn btn-info btn-circle btn-sm">Thêm mới báo cáo></a><br>
<a ui-sref="allReport({ID: pro.id})" class="btn btn-warning btn-circle btn-sm">Danh sách báo cáo</a> <br>
<a ui-sref="reportEmployeeLack({ID: pro.id})" class="btn btn-danger btn-circle btn-sm" data-ng-click="">Ds thành viên thiếu báo cáo</a>
</td>
</tr>
</form>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Timesheet Dự án
</div>
<div class="card-body">
<div class="table-responsive">
<div ng-controller="updateTimeSheetCheckedController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tiêu đề</th>
<th>Nội dung</th>
<th>Ghi chú</th>
<th>Ngày tạo</th>
<th>trạng thái duyệt</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="item in timeSheets|filter:search">
<td>{{$index+1}}</td>
<td>{{item.title}}</td>
<td>{{item.content}}</td>
<td>{{item.note}}</td>
<td>{{item.createdAt | date:"dd/MM/yyyy" }}</td>
<td>
<select ng-model="item.checked" class="form-control" autofocus="autofocus" required="required">
<!-- <option value="">==> Trạng Thái</option>-->
<option value="unapproved">Chưa duyệt</option>
<option value="approved">Đã duyệt</option>
<option value="deny">Từ chối</option>
</select>
</td>
<td><a ui-sref="" class="btn btn-info btn-circle btn-sm">Xem </a>
<a ng-click="updateTimeSheetChecked(item.id, item.checked)" class="btn btn-warning btn-circle btn-sm">Duyệt </a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i>Danh Sách Dự án (Đang được triển khai)
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="reportController">
<div ng-controller="updateTimeSheetStatusController">
<!-- <a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;">-->
<!-- Thêm </a>-->
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
{{timeSheetsMessages.view}}
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>STT</th>
<th>Tên dự án</th>
<th>Mô tả</th>
<th>Thời gian bắt đầu</th>
<th>Thời gian kết thúc</th>
<th>Trạng thái</th>
<th>Menu</th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="pro in projects|filter:search">
<td>{{$index+1}}</td>
<td>{{pro.name}}</td>
<td>{{pro.descriptions}}</td>
<td>{{pro.startDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.endDate | date:"dd/MM/yyyy"}}</td>
<td>{{pro.status}}</td>
<td><a ui-sref="reportTimeSheet({ID: pro.id})" class="btn btn-info btn-circle btn-sm">Ds báo cáo ngày </a><br>
<a ng-click="updateTimeSheetStatus(pro.id)" class="btn btn-warning btn-circle btn-sm">khởi tạo tv thiếu báo cáo</a> <br>
<a ui-sref="reportEmployee({ID: pro.id})" class="btn btn-danger btn-circle btn-sm" data-ng-click="">Ds thành viên thiếu báo cáo</a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
angular.module('myApp').controller('timeSheetReportController' , function ($scope , $http) {
$scope.request = {
"currentDate": ""
};
$scope.timeSheetList = function(pro) {
var date = new Date();
$scope.request.currentDate = date.getFullYear() + '-' + ('0' + (date.getMonth() + 1)).slice(-2) + '-' + ('0' + date.getDate()).slice(-2);
$http({
method: 'GET',
url: "http://localhost:8081/admin/report/project/"+pro.id+"/timeSheet/"+$scope.request.currentDate
}).then(function successCallback(response) {
console.log(response);
$scope.timeSheets= response.data;
console.log($scope.timeSheets);
}, function errorCallback(response) {
console.log(response)
});
}
});
<div class="container">
state con của layout2
</div>
/**
*
*/
angular.module("myApp").controller("testlayoutController", function($scope, $http,$window) {
console.log("testlayoutController");
});
\ 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