Commit a98ad627 authored by Phạm Duy Phi's avatar Phạm Duy Phi

Merge branch 'master' into phipham

# Conflicts:
#	src/main/java/com/itsol/quantrivanphong/report/timesheet/business/TimeSheetBusiness.java
#	src/main/java/com/itsol/quantrivanphong/report/timesheet/controller/TimeSheetController.java
#	src/main/java/com/itsol/quantrivanphong/report/timesheet/repository/TimeSheetRepository.java
#	src/main/resources/application.properties
#	src/main/resources/public/index.html
#	src/main/resources/public/js/app.js
#	src/main/resources/public/pages/timesheet/timesheet.html
#	src/main/resources/public/pages/timesheet/timesheetController.js
parents d39d214d d09d0eff
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencies> <dependencies>
...@@ -65,7 +66,8 @@ ...@@ -65,7 +66,8 @@
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
</plugins> </plugins>
<finalName>Spring4MVCCRUDRestService</finalName>
</build> </build>
</project> </project>
...@@ -3,14 +3,11 @@ package com.itsol.quantrivanphong.access.homepage.controller; ...@@ -3,14 +3,11 @@ package com.itsol.quantrivanphong.access.homepage.controller;
import com.itsol.quantrivanphong.access.homepage.business.CatalogiBusiness; import com.itsol.quantrivanphong.access.homepage.business.CatalogiBusiness;
import com.itsol.quantrivanphong.access.homepage.business.NewsBusiness; import com.itsol.quantrivanphong.access.homepage.business.NewsBusiness;
import com.itsol.quantrivanphong.business.EmployeeBusiness;
import com.itsol.quantrivanphong.exception.ResourceNotFoundException; import com.itsol.quantrivanphong.exception.ResourceNotFoundException;
import com.itsol.quantrivanphong.manager.employee.business.EmployeeBusiness;
import com.itsol.quantrivanphong.model.Employee; import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.News; import com.itsol.quantrivanphong.model.News;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
......
package com.itsol.quantrivanphong.employee.bussiness;
import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.repository.EmployeeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public class EmployeeBussiness {
@Autowired
EmployeeRepository employeeRepository;
// public List<Employee> findAll(){
// return employeeRepository.findAll();
// }
//
public Optional<Employee> findById(int newsId){
return employeeRepository.findById(newsId);
}
// public User save(User user){
// return userRepository.save(user);
// }
// public User updateUser(Long newsId, User signUpDTO){
// User user = userRepository.findUserById(newsId);
// user.setUsername(signUpDTO.getUsername());
// user.setPassword(signUpDTO.getPassword());
// user.setEmail(signUpDTO.getEmail());
// user.setFullname(signUpDTO.getFullname());
// user.setImage(signUpDTO.getImage());
// user.setKnowledge(signUpDTO.getKnowledge());
// user.setUniversity(signUpDTO.getUniversity());
// user.setPhonenumber(signUpDTO.getPhonenumber());
// user.setPosition(signUpDTO.getPosition());
// user.setVillage(signUpDTO.getVillage());
// user.setYearOfGraduation(signUpDTO.getYearOfGraduation());
// user.setRole(signUpDTO.getRole());
// return userRepository.save(user);
// }
//
// public void deleteUser(Long newsId){
// userRepository.deleteById(newsId);
// }
}
package com.itsol.quantrivanphong.business; package com.itsol.quantrivanphong.manager.employee.business;
import com.itsol.quantrivanphong.model.Employee; import com.itsol.quantrivanphong.model.Employee;
import org.springframework.validation.Validator; import org.springframework.validation.Validator;
......
package com.itsol.quantrivanphong.business.impl; package com.itsol.quantrivanphong.manager.employee.business.impl;
import com.itsol.quantrivanphong.manager.employee.business.EmployeeBusiness;
import com.itsol.quantrivanphong.manager.employee.repository.EmployeeRepository;
import com.itsol.quantrivanphong.model.Employee; import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.repository.EmployeeRepository;
import com.itsol.quantrivanphong.business.EmployeeBusiness;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
......
package com.itsol.quantrivanphong.controller; package com.itsol.quantrivanphong.manager.employee.controller;
import com.itsol.quantrivanphong.manager.employee.business.EmployeeBusiness;
import com.itsol.quantrivanphong.model.Employee; import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.business.EmployeeBusiness;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
...@@ -12,6 +12,7 @@ import org.springframework.web.util.UriComponentsBuilder; ...@@ -12,6 +12,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import java.util.List; import java.util.List;
@RestController @RestController
public class EmployeeController { public class EmployeeController {
@Autowired @Autowired
//Retrieve Employee by id //Retrieve Employee by id
......
package com.itsol.quantrivanphong.repository; package com.itsol.quantrivanphong.manager.employee.repository;
import com.itsol.quantrivanphong.model.Employee; import com.itsol.quantrivanphong.model.Employee;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
......
package com.itsol.quantrivanphong.manager.employee;
public class test {
}
package com.itsol.quantrivanphong.manager.reportdetail.bussiness; 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.ReportDTO;
import com.itsol.quantrivanphong.manager.reportdetail.dto.request.TimesheetRequestDTO; import com.itsol.quantrivanphong.manager.reportdetail.dto.request.TimesheetRequestDTO;
import com.itsol.quantrivanphong.manager.reportdetail.repository.ProjectReportRepository; import com.itsol.quantrivanphong.manager.reportdetail.repository.ProjectReportRepository;
import com.itsol.quantrivanphong.manager.project.project.repository.ProjectRRepository;
import com.itsol.quantrivanphong.model.*; import com.itsol.quantrivanphong.model.*;
import com.itsol.quantrivanphong.report.timesheet.business.TimeSheetBusiness;
import com.itsol.quantrivanphong.report.timesheet.dto.TimeSheetDTO;
import com.itsol.quantrivanphong.report.timesheet.repository.EProjectRepository; import com.itsol.quantrivanphong.report.timesheet.repository.EProjectRepository;
import com.itsol.quantrivanphong.report.timesheet.repository.TimeSheetRepository; import com.itsol.quantrivanphong.report.timesheet.repository.TimeSheetRepository;
import com.itsol.quantrivanphong.repository.EmployeeRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -34,6 +32,7 @@ public class ReportProjectBussiness { ...@@ -34,6 +32,7 @@ public class ReportProjectBussiness {
@Autowired @Autowired
private TimeSheetRepository timeSheetRepository; private TimeSheetRepository timeSheetRepository;
//====================================================================================================================== //======================================================================================================================
public List<Project> listProjectWorking(){ public List<Project> listProjectWorking(){
...@@ -105,6 +104,14 @@ public class ReportProjectBussiness { ...@@ -105,6 +104,14 @@ public class ReportProjectBussiness {
return employeeList; return employeeList;
} }
// public String insertProjectReport(ReportDTO reportDTO){
// ProjectReport projectReport = new ProjectReport();
// projectReport.setProjectName(projectRepository.ProjectName(reportDTO.getProjectId()));
// projectReport.setTeamLeader(employeeRepository.findTeamLeader(reportDTO.getProjectId()));
// projectReport.setNumberOfMember(employeeRepository.numberOfMember(reportDTO.getProjectId()));
// projectReport.setCalendarEffort(10);
// projectReport.set
// }
//
} }
...@@ -67,6 +67,17 @@ public class ReportProjectController { ...@@ -67,6 +67,17 @@ public class ReportProjectController {
//================================================================================================================= //=================================================================================================================
// //Tạo một báo cáo mới
// @PostMapping(path = "/project/newReport", consumes = "application/json", produces = "application/json")
// public ResponseEntity<String> updateTimesheetChecked(@RequestBody TimesheetRequestDTO timesheetRequestDTO){
// String mess = reportProjectBussiness.updateTimesheetChecked(timesheetRequestDTO);
// return ResponseEntity.ok(mess);
// }
//Báo cáo gần nhất của dự án //Báo cáo gần nhất của dự án
@GetMapping(path = "/project/latest",consumes = "application/json", produces = "application/json") @GetMapping(path = "/project/latest",consumes = "application/json", produces = "application/json")
public ResponseEntity<ProjectReport> latestReport(@RequestBody ReportDTO reportDTO){ public ResponseEntity<ProjectReport> latestReport(@RequestBody ReportDTO reportDTO){
......
...@@ -2,7 +2,9 @@ package com.itsol.quantrivanphong.manager.reportdetail.repository; ...@@ -2,7 +2,9 @@ package com.itsol.quantrivanphong.manager.reportdetail.repository;
import com.itsol.quantrivanphong.model.ProjectReport; import com.itsol.quantrivanphong.model.ProjectReport;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
...@@ -15,5 +17,8 @@ public interface ProjectReportRepository extends JpaRepository<ProjectReport, In ...@@ -15,5 +17,8 @@ public interface ProjectReportRepository extends JpaRepository<ProjectReport, In
@Query(value = "SELECT * FROM project_report pr WHERE pr.project_id = ?1 ORDER BY pr.created_at DESC", nativeQuery = true) @Query(value = "SELECT * FROM project_report pr WHERE pr.project_id = ?1 ORDER BY pr.created_at DESC", nativeQuery = true)
List<ProjectReport> allProjectReport(int projectId); List<ProjectReport> allProjectReport(int projectId);
@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) VALUES (?1, ?2, ?3, ?4, ?5, CURRENT_DATE(), CURRENT_DATE() ,?6, ?7)",nativeQuery = true)
void insertProjectReport(String projectName, String teamLeader, int NumberOfMember, int CalendarEffort, int LackOfReport, boolean status, int projectId);
} }
package com.itsol.quantrivanphong.report.leaveform.business; package com.itsol.quantrivanphong.report.leaveform.business;
import com.itsol.quantrivanphong.report.leaveform.dto.LeaveFormDTO; import com.itsol.quantrivanphong.manager.employee.repository.EmployeeRepository;
import com.itsol.quantrivanphong.report.leaveform.repository.LeaveFormRepository;
import com.itsol.quantrivanphong.report.leaveform.repository.LeaveTypeRepository;
import com.itsol.quantrivanphong.model.Employee; import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.LeaveForm; import com.itsol.quantrivanphong.model.LeaveForm;
import com.itsol.quantrivanphong.model.LeaveType; import com.itsol.quantrivanphong.model.LeaveType;
import com.itsol.quantrivanphong.repository.EmployeeRepository; import com.itsol.quantrivanphong.report.leaveform.dto.LeaveFormDTO;
import com.itsol.quantrivanphong.report.leaveform.repository.LeaveFormRepository;
import com.itsol.quantrivanphong.report.leaveform.repository.LeaveTypeRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -26,11 +26,11 @@ public class LeaveFormBusiness { ...@@ -26,11 +26,11 @@ public class LeaveFormBusiness {
return leaveFormRepository.findAll(); return leaveFormRepository.findAll();
} }
public String insertLeaveForm(int employee_Id, LeaveFormDTO leaveFormDTO, int leavetype_Id) { public String addLeaveForm(LeaveFormDTO leaveFormDTO) {
String message; String message;
Employee employee = employeeRepository.findEmployeeById(employee_Id); Employee employee = employeeRepository.findEmployeeById(leaveFormDTO.getEmployeeId());
LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leavetype_Id); LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leaveFormDTO.getLeaveTypeId());
if (employee != null) { if (employee != null) {
if (leaveType != null) { if (leaveType != null) {
...@@ -56,36 +56,32 @@ public class LeaveFormBusiness { ...@@ -56,36 +56,32 @@ public class LeaveFormBusiness {
} }
@Transactional @Transactional
public String deleteLeaveForm(int emloyee_Id, int leaveform_Id) { public String deleteLeaveForm(int leaveFormId) {
String message; String message;
Employee employee = employeeRepository.findEmployeeById(emloyee_Id); LeaveForm leaveForm = leaveFormRepository.findLeaveFormById(leaveFormId);
LeaveForm leaveForm = leaveFormRepository.findLeaveFormByEmployeeAndId(employee, leaveform_Id);
if (employee != null) { if (leaveForm != null) {
if (leaveForm != null) { leaveFormRepository.delete(leaveForm);
leaveFormRepository.delete(leaveForm); if (leaveFormRepository.findLeaveFormById(leaveFormId) != null) {
if (leaveFormRepository.findLeaveFormByEmployeeAndId(employee, leaveform_Id) != null) { message = "Delete failed!";
message = "Delete failed!";
} else {
message = "Delete success!";
}
} else { } else {
message = "Leave Form does not exist"; message = "Delete success!";
} }
} else { } else {
message = "Employee does not exist"; message = "Leave Form does not exist";
} }
return message; return message;
} }
@Transactional @Transactional
public String updateLeaveForm(int employee_Id, int leavetype_Id, int leaveform_Id, LeaveFormDTO leaveFormDTO) { public String updateLeaveForm(LeaveFormDTO leaveFormDTO) {
String message; String message;
Employee employee = employeeRepository.findEmployeeById(employee_Id); Employee employee = employeeRepository.findEmployeeById(leaveFormDTO.getEmployeeId());
LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leavetype_Id); LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leaveFormDTO.getLeaveTypeId());
LeaveForm leaveForm = leaveFormRepository.findLeaveFormByEmployeeAndLeaveTypeAndId(employee, leaveType, leaveform_Id); LeaveForm leaveForm = leaveFormRepository.findLeaveFormByEmployeeAndLeaveTypeAndId(employee, leaveType, leaveFormDTO.getId());
if (leaveType != null) { if (leaveType != null) {
if (leaveForm != null) { if (leaveForm != null) {
int i = leaveFormRepository.updateLeaveForm(leaveFormDTO.getTitle(), leaveFormDTO.getContent(), leaveform_Id); int i = leaveFormRepository.updateLeaveForm(leaveFormDTO.getTitle(), leaveFormDTO.getContent(), leaveFormDTO.getId());
if (i == 1) { if (i == 1) {
message = "Update success"; message = "Update success";
} else { } else {
...@@ -102,17 +98,19 @@ public class LeaveFormBusiness { ...@@ -102,17 +98,19 @@ public class LeaveFormBusiness {
} }
@Transactional @Transactional
public String updateLeaveFormStatus(int employee_Id, int leavetype_Id, int leaveform_Id) { public String updateLeaveFormStatus(int leaveformId) {
String message; String message;
Employee employee = employeeRepository.findEmployeeById(employee_Id); LeaveForm leaveForm = leaveFormRepository.findLeaveFormById(leaveformId);
LeaveType leaveType = leaveTypeRepository.findLeaveTypeById(leavetype_Id);
LeaveForm leaveForm = leaveFormRepository.findLeaveFormByEmployeeAndLeaveTypeAndId(employee, leaveType, leaveform_Id);
if (leaveForm != null) { if (leaveForm != null) {
int i = leaveFormRepository.updateLeaveFormStatus(leaveform_Id); if (leaveForm.isStatus()) {
if (i == 1) { message = "Status can not change";
message = "Update status success";
} else { } else {
message = "Update status failed"; int i = leaveFormRepository.updateLeaveFormStatus(leaveformId);
if (i == 1) {
message = "Update status success";
} else {
message = "Update status failed";
}
} }
} else { } else {
message = "Leave Form does not exist"; message = "Leave Form does not exist";
...@@ -121,8 +119,8 @@ public class LeaveFormBusiness { ...@@ -121,8 +119,8 @@ public class LeaveFormBusiness {
return message; return message;
} }
public List<LeaveForm> leaveFormById(int employee_Id) { public List<LeaveForm> showLeaveFormByEmployeeId(int employeeId) {
Employee employee = employeeRepository.findEmployeeById(employee_Id); Employee employee = employeeRepository.findEmployeeById(employeeId);
if (employee != null) { if (employee != null) {
if (leaveFormRepository.showLeaveFormById(employee) != null) { if (leaveFormRepository.showLeaveFormById(employee) != null) {
return leaveFormRepository.showLeaveFormById(employee); return leaveFormRepository.showLeaveFormById(employee);
...@@ -133,4 +131,8 @@ public class LeaveFormBusiness { ...@@ -133,4 +131,8 @@ public class LeaveFormBusiness {
return null; return null;
} }
} }
public LeaveForm showLeaveFormById(int id) {
return leaveFormRepository.findLeaveFormById(id);
}
} }
...@@ -8,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,7 +8,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -17,19 +16,19 @@ public class LeaveFormController { ...@@ -17,19 +16,19 @@ public class LeaveFormController {
@Autowired @Autowired
LeaveFormBusiness leaveFormBusiness; LeaveFormBusiness leaveFormBusiness;
@GetMapping(path = "/leaveform") @GetMapping(path = "/leaveform/show")
public ResponseEntity<List<LeaveForm>> showAllLeaveForm() { public ResponseEntity<List<LeaveForm>> showAllLeaveForm() {
return ResponseEntity.ok(leaveFormBusiness.findAll()); return ResponseEntity.ok(leaveFormBusiness.findAll());
} }
@PostMapping(path = "/{employee_Id}/leavetype/{leavetype_Id}/leaveform", consumes = "application/json", produces = "application/json") @PostMapping(path = "/leaveform/add", consumes = "application/json", produces = "application/json")
public ResponseEntity<String> insertLeaveForm(@PathVariable int employee_Id, @Valid @RequestBody LeaveFormDTO leaveFormDTO, @PathVariable int leavetype_Id) { public ResponseEntity<String> addLeaveForm(@RequestBody LeaveFormDTO leaveFormDTO) {
String message; String message;
try { try {
if (leaveFormDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống"); if (leaveFormDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
if (leaveFormDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống"); if (leaveFormDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
message = leaveFormBusiness.insertLeaveForm(employee_Id, leaveFormDTO, leavetype_Id); message = leaveFormBusiness.addLeaveForm(leaveFormDTO);
} catch (InputException e) { } catch (InputException e) {
message = e.getMessage(); message = e.getMessage();
} }
...@@ -37,19 +36,19 @@ public class LeaveFormController { ...@@ -37,19 +36,19 @@ public class LeaveFormController {
return ResponseEntity.ok(message); return ResponseEntity.ok(message);
} }
@DeleteMapping("/{employee_Id}/leaveform/{leaveform_Id}") @DeleteMapping("/leaveform/delete/{leaveformId}")
public ResponseEntity<String> deleteLeaveForm(@PathVariable int employee_Id, @Valid @PathVariable int leaveform_Id) { public ResponseEntity<String> deleteLeaveForm(@PathVariable int leaveformId) {
return ResponseEntity.ok(leaveFormBusiness.deleteLeaveForm(employee_Id, leaveform_Id)); return ResponseEntity.ok(leaveFormBusiness.deleteLeaveForm(leaveformId));
} }
@PostMapping(path = "/{employee_Id}/leavetype/{leavetype_Id}/leaveform/{leaveform_Id}", consumes = "application/json", produces = "application/json") @PostMapping(path = "/leaveform/update", consumes = "application/json", produces = "application/json")
public ResponseEntity<String> updateLeaveForm(@PathVariable int employee_Id, @PathVariable int leavetype_Id, @PathVariable int leaveform_Id, @Valid @RequestBody LeaveFormDTO leaveFormDTO) { public ResponseEntity<String> updateLeaveForm(@RequestBody LeaveFormDTO leaveFormDTO) {
String message; String message;
try { try {
if (leaveFormDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống"); if (leaveFormDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
if (leaveFormDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống"); if (leaveFormDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
message = leaveFormBusiness.updateLeaveForm(employee_Id, leavetype_Id, leaveform_Id, leaveFormDTO); message = leaveFormBusiness.updateLeaveForm(leaveFormDTO);
} catch (InputException e) { } catch (InputException e) {
message = e.getMessage(); message = e.getMessage();
} }
...@@ -57,19 +56,24 @@ public class LeaveFormController { ...@@ -57,19 +56,24 @@ public class LeaveFormController {
return ResponseEntity.ok(message); return ResponseEntity.ok(message);
} }
@PostMapping(path = "/{employee_Id}/leavetype/{leavetype_Id}/leaveform/{leaveform_Id}/status", consumes = "application/json", produces = "application/json") @PostMapping(path = "/leaveform/{leaveformId}/status")
public ResponseEntity<String> updateLeaveFormStatus(@PathVariable int employee_Id, @PathVariable int leavetype_Id, @PathVariable int leaveform_Id) { public ResponseEntity<String> updateLeaveFormStatus(@PathVariable int leaveformId) {
String message; String message;
message = leaveFormBusiness.updateLeaveFormStatus(employee_Id, leavetype_Id, leaveform_Id); message = leaveFormBusiness.updateLeaveFormStatus(leaveformId);
return ResponseEntity.ok(message); return ResponseEntity.ok(message);
} }
@GetMapping("/{employee_Id}/leaveform") @GetMapping("/leaveform/show/{employeeId}")
public ResponseEntity<List<LeaveForm>> showLeaveFormById(@PathVariable int employee_Id) { public ResponseEntity<List<LeaveForm>> showLeaveFormByEmployeeId(@PathVariable int employeeId) {
if (leaveFormBusiness.leaveFormById(employee_Id) != null) { if (leaveFormBusiness.showLeaveFormByEmployeeId(employeeId) != null) {
return ResponseEntity.ok(leaveFormBusiness.leaveFormById(employee_Id)); return ResponseEntity.ok(leaveFormBusiness.showLeaveFormByEmployeeId(employeeId));
} else { } else {
return null; return null;
} }
} }
@GetMapping("/leaveform/{id}")
public ResponseEntity<LeaveForm> showLeaveFormById(@PathVariable int id) {
return ResponseEntity.ok(leaveFormBusiness.showLeaveFormById(id));
}
} }
...@@ -12,6 +12,6 @@ public class LeaveFormDTO { ...@@ -12,6 +12,6 @@ public class LeaveFormDTO {
private String title; private String title;
private String content; private String content;
private boolean status; private boolean status;
private int employee_id; private int employeeId;
private int leave_type_id; private int leaveTypeId;
} }
...@@ -15,7 +15,7 @@ public interface LeaveFormRepository extends JpaRepository<LeaveForm, Integer> { ...@@ -15,7 +15,7 @@ public interface LeaveFormRepository extends JpaRepository<LeaveForm, Integer> {
LeaveForm findLeaveFormByEmployeeAndId(Employee employee, int id); LeaveForm findLeaveFormByEmployeeAndId(Employee employee, int id);
// LeaveForm findLeaveFormById(int i); LeaveForm findLeaveFormById(int i);
LeaveForm findLeaveFormByEmployeeAndLeaveTypeAndId(Employee employee, LeaveType leaveType, int id); LeaveForm findLeaveFormByEmployeeAndLeaveTypeAndId(Employee employee, LeaveType leaveType, int id);
......
package com.itsol.quantrivanphong.report.timesheet.business; package com.itsol.quantrivanphong.report.timesheet.business;
import com.itsol.quantrivanphong.report.timesheet.dto.TimeSheetDTO; import com.itsol.quantrivanphong.manager.employee.repository.EmployeeRepository;
import com.itsol.quantrivanphong.report.timesheet.repository.EProjectRepository;
import com.itsol.quantrivanphong.report.timesheet.repository.TimeSheetRepository;
import com.itsol.quantrivanphong.model.Employee; import com.itsol.quantrivanphong.model.Employee;
import com.itsol.quantrivanphong.model.Eproject; import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.model.TimeSheet; import com.itsol.quantrivanphong.model.TimeSheet;
import com.itsol.quantrivanphong.repository.EmployeeRepository; import com.itsol.quantrivanphong.report.timesheet.dto.TimeSheetDTO;
import com.itsol.quantrivanphong.report.timesheet.repository.EProjectRepository;
import com.itsol.quantrivanphong.report.timesheet.repository.TimeSheetRepository;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -21,7 +21,11 @@ public class TimeSheetBusiness { ...@@ -21,7 +21,11 @@ public class TimeSheetBusiness {
EProjectRepository eProjectRepository; EProjectRepository eProjectRepository;
@Autowired @Autowired
EmployeeRepository employeeRepository; EmployeeRepository employeeRepository;
<<<<<<< HEAD
public String insertTimeSheet(TimeSheetDTO timeSheetDTO) { public String insertTimeSheet(TimeSheetDTO timeSheetDTO) {
=======
public String addTimeSheet(TimeSheetDTO timeSheetDTO) {
>>>>>>> master
String message; String message;
Employee employee = employeeRepository.findEmployeeById(timeSheetDTO.getEmployeeId()); Employee employee = employeeRepository.findEmployeeById(timeSheetDTO.getEmployeeId());
Eproject eproject = eProjectRepository.findEprojectByIdAndEmployee(timeSheetDTO.getEprojectId(), employee); Eproject eproject = eProjectRepository.findEprojectByIdAndEmployee(timeSheetDTO.getEprojectId(), employee);
...@@ -49,6 +53,7 @@ public class TimeSheetBusiness { ...@@ -49,6 +53,7 @@ public class TimeSheetBusiness {
return message; return message;
} }
<<<<<<< HEAD
public String deleteTimeSheet(int timesheetId) { public String deleteTimeSheet(int timesheetId) {
String message; String message;
// Employee employee = employeeRepository.findEmployeeById(timeSheetDTO.getEmployeeId()); // Employee employee = employeeRepository.findEmployeeById(timeSheetDTO.getEmployeeId());
...@@ -58,6 +63,16 @@ public class TimeSheetBusiness { ...@@ -58,6 +63,16 @@ public class TimeSheetBusiness {
if (timeSheet != null) { if (timeSheet != null) {
timeSheetRepository.delete(timeSheet); timeSheetRepository.delete(timeSheet);
if (timeSheetRepository.findTimeSheetById(timesheetId) == null) { if (timeSheetRepository.findTimeSheetById(timesheetId) == null) {
=======
public String deleteTimeSheet(int timeSheetId) {
String message;
// Employee employee = employeeRepository.findEmployeeById(employee_Id);
// Eproject eproject = eProjectRepository.findEprojectByEmployee(employee);
TimeSheet timeSheet = timeSheetRepository.findTimeSheetById(timeSheetId);
if (timeSheet != null) {
timeSheetRepository.delete(timeSheet);
if (timeSheetRepository.findTimeSheetById(timeSheetId) == null) {
>>>>>>> master
message = "Delete success"; message = "Delete success";
} else { } else {
message = "Delete failed"; message = "Delete failed";
...@@ -96,10 +111,22 @@ public class TimeSheetBusiness { ...@@ -96,10 +111,22 @@ public class TimeSheetBusiness {
return message; return message;
} }
@Transactional
public String updateCheck(TimeSheetDTO timeSheetDTO) {
String message;
int i = timeSheetRepository.updateCheck(timeSheetDTO.getChecked(), timeSheetDTO.getId());
if (i == 1) {
message = "Success";
} else {
message = "Failed";
}
return message;
}
// @Transactional // @Transactional
// public String updateLeaveFormStatus(TimeSheetDTO timeSheetDTO) { // public String updateLeaveFormStatus(TimeSheetDTO timeSheetDTO) {
// String message; // String message;
// TimeSheet timeSheet = timeSheetRepository.findTimeSheetById(timeSheetDTO.getId()); // TimeSheet timeSheet = timeSheetRepository.findTimeSheetByEmployeeId(timeSheetDTO.getId());
// if (timeSheet != null) { // if (timeSheet != null) {
// int i = timeSheetRepository.updateTimeSheetStatus(timeSheetDTO.isStatus(), timeSheetDTO.getId()); // int i = timeSheetRepository.updateTimeSheetStatus(timeSheetDTO.isStatus(), timeSheetDTO.getId());
// if (i == 1) { // if (i == 1) {
...@@ -114,8 +141,8 @@ public class TimeSheetBusiness { ...@@ -114,8 +141,8 @@ public class TimeSheetBusiness {
// return message; // return message;
// } // }
public List<TimeSheet> findTimeSheetById(int employee_Id) { public List<TimeSheet> findTimeSheetByEmployeeId(int employeeId) {
Employee employee = employeeRepository.findEmployeeById(employee_Id); Employee employee = employeeRepository.findEmployeeById(employeeId);
Eproject eproject = eProjectRepository.findEprojectByEmployee(employee); Eproject eproject = eProjectRepository.findEprojectByEmployee(employee);
if (employee != null && eproject != null && timeSheetRepository.showTimeSheetByEproject(eproject) != null) { if (employee != null && eproject != null && timeSheetRepository.showTimeSheetByEproject(eproject) != null) {
return timeSheetRepository.showTimeSheetByEproject(eproject); return timeSheetRepository.showTimeSheetByEproject(eproject);
...@@ -123,4 +150,7 @@ public class TimeSheetBusiness { ...@@ -123,4 +150,7 @@ public class TimeSheetBusiness {
return null; return null;
} }
} }
public TimeSheet findTimeSheetById(int id) {
return timeSheetRepository.findTimeSheetById(id);
}
} }
package com.itsol.quantrivanphong.report.timesheet.controller; package com.itsol.quantrivanphong.report.timesheet.controller;
import com.itsol.quantrivanphong.exception.InputException; import com.itsol.quantrivanphong.exception.InputException;
import com.itsol.quantrivanphong.model.TimeSheet;
import com.itsol.quantrivanphong.report.timesheet.business.TimeSheetBusiness; import com.itsol.quantrivanphong.report.timesheet.business.TimeSheetBusiness;
import com.itsol.quantrivanphong.report.timesheet.dto.TimeSheetDTO; import com.itsol.quantrivanphong.report.timesheet.dto.TimeSheetDTO;
import com.itsol.quantrivanphong.model.TimeSheet;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List; import java.util.List;
@RestController @RestController
...@@ -16,19 +15,40 @@ import java.util.List; ...@@ -16,19 +15,40 @@ import java.util.List;
public class TimeSheetController { public class TimeSheetController {
@Autowired @Autowired
TimeSheetBusiness timeSheetBusiness; TimeSheetBusiness timeSheetBusiness;
<<<<<<< HEAD
@PostMapping(path = "/timesheet", consumes = "application/json", produces = "application/json") @PostMapping(path = "/timesheet", consumes = "application/json", produces = "application/json")
=======
@PostMapping(path = "/timesheet/add", consumes = "application/json", produces = "application/json")
>>>>>>> master
public ResponseEntity<String> addTimeSheet(@RequestBody TimeSheetDTO timeSheetDTO) { public ResponseEntity<String> addTimeSheet(@RequestBody TimeSheetDTO timeSheetDTO) {
String message; String message;
try { try {
if (timeSheetDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống"); if (timeSheetDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
if (timeSheetDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống"); if (timeSheetDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
<<<<<<< HEAD
message = timeSheetBusiness.insertTimeSheet(timeSheetDTO); message = timeSheetBusiness.insertTimeSheet(timeSheetDTO);
=======
message = timeSheetBusiness.addTimeSheet(timeSheetDTO);
>>>>>>> master
} catch (InputException e) { } catch (InputException e) {
message = e.getMessage(); message = e.getMessage();
} }
return ResponseEntity.ok(message); return ResponseEntity.ok(message);
} }
// @PostMapping(path = "/timesheet", consumes = "application/json", produces = "application/json")
// public ResponseEntity<String> insertTimeSheet(@RequestBody TimeSheetDTO timeSheetDTO) {
// String message;
// try {
// if (timeSheetDTO.getTitle().trim().equals("")) throw new InputException("Tiêu đề không được để trống");
// if (timeSheetDTO.getContent().trim().equals("")) throw new InputException("Nội dung không được để trống");
// message = timeSheetBusiness.insertTimeSheet(timeSheetDTO);
// } catch (InputException e) {
// message = e.getMessage();
// }
//
// return ResponseEntity.ok(message);
// }
@DeleteMapping("/timesheet/delete/{timesheetId}") @DeleteMapping("/timesheet/delete/{timesheetId}")
public ResponseEntity<String> deleteTimeSheet(@PathVariable int timesheetId) { public ResponseEntity<String> deleteTimeSheet(@PathVariable int timesheetId) {
...@@ -62,8 +82,25 @@ public class TimeSheetController { ...@@ -62,8 +82,25 @@ public class TimeSheetController {
// return ResponseEntity.ok(message); // return ResponseEntity.ok(message);
// } // }
<<<<<<< HEAD
@GetMapping("/timesheet/show/{employee_Id}") @GetMapping("/timesheet/show/{employee_Id}")
public ResponseEntity<List<TimeSheet>> showTimeSheetById(@PathVariable int employee_Id) { public ResponseEntity<List<TimeSheet>> showTimeSheetById(@PathVariable int employee_Id) {
return ResponseEntity.ok(timeSheetBusiness.findTimeSheetById(employee_Id)); return ResponseEntity.ok(timeSheetBusiness.findTimeSheetById(employee_Id));
=======
@GetMapping("/timesheet/show/{employeeId}")
public ResponseEntity<List<TimeSheet>> showTimeSheetByEmployeeId(@PathVariable int employeeId) {
return ResponseEntity.ok(timeSheetBusiness.findTimeSheetByEmployeeId(employeeId));
}
@GetMapping("/timesheet/{id}")
public ResponseEntity<TimeSheet> showTimeSheetById(@PathVariable int id) {
return ResponseEntity.ok(timeSheetBusiness.findTimeSheetById(id));
}
@PostMapping(path = "/timesheet/update/check", consumes = "application/json", produces = "application/json")
public ResponseEntity<String> updateCheck(@RequestBody TimeSheetDTO timeSheetDTO) {
return ResponseEntity.ok(timeSheetBusiness.updateCheck(timeSheetDTO));
>>>>>>> master
} }
} }
\ No newline at end of file
...@@ -11,7 +11,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -11,7 +11,10 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> { public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> {
<<<<<<< HEAD
//------------------------------------ Phi ---------------------------------// //------------------------------------ Phi ---------------------------------//
=======
>>>>>>> master
TimeSheet findTimeSheetById(int id); TimeSheet findTimeSheetById(int id);
// @Query("select ts from TimeSheet ts order by ts.createdAt desc") // @Query("select ts from TimeSheet ts order by ts.createdAt desc")
...@@ -19,7 +22,11 @@ public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> { ...@@ -19,7 +22,11 @@ public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> {
@Modifying @Modifying
@Query("update TimeSheet ts set ts.title = ?1, ts.content = ?2, ts.note = ?3 where ts.id = ?4") @Query("update TimeSheet ts set ts.title = ?1, ts.content = ?2, ts.note = ?3 where ts.id = ?4")
int updateTimeSheet(String title, String content, String note, int timesheet_Id); int updateTimeSheet(String title, String content, String note, int timeSheetId);
@Modifying
@Query("update TimeSheet ts set ts.checked = ?1 where ts.id = ?2")
int updateCheck(String check, int timeSheetId);
// @Modifying // @Modifying
// @Query("update TimeSheet ts set ts.status = ?1 where ts.id = ?2") // @Query("update TimeSheet ts set ts.status = ?1 where ts.id = ?2")
...@@ -28,8 +35,12 @@ public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> { ...@@ -28,8 +35,12 @@ public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> {
@Query("select ts from TimeSheet ts where ts.eproject = ?1") @Query("select ts from TimeSheet ts where ts.eproject = ?1")
List<TimeSheet> showTimeSheetByEproject(Eproject eproject); List<TimeSheet> showTimeSheetByEproject(Eproject eproject);
<<<<<<< HEAD
TimeSheet findTimeSheetByEprojectAndId(Eproject eproject, int timeSheet_Id); TimeSheet findTimeSheetByEprojectAndId(Eproject eproject, int timeSheet_Id);
//------------------------------------ Phi ---------------------------------// //------------------------------------ Phi ---------------------------------//
=======
TimeSheet findTimeSheetByEprojectAndId(Eproject eproject, int timeSheetId);
>>>>>>> master
//================================================================================================================== //==================================================================================================================
......
...@@ -5,8 +5,12 @@ ...@@ -5,8 +5,12 @@
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/quantrivanphong spring.datasource.url=jdbc:mysql://localhost:3306/quantrivanphong
spring.datasource.username=root spring.datasource.username=root
<<<<<<< HEAD
spring.datasource.password=ahihi123 spring.datasource.password=ahihi123
=======
spring.datasource.password= ahihi123
>>>>>>> master
# =============================== # ===============================
# JPA / HIBERNATE # JPA / HIBERNATE
...@@ -16,7 +20,9 @@ spring.jpa.hibernate.ddl-auto=update ...@@ -16,7 +20,9 @@ spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL57Dialect
#spring.jpa.properties.hibernate.default_schema=qlns_itsol #spring.jpa.properties.hibernate.default_schema=qlns_itsol
## Fix Postgres JPA Error:
## Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
#spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
# =============================== # ===============================
# SEND EMAIL # SEND EMAIL
......
html {
font-family: sans-serif;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
body {
margin: 0;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden],
template {
display: none;
}
a {
background-color: transparent;
}
a:active,
a:hover {
outline: 0;
}
abbr[title] {
border-bottom: 1px dotted;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
h1 {
margin: .67em 0;
font-size: 2em;
}
mark {
color: #000;
background: #ff0;
}
small {
font-size: 80%;
}
sub,
sup {
position: relative;
font-size: 75%;
line-height: 0;
vertical-align: baseline;
}
sup {
top: -.5em;
}
sub {
bottom: -.25em;
}
img {
border: 0;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 1em 40px;
}
hr {
height: 0;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
pre {
overflow: auto;
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
button,
input,
optgroup,
select,
textarea {
margin: 0;
font: inherit;
color: inherit;
}
button {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
button[disabled],
html input[disabled] {
cursor: default;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
padding: 0;
border: 0;
}
input {
line-height: normal;
}
input[type="checkbox"],
input[type="radio"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
-webkit-appearance: textfield;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
fieldset {
padding: .35em .625em .75em;
margin: 0 2px;
border: 1px solid #c0c0c0;
}
legend {
padding: 0;
border: 0;
}
textarea {
overflow: auto;
}
optgroup {
font-weight: bold;
}
table {
border-spacing: 0;
border-collapse: collapse;
}
td,
th {
padding: 0;
}
/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */
@media print {
*,
*:before,
*:after {
color: #000 !important;
text-shadow: none !important;
background: transparent !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
select {
background: #fff !important;
}
.navbar {
display: none;
}
.btn > .caret,
.dropup > .btn > .caret {
border-top-color: #000 !important;
}
.label {
border: 1px solid #000;
}
.table {
border-collapse: collapse !important;
}
.table td,
.table th {
background-color: #fff !important;
}
.table-bordered th,
.table-bordered td {
border: 1px solid #ddd !important;
}
}
.blue-button {
background: #25A6E1;
padding: 3px 5px;
color: #fff;
font-family: 'Helvetica Neue', sans-serif;
font-size: 12px;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 4px;
border: 1px solid #1A87B9
}
.red-button {
background: #CD5C5C;
padding: 3px 5px;
color: #fff;
font-family: 'Helvetica Neue', sans-serif;
font-size: 12px;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 4px;
border: 1px solid #CD5C5C
}
table {
font-family: "Helvetica Neue", Helvetica, sans-serif;
width: 70%;
}
caption {
text-align: left;
color: silver;
font-weight: bold;
text-transform: uppercase;
padding: 5px;
}
th {
background: SteelBlue;
color: white;
}
tbody tr:nth-child(even) {
background: WhiteSmoke;
}
tbody tr td:nth-child(2) {
text-align: center;
}
tbody tr td:nth-child(3), tbody tr td:nth-child(4) {
text-align: center;
font-family: monospace;
}
tfoot {
background: SeaGreen;
color: white;
text-align: right;
}
tfoot tr th:last-child {
font-family: monospace;
}
td, th {
border: 1px solid gray;
width: 25%;
text-align: left;
padding: 5px 10px;
}
table {
border-collapse: collapse;
padding-bottom: 20%;
text-align: center;
}
table td, th {
padding: 5px;
}
table>thead>tr>th{
text-align: center;
}
.table>thead>tr>td{
text-align: center;
padding-bottom: 50px;
}
.container{
background-color: #f1f1f1;
}
\ No newline at end of file
<!doctype html>
<!DOCTYPE HTML> <html lang="en">
<html>
<head> <head>
<title>Business_Blog a Blogging Category Flat Bootstrap Responsive Website Template | World :: w3layouts</title> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport"
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta name="keywords" content="Business_Blog Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template, <!-- <meta http-equiv="X-UA-Compatible" content="ie=edge">-->
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="applijewelleryion/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script> <title>Document</title>
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' /> <link href="css/bootstrap.css" rel='stylesheet' type='text/css'/>
<!-- Custom Theme files --> <!-- 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=Roboto+Condensed:400,700" rel='stylesheet' type='text/css'>-->
<link href="https://fonts.googleapis.com/css?family=Open+Sans" 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 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">-->
<!--Khai báo các thư viện--> <link data-require="bootstrap-css@*" data-semver="4.3.1" rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script> <script src="js/jquery-3.2.1.min.js"></script>
<script src="js/angular.js"></script> <script src="js/bootstrap.min.js"></script>
<script src="js/angular-ui-router.min.js"></script> <script src="js/angular.js"></script>
<!--End khai báo thư viện--> <script src="js/angular-ui-router.min.js"></script>
<!--Khai báo các file js--> <script src="js/app.js"></script>
<script src="js/app.js"></script> <script src="pages/employee/employeeController.js"></script>
<!--End khai báo các file js--> <script src="pages/project/projectController.js"></script>
<script src="pages/testlayout/testlayoutController.js"></script>
<!-- khai báo các controllers -->
<script src="pages/employee/employeeController.js"></script> <script src="pages/timesheet/timeSheetController.js"></script>
<script src="pages/leaveform/leaveFormController.js"></script>
<script src="pages/leaveform/leaveFormDetailController.js"></script>
<!--End khai báo controllers--> <script src="pages/timesheet/timeSheetDetailController.js"></script>
<!-- <script src="js/angular-resource.js"></script>-->
<script>
function showAddTimeSheetFunction() {
const x = document.getElementById("addDivTS");
const n = document.getElementById("addTimeSheet");
if (x.style.display === "none") {
x.style.display = "block";
n.value = "Close";
} else {
x.style.display = "none";
n.value = "Add";
}
}
</script>
<script>
function showAddLeaveFormFunction() {
const x = document.getElementById("addDivLF");
const n = document.getElementById("addLeaveForm");
if (x.style.display === "none") {
x.style.display = "block";
n.value = "Close";
} else {
x.style.display = "none";
n.value = "Add";
}
}
</script>
</head> </head>
<body ng-app="myApp"> <body ng-app="myApp">
<<<<<<< HEAD
<div class="container"> <div class="container">
=======
>>>>>>> master
</div> <div ui-view="layout">
<div style="margin-left:5px;margin-top:10px" ng-controller="timeSheetController">
<span pgn-table="myTimeSheets"></span>
</div>
</div>
</body> </body>
......
/**
* @license AngularJS v1.7.8
* (c) 2010-2018 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular) {'use strict';
var $resourceMinErr = angular.$$minErr('$resource');
// Helper functions and regex to lookup a dotted path on an object
// stopping at undefined/null. The path must be composed of ASCII
// identifiers (just like $parse)
var MEMBER_NAME_REGEX = /^(\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;
function isValidDottedPath(path) {
return (path != null && path !== '' && path !== 'hasOwnProperty' &&
MEMBER_NAME_REGEX.test('.' + path));
}
function lookupDottedPath(obj, path) {
if (!isValidDottedPath(path)) {
throw $resourceMinErr('badmember', 'Dotted member path "@{0}" is invalid.', path);
}
var keys = path.split('.');
for (var i = 0, ii = keys.length; i < ii && angular.isDefined(obj); i++) {
var key = keys[i];
obj = (obj !== null) ? obj[key] : undefined;
}
return obj;
}
/**
* Create a shallow copy of an object and clear other fields from the destination
*/
function shallowClearAndCopy(src, dst) {
dst = dst || {};
angular.forEach(dst, function(value, key) {
delete dst[key];
});
for (var key in src) {
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
dst[key] = src[key];
}
}
return dst;
}
/**
* @ngdoc module
* @name ngResource
* @description
*
* The `ngResource` module provides interaction support with RESTful services
* via the $resource service.
*
* See {@link ngResource.$resourceProvider} and {@link ngResource.$resource} for usage.
*/
/**
* @ngdoc provider
* @name $resourceProvider
*
* @description
*
* Use `$resourceProvider` to change the default behavior of the {@link ngResource.$resource}
* service.
*
* ## Dependencies
* Requires the {@link ngResource } module to be installed.
*
*/
/**
* @ngdoc service
* @name $resource
* @requires $http
* @requires ng.$log
* @requires $q
* @requires ng.$timeout
*
* @description
* A factory which creates a resource object that lets you interact with
* [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
*
* The returned resource object has action methods which provide high-level behaviors without
* the need to interact with the low level {@link ng.$http $http} service.
*
* Requires the {@link ngResource `ngResource`} module to be installed.
*
* By default, trailing slashes will be stripped from the calculated URLs,
* which can pose problems with server backends that do not expect that
* behavior. This can be disabled by configuring the `$resourceProvider` like
* this:
*
* ```js
app.config(['$resourceProvider', function($resourceProvider) {
// Don't strip trailing slashes from calculated URLs
$resourceProvider.defaults.stripTrailingSlashes = false;
}]);
* ```
*
* @param {string} url A parameterized URL template with parameters prefixed by `:` as in
* `/user/:username`. If you are using a URL with a port number (e.g.
* `http://example.com:8080/api`), it will be respected.
*
* If you are using a url with a suffix, just add the suffix, like this:
* `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`
* or even `$resource('http://example.com/resource/:resource_id.:format')`
* If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be
* collapsed down to a single `.`. If you need this sequence to appear and not collapse then you
* can escape it with `/\.`.
*
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
* `actions` methods. If a parameter value is a function, it will be called every time
* a param value needs to be obtained for a request (unless the param was overridden). The
* function will be passed the current data value as an argument.
*
* Each key value in the parameter object is first bound to url template if present and then any
* excess keys are appended to the url search query after the `?`.
*
* Given a template `/path/:verb` and parameter `{verb: 'greet', salutation: 'Hello'}` results in
* URL `/path/greet?salutation=Hello`.
*
* If the parameter value is prefixed with `@`, then the value for that parameter will be
* extracted from the corresponding property on the `data` object (provided when calling actions
* with a request body).
* For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of
* `someParam` will be `data.someProp`.
* Note that the parameter will be ignored, when calling a "GET" action method (i.e. an action
* method that does not accept a request body).
*
* @param {Object.<Object>=} actions Hash with declaration of custom actions that will be available
* in addition to the default set of resource actions (see below). If a custom action has the same
* key as a default action (e.g. `save`), then the default action will be *overwritten*, and not
* extended.
*
* The declaration should be created in the format of {@link ng.$http#usage $http.config}:
*
* {
* action1: {method:?, params:?, isArray:?, headers:?, ...},
* action2: {method:?, params:?, isArray:?, headers:?, ...},
* ...
* }
*
* Where:
*
* - **`action`** – {string} – The name of action. This name becomes the name of the method on
* your resource object.
* - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,
* `DELETE`, `JSONP`, etc).
* - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of
* the parameter value is a function, it will be called every time when a param value needs to
* be obtained for a request (unless the param was overridden). The function will be passed the
* current data value as an argument.
* - **`url`** – {string} – Action specific `url` override. The url templating is supported just
* like for the resource-level urls.
* - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,
* see `returns` section.
* - **`transformRequest`** –
* `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
* Transform function or an array of such functions. The transform function takes the http
* request body and headers and returns its transformed (typically serialized) version.
* By default, transformRequest will contain one function that checks if the request data is
* an object and serializes it using `angular.toJson`. To prevent this behavior, set
* `transformRequest` to an empty array: `transformRequest: []`
* - **`transformResponse`** –
* `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –
* Transform function or an array of such functions. The transform function takes the HTTP
* response body, headers and status and returns its transformed (typically deserialized)
* version.
* By default, transformResponse will contain one function that checks if the response looks
* like a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior,
* set `transformResponse` to an empty array: `transformResponse: []`
* - **`cache`** – `{boolean|Cache}` – A boolean value or object created with
* {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response.
* See {@link $http#caching $http Caching} for more information.
* - **`timeout`** – `{number}` – Timeout in milliseconds.<br />
* **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are
* **not** supported in `$resource`, because the same value would be used for multiple requests.
* If you are looking for a way to cancel requests, you should use the `cancellable` option.
* - **`cancellable`** – `{boolean}` – If true, the request made by a "non-instance" call will be
* cancelled (if not already completed) by calling `$cancelRequest()` on the call's return
* value. Calling `$cancelRequest()` for a non-cancellable or an already completed/cancelled
* request will have no effect.
* - **`withCredentials`** – `{boolean}` – Whether to set the `withCredentials` flag on the
* XHR object. See
* [XMLHttpRequest.withCredentials](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials)
* for more information.
* - **`responseType`** – `{string}` – See
* [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType).
* - **`interceptor`** – `{Object=}` – The interceptor object has four optional methods -
* `request`, `requestError`, `response`, and `responseError`. See
* {@link ng.$http#interceptors $http interceptors} for details. Note that
* `request`/`requestError` interceptors are applied before calling `$http`, thus before any
* global `$http` interceptors. Also, rejecting or throwing an error inside the `request`
* interceptor will result in calling the `responseError` interceptor.
* The resource instance or collection is available on the `resource` property of the
* `http response` object passed to `response`/`responseError` interceptors.
* Keep in mind that the associated promise will be resolved with the value returned by the
* response interceptors. Make sure you return an appropriate value and not the `response`
* object passed as input. For reference, the default `response` interceptor (which gets applied
* if you don't specify a custom one) returns `response.resource`.<br />
* See {@link ngResource.$resource#using-interceptors below} for an example of using
* interceptors in `$resource`.
* - **`hasBody`** – `{boolean}` – If true, then the request will have a body.
* If not specified, then only POST, PUT and PATCH requests will have a body. *
* @param {Object} options Hash with custom settings that should extend the
* default `$resourceProvider` behavior. The supported options are:
*
* - **`stripTrailingSlashes`** – {boolean} – If true then the trailing
* slashes from any calculated URL will be stripped. (Defaults to true.)
* - **`cancellable`** – {boolean} – If true, the request made by a "non-instance" call will be
* cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value.
* This can be overwritten per action. (Defaults to false.)
*
* @returns {Object} A resource "class" object with methods for the default set of resource actions
* optionally extended with custom `actions`. The default set contains these actions:
* ```js
* {
* 'get': {method: 'GET'},
* 'save': {method: 'POST'},
* 'query': {method: 'GET', isArray: true},
* 'remove': {method: 'DELETE'},
* 'delete': {method: 'DELETE'}
* }
* ```
*
* Calling these methods invoke {@link ng.$http} with the specified http method, destination and
* parameters. When the data is returned from the server then the object is an instance of the
* resource class. The actions `save`, `remove` and `delete` are available on it as methods with
* the `$` prefix. This allows you to easily perform CRUD operations (create, read, update,
* delete) on server-side data like this:
* ```js
* var User = $resource('/user/:userId', {userId: '@id'});
* User.get({userId: 123}).$promise.then(function(user) {
* user.abc = true;
* user.$save();
* });
* ```
*
* It is important to realize that invoking a `$resource` object method immediately returns an
* empty reference (object or array depending on `isArray`). Once the data is returned from the
* server the existing reference is populated with the actual data. This is a useful trick since
* usually the resource is assigned to a model which is then rendered by the view. Having an empty
* object results in no rendering, once the data arrives from the server then the object is
* populated with the data and the view automatically re-renders itself showing the new data. This
* means that in most cases one never has to write a callback function for the action methods.
*
* The action methods on the class object or instance object can be invoked with the following
* parameters:
*
* - "class" actions without a body: `Resource.action([parameters], [success], [error])`
* - "class" actions with a body: `Resource.action([parameters], postData, [success], [error])`
* - instance actions: `instance.$action([parameters], [success], [error])`
*
*
* When calling instance methods, the instance itself is used as the request body (if the action
* should have a body). By default, only actions using `POST`, `PUT` or `PATCH` have request
* bodies, but you can use the `hasBody` configuration option to specify whether an action
* should have a body or not (regardless of its HTTP method).
*
*
* Success callback is called with (value (Object|Array), responseHeaders (Function),
* status (number), statusText (string)) arguments, where `value` is the populated resource
* instance or collection object. The error callback is called with (httpResponse) argument.
*
* Class actions return an empty instance (with the additional properties listed below).
* Instance actions return a promise for the operation.
*
* The Resource instances and collections have these additional properties:
*
* - `$promise`: The {@link ng.$q promise} of the original server interaction that created this
* instance or collection.
*
* On success, the promise is resolved with the same resource instance or collection object,
* updated with data from server. This makes it easy to use in the
* {@link ngRoute.$routeProvider `resolve` section of `$routeProvider.when()`} to defer view
* rendering until the resource(s) are loaded.
*
* On failure, the promise is rejected with the {@link ng.$http http response} object.
*
* If an interceptor object was provided, the promise will instead be resolved with the value
* returned by the response interceptor (on success) or responceError interceptor (on failure).
*
* - `$resolved`: `true` after first server interaction is completed (either with success or
* rejection), `false` before that. Knowing if the Resource has been resolved is useful in
* data-binding. If there is a response/responseError interceptor and it returns a promise,
* `$resolved` will wait for that too.
*
* The Resource instances and collections have these additional methods:
*
* - `$cancelRequest`: If there is a cancellable, pending request related to the instance or
* collection, calling this method will abort the request.
*
* The Resource instances have these additional methods:
*
* - `toJSON`: It returns a simple object without any of the extra properties added as part of
* the Resource API. This object can be serialized through {@link angular.toJson} safely
* without attaching AngularJS-specific fields. Notice that `JSON.stringify` (and
* `angular.toJson`) automatically use this method when serializing a Resource instance
* (see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior)).
*
* @example
*
* ### Basic usage
*
```js
// Define a CreditCard class
var CreditCard = $resource('/users/:userId/cards/:cardId',
{userId: 123, cardId: '@id'}, {
charge: {method: 'POST', params: {charge: true}}
});
// We can retrieve a collection from the server
var cards = CreditCard.query();
// GET: /users/123/cards
// server returns: [{id: 456, number: '1234', name: 'Smith'}]
// Wait for the request to complete
cards.$promise.then(function() {
var card = cards[0];
// Each item is an instance of CreditCard
expect(card instanceof CreditCard).toEqual(true);
// Non-GET methods are mapped onto the instances
card.name = 'J. Smith';
card.$save();
// POST: /users/123/cards/456 {id: 456, number: '1234', name: 'J. Smith'}
// server returns: {id: 456, number: '1234', name: 'J. Smith'}
// Our custom method is mapped as well (since it uses POST)
card.$charge({amount: 9.99});
// POST: /users/123/cards/456?amount=9.99&charge=true {id: 456, number: '1234', name: 'J. Smith'}
});
// We can create an instance as well
var newCard = new CreditCard({number: '0123'});
newCard.name = 'Mike Smith';
var savePromise = newCard.$save();
// POST: /users/123/cards {number: '0123', name: 'Mike Smith'}
// server returns: {id: 789, number: '0123', name: 'Mike Smith'}
savePromise.then(function() {
// Once the promise is resolved, the created instance
// is populated with the data returned by the server
expect(newCard.id).toEqual(789);
});
```
*
* The object returned from a call to `$resource` is a resource "class" which has one "static"
* method for each action in the definition.
*
* Calling these methods invokes `$http` on the `url` template with the given HTTP `method`,
* `params` and `headers`.
*
* @example
*
* ### Accessing the response
*
* When the data is returned from the server then the object is an instance of the resource type and
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
* operations (create, read, update, delete) on server-side data.
*
```js
var User = $resource('/users/:userId', {userId: '@id'});
User.get({userId: 123}).$promise.then(function(user) {
user.abc = true;
user.$save();
});
```
*
* It's worth noting that the success callback for `get`, `query` and other methods gets called with
* the resource instance (populated with the data that came from the server) as well as an `$http`
* header getter function, the HTTP status code and the response status text. So one could rewrite
* the above example and get access to HTTP headers as follows:
*
```js
var User = $resource('/users/:userId', {userId: '@id'});
User.get({userId: 123}, function(user, getResponseHeaders) {
user.abc = true;
user.$save(function(user, putResponseHeaders) {
// `user` => saved `User` object
// `putResponseHeaders` => `$http` header getter
});
});
```
*
* @example
*
* ### Creating custom actions
*
* In this example we create a custom method on our resource to make a PUT request:
*
```js
var app = angular.module('app', ['ngResource']);
// Some APIs expect a PUT request in the format URL/object/ID
// Here we are creating an 'update' method
app.factory('Notes', ['$resource', function($resource) {
return $resource('/notes/:id', {id: '@id'}, {
update: {method: 'PUT'}
});
}]);
// In our controller we get the ID from the URL using `$location`
app.controller('NotesCtrl', ['$location', 'Notes', function($location, Notes) {
// First, retrieve the corresponding `Note` object from the server
// (Assuming a URL of the form `.../notes?id=XYZ`)
var noteId = $location.search().id;
var note = Notes.get({id: noteId});
note.$promise.then(function() {
note.content = 'Hello, world!';
// Now call `update` to save the changes on the server
Notes.update(note);
// This will PUT /notes/ID with the note object as the request payload
// Since `update` is a non-GET method, it will also be available on the instance
// (prefixed with `$`), so we could replace the `Note.update()` call with:
//note.$update();
});
}]);
```
*
* @example
*
* ### Cancelling requests
*
* If an action's configuration specifies that it is cancellable, you can cancel the request related
* to an instance or collection (as long as it is a result of a "non-instance" call):
*
```js
// ...defining the `Hotel` resource...
var Hotel = $resource('/api/hotels/:id', {id: '@id'}, {
// Let's make the `query()` method cancellable
query: {method: 'get', isArray: true, cancellable: true}
});
// ...somewhere in the PlanVacationController...
...
this.onDestinationChanged = function onDestinationChanged(destination) {
// We don't care about any pending request for hotels
// in a different destination any more
if (this.availableHotels) {
this.availableHotels.$cancelRequest();
}
// Let's query for hotels in `destination`
// (calls: /api/hotels?location=<destination>)
this.availableHotels = Hotel.query({location: destination});
};
```
*
* @example
*
* ### Using interceptors
*
* You can use interceptors to transform the request or response, perform additional operations, and
* modify the returned instance/collection. The following example, uses `request` and `response`
* interceptors to augment the returned instance with additional info:
*
```js
var Thing = $resource('/api/things/:id', {id: '@id'}, {
save: {
method: 'POST',
interceptor: {
request: function(config) {
// Before the request is sent out, store a timestamp on the request config
config.requestTimestamp = Date.now();
return config;
},
response: function(response) {
// Get the instance from the response object
var instance = response.resource;
// Augment the instance with a custom `saveLatency` property, computed as the time
// between sending the request and receiving the response.
instance.saveLatency = Date.now() - response.config.requestTimestamp;
// Return the instance
return instance;
}
}
}
});
Thing.save({foo: 'bar'}).$promise.then(function(thing) {
console.log('That thing was saved in ' + thing.saveLatency + 'ms.');
});
```
*
*/
angular.module('ngResource', ['ng']).
info({ angularVersion: '1.7.8' }).
provider('$resource', function ResourceProvider() {
var PROTOCOL_AND_IPV6_REGEX = /^https?:\/\/\[[^\]]*][^/]*/;
var provider = this;
/**
* @ngdoc property
* @name $resourceProvider#defaults
* @description
* Object containing default options used when creating `$resource` instances.
*
* The default values satisfy a wide range of usecases, but you may choose to overwrite any of
* them to further customize your instances. The available properties are:
*
* - **stripTrailingSlashes** – `{boolean}` – If true, then the trailing slashes from any
* calculated URL will be stripped.<br />
* (Defaults to true.)
* - **cancellable** – `{boolean}` – If true, the request made by a "non-instance" call will be
* cancelled (if not already completed) by calling `$cancelRequest()` on the call's return
* value. For more details, see {@link ngResource.$resource}. This can be overwritten per
* resource class or action.<br />
* (Defaults to false.)
* - **actions** - `{Object.<Object>}` - A hash with default actions declarations. Actions are
* high-level methods corresponding to RESTful actions/methods on resources. An action may
* specify what HTTP method to use, what URL to hit, if the return value will be a single
* object or a collection (array) of objects etc. For more details, see
* {@link ngResource.$resource}. The actions can also be enhanced or overwritten per resource
* class.<br />
* The default actions are:
* ```js
* {
* get: {method: 'GET'},
* save: {method: 'POST'},
* query: {method: 'GET', isArray: true},
* remove: {method: 'DELETE'},
* delete: {method: 'DELETE'}
* }
* ```
*
* #### Example
*
* For example, you can specify a new `update` action that uses the `PUT` HTTP verb:
*
* ```js
* angular.
* module('myApp').
* config(['$resourceProvider', function ($resourceProvider) {
* $resourceProvider.defaults.actions.update = {
* method: 'PUT'
* };
* }]);
* ```
*
* Or you can even overwrite the whole `actions` list and specify your own:
*
* ```js
* angular.
* module('myApp').
* config(['$resourceProvider', function ($resourceProvider) {
* $resourceProvider.defaults.actions = {
* create: {method: 'POST'},
* get: {method: 'GET'},
* getAll: {method: 'GET', isArray:true},
* update: {method: 'PUT'},
* delete: {method: 'DELETE'}
* };
* });
* ```
*
*/
this.defaults = {
// Strip slashes by default
stripTrailingSlashes: true,
// Make non-instance requests cancellable (via `$cancelRequest()`)
cancellable: false,
// Default actions configuration
actions: {
'get': {method: 'GET'},
'save': {method: 'POST'},
'query': {method: 'GET', isArray: true},
'remove': {method: 'DELETE'},
'delete': {method: 'DELETE'}
}
};
this.$get = ['$http', '$log', '$q', '$timeout', function($http, $log, $q, $timeout) {
var noop = angular.noop,
forEach = angular.forEach,
extend = angular.extend,
copy = angular.copy,
isArray = angular.isArray,
isDefined = angular.isDefined,
isFunction = angular.isFunction,
isNumber = angular.isNumber,
encodeUriQuery = angular.$$encodeUriQuery,
encodeUriSegment = angular.$$encodeUriSegment;
function Route(template, defaults) {
this.template = template;
this.defaults = extend({}, provider.defaults, defaults);
this.urlParams = {};
}
Route.prototype = {
setUrlParams: function(config, params, actionUrl) {
var self = this,
url = actionUrl || self.template,
val,
encodedVal,
protocolAndIpv6 = '';
var urlParams = self.urlParams = Object.create(null);
forEach(url.split(/\W/), function(param) {
if (param === 'hasOwnProperty') {
throw $resourceMinErr('badname', 'hasOwnProperty is not a valid parameter name.');
}
if (!(new RegExp('^\\d+$').test(param)) && param &&
(new RegExp('(^|[^\\\\]):' + param + '(\\W|$)').test(url))) {
urlParams[param] = {
isQueryParamValue: (new RegExp('\\?.*=:' + param + '(?:\\W|$)')).test(url)
};
}
});
url = url.replace(/\\:/g, ':');
url = url.replace(PROTOCOL_AND_IPV6_REGEX, function(match) {
protocolAndIpv6 = match;
return '';
});
params = params || {};
forEach(self.urlParams, function(paramInfo, urlParam) {
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
if (isDefined(val) && val !== null) {
if (paramInfo.isQueryParamValue) {
encodedVal = encodeUriQuery(val, true);
} else {
encodedVal = encodeUriSegment(val);
}
url = url.replace(new RegExp(':' + urlParam + '(\\W|$)', 'g'), function(match, p1) {
return encodedVal + p1;
});
} else {
url = url.replace(new RegExp('(/?):' + urlParam + '(\\W|$)', 'g'), function(match,
leadingSlashes, tail) {
if (tail.charAt(0) === '/') {
return tail;
} else {
return leadingSlashes + tail;
}
});
}
});
// strip trailing slashes and set the url (unless this behavior is specifically disabled)
if (self.defaults.stripTrailingSlashes) {
url = url.replace(/\/+$/, '') || '/';
}
// Collapse `/.` if found in the last URL path segment before the query.
// E.g. `http://url.com/id/.format?q=x` becomes `http://url.com/id.format?q=x`.
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
// Replace escaped `/\.` with `/.`.
// (If `\.` comes from a param value, it will be encoded as `%5C.`.)
config.url = protocolAndIpv6 + url.replace(/\/(\\|%5C)\./, '/.');
// set params - delegate param encoding to $http
forEach(params, function(value, key) {
if (!self.urlParams[key]) {
config.params = config.params || {};
config.params[key] = value;
}
});
}
};
function resourceFactory(url, paramDefaults, actions, options) {
var route = new Route(url, options);
actions = extend({}, provider.defaults.actions, actions);
function extractParams(data, actionParams) {
var ids = {};
actionParams = extend({}, paramDefaults, actionParams);
forEach(actionParams, function(value, key) {
if (isFunction(value)) { value = value(data); }
ids[key] = value && value.charAt && value.charAt(0) === '@' ?
lookupDottedPath(data, value.substr(1)) : value;
});
return ids;
}
function defaultResponseInterceptor(response) {
return response.resource;
}
function Resource(value) {
shallowClearAndCopy(value || {}, this);
}
Resource.prototype.toJSON = function() {
var data = extend({}, this);
delete data.$promise;
delete data.$resolved;
delete data.$cancelRequest;
return data;
};
forEach(actions, function(action, name) {
var hasBody = action.hasBody === true || (action.hasBody !== false && /^(POST|PUT|PATCH)$/i.test(action.method));
var numericTimeout = action.timeout;
var cancellable = isDefined(action.cancellable) ?
action.cancellable : route.defaults.cancellable;
if (numericTimeout && !isNumber(numericTimeout)) {
$log.debug('ngResource:\n' +
' Only numeric values are allowed as `timeout`.\n' +
' Promises are not supported in $resource, because the same value would ' +
'be used for multiple requests. If you are looking for a way to cancel ' +
'requests, you should use the `cancellable` option.');
delete action.timeout;
numericTimeout = null;
}
Resource[name] = function(a1, a2, a3, a4) {
var params = {}, data, onSuccess, onError;
switch (arguments.length) {
case 4:
onError = a4;
onSuccess = a3;
// falls through
case 3:
case 2:
if (isFunction(a2)) {
if (isFunction(a1)) {
onSuccess = a1;
onError = a2;
break;
}
onSuccess = a2;
onError = a3;
// falls through
} else {
params = a1;
data = a2;
onSuccess = a3;
break;
}
// falls through
case 1:
if (isFunction(a1)) onSuccess = a1;
else if (hasBody) data = a1;
else params = a1;
break;
case 0: break;
default:
throw $resourceMinErr('badargs',
'Expected up to 4 arguments [params, data, success, error], got {0} arguments',
arguments.length);
}
var isInstanceCall = this instanceof Resource;
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
var httpConfig = {};
var requestInterceptor = action.interceptor && action.interceptor.request || undefined;
var requestErrorInterceptor = action.interceptor && action.interceptor.requestError ||
undefined;
var responseInterceptor = action.interceptor && action.interceptor.response ||
defaultResponseInterceptor;
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
$q.reject;
var successCallback = onSuccess ? function(val) {
onSuccess(val, response.headers, response.status, response.statusText);
} : undefined;
var errorCallback = onError || undefined;
var timeoutDeferred;
var numericTimeoutPromise;
var response;
forEach(action, function(value, key) {
switch (key) {
default:
httpConfig[key] = copy(value);
break;
case 'params':
case 'isArray':
case 'interceptor':
case 'cancellable':
break;
}
});
if (!isInstanceCall && cancellable) {
timeoutDeferred = $q.defer();
httpConfig.timeout = timeoutDeferred.promise;
if (numericTimeout) {
numericTimeoutPromise = $timeout(timeoutDeferred.resolve, numericTimeout);
}
}
if (hasBody) httpConfig.data = data;
route.setUrlParams(httpConfig,
extend({}, extractParams(data, action.params || {}), params),
action.url);
// Start the promise chain
var promise = $q.
resolve(httpConfig).
then(requestInterceptor).
catch(requestErrorInterceptor).
then($http);
promise = promise.then(function(resp) {
var data = resp.data;
if (data) {
// Need to convert action.isArray to boolean in case it is undefined
if (isArray(data) !== (!!action.isArray)) {
throw $resourceMinErr('badcfg',
'Error in resource configuration for action `{0}`. Expected response to ' +
'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object',
isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url);
}
if (action.isArray) {
value.length = 0;
forEach(data, function(item) {
if (typeof item === 'object') {
value.push(new Resource(item));
} else {
// Valid JSON values may be string literals, and these should not be converted
// into objects. These items will not have access to the Resource prototype
// methods, but unfortunately there
value.push(item);
}
});
} else {
var promise = value.$promise; // Save the promise
shallowClearAndCopy(data, value);
value.$promise = promise; // Restore the promise
}
}
resp.resource = value;
response = resp;
return responseInterceptor(resp);
}, function(rejectionOrResponse) {
rejectionOrResponse.resource = value;
response = rejectionOrResponse;
return responseErrorInterceptor(rejectionOrResponse);
});
promise = promise['finally'](function() {
value.$resolved = true;
if (!isInstanceCall && cancellable) {
value.$cancelRequest = noop;
$timeout.cancel(numericTimeoutPromise);
timeoutDeferred = numericTimeoutPromise = httpConfig.timeout = null;
}
});
// Run the `success`/`error` callbacks, but do not let them affect the returned promise.
promise.then(successCallback, errorCallback);
if (!isInstanceCall) {
// we are creating instance / collection
// - set the initial promise
// - return the instance / collection
value.$promise = promise;
value.$resolved = false;
if (cancellable) value.$cancelRequest = cancelRequest;
return value;
}
// instance call
return promise;
function cancelRequest(value) {
promise.catch(noop);
if (timeoutDeferred !== null) {
timeoutDeferred.resolve(value);
}
}
};
Resource.prototype['$' + name] = function(params, success, error) {
if (isFunction(params)) {
error = success; success = params; params = {};
}
var result = Resource[name].call(this, params, this, success, error);
return result.$promise || result;
};
});
return Resource;
}
return resourceFactory;
}];
});
})(window, window.angular);
\ No newline at end of file
/* /*
<<<<<<< HEAD
AngularJS v1.7.8 AngularJS v1.7.8
(c) 2010-2018 Google, Inc. http://angularjs.org (c) 2010-2018 Google, Inc. http://angularjs.org
License: MIT License: MIT
...@@ -684,4 +683,3 @@ link:function(a,b,d,c){if(c){var e=-1;d.$observe("maxlength",function(a){a=Z(a); ...@@ -684,4 +683,3 @@ link:function(a,b,d,c){if(c){var e=-1;d.$observe("maxlength",function(a){a=Z(a);
STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2, STANDALONEMONTH:"January February March April May June July August September October November December".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,
minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a,c){var e=a|0,f=c;void 0===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),B(function(){we(u.document,Uc)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>'); minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a,c){var e=a|0,f=c;void 0===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),B(function(){we(u.document,Uc)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');
//# sourceMappingURL=angular.min.js.map //# sourceMappingURL=angular.min.js.map
>>>>>>> master
/** /**
* *
*/ */
angular.module("myApp", ["ui.router"]).config(function($stateProvider, $urlRouterProvider,$locationProvider) { angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix(''); $locationProvider.hashPrefix('');
$urlRouterProvider.otherwise("/index"); $urlRouterProvider.otherwise("/employees");
$stateProvider $stateProvider
.state("layout1", {
//index layout riêng abstract: true,
.state("index", { views: {
url: "/index", "layout": {
views:{ templateUrl: "layout/layout1.html"
"index":{ }
templateUrl: "pages/index/index.htm",
controller: "indexController"
},
"banner":{
templateUrl: "pages/index/banner.htm"
}
}
})
// State chứa layout chung cho các trang
.state('app', {
abstract: true,
views: {
'main_layout': {
templateUrl: 'main_layout.html',
} }
} })
})
.state("layout2", {
// Các state bên dưới kế thừa state app abstract: true,
views: {
.state("tintuc", { // Khai báo một state "layout": {
parent: 'app', templateUrl: "layout/layout2.html"
url: "/tintuc", // URL hiển thị }
views:{ }
"content":{ })
templateUrl: "pages/tintuc/tintuc.htm",
controller: "tintucController" // khai báo controller .state("layout5", {
} abstract: true,
} views: {
}) "layout": {
templateUrl: "layout/layout5.html"
}
}
})
// .state('app', {
// abstract: true,
// views: {
// 'main_layout': {
// templateUrl: 'main_layout.html',
// }
// }
// })
.state("employees", {
parent: 'layout1',
url: "/employees",
views: {
"content": {
templateUrl: "pages/employee/employee.html",
controller: "employeeController"
}
}
})
.state("project", {
parent: 'layout1',
url: "/project",
views: {
"content": {
templateUrl: "pages/project/project.html",
controller: "projectController"
}
}
})
.state("report", {
parent: 'layout1',
url: "/report",
views: {
"content": {
templateUrl: "pages/employee/project.html",
controller: "employeeController"
}
}
})
.state("timeSheet", {
parent: 'layout5',
url: "/timesheet",
views: {
"content": {
templateUrl: "/pages/timesheet/timeSheet.html",
controller: "timeSheetController"
}
}
})
.state("timeSheetDetail", {
parent: 'layout5',
url: "/timesheetdetail/:id",
views: {
"content": {
templateUrl: "/pages/timesheet/timeSheetDetail.html",
controller: "timeSheetDetailController"
}
}
})
.state("leaveForm", {
parent: 'layout5',
url: "/leaveform",
views: {
"content": {
templateUrl: "/pages/leaveform/leaveForm.html",
controller: "leaveFormController"
}
}
})
.state("leaveFormDetail", {
parent: 'layout5',
url: "/leaveformdetail/:id",
views: {
"content": {
templateUrl: "/pages/leaveform/leaveFormDetail.html",
controller: "leaveFormDetailController"
}
}
})
// .state("testlayout2", {
// parent: 'layout2',
// url: "/testttt",
// views: {
// "content": {
// templateUrl: "/pages/testlayout/testlayout.html",
// controller: "testlayoutController"
// }
// }
// })
});
.state("tuyendung", {
parent: 'app',
url: "/tuyendung",
views:{
"content":{
templateUrl: "pages/tuyendung/tuyendung.htm",
controller: "tuyendungController"
}
}
})
<<<<<<< HEAD
// .state("lienhe", { // .state("lienhe", {
// parent: 'app', // parent: 'app',
// url: "/lienhe", // url: "/lienhe",
...@@ -79,3 +154,18 @@ angular.module("myApp", ["ui.router"]).config(function($stateProvider, $urlRoute ...@@ -79,3 +154,18 @@ angular.module("myApp", ["ui.router"]).config(function($stateProvider, $urlRoute
}) })
}); });
=======
// myApp.directive('ngConfirmClick', [ function() {
// return {
// link : function(scope, element, attr) {
// var msg = attr.ngConfirmClick || "Are you sure?";
// var clickAction = attr.confirmedClick;
// element.bind('click', function(event) {
// if (window.confirm(msg)) {
// scope.$eval(clickAction)
// }
// });
// }
// };
// } ])
>>>>>>> master
<div>
layout1
<a ui-sref="employees">Employee</a>
<a ui-sref="report">Report</a>
<a ui-sref="project">Project</a>
<div ui-view="content">
</div>
</div>
\ No newline at end of file
<div>
layout2
Không có menu
<div ui-view="content"></div>
</div>
\ No newline at end of file
<div>
layout5
<a ui-sref="timeSheet">Time Sheet</a>
<a ui-sref="leaveForm">Leave Form</a>
<div ui-view="content">
</div>
</div>
\ No newline at end of file
<!-- technology -->
<div class="technology-1">
<div class="container">
<div class="col-md-9 technology-left">
<div ui-view="content">
<!-- nội dung các trang -->
</div>
</div>
<!-- technology-right -->
<div class="col-md-3 technology-right-1">
<div class="blo-top">
<div class="tech-btm">
<img src="images/banner1.jpg" class="img-responsive" alt=""/>
</div>
</div>
<div class="blo-top">
<div class="tech-btm">
<h4>Sign up to our newsletter</h4>
<p>Pellentesque dui, non felis. Maecenas male</p>
<div class="name">
<form>
<input type="text" placeholder="Email" required="">
</form>
</div>
<div class="button">
<form>
<input type="submit" value="Subscribe">
</form>
</div>
<div class="clearfix"> </div>
</div>
</div>
<div class="blo-top1">
<div class="tech-btm">
<h4>Tin tức nổi bật </h4>
<div class="blog-grids">
<div class="blog-grid-left">
<a href="singlepage.html"><img src="images/6.jpg" class="img-responsive" alt=""/></a>
</div>
<div class="blog-grid-right">
<h5><a href="singlepage.html">Pellentesque dui, non felis. Maecenas male</a> </h5>
</div>
<div class="clearfix"> </div>
</div>
<div class="blog-grids">
<div class="blog-grid-left">
<a href="singlepage.html"><img src="images/7.jpg" class="img-responsive" alt=""/></a>
</div>
<div class="blog-grid-right">
<h5><a href="singlepage.html">Pellentesque dui, non felis. Maecenas male</a> </h5>
</div>
<div class="clearfix"> </div>
</div>
<div class="blog-grids">
<div class="blog-grid-left">
<a href="singlepage.html"><img src="images/11.jpg" class="img-responsive" alt=""/></a>
</div>
<div class="blog-grid-right">
<h5><a href="singlepage.html">Pellentesque dui, non felis. Maecenas male</a> </h5>
</div>
<div class="clearfix"> </div>
</div>
<div class="blog-grids">
<div class="blog-grid-left">
<a href="singlepage.html"><img src="images/9.jpg" class="img-responsive" alt=""/></a>
</div>
<div class="blog-grid-right">
<h5><a href="singlepage.html">Pellentesque dui, non felis. Maecenas male</a> </h5>
</div>
<div class="clearfix"> </div>
</div>
<div class="blog-grids">
<div class="blog-grid-left">
<a href="singlepage.html"><img src="images/10.jpg" class="img-responsive" alt=""/></a>
</div>
<div class="blog-grid-right">
<h5><a href="singlepage.html">Pellentesque dui, non felis. Maecenas male</a> </h5>
</div>
<div class="clearfix"> </div>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<!-- technology-right -->
</div>
</div>
<!-- technology -->
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<div> <div>
<legend>Employee Details</legend> <legend>Employee Details</legend>
<table> <table>
<tr> <tr>
<td><label>User Name</label></td> <td><label>User Name</label></td>
<td> <td>
<input type="text" maxlength="29" ng-model="emp.username"/> <input type="text" maxlength="29" ng-model="emp.username"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><label>First Name</label></td> <td><label>First Name</label></td>
<td> <td>
<input type="text" maxlength="29" ng-model="emp.firstName"/> <input type="text" maxlength="29" ng-model="emp.firstName"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><label>Last Name</label></td> <td><label>Last Name</label></td>
<td> <td>
<input type="text" maxlength="29" ng-model="emp.lastName"/> <input type="text" maxlength="29" ng-model="emp.lastName"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><label id="email" for="email">Email</label> </td> <td><label id="email" for="email">Email</label></td>
<td> <td>
<input type="email" maxlength="150" ng-model="emp.emailAddress"/> <input type="email" maxlength="150" ng-model="emp.emailAddress"/>
</td> </td>
...@@ -49,31 +43,40 @@ ...@@ -49,31 +43,40 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td><label >home town:</label></td> <td><label>home town:</label></td>
<td> <input type="text" ng-model="emp.homeTown"/></td> <td><input type="text" ng-model="emp.homeTown"/></td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td> <td >
<input type="submit" name="submit" value="submit" ng-click="save();"/> <input type="submit" name="submit" value="submit" ng-click="save();"/>
<input type="submit" name="clear" value="clear" ng-click=" emp = null"/> <input type="submit" name="clear" value="clear" ng-click=" emp = null"/>
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
<br><br>
<div> <div>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>ID</th> <tr>
<th>User Name</th>
<th>First Name</th> <td colspan="12">Thông tin nhân viên</td>
<th>Last Name</th> </tr>
<th>EmailAddress</th> <th>ID</th>
<th>Phone</th> <th>User Name</th>
<th>Education</th> <th>First Name</th>
<th>Home Town</th> <th>Last Name</th>
<th>EmailAddress</th>
<th>Phone</th>
<th>Education</th>
<th>Home Town</th>
<th>Department</th>
<th>Position</th>
<th colspan="2">Menu</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -86,11 +89,12 @@ ...@@ -86,11 +89,12 @@
<td>{{emp.phoneNumber}}</td> <td>{{emp.phoneNumber}}</td>
<td>{{emp.education}}</td> <td>{{emp.education}}</td>
<td>{{emp.homeTown}}</td> <td>{{emp.homeTown}}</td>
<td>{{emp.department}}</td>
<td>{{emp.position}}</td>
<td><a href="#" ng-click="update(emp);">Edit</a>
<td><a href="#" ng-confirm-click=" Do you want to delete this user?" ng-click="delete(emp);">Delete</a>
</td>
<td><a href="#" ng-click="update(emp);">Update</a>
<td><a href="#" confirmed-click="delete(employee);" ng-confirm-click=" Do you want to delete this user?">Delete</a></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -98,5 +102,3 @@ ...@@ -98,5 +102,3 @@
</div> </div>
</div> </div>
</div> </div>
</body>
</html>
\ No newline at end of file
/** /**
* *
*/ */
angular.module("myApp",[]).controller("tintucController", function($scope, $http,$window) { angular.module("myApp").controller("employeeController", function($scope, $http,$window) {
console.log("Tin tức controller"); console.log("Employee controller");
$scope.emp= { $scope.emp= {
"username": "", "username": "",
...@@ -12,7 +12,10 @@ angular.module("myApp",[]).controller("tintucController", function($scope, $http ...@@ -12,7 +12,10 @@ angular.module("myApp",[]).controller("tintucController", function($scope, $http
"emailAddress": "", "emailAddress": "",
"phoneNumber": "", "phoneNumber": "",
"homeTown": "", "homeTown": "",
"education": "" "education": "",
"department": "",
"position" : "",
}; };
...@@ -23,33 +26,63 @@ angular.module("myApp",[]).controller("tintucController", function($scope, $http ...@@ -23,33 +26,63 @@ angular.module("myApp",[]).controller("tintucController", function($scope, $http
console.log($scope.emp); console.log($scope.emp);
$http({ $http({
method : 'POST', method : 'POST',
url : "http://localhost:8081/list_employee/", url : "http://localhost:8080/list_employee/",
data: $scope.emp data: $scope.emp
}).then(function successCallback(response) { }).then(function successCallback(response) {
console.log(response); console.log(response);
// $window.location.href ='http://localhost:8081/#/tintuc';
}, function errorCallback(response) { }, function errorCallback(response) {
console.log(response) console.log(response)
}); });
} }
$scope.update = update; $scope.update = update;
function update(employee){ function update(emp){
$scope.employee = employee; $scope.emp = emp;
list_employee(); $http({
method : 'PUT',
url : "/employee/" + emp.id,
data: $scope.emp
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response)
});
} }
$scope.deleteEmployee = function (employee) { // HTTP DELETE- delete employee by Id
// Call: http://localhost:8080/employee/{id}
$scope.delete = function (emp) {
$http({ $http({
method : 'DELETE', method : 'DELETE',
url : 'http://localhost:8081/deleteEmployee/' + employee.id url : '/employee/' + emp.id
}).then(_success, _error); }).then(function successCallback(response) {
} console.log(response);
$scope.employess=response.data;
}, function errorCallback(response) {
console.log(response)
});
};
// In case of edit
$scope.edit = function(emp){
$scope.emp.username = emp.username;
$scope.emp.password = emp.password;
$scope.emp.firstName = emp.firstName;
$scope.emp.lastName = emp.lastName;
$scope.emp.emailAddress = emp.emailAddress;
$scope.emp.phoneNumber = emp.phoneNumber;
$scope.emp.homeTown = emp.homeTown;
$scope.emp.education = emp.education;
$scope.emp.department = emp.department;
$scope.emp.position = emp.position;
};
$http({ $http({
method : 'GET', method : 'GET',
url : "http://localhost:8081/list_employee/", url : "http://localhost:8080/list_employee/"
}).then(function successCallback(response) { }).then(function successCallback(response) {
console.log(response) console.log(response);
$scope.employess=response.data; $scope.employess=response.data;
}, function errorCallback(response) { }, function errorCallback(response) {
console.log(response) console.log(response)
......
<!--<!DOCTYPE html>-->
<!--<html lang="en" ng-app="myApp" ng-controller="timesheetController">-->
<!--<head>-->
<!-- <meta charset="UTF-8">-->
<!-- <title>Time Sheet</title>-->
<!-- <meta name="viewport" content="width=device-width, initial-scale=1">-->
<!-- <script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>-->
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"-->
<!-- integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"-->
<!-- crossorigin="anonymous"></script>-->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"-->
<!-- integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">-->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>-->
<!-- <script src="timeSheetController.js"></script>-->
<!--</head>-->
<!--<body>-->
<!--</body>-->
<!--</html>-->
<div class="container">
<div class="row">
<div class="col-sm-12">
<br><br>
<input id="addLeaveForm" type="submit" name="addTS" value="Add" onclick="showAddLeaveFormFunction()"/>
<div id="addDivLF" style="display: none">
<legend>Leave Form</legend>
<table>
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="lfdto.title"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="lfdto.content"/>
</td>
</tr>
<tr>
<td><label>Employee Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="lfdto.employeeId"/>
</td>
</tr>
<tr>
<td><label>Leave Type Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="lfdto.leaveTypeId"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" name="submit" value="Confirm" ng-click="save();"/>
<input type="submit" name="clear" value="Clear" ng-click="lfdto = null"/>
</td>
</tr>
</table>
</div>
<br><br>
<div id="updateDivLF" style="display: none">
<!-- <legend>Leave Form</legend>-->
<table>
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="lfdto.title"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="lfdto.content"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" name="submit" value="Confirm" ng-click="update();"/>
<input type="submit" name="clear" value="Clear" ng-click="lfdto = null"/>
<input type="submit" name="close" value="Close" onclick="document.getElementById('updateDivLF').style.display = 'none'"/>
</td>
</tr>
</table>
</div>
<br><br>
<div>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Content</th>
<th>Employee</th>
<th>Leave Type</th>
<th>Create At</th>
<th>Status</th>
<th colspan="4"></th>
</tr>
</thead>
<tbody>
<tr class="lff" ng-repeat="lf in leaveForms">
<td>{{$index + 1}}</td>
<td>{{lf.title}}</td>
<td>{{lf.content}}</td>
<td>{{lf.employee.lastName}}</td>
<td>{{lf.leaveType.name}}</td>
<td>{{lf.createdAt}}</td>
<td>{{lf.status}}</td>
<td><a ui-sref="leaveFormDetail({id: lf.id})">Xem</a></td>
<td><a href="/#/leaveform" ng-click="getLf(lf);" onclick="document.getElementById('updateDivLF').style.display = 'block'">Sửa</a></td>
<td><a href="/#/leaveform" ng-click="delete(lf);">Xoá</a></td>
<td><a href="/#/leaveform" ng-click="updateStatus(lf)">Duyệt</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp").controller("leaveFormController", function($scope, $http, $state) {
console.log("Leave Form controller");
$scope.lf = {
"id": "",
"title": "",
"content": "",
"employee": "",
"leaveType": "",
"createdAt": "",
"status": ""
};
$scope.lfdto = {
"id": "",
"title": "",
"content": "",
"employeeId": "",
"leaveTypeId": ""
};
//get all leave form
$http({
method : 'GET',
url : "http://localhost:8080/employee/leaveform/show"
}).then(function successCallback(response) {
console.log(response);
$scope.leaveForms=response.data;
}, function errorCallback(response) {
console.log(response)
});
//delete leave form
$scope.delete = function (lf) {
$http({
method : 'DELETE',
url : "http://localhost:8080/employee/leaveform/delete/" + lf.id
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response)
});
};
$scope.save = save;
function save(){
console.log($scope.lfdto);
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/add",
data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
// $window.location.reload();
}, function errorCallback(response) {
console.log(response)
});
}
$scope.getLf = getLf;
function getLf(lf) {
$scope.lfdto.id = lf.id;
$scope.lfdto.title = lf.title;
$scope.lfdto.content = lf.content;
$scope.lfdto.employeeId = lf.employee.id;
$scope.lfdto.leaveTypeId = lf.leaveType.id;
}
$scope.update = update;
function update(){
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/update",
data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response)
});
}
$scope.updateStatus = updateStatus;
function updateStatus(lf){
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/"+lf.id+"/status",
// data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response)
});
}
});
\ No newline at end of file
<div class="container">
<div class="row">
<div class="col-sm-12">
<div>
<br><br>
<div>
<tr>
<legend><p>Tiêu đề</p>{{leaveFormDetail.title}}</legend>
<h3>Nội dung</h3>
<td>{{leaveFormDetail.content}}</td>
</tr>
</div>
<br><br>
<div>
<tr>
<input type="submit" name="submit" value="Duyệt" ui-sref="leaveForm" ng-click="updateStatus(leaveFormDetail.id)"/>
<input type="submit" name="submit" value="Quay lại" ui-sref="leaveForm"/>
</tr>
</div>
<br><br>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp").controller("leaveFormDetailController", function($scope, $http, $stateParams) {
console.log("Leave Form Detail Controller");
$http({
method : 'GET',
url : "http://localhost:8080/employee/leaveform/" + $stateParams.id
}).then(function successCallback(response) {
console.log(response);
$scope.leaveFormDetail=response.data;
}, function errorCallback(response) {
console.log(response)
});
$scope.updateStatus = updateStatus;
function updateStatus(id){
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/"+id+"/status",
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response)
});
}
});
\ No newline at end of file
<div class="container">
Project works
</div>
/**
*
*/
angular.module("myApp").controller("projectController", function($scope, $http,$window) {
console.log("projectController ");
});
\ No newline at end of file
<!--<div class="container">-->
<!-- <div class="row">-->
<!-- <div class="col-md-8">-->
<!-- <div>-->
<!-- <legend>Employee Details</legend>-->
<!-- <table>-->
<!-- <tr>-->
<!-- <td><label>User Name</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="emp.username"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>First Name</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="emp.firstName"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Last Name</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="emp.lastName"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label id="email" for="email">Email</label> </td>-->
<!-- <td>-->
<!-- <input type="email" maxlength="150" ng-model="emp.emailAddress"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Phone</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="10" value="" ng-model="emp.phoneNumber"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>education:</label></td>-->
<!-- <td>-->
<!-- <input ng-model="emp.education"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label >home town:</label></td>-->
<!-- <td> <input type="text" ng-model="emp.homeTown"/></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td></td>-->
<!-- <td>-->
<!-- <input type="submit" name="submit" value="submit" ng-click="save();"/>-->
<!-- <input type="submit" name="clear" value="clear" ng-click=" emp = null"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<!-- </div>-->
<!-- <div>-->
<!-- <table class="table">-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <th>ID</th>-->
<!-- <th>User Name</th>-->
<!-- <th>First Name</th>-->
<!-- <th>Last Name</th>-->
<!-- <th>EmailAddress</th>-->
<!-- <th>Phone</th>-->
<!-- <th>Education</th>-->
<!-- <th>Home Town</th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<!-- <tr class="vide" ng-repeat="emp in employess">-->
<!-- <td>{{$index + 1}}</td>-->
<!-- <td>{{emp.username}}</td>-->
<!-- <td>{{emp.firstName}}</td>-->
<!-- <td>{{emp.lastName}}</td>-->
<!-- <td>{{emp.emailAddress}}</td>-->
<!-- <td>{{emp.phoneNumber}}</td>-->
<!-- <td>{{emp.education}}</td>-->
<!-- <td>{{emp.homeTown}}</td>-->
<!-- <td><a href="#" ng-click="update(emp);">Update</a>-->
<!-- <td><a href="#" confirmed-click="delete(employee);" ng-confirm-click=" Do you want to delete this user?">Delete</a></td>-->
<!-- </tr>-->
<!-- </tbody>-->
<!-- </table>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!--</div>-->
// /**
// *
// */
// angular.module("myApp").controller("employeeController", function($scope, $http,$window) {
// console.log("Employee controller");
//
// $scope.emp= {
// "username": "",
// "password": "",
// "firstName": "",
// "lastName": "",
// "emailAddress": "",
// "phoneNumber": "",
// "homeTown": "",
// "education": ""
// };
//
//
//
// $scope.save = save;
//
// function save(){
// console.log($scope.emp);
// $http({
// method : 'POST',
// url : "http://localhost:8080/list_employee/",
// data: $scope.emp
// }).then(function successCallback(response) {
// console.log(response);
// $window.location.href ='http://localhost:8080/#/tintuc';
// }, function errorCallback(response) {
// console.log(response)
// });
// }
// $scope.update = update;
// function update(employee){
// $scope.employee = employee;
// list_employee();
// }
// $scope.deleteEmployee = function (employee) {
// $http({
// method : 'DELETE',
// url : 'http://localhost:8080/employee/' + employee.id
// }).then(_success, _error);
// }
//
//
// $http({
// method : 'GET',
// url : "http://localhost:8080/list_employee/",
// }).then(function successCallback(response) {
// console.log(response)
// $scope.employess=response.data;
// }, function errorCallback(response) {
// console.log(response)
// });
// });
\ No newline at end of file
<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
<!--<!DOCTYPE html>-->
<!--<html lang="en" ng-app="myApp" ng-controller="timesheetController">-->
<!--<head>-->
<!-- <meta charset="UTF-8">-->
<!-- <title>Time Sheet</title>-->
<!-- <meta name="viewport" content="width=device-width, initial-scale=1">-->
<!-- <script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>-->
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"-->
<!-- integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"-->
<!-- crossorigin="anonymous"></script>-->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"-->
<!-- integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">-->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>-->
<!-- <script src="timeSheetController.js"></script>-->
<!--</head>-->
<!--<body>-->
<!--</body>-->
<!--</html>-->
<div class="container">
<div class="row">
<div class="col-md-12">
<br><br>
<input id="addTimeSheet" type="submit" name="addTS" value="Add" onclick="showAddTimeSheetFunction()"/>
<div id="addDivTS" style="display: none">
<legend>Time Sheet</legend>
<table>
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="tsdto.title"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.content"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.note"/>
</td>
</tr>
<tr>
<td><label>Employee Project Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="tsdto.eprojectId"/>
</td>
</tr>
<tr>
<td><label>Employee Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="tsdto.employeeId"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" name="submit" value="Confirm" ng-click="save();"/>
<input type="submit" name="clear" value="Clear" ng-click="tsdto = null"/>
</td>
</tr>
</table>
</div>
<br><br>
<div id="updateDivTS" style="display: none">
<!-- <legend>Time Sheet</legend>-->
<table>
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="tsdto.title"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.content"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.note"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" name="submit" value="Confirm" ng-click="update();"/>
<input type="submit" name="clear" value="Clear" ng-click="tsdto = null"/>
<input type="submit" name="close" value="Close" onclick="document.getElementById('updateDivTS').style.display = 'none'"/>
</td>
</tr>
</table>
</div>
<br><br>
<div>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Content</th>
<th>Note</th>
<th>Employee</th>
<th>Create at</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<tr class="tss" ng-repeat="ts in myTimeSheets | limitTo:numLimit:start">
<td>{{$index + 1}}</td>
<td>{{ts.title}}</td>
<td>{{ts.content}}</td>
<td>{{ts.note}}</td>
<td>{{ts.eproject.project.name}}</td>
<td>{{ts.createdAt}}</td>
<td><a ui-sref="timeSheetDetail({id: ts.id})">Xem</a></td>
<td><a href="#timesheet" ng-click="getTs(ts);" onclick="document.getElementById('updateDivTS').style.display = 'block'">Sửa</a></td>
<td><a href="#timesheet" ng-click="delete(ts);">Xoá</a></td>
</tr>
<tr>
<td colspan="9" style='text-align: center'><span>Page# {{currentPage}} of {{pages}}</span>
<span style="float:left;padding:5px"><a ng-hide="hidePrev()" href="" ng-click="PrevPage()">Prev</a></span>
<span style="float:right;padding:5px"><a ng-hide="hideNext()" href="" ng-click="nextPage()">Next</a></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp").controller("timeSheetController", function($scope, $http) {
console.log("Time Sheet controller");
$scope.ts = {
"id": "",
"title": "",
"content": "",
"note": "",
"eproject": "",
"createdAt": ""
};
$scope.tsdto = {
"id": "",
"title": "",
"content": "",
"note": "",
"eprojectId": "",
"employeeId": ""
};
//get all time sheet
$http({
method : 'GET',
url : "http://localhost:8080/eproject/timesheet/show"
}).then(function successCallback(response) {
console.log(response);
$scope.myTimeSheets=response.data;
}, function errorCallback(response) {
console.log(response)
});
//delete time sheet
$scope.delete = function (ts) {
$http({
method : 'DELETE',
url : "http://localhost:8080/eproject/timesheet/delete/" + ts.id
}).then(function successCallback(response) {
console.log(response);
$scope.config.timeSheets=response.data;
}, function errorCallback(response) {
console.log(response)
});
};
$scope.save = save;
function save(){
console.log($scope.tsdto);
$http({
method : 'POST',
url : "http://localhost:8080/eproject/timesheet/add",
data: $scope.tsdto
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response)
});
}
$scope.getTs = getTs;
function getTs(ts) {
$scope.tsdto.id = ts.id;
$scope.tsdto.title = ts.title;
$scope.tsdto.content = ts.content;
$scope.tsdto.note = ts.note;
$scope.tsdto.employeeId = ts.eproject.employee.id;
}
$scope.update = update;
function update(){
$http({
headers: "content-type: application/json",
method : 'POST',
url : "http://localhost:8080/eproject/timesheet/update",
data: $scope.tsdto
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response)
});
}
}).directive('pgnTable', ['$compile', function ($compile) {
return {
restrict: 'EA',
templateUrl: 'pages/timesheet/timeSheet.html',
replace: true,
scope: {
pages: "=pgnTable"
},
controller: function ($scope) {
$scope.currentPage=1;
$scope.numLimit=5;
$scope.start = 0;
$scope.$watch("pages",function(newVal){
if(newVal){
$scope.pages=Math.ceil($scope.pages.length/$scope.numLimit);
}
});
$scope.hideNext=function(){
if(($scope.start + $scope.numLimit) < $scope.pages.length){
return false;
}
else
return true;
};
$scope.hidePrev=function(){
if($scope.start===0){
return true;
}
else
return false;
};
$scope.nextPage=function(){
console.log("next pages");
$scope.currentPage++;
$scope.start=$scope.start+ $scope.numLimit;
console.log( $scope.start)
};
$scope.PrevPage=function(){
if($scope.currentPage>1){
$scope.currentPage--;
}
console.log("next pages");
$scope.start=$scope.start - $scope.numLimit;
console.log( $scope.start)
};
},
compile: function(elem) {
return function(ielem, $scope) {
$compile(ielem)($scope);
};
}
};
}]);
\ No newline at end of file
<div class="container">
<div class="row">
<div class="col-sm-12">
<div>
<br><br>
<div>
<tr>
<legend><p>Tiêu đề</p>{{timeSheetDetail.title}}</legend>
<h3>Nội dung</h3>
<td>{{timeSheetDetail.content}}</td>
</tr>
</div>
<br><br>
<div>
<tr>
<h3>Ghi chú</h3>
<td>{{timeSheetDetail.note}}</td>
</tr>
</div>
<br><br>
<div>
<tr>
<h3>Nhận xét</h3>
<td>{{timeSheetDetail.checked}}</td>
</tr>
</div>
<br><br>
<div>
<tr>
<input type="text" name="check" placeholder="Nhận xét" ng-model="check"/>
<input type="submit" name="submit" value="Xác nhận" ng-click="updateCheck(timeSheetDetail.id, check);" ui-sref="leaveFormDetail"/>
<input type="submit" name="submit" value="Quay lại" ui-sref="timeSheet"/>
</tr>
</div>
<br><br>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp").controller("timeSheetDetailController", function($scope, $http, $stateParams) {
console.log("Time Sheet Detail Controller");
$scope.tsd = {
"id": "",
"checked": ""
};
$http({
method : 'GET',
url : "http://localhost:8080/eproject/timesheet/" + $stateParams.id
}).then(function successCallback(response) {
console.log(response);
$scope.timeSheetDetail=response.data;
}, function errorCallback(response) {
console.log(response)
});
$scope.updateCheck = function updateCheck(id, check){
$scope.tsd.id = id;
$scope.tsd.checked = check;
$http({
headers: {"Content-Type": "application/json"},
method : 'POST',
url : "http://localhost:8080/eproject/timesheet/update/check",
data: $scope.tsd
}).then(function successCallback(response) {
console.log(response);
}, function errorCallback(response) {
console.log(response)
});
}
});
\ No newline at end of file
<!DOCTYPE html> <!--<!DOCTYPE html>-->
<html lang="en"> <!--<html lang="en" ng-app="myApp" ng-controller="timesheetController">-->
<head> <!--<head>-->
<meta charset="UTF-8"> <!-- <meta charset="UTF-8">-->
<title>Time Sheet</title> <!-- <title>Time Sheet</title>-->
<meta name="viewport" content="width=device-width, initial-scale=1"> <!-- <meta name="viewport" content="width=device-width, initial-scale=1">-->
<script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script> <!-- <script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>-->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> <!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <!-- integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"-->
<!-- <script src="../../js/angular.js"></script>--> <!-- crossorigin="anonymous"></script>-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"-->
<script src="timesheetController.js"></script> <!-- integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">-->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>-->
<!-- <script src="timeSheetController.js"></script>-->
<!-- <script>--> <!--</head>-->
<!-- function myFunction() {--> <!--<body>-->
<!-- const x = document.getElementById("mydiv");-->
<!-- if (x.style.display === "none") {-->
<!-- x.style.display = "block";-->
<!-- } else {-->
<!-- x.style.display = "none";-->
<!-- }-->
<!-- }-->
<!-- </script>-->
</head> <!--</body>-->
<body ng-controller="showTimeSheetController"> <!--</html>-->
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-12">
<!-- <div>--> <br><br>
<!-- <legend>Create Time Sheet</legend>--> <input id="addTimeSheet" type="submit" name="addTS" value="Add" onclick="showAddTimeSheetFunction()"/>
<!-- <table>--> <div id="addDivTS" style="display: none">
<!-- <tr>--> <legend>Time Sheet</legend>
<!-- <td><label>Title</label></td>--> <table>
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdto.title"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Content</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdto.content"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Note</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdto.note"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Employee Id</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdto.employeeId"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Employee Project Id</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdto.eprojectId"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td></td>-->
<!-- <td>-->
<!-- <input type="submit" name="submit" value="Submit" ng-click="save();"/>-->
<!-- <input type="submit" name="clear" value="Clear" ng-click="tsdto = null"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<!-- </div>-->
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="tsdto.title"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.content"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.note"/>
</td>
</tr>
<tr>
<td><label>Employee Project Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="tsdto.eprojectId"/>
</td>
</tr>
<tr>
<td><label>Employee Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="tsdto.employeeId"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" name="submit" value="Confirm" ng-click="save();"/>
<input type="submit" name="clear" value="Clear" ng-click="tsdto = null"/>
</td>
</tr>
</table>
</div>
<br><br>
<div id="updateDivTS" style="display: none">
<!-- <legend>Time Sheet</legend>-->
<table>
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="tsdto.title"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.content"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.note"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" name="submit" value="Confirm" ng-click="update();"/>
<input type="submit" name="clear" value="Clear" ng-click="tsdto = null"/>
<input type="submit" name="close" value="Close" onclick="document.getElementById('updateDivTS').style.display = 'none'"/>
</td>
</tr>
</table>
</div>
<br><br>
<div> <div>
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>ID</th> <th>ID</th>
<th>Title</th> <th>Title</th>
<th>Content</th> <th>Content</th>
<th>Note</th> <th>Note</th>
<th>Employee Project Id</th> <th>Employee</th>
<th>Created at</th> <th>Create at</th>
</tr> <th colspan="3"></th>
</tr>
</thead> </thead>
<tbody> <tbody>
<tr class="showTimeSheet" ng-repeat="timesheet in timesheets"> <tr class="tss" ng-repeat="ts in myTimeSheets | limitTo:numLimit:start">
<td>{{$index + 1}}</td> <td>{{$index + 1}}</td>
<td>{{timesheet.title}}</td> <td>{{ts.title}}</td>
<td>{{timesheet.content}}</td> <td>{{ts.content}}</td>
<td>{{timesheet.note}}</td> <td>{{ts.note}}</td>
<td>{{timesheet.eproject.project.name}}</td> <td>{{ts.eproject.project.name}}</td>
<td>{{timesheet.createdAt}}</td> <td>{{ts.createdAt}}</td>
<td><a href="#" onclick="myFunction()" ng-click="update(timesheet);">Update</a> <td><a ui-sref="timeSheetDetail({id: ts.id})">Xem</a></td>
<td><a href="http://localhost:8080/pages/timesheet/timesheet.html" ng-click="delete(timesheet);">Delete</a></td> <td><a href="#timesheet" ng-click="getTs(ts);" onclick="document.getElementById('updateDivTS').style.display = 'block'">Sửa</a></td>
<td><a href="#timesheet" ng-click="delete(ts);">Xoá</a></td>
</tr>
<tr>
<td colspan="9" style='text-align: center'><span>Page# {{currentPage}} of {{pages}}</span>
<span style="float:left;padding:5px"><a ng-hide="hidePrev()" href="" ng-click="PrevPage()">Prev</a></span>
<span style="float:right;padding:5px"><a ng-hide="hideNext()" href="" ng-click="nextPage()">Next</a></span></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<!-- <div id="mydiv" style="display: none">-->
<!-- <legend>Update Time Sheet</legend>-->
<!-- <table>-->
<!-- <tr>-->
<!-- <td><label>Employee Id</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdtou.employeeId"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Title</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdtou.title"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Content</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdtou.content"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Note</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdtou.note"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>-->
<!-- <input type="submit" name="update" value="Update" ng-click="updatedto();"/>-->
<!-- <input type="submit" name="clear" value="Clear" ng-click="tsdtou = null"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<!-- </div>-->
</div> </div>
</div> </div>
</div> </div>
</body> \ No newline at end of file
</html>
\ No newline at end of file
// /*
//
// */
// angular.module("MyTimeSheet",[]).controller("timesheetController", function($scope, $http, $window) { angular.module("myApp").controller("timeSheetController", function($scope, $http) {
// console.log("Time Sheet controller"); console.log("Time Sheet controller");
//
// $scope.ts = { $scope.ts = {
// "id": "", "id": "",
// "title": "", "title": "",
// "content": "", "content": "",
// "note": "", "note": "",
// "eproject": "", "eproject": "",
// "createdAt": "" "createdAt": ""
// }; };
//
// $scope.tsdto = { $scope.tsdto = {
// "title": "", "id": "",
// "content": "", "title": "",
// "note": "", "content": "",
// "employeeId": "", "note": "",
// "eprojectId": "" "eprojectId": "",
// }; "employeeId": ""
// };
// $scope.tsdtou = {
// "id": "", //get all time sheet
// "title": "", $http({
// "content": "", method : 'GET',
// "note": "", url : "http://localhost:8080/eproject/timesheet/show"
// "employeeId": "" }).then(function successCallback(response) {
// }; console.log(response);
// $scope.myTimeSheets=response.data;
// $http({ }, function errorCallback(response) {
// method : 'GET', console.log(response)
// url : "http://localhost:8080/eproject/timesheet/show", });
// }).then(function successCallback(response) {
// console.log(response); //delete time sheet
// $scope.timesheet = response.data; $scope.delete = function (ts) {
// }, function errorCallback(response) { $http({
// console.log(response) method : 'DELETE',
// }); url : "http://localhost:8080/eproject/timesheet/delete/" + ts.id
// }).then(function successCallback(response) {
// console.log(response);
// $scope.save = save; $scope.config.timeSheets=response.data;
// function save(){ }, function errorCallback(response) {
// console.log($scope.tsdto); console.log(response)
// $http({ });
// method : 'POST', };
// url : "http://localhost:8080/eproject/timesheet",
// data: $scope.tsdto
// }).then(function successCallback(response) { $scope.save = save;
// console.log(response); function save(){
// $window.location.href ='http://localhost:8080/#/eproject/timesheet'; console.log($scope.tsdto);
// }, function errorCallback(response) { $http({
// console.log(response) method : 'POST',
// }); url : "http://localhost:8080/eproject/timesheet/add",
// } data: $scope.tsdto
// }).then(function successCallback(response) {
// console.log(response);
// $scope.update = function (ts) { }, function errorCallback(response) {
// $scope.tsdtou.id = ts.id; console.log(response)
// $scope.tsdtou.title = ts.title; });
// $scope.tsdtou.content = ts.content; }
// $scope.tsdtou.note = ts.note;
// }; $scope.getTs = getTs;
// function getTs(ts) {
// $scope.updatedto = function () { $scope.tsdto.id = ts.id;
// console.log($scope.tsdtou); $scope.tsdto.title = ts.title;
// $http({ $scope.tsdto.content = ts.content;
// method : 'POST', $scope.tsdto.note = ts.note;
// url : 'http://localhost:8080/eproject/timesheet/update', $scope.tsdto.employeeId = ts.eproject.employee.id;
// data: $scope.tsdtou }
// }).then(function successCallback(response) {
// console.log(response); $scope.update = update;
// $window.location.href ='http://localhost:8080/eproject/timesheet#!'; function update(){
// }, function errorCallback(response) { $http({
// console.log(response) headers: "content-type: application/json",
// }); method : 'POST',
// }; url : "http://localhost:8080/eproject/timesheet/update",
// data: $scope.tsdto
// }).then(function successCallback(response) {
// $scope.delete = function (ts) { console.log(response);
// $http({ }, function errorCallback(response) {
// method : 'DELETE', console.log(response)
// url : 'http://localhost:8080/eproject/timesheet/delete/'+ts.id, });
// }).then(function successCallback(response) { }
// console.log(response); }).directive('pgnTable', ['$compile', function ($compile) {
// $window.location.href ='http://localhost:8080/#/eproject/timesheet#!'; return {
// }, function errorCallback(response) { restrict: 'EA',
// console.log(response) templateUrl: 'pages/timesheet/timeSheet.html',
// }); replace: true,
// } scope: {
// }); pages: "=pgnTable"
\ No newline at end of file },
controller: function ($scope) {
$scope.currentPage=1;
$scope.numLimit=5;
$scope.start = 0;
$scope.$watch("pages",function(newVal){
if(newVal){
$scope.pages=Math.ceil($scope.pages.length/$scope.numLimit);
}
});
$scope.hideNext=function(){
if(($scope.start + $scope.numLimit) < $scope.pages.length){
return false;
}
else
return true;
};
$scope.hidePrev=function(){
if($scope.start===0){
return true;
}
else
return false;
};
$scope.nextPage=function(){
console.log("next pages");
$scope.currentPage++;
$scope.start=$scope.start+ $scope.numLimit;
console.log( $scope.start)
};
$scope.PrevPage=function(){
if($scope.currentPage>1){
$scope.currentPage--;
}
console.log("next pages");
$scope.start=$scope.start - $scope.numLimit;
console.log( $scope.start)
};
},
compile: function(elem) {
return function(ielem, $scope) {
$compile(ielem)($scope);
};
}
};
}]);
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Nhóm Dự Án</title>
</head>
<body>
</body>
</html>
\ 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="insertProjectModule">
<form ng-controller="insertProject">
<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"
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"
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="text" ng-model="lstProject.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="text" ng-model="lstProject.endDate" id="endDate" class="form-control"
placeholder="nick skype" required="required">
<label for="endDate">Ngày Kết Thuc</label>
</div>
</div>
</div>
</div>
<div>
<input ng-click="insert_project()" type="submit" value="Lưu">
<input type="reset" value="Reset">
</div>
</form>
</div>
<script src="components/project/projectAddController.js"></script>
\ 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" ng-app="GetAPI">
<div class="table-responsive" ng-controller="showProject">
<a href="#" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Mô tả ngắn</th>
<th>Ngày bắt đầu</th>
<th>Hạn giao</th>
<th>Trạng Thái</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="project in listProject">
<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.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">
Sửa </a> <a data-ng-href="#" class="btn btn-danger btn-circle btn-sm">Xóa</a>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!--angular js-->
<script src="components/project/projectController.js"></script>
\ 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