Commit 8aee3779 authored by Phạm Duy Phi's avatar Phạm Duy Phi

no message

parent ed09ed47
......@@ -137,4 +137,8 @@ public class TimeSheetBusiness {
public TimeSheet findTimeSheetById(int id) {
return timeSheetRepository.findTimeSheetById(id);
}
public List<Eproject> getEprojectList() {
return eProjectRepository.findAll();
}
}
package com.itsol.quantrivanphong.report.timesheet.controller;
import com.itsol.quantrivanphong.exception.InputException;
import com.itsol.quantrivanphong.model.Eproject;
import com.itsol.quantrivanphong.model.TimeSheet;
import com.itsol.quantrivanphong.report.leaveform.controller.Notification;
import com.itsol.quantrivanphong.report.timesheet.business.TimeSheetBusiness;
......@@ -90,4 +91,10 @@ public class TimeSheetController {
public ResponseEntity<String> updateCheck(@RequestBody TimeSheetDTO timeSheetDTO) {
return ResponseEntity.ok(timeSheetBusiness.updateCheck(timeSheetDTO));
}
@GetMapping(path = "/getAll")
public List<Eproject> getAllEproject() {
return timeSheetBusiness.getEprojectList();
}
}
\ No newline at end of file
......@@ -15,9 +15,6 @@ public interface EProjectRepository extends JpaRepository<Eproject, Integer> {
//======================================================================================================
// Hieunv
......
......@@ -15,103 +15,54 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Custom Theme files -->
<!-- <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700" rel='stylesheet' type='text/css'>-->
<!-- <link href="https://fonts.googleapis.com/css?family=Open+Sans" type='text/css'>-->
<link href="css/style.css" rel='stylesheet' type='text/css'/>
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">-->
<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>
<!-- Custom fonts for this template-->
<link href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
rel="stylesheet" type="text/css">
<link href="common/css/all.min.css" rel="stylesheet"
type="text/css">
<!-- Page level plugin CSS-->
<link href="common/css/dataTables.bootstrap4.css"
rel="stylesheet">
<!-- Custom styles for this template-->
<link href="common/css/sb-admin.css" rel="stylesheet">
<!-- angular -->
<script src="js/angular.js"></script>
<script src="js/angular-route.js"></script>
<script src="js/angular-ui-router.min.js"></script>
<script src="js/app.js"></script>
<script src="pages/project/groupproject/groupProjectController.js"></script>
<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 Leave Form";
}
}
</script>
<script>
if (document.getElementById("checkStatus") === true) {
document.getElementById("approved").style.display = "none";
}
</script>
<!-- Js -->
<!-- Bootstrap core JavaScript-->
<script src="pages/employee/employeeController.js"></script>
<script src="pages/project/project/projectController.js"></script>
<script src="pages/login/loginsController.js"></script>
<script src="pages/adminhome/admin.js"></script>
<script src="common/js/jquery.min.js"></script>
<script src="common/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="common/js/jquery.easing.min.js"></script>
<!-- Page level plugin JavaScript-->
<script src="common/js/Chart.min.js"></script>
<script src="common/js/jquery.dataTables.js"></script>
<script src="common/js/dataTables.bootstrap4.js"></script>
<!-- Custom scripts for all pages-->
<script src="common/js/sb-admin.min.js"></script>
<script src="common/js/sb-admin.min.js"></script>\
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-animate.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular-sanitize.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.3.3.js"></script>
</head>
<body ng-app="myApp">
<div ui-view="layout">
<!-- <div style="margin-left:5px;margin-top:10px" ng-controller="timeSheetController">-->
<!-- <span pgn-table="myTimeSheets"></span>-->
<!-- </div>-->
</div>
<div ui-view="layout"></div>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
/**
*
*/
angular.module("myApp", ["ui.router", 'ngRoute']).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
angular.module("myApp", ["ui.router", "ui.bootstrap"]).config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix('');
//trở về trang mặc định
......@@ -16,14 +16,6 @@ angular.module("myApp", ["ui.router", 'ngRoute']).config(function ($stateProvide
}
}
})
// .state("layout4", {
// abstract: true,
// views: {
// "layout": {
// templateUrl: "layout/layout4.html"
// }
// }
// })
.state("admin", {
parent: 'layout3',
url: "/admin",
......@@ -64,16 +56,6 @@ angular.module("myApp", ["ui.router", 'ngRoute']).config(function ($stateProvide
}
}
})
// .state('app', {
// abstract: true,
// views: {
// 'main_layout': {
// templateUrl: 'main_layout.html',
// }
// }
// })
.state("employees", {
parent: 'layout3',
url: "/employees",
......@@ -145,17 +127,6 @@ angular.module("myApp", ["ui.router", 'ngRoute']).config(function ($stateProvide
}
}
})
// .state("testlayout2", {
// parent: 'layout2',
// url: "/testttt",
// views: {
// "content": {
// templateUrl: "/pages/testlayout/testlayout.html",
// controller: "testlayoutController"
// }
// }
// })
.state("gioithieu", {
parent: 'app',
url: "/gioithieu",
......@@ -198,29 +169,3 @@ angular.module("myApp", ["ui.router", 'ngRoute']).config(function ($stateProvide
}
})
});
// .state("lienhe", {
// parent: 'app',
// url: "/lienhe",
// views:{
// "content":{
// templateUrl: "pages/lienhe/lienhe.htm",
// controller: "lienheController"
// }
// }
// })
// 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)
// }
// });
// }
// };
// } ])
<!--<!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>-->
<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 Leave Form";
}
}
</script>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><b>Leave Form</b></h2>
<label>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label>
</div>
<div class="col-sm-6">
<input id="addLeaveForm" class="btn btn-success" type="submit" name="addTS" value="Add Leave Form" data-toggle="modal" onclick="showAddLeaveFormFunction()"/>
......@@ -109,7 +105,7 @@
</tr>
</thead>
<tbody>
<tr class="lff" ng-repeat="lf in leaveForms">
<tr class="lff" ng-repeat="lf in leaveForms | filter: search">
<td>{{$index + 1}}</td>
<td>{{lf.title}}</td>
<td>{{lf.content}}</td>
......@@ -121,7 +117,7 @@
<td><a ui-sref="leaveFormDetail({id: lf.id})" data-toggle="modal"><i class="fa fa-eye" data-toggle="tooltip" title="View"></i></a></td>
<td><a ui-sref="leaveForm" ng-click="getLf(lf);" onclick="document.getElementById('updateDivLF').style.display = 'block'" class="edit" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Edit">&#xE254;</i></a></td>
<td><a ui-sref="leaveForm" ng-click="delete(lf);" class="delete" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Delete">&#xE872;</i></a></td>
<td><a id="approved" ui-sref="leaveForm" ng-click="updateStatus(lf)" data-toggle="modal"><i class="fa fa-check" data-toggle="tooltip" title="Approved"></i></a></td>
<!-- <td><a ui-sref="leaveForm" ng-click="updateStatus(lf)" data-toggle="modal"><i id="approved" class="fa fa-check" data-toggle="tooltip" title="Approved"></i></a></td>-->
</tr>
</tbody>
</table>
......
/*
*/
angular.module("myApp").controller("leaveFormController", function($scope, $http, $route, $state) {
angular.module("myApp").controller("leaveFormController", function($scope, $http, $state) {
console.log("Leave Form controller");
$scope.lf = {
......
......@@ -13,7 +13,7 @@
<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="Duyệt" ui-sref="leaveForm" ng-click="updateStatus(leaveFormDetail.id)"/>-->
<input type="submit" name="submit" value="Quay lại" ui-sref="leaveForm"/>
</tr>
</div>
......
......@@ -23,21 +23,33 @@ angular.module("myApp").controller("timeSheetController", function($scope, $http
};
//get all time sheet
//function getAllTimesheet(){
$http({
method : 'GET',
url : "http://localhost:8080/eproject/timesheet/show"
method: 'GET',
url: "http://localhost:8080/eproject/timesheet/show"
}).then(function successCallback(response) {
console.log(response);
$scope.myTimeSheets=response.data;
$scope.myTimeSheets = response.data;
}, function errorCallback(response) {
console.log(response)
});
//}
//get all eproject
$http({
method: 'GET',
url: "http://localhost:8080/eproject/getAll"
}).then(function successCallback(response) {
console.log(response);
$scope.eProjectList = 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
method: 'DELETE',
url: "http://localhost:8080/eproject/timesheet/delete/" + ts.id
}).then(function successCallback(response) {
console.log(response);
$state.reload();
......@@ -49,11 +61,12 @@ angular.module("myApp").controller("timeSheetController", function($scope, $http
$scope.save = save;
function save(){
function save() {
console.log($scope.tsdto);
$http({
method : 'POST',
url : "http://localhost:8080/eproject/timesheet/add",
method: 'POST',
url: "http://localhost:8080/eproject/timesheet/add",
data: $scope.tsdto
}).then(function successCallback(response) {
console.log(response);
......@@ -65,6 +78,7 @@ angular.module("myApp").controller("timeSheetController", function($scope, $http
}
$scope.getTs = getTs;
function getTs(ts) {
$scope.tsdto.id = ts.id;
$scope.tsdto.title = ts.title;
......@@ -74,11 +88,12 @@ angular.module("myApp").controller("timeSheetController", function($scope, $http
}
$scope.update = update;
function update(){
function update() {
$http({
headers: "content-type: application/json",
method : 'POST',
url : "http://localhost:8080/eproject/timesheet/update",
method: 'POST',
url: "http://localhost:8080/eproject/timesheet/update",
data: $scope.tsdto
}).then(function successCallback(response) {
console.log(response);
......@@ -88,56 +103,84 @@ angular.module("myApp").controller("timeSheetController", function($scope, $http
$state.reload();
});
}
}).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
// $scope.myTimeSheets = [];
// $scope.save = save;
// $scope.currentPage = 1;
// $scope.timesheetPerPage = 3;
// $scope.maxSize = 5;
// this.myTimeSheets = $scope.myTimeSheets;
// $scope.numOfPage = numOfPage;
// $scope.dataHasLoaded = false;
// $scope.makeTimesheet = function () {
// $scope.myTimeSheets = [];
// for (let i = 1; i <=50 ; i++) {
// $scope.myTimeSheets.push( {text : 'ts'+ i , done:false});
// }
//
// };
// $scope.makeTimesheet();
// $scope.getAllTimesheet = getAllTimesheet;
// //$scope.getTotalTimesheet = getTotalTimesheet;
// getAllTimesheet();
// $scope.pageChangedIndex = pageChangedIndex;
// function pageChangedIndex() {
// console.log($scope.currentPage);
// }
// function numOfPage() {
// return Math.ceil($scope.myTimeSheets.length/ $scope.timesheetPerPage);
//
// }
});
// }).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);
// };
// }
// };
<!--<!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>-->
<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 TimeSheet";
}
}
</script>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
......@@ -25,11 +18,11 @@
<div class="col-sm-6">
<h2><b>TimeSheet</b></h2>
<label>
<input type="text" ng-model="search" placeholder="Search" style="color: black"/>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label>
</div>
<div class="col-sm-6">
<input id="addTimeSheet" class="btn btn-success" data-toggle="modal" type="submit" name="addTS" value="Add" onclick="showAddTimeSheetFunction()"/>
<input id="addTimeSheet" class="btn btn-success" data-toggle="modal" type="submit" name="addTS" value="Add TimeSheet" onclick="showAddTimeSheetFunction()"/>
</div>
</div>
</div>
......@@ -59,8 +52,13 @@
</tr>
<tr>
<td><label>Employee Project Id</label></td>
<!-- <td>-->
<!-- <input type="text" maxlength="10" value="" ng-model="tsdto.eprojectId" style="width: 100%;"/>-->
<!-- </td>-->
<td>
<input type="text" maxlength="10" value="" ng-model="tsdto.eprojectId" style="width: 100%;"/>
<select ng-repeat="ep in eProjectList">
<option value="ahihi">{{ep.project.name}}</option>
</select>
</td>
</tr>
......@@ -126,7 +124,7 @@
</tr>
</thead>
<tbody>
<tr class="tss" ng-repeat="ts in myTimeSheets | limitTo:numLimit:start">
<tr class="tss" ng-repeat="ts in myTimeSheets | limitTo:numLimit:start | filter: search">
<td>{{$index + 1}}</td>
<td>{{ts.title}}</td>
<td>{{ts.content}}</td>
......@@ -138,11 +136,10 @@
<td><a ui-sref="timeSheet" ng-click="getTs(ts);" onclick="document.getElementById('updateDivTS').style.display = 'block'"class="edit" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Edit">&#xE254;</i></a></td>
<td><a ui-sref="timeSheet" ng-click="delete(ts);"class="delete" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Delete">&#xE872;</i></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>-->
<!-- <h6><code>rotate</code> defaulted to <code>true</code> and <code>force-ellipses</code> set to <code>true</code>:</h6>-->
<!-- <ul uib-pagination total-items="getAllTimesheet()" ng-model="currentPage" max-size="maxSize" class="pagination-sm" boundary-link-number="true" ng-change ="pageChangedIndex()" items-per-page = "timesheetPerPage" ></ul>-->
<!-- </tr>-->
</tbody>
</table>
</div>
......
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