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

Merge branch 'master' of https://git.myitsol.com/hieunv/qlns_n01

# Conflicts:
#	src/main/java/com/itsol/quantrivanphong/manager/reportdetail/bussiness/ReportProjectBussiness.java
#	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/dto/TimeSheetDTO.java
#	src/main/resources/application.properties
parents 66f63c38 d87c8887
...@@ -2,10 +2,10 @@ package com.itsol.quantrivanphong.manager.reportdetail.bussiness; ...@@ -2,10 +2,10 @@ package com.itsol.quantrivanphong.manager.reportdetail.bussiness;
import com.itsol.quantrivanphong.manager.employee.repository.EmployeeRepository; 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.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;
...@@ -32,6 +32,7 @@ public class ReportProjectBussiness { ...@@ -32,6 +32,7 @@ public class ReportProjectBussiness {
@Autowired @Autowired
private TimeSheetRepository timeSheetRepository; private TimeSheetRepository timeSheetRepository;
//====================================================================================================================== //======================================================================================================================
public List<Project> listProjectWorking(){ public List<Project> listProjectWorking(){
...@@ -103,6 +104,14 @@ public class ReportProjectBussiness { ...@@ -103,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);
} }
...@@ -102,12 +102,16 @@ public class LeaveFormBusiness { ...@@ -102,12 +102,16 @@ public class LeaveFormBusiness {
String message; String message;
LeaveForm leaveForm = leaveFormRepository.findLeaveFormById(leaveformId); LeaveForm leaveForm = leaveFormRepository.findLeaveFormById(leaveformId);
if (leaveForm != null) { if (leaveForm != null) {
if (leaveForm.isStatus()) {
message = "Status can not change";
} else {
int i = leaveFormRepository.updateLeaveFormStatus(leaveformId); int i = leaveFormRepository.updateLeaveFormStatus(leaveformId);
if (i == 1) { if (i == 1) {
message = "Update status success"; message = "Update status success";
} else { } else {
message = "Update status failed"; message = "Update status failed";
} }
}
} else { } else {
message = "Leave Form does not exist"; message = "Leave Form does not exist";
} }
...@@ -127,4 +131,8 @@ public class LeaveFormBusiness { ...@@ -127,4 +131,8 @@ public class LeaveFormBusiness {
return null; return null;
} }
} }
public LeaveForm showLeaveFormById(int id) {
return leaveFormRepository.findLeaveFormById(id);
}
} }
...@@ -56,7 +56,7 @@ public class LeaveFormController { ...@@ -56,7 +56,7 @@ public class LeaveFormController {
return ResponseEntity.ok(message); return ResponseEntity.ok(message);
} }
@PostMapping(path = "/leaveform/{leaveformId}/status", consumes = "application/json", produces = "application/json") @PostMapping(path = "/leaveform/{leaveformId}/status")
public ResponseEntity<String> updateLeaveFormStatus(@PathVariable int leaveformId) { public ResponseEntity<String> updateLeaveFormStatus(@PathVariable int leaveformId) {
String message; String message;
message = leaveFormBusiness.updateLeaveFormStatus(leaveformId); message = leaveFormBusiness.updateLeaveFormStatus(leaveformId);
...@@ -64,11 +64,16 @@ public class LeaveFormController { ...@@ -64,11 +64,16 @@ public class LeaveFormController {
} }
@GetMapping("/leaveform/show/{employeeId}") @GetMapping("/leaveform/show/{employeeId}")
public ResponseEntity<List<LeaveForm>> showLeaveFormById(@PathVariable int employeeId) { public ResponseEntity<List<LeaveForm>> showLeaveFormByEmployeeId(@PathVariable int employeeId) {
if (leaveFormBusiness.showLeaveFormByEmployeeId(employeeId) != null) { if (leaveFormBusiness.showLeaveFormByEmployeeId(employeeId) != null) {
return ResponseEntity.ok(leaveFormBusiness.showLeaveFormByEmployeeId(employeeId)); 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));
}
} }
...@@ -95,6 +95,18 @@ public class TimeSheetBusiness { ...@@ -95,6 +95,18 @@ 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;
...@@ -122,4 +134,7 @@ public class TimeSheetBusiness { ...@@ -122,4 +134,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.*;
...@@ -28,6 +28,19 @@ public class TimeSheetController { ...@@ -28,6 +28,19 @@ public class TimeSheetController {
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,7 +75,18 @@ public class TimeSheetController { ...@@ -62,7 +75,18 @@ public class TimeSheetController {
// } // }
@GetMapping("/timesheet/show/{employeeId}") @GetMapping("/timesheet/show/{employeeId}")
public ResponseEntity<List<TimeSheet>> showTimeSheetById(@PathVariable int employeeId) { public ResponseEntity<List<TimeSheet>> showTimeSheetByEmployeeId(@PathVariable int employeeId) {
return ResponseEntity.ok(timeSheetBusiness.findTimeSheetByEmployeeId(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));
}
} }
\ No newline at end of file
...@@ -18,7 +18,11 @@ public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> { ...@@ -18,7 +18,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")
...@@ -27,7 +31,7 @@ public interface TimeSheetRepository extends JpaRepository<TimeSheet, Integer> { ...@@ -27,7 +31,7 @@ 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);
TimeSheet findTimeSheetByEprojectAndId(Eproject eproject, int timeSheet_Id); TimeSheet findTimeSheetByEprojectAndId(Eproject eproject, int timeSheetId);
//================================================================================================================== //==================================================================================================================
......
...@@ -7,8 +7,6 @@ spring.datasource.url=jdbc:mysql://localhost:3306/quantrivanphong ...@@ -7,8 +7,6 @@ spring.datasource.url=jdbc:mysql://localhost:3306/quantrivanphong
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password= ahihi123 spring.datasource.password= ahihi123
# =============================== # ===============================
# JPA / HIBERNATE # JPA / HIBERNATE
# =============================== # ===============================
...@@ -35,6 +33,4 @@ spring.mail.properties.mail.smtp.connectiontimeout=5000 ...@@ -35,6 +33,4 @@ spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=5000 spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.writetimeout=5000 spring.mail.properties.mail.smtp.writetimeout=5000
## App Properties
app.jwtSecret= JWTSuperSecretKey
app.jwtExpirationInMs = 604800000
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
<!-- <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"> <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">-->
<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/jquery-3.2.1.min.js"></script>
<script src="js/bootstrap.min.js"></script> <script src="js/bootstrap.min.js"></script>
...@@ -25,12 +25,47 @@ ...@@ -25,12 +25,47 @@
<script src="pages/project/projectController.js"></script> <script src="pages/project/projectController.js"></script>
<script src="pages/testlayout/testlayoutController.js"></script> <script src="pages/testlayout/testlayoutController.js"></script>
<script src="pages/timesheet/timeSheetController.js"></script>
<script src="pages/leaveform/leaveFormController.js"></script>
<script src="pages/leaveform/leaveFormDetailController.js"></script>
<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">
<div ui-view="layout"> <div ui-view="layout">
<div style="margin-left:5px;margin-top:10px" ng-controller="timeSheetController">
<span pgn-table="myTimeSheets"></span>
</div>
</div> </div>
......
This diff is collapsed.
/* /*
<<<<<<< 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
...@@ -7,7 +7,6 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout ...@@ -7,7 +7,6 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
$urlRouterProvider.otherwise("/employees"); $urlRouterProvider.otherwise("/employees");
$stateProvider $stateProvider
.state("layout1", { .state("layout1", {
abstract: true, abstract: true,
views: { views: {
...@@ -26,6 +25,15 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout ...@@ -26,6 +25,15 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
} }
}) })
.state("layout5", {
abstract: true,
views: {
"layout": {
templateUrl: "layout/layout5.html"
}
}
})
// .state('app', { // .state('app', {
// abstract: true, // abstract: true,
// views: { // views: {
...@@ -66,18 +74,59 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout ...@@ -66,18 +74,59 @@ angular.module("myApp", ["ui.router"]).config(function ($stateProvider, $urlRout
} }
} }
}) })
.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("testlayout2", { .state("leaveFormDetail", {
parent: 'layout2', parent: 'layout5',
url: "/testttt", url: "/leaveformdetail/:id",
views: { views: {
"content": { "content": {
templateUrl: "pages/testlayout/testlayout.html", templateUrl: "/pages/leaveform/leaveFormDetail.html",
controller: "testlayoutController" controller: "leaveFormDetailController"
} }
} }
}) })
// .state("testlayout2", {
// parent: 'layout2',
// url: "/testttt",
// views: {
// "content": {
// templateUrl: "/pages/testlayout/testlayout.html",
// controller: "testlayoutController"
// }
// }
// })
}); });
......
<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
<!--<!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
<!--<!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>
<html lang="en" ng-app="MyTimeSheet" 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>
<div class="container">
<div class="row">
<div class="col-md-12">
<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>
</tr>
</thead>
<tbody>
<tr class="vide" ng-repeat="timesheet in timesheets">
<td>{{$index + 1}}</td>
<td>{{timesheet.title}}</td>
<td>{{timesheet.content}}</td>
<td>{{timesheet.note}}</td>
<td>{{timesheet.eproject.project.name}}</td>
<td>{{timesheet.createdAt}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
angular.module("MyTimeSheet",['ui.bootstrap']).controller("timesheetController", function($scope, $http) {
console.log("Time Sheet controller");
$scope.timesheet = {
"title": "",
"content": "",
"note": "",
"eproject": "",
"createdAt": ""
};
$http({
method : 'GET',
url : "http://localhost:8080/eproject/timesheet/show",
}).then(function successCallback(response) {
console.log(response);
$scope.timesheets=response.data;
}, function errorCallback(response) {
console.log(response)
});
}).controller("todoController", function($scope) {
$scope.filteredTodos = [],
$scope.currentPage = 1,
$scope.numPerPage = 10,
$scope.maxSize = 5;
$scope.numPages = function () {
return Math.ceil($scope.timesheets.length / )
}
});
\ 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