Commit 9ff00192 authored by Phạm Duy Phi's avatar Phạm Duy Phi

Merge branch 'master' into phipham

# Conflicts:
#	pom.xml
#	src/main/resources/public/general.html
#	src/main/resources/public/index.html
#	src/main/resources/public/js/app.js
#	src/main/resources/public/layout/layout1.html
#	src/main/resources/public/layout/layout2.html
#	src/main/resources/public/pages/leaveform/leaveForm.html
#	src/main/resources/public/pages/timesheet/timeSheet.html
#	src/main/resources/public/pages/timesheet/timeSheetController.js
#	src/main/resources/public/pages/timesheet/timesheet.html
#	src/main/resources/public/pages/timesheet/timesheetController.js
parents 424c818d 50e259b2
...@@ -17,10 +17,6 @@ ...@@ -17,10 +17,6 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<<<<<<< HEAD
=======
<java.version>1.8</java.version>
>>>>>>> 049511c3b37f668c637022150c53bd25d9b8e61d
</properties> </properties>
<dependencies> <dependencies>
...@@ -38,45 +34,26 @@ ...@@ -38,45 +34,26 @@
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency> <dependency>
<groupId>mysql</groupId> <groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>log4j</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<version>1.2.17</version> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>log4j</groupId> <groupId>log4j</groupId>
<artifactId>log4j</artifactId> <artifactId>log4j</artifactId>
<version>1.2.12</version> <version>1.2.17</version>
</dependency> </dependency>
<<<<<<< HEAD
=======
<<<<<<< HEAD
=======
>>>>>>> ed09ed47f5d092a7753469913def1ab676073023
=======
<!-- <dependency>-->
<!-- <groupId>org.springframework.security</groupId>-->
<!-- <artifactId>spring-security-config</artifactId>-->
<!-- <version>${spring-security.version}</version>-->
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
>>>>>>> 049511c3b37f668c637022150c53bd25d9b8e61d
>>>>>>> master
</dependencies> </dependencies>
<build> <build>
......
This diff is collapsed.
This diff is collapsed.
...@@ -6333,7 +6333,7 @@ defaults._set('bar', { ...@@ -6333,7 +6333,7 @@ defaults._set('bar', {
defaults._set('horizontalBar', { defaults._set('horizontalBar', {
hover: { hover: {
mode: 'index', mode: 'public.index',
axis: 'y' axis: 'y'
}, },
...@@ -6389,7 +6389,7 @@ defaults._set('horizontalBar', { ...@@ -6389,7 +6389,7 @@ defaults._set('horizontalBar', {
return datasetLabel + ': ' + item.xLabel; return datasetLabel + ': ' + item.xLabel;
} }
}, },
mode: 'index', mode: 'public.index',
axis: 'y' axis: 'y'
} }
}); });
......
...@@ -199,4 +199,89 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct ...@@ -199,4 +199,89 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
} }
} }
}) })
// .state("timeSheet", {
// parent: 'layout1',
// url: "/timesheet",
// views: {
// "content": {
// templateUrl: "pages/timesheet/leaveFromeaveFromDetail.html",
// controller: "leaveFormController"
// }
// }
// })
// .state("timeSheetDetail", {
// parent: 'layout1',
// url: "/timesheetdetail/:id",
// views: {
// "content": {
// templateUrl: "pages/timesheet/l",
// controller: "timeSheetDetailController"
// }
// }
// })
.state("leaveform", {
parent: 'layout1',
url: "/leaveform",
views: {
"content": {
templateUrl: "pages/leaveform/leaveForm.html",
controller: "leaveFormController"
}
}
})
.state("leaveFormDetail", {
parent: 'layout1',
url: "/leaveformdetail/:id",
views: {
"content": {
templateUrl: "pages/leaveform/leaveFormDetail.html",
controller: "leaveFormDetailController"
}
}
})
.state("timesheet",{
parent:'layout1',
url:"/timesheet",
views:{
"content":{
templateUrl:"pages/timesheet/timesheet.html",
controller:"timeSheetController"
}
}
})
.state("timesheetDetail",{
parent:'layout1',
url:"/timesheetDetail/:id",
views:{
"content":{
templateUrl:"page/timesheet/timeSheetDetail.html",
controller:"timeSheetDetailController"
}
}
})
.state("project", {
parent: 'layout1',
url: "/project",
views: {
"content": {
templateUrl: "pages/project/project.html",
controller: "projectController"
}
}
})
.state("news",{
parent:'layout1',
url:"/news",
views:{
"content":{
templateUrl:"pages/homepage/catagoriManagements.html",
controller:"homeController"
}
}
})
}); });
\ No newline at end of file
<<<<<<< HEAD
<div class="main-content"> <div class="main-content">
<div class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1"> <div class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1">
<!--left-fixed -navigation--> <!--left-fixed -navigation-->
...@@ -100,6 +101,13 @@ ...@@ -100,6 +101,13 @@
<!-- /.navbar-collapse --> <!-- /.navbar-collapse -->
</nav> </nav>
</aside> </aside>
=======
<div>
<div ui-view="content">
>>>>>>> master
</div> </div>
<!--left-fixed -navigation--> <!--left-fixed -navigation-->
......
<!--<link rel="stylesheet" href="../../css/bootstrap-combined.min.css">-->
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
<td>{{$index + 1}}</td> <td>{{$index + 1}}</td>
<td>{{cata.name}}</td> <td>{{cata.name}}</td>
<td>{{cata.news.length}}</td> <td>{{cata.news.length}}</td>
<td><a href="http://localhost:8080/#/management/catagori/{{cata.id}}" ng-click="detailNews(emp);">Detail</a> </td> <td><a href="#/management/catagori/{{cata.id}}">Detail</a> </td>
<td><a href="#" ng-click="update(emp);">Edit</a> </td> <td><a href="#">Edit</a> </td>
</tr> </tr>
</tbody> </tbody>
......
angular.module("myApp").controller('homeController', function ($scope,$http, $state,News, $window,$stateParams,Catagories,LatestNews,NewsByCatagori) { angular.module("myApp").controller('homeController', function ($scope,$http, $state,News, $window,$stateParams,Catagories,LatestNews) {
$scope.catagories = Catagories.query(); $scope.catagories = Catagories.query();
...@@ -35,21 +35,44 @@ angular.module("myApp").controller('homeController', function ($scope,$http, $st ...@@ -35,21 +35,44 @@ angular.module("myApp").controller('homeController', function ($scope,$http, $st
$scope.catagoriById = Catagories.get({}, {myCatagoriesId: $stateParams.myCatagoriId}); $scope.catagoriById = Catagories.get({}, {myCatagoriesId: $stateParams.myCatagoriId});
//Delete News //Delete News
$scope.deleteNews = function(newsId,catagoriId) { $scope.deleteNews = function(newsId) {
if(confirm("Delete?")) { if (confirm("Delete?")) {
$http({ $http({
method: 'DELETE', method: 'DELETE',
url: 'http://localhost:8080/api/HR/catagori/' + catagoriId + '/news/' + newsId, url: 'http://localhost:8080/api/HR/news/' + newsId,
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}).then(function (response) { }).then(function (response) {
console.log("delete OK");
$state.reload();
}, function (data, status) {
$state.reload();
});
}
};
//Edit news
$scope.newsEditById = News.get({}, {myNewsId: $stateParams.myNewsEditId});
$scope.editNews = function(newsEditById) {
if(confirm("Update?")) {
$http({
method: 'PUT',
url: 'http://localhost:8080/api/HR/news/' + newsEditById.id,
data: angular.toJson(newsEditById),
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
console.log("update OK");
$state.go('newsManagement',{myCatagoriId:$stateParams.myCatagoriEditId});
}, function (data, status) { }, function (data, status) {
console.log(status);
}); });
} }
}; };
}); });
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
{{catagori.name}} {{catagori.name}}
</h3> </h3>
<a href="http://localhost:8080/index.html#/news/catagori/{{catagori.id}}" class="tab01-link f1-s-1 cl9 hov-cl10 trans-03"> <a href="http://localhost:8080/#/news/catagori/{{catagori.id}}" class="tab01-link f1-s-1 cl9 hov-cl10 trans-03">
View all View all
<i class="fs-12 m-l-5 fa fa-caret-right"></i> <i class="fs-12 m-l-5 fa fa-caret-right"></i>
</a> </a>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content p-t-35"> <div class="tab-content p-t-35" style="overflow: hidden">
<!-- - --> <!-- - -->
<div class="tab-pane fade show active" id="tab1-1" role="tabpanel"> <div class="tab-pane fade show active" id="tab1-1" role="tabpanel">
<div class="row"> <div class="row">
......
<form name="myForm" novalidate ng-submit="editNews(newsEditById)" >
<table border= 1>
<tr>
<td>News Id</td>
<td>{{newsEditById.id}}</td>
</tr>
<tr>
<td>Thumbnail</td>
<td><input type="text" data-ng-model="newsEditById.thumbnail" /></td>
</tr>
<tr>
<td>Title</td>
<td><input type="text" ng-model="newsEditById.title" /></td>
</tr>
<tr>
<td>Content</td>
<td><input type="text" data-ng-model="newsEditById.content" /></td>
</tr>
<tr>
<td>Status</td>
<td><input type="text" data-ng-model="newsEditById.status" /></td>
</tr>
<tr>
<td colspan="2">
<input data-ng-disabled="myForm.$invalid" type="submit" value="Submit" class="blue-button" />
</td>
</tr>
</table>
</form>
<!--<link rel="stylesheet" href="../../css/bootstrap-combined.min.css">-->
<div class="container"> <div class="container">
<div class="row">
<div class="col-md-8">
<div >
<div> <div>
<table class="table"> <table class="table" >
<thead> <thead>
<tr> <tr>
<tr> <tr>
<a ui-sref="CatagoriManagement"><< Back</a>
<td colspan="12"><h1 style="font-size: 30px;text-align: center">{{catagoriById.name}}</h1></td> <td colspan="12"><h1 style="font-size: 30px;text-align: center">{{catagoriById.name}}</h1></td>
</tr> </tr>
<th>STT</th> <th>STT</th>
...@@ -21,17 +20,18 @@ ...@@ -21,17 +20,18 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr class="vide" ng-repeat="new in catagoriById.news"> <tr class="vide" ng-repeat="myNews in catagoriById.news">
<td>{{$index + 1}}</td> <td>{{$index + 1}}</td>
<td>{{new.title}}</td> <td>{{myNews.title}}</td>
<td>{{new.createdAt}}</td> <td>{{myNews.createdAt}}</td>
<td>{{new.content}}</td> <td>{{myNews.content}}</td>
<td><button ng-click="editNews(new,catagoryById.id)">Edit</button> </td> <td><a href="#/management/catagori/{{catagoriById.id}}/news/{{myNews.id}}" style="color:green;border: 1px solid black;padding: 10px;" >Edit</a> </td>
<td><button ng-click="deleteNews(new.id,catagoryById.id)">Delete</button> </td> <td><button type="button" style="color:red;border: 1px solid black;padding: 10px;" ng-click="deleteNews(myNews.id)">Delete</button> </td>
<td><button type="button" ng-click=""></button>Add</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>Add
</div> </div>
</div>
</div>
</div> </div>
<div class="card-header">
<i class="fas fa-table"></i> Thêm mới dự án
</div>
<div class="card-body">
<form ng-submit="insertIssues(Issues)">
<label>Tên Dự Án</label>
<select ng-model="Issues.projectId" autofocus="autofocus"
required="required">
<option value="">==> Trạng Thái</option>
<option ng-repeat="project in listProject" value="{{project.id}}">{{project.name}}</option>
</select><br/>
<label>Tiêu đề</label>
<input type="text" ng-model="Issues.title" id="title" placeholder="Tiêu Đề"
required="required"><br/>
<label>Nội Dung</label>
<input type="text" ng-model="Issues.actionCode" id="actionCode" placeholder="Nội dung issues"
required="required"><br/>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="issues">Back</button>
</div>
</form>
</div>
\ No newline at end of file
angular.module("myApp").controller('IssuesAddController', function ($scope,$state,$http) {
$scope.insertIssues = function (Issues) {
$http({
method: 'POST',
url: 'http://localhost:8081/them-issues',
data: angular.toJson($scope.Issues),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('issues');
}
}
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an/").then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listProject = response.data;
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
});
\ No newline at end of file
angular.module("myApp").controller('IssuesShowController', function ($scope,$stateParams,$http,$state) {
$scope.currentPage = 1
,$scope.numPerPage = 5
,$scope.maxSize = 5;
$http.get('http://localhost:8081/danh-sach-issues').then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.ListIssues = response.data;
$scope.numPages = function () {
return Math.ceil($scope.ListIssues.length / $scope.numPerPage);
};
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.pageListIssues = $scope.ListIssues.slice(begin, end);
});
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
$scope.updateIssues = function (issue) {
if (confirm("Bạn có muốn thay đổi trạng thái không ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/sua-issues',
data: angular.toJson(issue),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
//error code
console.log("can't update data!!");
}
}
};
});
\ No newline at end of file
<div class="col-lg-8">
<hr>
<p style="text-align: center">Tên Dự Án : {{loadIssues.project.name | uppercase}}</p>
<hr>
<p class="lead">Tiêu Đề: {{loadIssues.title | uppercase}}</p>
<blockquote class="blockquote">
<p class="mb-0">NỘI DUNG ISSUES : {{loadIssues.actionCode}}</p>
</blockquote>
<hr>
<!-- Comments Form -->
<div class="card my-4">
<h5 class="card-header">Comment:</h5>
<div class="card-body">
<form ng-submit="saveComment(IssuesComment)">
<div class="form-group">
<textarea ng-model="IssuesComment.contentIssuse" class="form-control" rows="3"></textarea>
</div>
<button type="submit" class="btn btn-primary">Đăng Comments</button>
<input class="btn btn-primary" type="reset" value="Reset">
</form>
</div>
</div>
<!-- Single Comment -->
<div class="media mb-4">
<div class="media-body">
<h5 class="mt-0">UserName</h5><p>Thời gian đăng</p>
-<p>Nội dung comment</p>-
</div>
</div>
</div>
\ No newline at end of file
<div class="card mb-3">
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Issue
</div>
<div class="card-body">
<div class="table-responsive">
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Issue</th>
<th>Ngày Tạo</th>
<th>Trạng Thái</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="issue in pageListIssues|filter:search">
<td>{{ issue.project.name }}</td>
<td>{{ issue.title }}</td>
<td>{{ issue.startDate | date:"dd/MM/yyyy" }}</td>
<td>
<span ng-if="issue.status == 0" style="color: #34ce57">Đang fix</span>
<span ng-if="issue.status == 1" style="color: #0e90d2">Đã fix xong</span>
</td>
<td><a ui-sref="IssuesComment({IssuesId : issue.id})" class="btn btn-info btn-circle btn-sm">
Chi Tiết </a>
<a ng-click="updateIssues(issue)" class="btn btn-warning btn-circle btn-sm">
Cập nhật Trạng Thái </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="IssuesDeleteController"
data-ng-click="IssuesDelete(issue)">Xóa</a>
</tr>
</tbody>
</table>
<a ui-sref="addIssues" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm Issue Mới</a>
</div>
</div>
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div>
angular.module("myApp").controller('IssuesDeleteController', function($scope, $window, $http,$state) {
$scope.IssuesDelete = function (issue) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8081/xoa-issues',
data: $scope.issue,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
console.log("can't delete data!!");
}
}
};
});
\ No newline at end of file
var app = angular.module("myApp").controller('loadIssuesDetail', function ($scope, $stateParams, $http, $state) {
$http.get('http://localhost:8081/chi-tiet-issues/' + $stateParams.IssuesId).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.loadIssues = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
$scope.saveComment = function (IssuesComment) {
IssuesComment.issueId = $scope.loadIssues.id;
$http({
method: 'POST',
url: 'http://localhost:8081/tao-comment',
data: angular.toJson(IssuesComment),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
//error code
console.log("can't insert data!!");
}
}
//hiện thị danh sách comment
});
app.controller('showComment',showComment)
function showComment($scope, $http) {
//trang đang đứng trên font-end
$scope.currentPage = 1
//số item hiển thị trong 1 page
, $scope.numPerPage = 4
//tổng số page hiển thị trên thanh chọn
, $scope.maxSize = 5;
$http.get('http://localhost:8081/Comment/' + $scope.loadIssues.id).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.CommentIssues = response.data
$scope.numPages = function () {
return Math.ceil($scope.CommentIssues.length / $scope.numPerPage);
};
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.pageListCommentIssues = $scope.CommentIssues.slice(begin, end);
});
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
\ No newline at end of file
<script> <script>
function showAddLeaveFormFunction() { function showAddLeaveFormFunction() {
<<<<<<< HEAD
const x = document.getElementById("addDivLF"); const x = document.getElementById("addDivLF");
const n = document.getElementById("addLeaveForm"); const n = document.getElementById("addLeaveForm");
if (x.style.display === "none") { if (x.style.display === "none") {
x.style.display = "block"; x.style.display = "block";
n.value = "Close"; n.value = "Close";
=======
var x = document.getElementById("addDivLF");
var n = document.getElementById("addLeaveForm");
if (x.style.display === "none") {
x.style.display = "block";
n.value = " Back";
>>>>>>> master
} else { } else {
x.style.display = "none"; x.style.display = "none";
n.value = "Add Leave Form"; n.value = "Add Leave Form";
...@@ -16,7 +24,11 @@ ...@@ -16,7 +24,11 @@
<div class="table-title"> <div class="table-title">
<div class="row"> <div class="row">
<div class="col-sm-6"> <div class="col-sm-6">
<<<<<<< HEAD
<h4><b>Leave Form</b></h4> <h4><b>Leave Form</b></h4>
=======
<h2><b>Leave Form</b></h2>
>>>>>>> master
<label> <label>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/> Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label> </label>
......
...@@ -62,7 +62,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http ...@@ -62,7 +62,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
console.log($scope.lfdto); console.log($scope.lfdto);
$http({ $http({
method : 'POST', method : 'POST',
url : "http://localhost:8080/employee/leaveform/add", url : "http://localhost:8080/timesheet/leaveform/add",
data: $scope.lfdto data: $scope.lfdto
}).then(function successCallback(response) { }).then(function successCallback(response) {
console.log(response); console.log(response);
...@@ -86,7 +86,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http ...@@ -86,7 +86,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
function update(){ function update(){
$http({ $http({
method : 'POST', method : 'POST',
url : "http://localhost:8080/employee/leaveform/update", url : "http://localhost:8080/timesheet/leaveform/update",
data: $scope.lfdto data: $scope.lfdto
}).then(function successCallback(response) { }).then(function successCallback(response) {
console.log(response); console.log(response);
...@@ -101,7 +101,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http ...@@ -101,7 +101,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
function updateStatus(lf){ function updateStatus(lf){
$http({ $http({
method : 'POST', method : 'POST',
url : "http://localhost:8080/employee/leaveform/"+lf.id+"/status", url : "http://localhost:8080/timesheet/leaveform/"+lf.id+"/status",
// data: $scope.lfdto // data: $scope.lfdto
}).then(function successCallback(response) { }).then(function successCallback(response) {
console.log(response); console.log(response);
...@@ -111,4 +111,5 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http ...@@ -111,4 +111,5 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
$state.reload(); $state.reload();
}); });
} }
}); });
...@@ -5,7 +5,7 @@ angular.module("myApp").controller("leaveFormDetailController", function($scope, ...@@ -5,7 +5,7 @@ angular.module("myApp").controller("leaveFormDetailController", function($scope,
console.log("Leave Form Detail Controller"); console.log("Leave Form Detail Controller");
$http({ $http({
method : 'GET', method : 'GET',
url : "http://localhost:8080/employee/leaveform/" + $stateParams.id url : "http://localhost:8080/timesheet/leaveform/" + $stateParams.id
}).then(function successCallback(response) { }).then(function successCallback(response) {
console.log(response); console.log(response);
$scope.leaveFormDetail=response.data; $scope.leaveFormDetail=response.data;
...@@ -17,7 +17,7 @@ angular.module("myApp").controller("leaveFormDetailController", function($scope, ...@@ -17,7 +17,7 @@ angular.module("myApp").controller("leaveFormDetailController", function($scope,
function updateStatus(id){ function updateStatus(id){
$http({ $http({
method : 'POST', method : 'POST',
url : "http://localhost:8080/employee/leaveform/"+id+"/status", url : "http://localhost:8080/timesheet/leaveform/"+id+"/status",
}).then(function successCallback(response) { }).then(function successCallback(response) {
console.log(response); console.log(response);
$state.reload(); $state.reload();
......
var app = angular.module('myApp');
app.factory('apiService', apiService);
apiService.$inject = ['$http', 'notificationService', 'authenticationService'];
function apiService($http, notificationService, authenticationService) {
return {
get: get,
post: post,
put: put,
del: del
}
function del(url, data, success, failure) {
authenticationService.setHeader();
$http.delete(url, data).then(function (result) {
success(result);
}, function (error) {
console.log(error.status)
if (error.status === 401) {
notificationService.displayError('Authenticate is required.');
} else if (failure != null) {
failure(error);
}
});
}
function post(url, data, success, failure) {
authenticationService.setHeader();
$http.post(url, data).then(function (result) {
success(result);
}, function (error) {
console.log(error.status)
if (error.status === 401) {
notificationService.displayError('Authenticate is required.');
} else if (failure != null) {
failure(error);
}
});
}
function put(url, data, success, failure) {
authenticationService.setHeader();
$http.put(url, data).then(function (result) {
success(result);
}, function (error) {
console.log(error.status)
if (error.status === 401) {
notificationService.displayError('Authenticate is required.');
} else if (failure != null) {
failure(error);
}
});
}
function get(url, params, success, failure) {
authenticationService.setHeader();
$http.get(url, params).then(function (result) {
success(result);
}, function (error) {
failure(error);
});
}
};
\ No newline at end of file
...@@ -3,53 +3,26 @@ ...@@ -3,53 +3,26 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<form ng-controller="insertEmployeeProject" ng-submit="insert_employeeproject(employeeProject)" name="eproject"> <form ng-controller="insertEmployeeProject" ng-submit="insert_employeeproject(employeeProject)" name="eproject">
<div class="form-group"> <label>Tên Dự Án</label>
<div class="form-row"> <select ng-model="employeeProject.projectId" autofocus="autofocus" required="required">
<div class="col-md-6">
<div class="form-label-group">
<select ng-model="employeeProject.projectId" class="form-control"
autofocus="autofocus" required="required">
<option value=""> ==> Tên Dự Án</option> <option value=""> ==> Tên Dự Án</option>
<option ng-repeat="project in pGroupProject" value="{{project.id}}">{{project.name}} <option ng-repeat="project in pGroupProject" value="{{project.id}}">{{project.name}}</option>
</option> </select><br/>
</select> <label>Tài khoản nhân viên</label>
</div> <input type="text" ng-model="employeeProject.userName" id="employee"
</div> placeholder="Tài khoản nhân viên" required="required"><br/>
</div> <label>Chức Vụ</label>
</div> <select ng-model="employeeProject.position" autofocus="autofocus"
<div class="form-group"> required="required">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<select ng-model="employeeProject.userId" class="form-control" autofocus="autofocus" required="required">
<option value=""> ==> Tên Tài Khoản</option>
<option ng-repeat="em in eProject" value="{{em.id}}">{{em.username}}</option>
</select>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<select ng-model="employeeProject.position" class="form-control" autofocus="autofocus" required="required">
<option value="">==> Chức Vụ</option> <option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option> <option value="TeamLead">TeamLead</option>
<option value="Member">Member</option> <option value="Member">Member</option>
<option value="HR">HR</option> </select><br/>
<option value="Manager">Manager</option>
</select>
</div>
</div>
</div>
</div>
<h3 ng-show="eproject.$valid" style="text-align: center; color: #1c7430">Bạn Có Thể Lưu</h3>
<h1>{{view.message}}</h1> <h1>{{view.message}}</h1>
<div> <div>
<input type="submit" value="Lưu"> <input type="submit" value="Lưu">
<input type="reset" value="Reset"> <input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button> <button type="button" ui-sref="project">Back</button>
</div> </div>
</form> </form>
</div> </div>
\ No newline at end of file
...@@ -2,6 +2,8 @@ var app = angular.module('myApp'); ...@@ -2,6 +2,8 @@ var app = angular.module('myApp');
app.controller('loadGroupProjectByProjectId', loadGroupProjectByProjectId); app.controller('loadGroupProjectByProjectId', loadGroupProjectByProjectId);
app.controller('insertEmployeeProject', insertEmployeeProject); app.controller('insertEmployeeProject', insertEmployeeProject);
app.controller('deleteEmployeeProject', deleteEmployeeProject); app.controller('deleteEmployeeProject', deleteEmployeeProject);
app.controller('updateGroutpProject', updateGroutpProject);
app.controller('loadEmployeeProjectDetail', loadEmployeeProjectDetail);
// controlers tạo Get API // controlers tạo Get API
function loadGroupProjectByProjectId($scope,$stateParams,$http) { function loadGroupProjectByProjectId($scope,$stateParams,$http) {
$http.get('http://localhost:8081/thong-tin-du-an/'+ $stateParams.ID).then(successCallback, errorCallback); $http.get('http://localhost:8081/thong-tin-du-an/'+ $stateParams.ID).then(successCallback, errorCallback);
...@@ -11,14 +13,12 @@ function loadGroupProjectByProjectId($scope,$stateParams,$http) { ...@@ -11,14 +13,12 @@ function loadGroupProjectByProjectId($scope,$stateParams,$http) {
$scope.listGruopProject = response.data $scope.listGruopProject = response.data
} }
} }
function errorCallback(error) { function errorCallback(error) {
//error code
console.log("can't get data!!"); console.log("can't get data!!");
} }
} }
// tạo controllers insert API // tạo controllers insert API
function insertEmployeeProject($scope, $http, $window) { function insertEmployeeProject($scope, $http, $state) {
$scope.insert_employeeproject = function () { $scope.insert_employeeproject = function () {
$http({ $http({
//khai báo type //khai báo type
...@@ -34,29 +34,16 @@ function insertEmployeeProject($scope, $http, $window) { ...@@ -34,29 +34,16 @@ function insertEmployeeProject($scope, $http, $window) {
} }
// kết quả trả về (THEN) // kết quả trả về (THEN)
}).then(successCallback, errorCallback); }).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) { function successCallback(response) {
$scope.view = response.data; $scope.view = response.data;
if($scope.view.status == 200){
$state.go('groupProjectByProjectId', {ID: $scope.employeeProject.projectId});
}
} }
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) { function errorCallback(error) {
//error code
console.log("can't insert data!!"); console.log("can't insert data!!");
} }
} }
//get Employee
$http({
method : 'GET',
url : "http://localhost:8081/list_employee/"
}).then(function successCallback(response) {
console.log(response);
$scope.eProject=response.data;
}, function errorCallback(response) {
console.log(response)
});
// get Project // get Project
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback); $http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
...@@ -72,7 +59,7 @@ function insertEmployeeProject($scope, $http, $window) { ...@@ -72,7 +59,7 @@ function insertEmployeeProject($scope, $http, $window) {
console.log("can't get data!!"); console.log("can't get data!!");
} }
}; };
function deleteEmployeeProject($scope, $window, $http) { function deleteEmployeeProject($scope, $window, $http,$state) {
$scope.deleteEmployeeProject = function (gruopProject) { $scope.deleteEmployeeProject = function (gruopProject) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) { if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({ $http({
...@@ -83,17 +70,52 @@ function deleteEmployeeProject($scope, $window, $http) { ...@@ -83,17 +70,52 @@ function deleteEmployeeProject($scope, $window, $http) {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}).then(successCallback, errorCallback); }).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) { function successCallback(response) {
$window.location.reload(); $scope.view = response.data;
if($scope.view.status == 200){
// $window.location.reload();
$state.reload();
}
}
function errorCallback(error) {
console.log("can't delete data!!");
}
}
};
};
function updateGroutpProject($scope, $http,$state,$window) {
$scope.updatePositionProject = function (gruopProject) {
if (confirm("Bạn có chắc chắn muốn sửa ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/cap-nhat-chuc-vu-thanh-vien',
data: $scope.gruopProject,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if($scope.view.status == 200){
$state.go('groupProjectByProjectId', {ID: $scope.gruopProject.projectDTO.id});
// $window.location.href = 'http://localhost:8081/#/groupProjectByProjectId/'+$scope.gruopProject.projectDTO.id;
}
} }
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) { function errorCallback(error) {
//error code
console.log("can't delete data!!"); console.log("can't delete data!!");
} }
} }
}; };
}; };
function loadEmployeeProjectDetail($scope,$stateParams,$http) {
$http.get('http://localhost:8081/chi-tiet-thanh-vien-du-an/'+ $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.gruopProject = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
\ No newline at end of file
<!DOCTYPE html> <div class="card-header">
<html lang="en"> <i class="fas fa-table"></i> Cập nhật chức vụ của nhân viên trong nhóm
<head> </div>
<meta charset="UTF-8"> <div class="card-body">
<title>Title</title> <form ng-controller="updateGroutpProject" ng-submit="updatePositionProject(gruopProject)" name="formProject">
</head> <input type="hidden" ng-model="gruopProject.id" id="id"><br/>
<body> <input type="hidden" ng-model="gruopProject.projectDTO.id" id="idProject"><br/>
<label>Tài khoản nhân viên</label>
</body> <input type="text" ng-model="gruopProject.employeeDTO.username" id="descriptions"
</html> placeholder="Tài khoản nhân viên"
\ No newline at end of file ng-disabled="true"><br/>
<label>Chức Vụ</label><br/>
<select ng-model="gruopProject.position" autofocus="autofocus"
required="required">
<option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option>
<option value="Member">Member</option>
</select><br/>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="groupProjectByProjectId({ID: gruopProject.projectDTO.id})">Back</button>
</div>
</form>
</div>
\ No newline at end of file
<div class="card mb-3"> <div class="card mb-3">
<div class="card-header"> <div class="card-header" ng-controller="loadGroupProjectByProjectId">
<i class="fas fa-table"></i> Danh Sách Dự Án
<i class="fas fa-table" ></i> Thành Viên Trong Nhóm Dự Án <div ng-model="ProjectName.name"></div>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="table-responsive" ng-controller="loadGroupProjectByProjectId"> <div class="table-responsive" >
<a ui-sref="addEmployeeProject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm thành viên</a>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;"> <input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%" <table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0"> cellspacing="0">
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="gruopProject in listGruopProject"> <tr ng-repeat="gruopProject in pageGroupListProject">
<td>{{ gruopProject.employeeDTO.username }}</td> <td>{{ gruopProject.employeeDTO.username }}</td>
<td>{{ gruopProject.employeeDTO.lastName }}</td> <td>{{ gruopProject.employeeDTO.lastName }}</td>
<td>{{ gruopProject.employeeDTO.email}}</td> <td>{{ gruopProject.employeeDTO.email}}</td>
...@@ -29,14 +30,19 @@ ...@@ -29,14 +30,19 @@
<td>{{ gruopProject.joinDate | date:"dd/MM/yyyy" }}</td> <td>{{ gruopProject.joinDate | date:"dd/MM/yyyy" }}</td>
<td>{{ gruopProject.outDate | date:"dd/MM/yyyy" }}</td> <td>{{ gruopProject.outDate | date:"dd/MM/yyyy" }}</td>
<td> <td>
<a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm"> <a ui-sref="editEmployeeProject({ID: gruopProject.id})" class="btn btn-warning btn-circle btn-sm">
Sửa </a> Cập Nhật </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="deleteEmployeeProject" <a class="btn btn-danger btn-circle btn-sm" ng-controller="deleteEmployeeProject"
data-ng-click="deleteEmployeeProject(gruopProject)">xóa thành viên</a> data-ng-click="deleteEmployeeProject(gruopProject)">Xóa Thành Viên</a>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<a ui-sref="project" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Trở Về</a> <a ui-sref="addEmployeeProject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm thành viên</a>
<a ui-sref="project" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Back</a>
</div>
</div> </div>
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div> </div>
</div> </div>
\ No newline at end of file
angular.module("myApp").controller('groupProjectShowController', function ($scope,$stateParams,$http) {
$scope.currentPage = 1
,$scope.numPerPage = 2
,$scope.maxSize = 5;
$http.get('http://localhost:8081/thong-tin-du-an/'+ $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listGruopProject = response.data;
$scope.numPages = function () {
return Math.ceil($scope.listGruopProject.length / $scope.numPerPage);
};
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.pageGroupListProject = $scope.listGruopProject.slice(begin, end);
});
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
});
\ No newline at end of file
...@@ -3,50 +3,21 @@ ...@@ -3,50 +3,21 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<form ng-controller="insertProject" ng-submit="insert_project()"> <form ng-controller="insertProject" ng-submit="insert_project()">
<div class="form-group"> <label>Tên Dự Án</label>
<div class="form-row"> <input type="text" ng-model="project.name" id="name" placeholder="Tên Dự Án"
<div class="col-md-6"> required="required" style="height: 20px;"><br/>
<div class="form-label-group"> <label>Mô tả ngắn</label>
<input type="text" ng-model="project.name" id="name" class="form-control" <input type="text" ng-model="project.descriptions" id="descriptions" placeholder="Mô tả ngắn"
placeholder="Tên Dự Án" required="required"><br/>
required="required" autofocus="autofocus"> <label>Ngày bắt đầu</label>
<label for="name">Tên Dự Án</label> <input type="date" ng-model="project.startDate" id="startDate" placeholder="Ngày Bắt Đầu" required="required"><br/>
</div> <label>Ngày kết thúc</label>
</div> <input type="date" ng-model="project.endDate" id="endDate" placeholder="nick skype" required="required"><br/>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="project.descriptions" id="descriptions"
class="form-control"
placeholder="Mô tả ngắn"
required="required">
<label for="descriptions">Mô tả ngắn</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="project.startDate" id="startDate" class="form-control"
placeholder="Ngày Bắt Đầu" required="required">
<label for="startDate">Ngày Bắt Đầu</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="project.endDate" id="endDate" class="form-control"
placeholder="nick skype" required="required">
<label for="endDate">Ngày Kết Thuc</label>
</div>
</div>
</div>
</div>
<h3 ng-show="formProject.$valid" style="text-align: center; color: #1c7430">Bạn Có Thể Lưu</h3>
<div> <div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save"> <input type="submit" value="Save">
<input type="reset" value="Reset"> <input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button> <button type="button" ui-sref="project">Back</button>
</div> </div>
</form> </form>
</div> </div>
\ No newline at end of file
var app = angular.module('myApp'); var app = angular.module('myApp');
app.controller('showProject', showProject); // app.controller('showProject', showProject);
app.controller('insertProject', insertProject); app.controller('insertProject', insertProject);
app.controller('deleteProject', deleteProject); app.controller('deleteProject', deleteProject);
app.controller('updateProject', updateProject); app.controller('updateProject', updateProject);
app.controller('loadProjectDetail', loadProjectDetail); app.controller('loadProjectDetail', loadProjectDetail);
// controlers tạo Get API
function showProject($scope, $http) {
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listProject = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
};
// controlers tạo Get API
// function showProject($scope, $http) {
// $scope.lstProject = [];
// $scope.page = 0;
// $scope.pagesCount = 0;
// $http.get("http://localhost:8081/quan-tri/danh-sach-du-an/" + $scope.page + "/2").then(successCallback, errorCallback);
//
// function successCallback(response) {
// console.log(response.data);
// {
// $scope.listProject = response.data.lstResult;
// $scope.page = response.data.page;
// $scope.pagesCount = response.data.totalPage;
// $scope.totalCount = response.data.totalItem;
// }
// }
//
// function errorCallback(error) {
// //error code
// console.log("can't get data!!");
// }
// };
// tạo controllers insert API // tạo controllers insert API
function insertProject($scope, $http, $window,$state) { function insertProject($scope, $http, $state) {
$scope.insert_project = function () { $scope.insert_project = function () {
$http({ $http({
//khai báo type
method: 'POST', method: 'POST',
//đường dẫn API
url: 'http://localhost:8081/quan-tri/them-du-an', url: 'http://localhost:8081/quan-tri/them-du-an',
//truyền dữ liệu nhập trên cline vào data
data: angular.toJson($scope.project), data: angular.toJson($scope.project),
//kiểu dữ liệu API
headers: { headers: {
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
// kết quả trả về (THEN)
}).then(successCallback, errorCallback); }).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) { function successCallback(response) {
// $window.location.href = "http://localhost:8081/#/project"; $scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('project'); $state.go('project');
} }
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) { function errorCallback(error) {
//error code //error code
console.log("can't insert data!!"); console.log("can't insert data!!");
...@@ -66,15 +66,14 @@ function deleteProject($scope, $window, $http,$state) { ...@@ -66,15 +66,14 @@ function deleteProject($scope, $window, $http,$state) {
} }
}).then(successCallback, errorCallback); }).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) { function successCallback(response) {
// $state.go('project'); $scope.view = response.data;
$window.location.reload(); if ($scope.view.status == 200) {
$state.reload();
}
} }
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) { function errorCallback(error) {
//error code
console.log("can't delete data!!"); console.log("can't delete data!!");
} }
} }
...@@ -82,7 +81,7 @@ function deleteProject($scope, $window, $http,$state) { ...@@ -82,7 +81,7 @@ function deleteProject($scope, $window, $http,$state) {
}; };
//tạo controller sửa theo id //tạo controller sửa theo id
function updateProject($scope, $window, $http,$state) { function updateProject($scope, $http, $state) {
$scope.updateProject = function (project) { $scope.updateProject = function (project) {
if (confirm("Bạn có muốn sửa không ?")) { if (confirm("Bạn có muốn sửa không ?")) {
$http({ $http({
...@@ -94,13 +93,13 @@ function updateProject($scope, $window, $http,$state) { ...@@ -94,13 +93,13 @@ function updateProject($scope, $window, $http,$state) {
} }
}).then(successCallback, errorCallback); }).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) { function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('project'); $state.go('project');
// $window.location.href = "http://localhost:8081/#/project"; }
} }
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) { function errorCallback(error) {
//error code //error code
console.log("can't update data!!"); console.log("can't update data!!");
...@@ -108,8 +107,10 @@ function updateProject($scope, $window, $http,$state) { ...@@ -108,8 +107,10 @@ function updateProject($scope, $window, $http,$state) {
} }
}; };
}; };
function loadProjectDetail($scope,$stateParams,$http) {
$http.get('http://localhost:8081/quan-tri/chi-tiet-du-an/'+ $stateParams.ID).then(successCallback, errorCallback); function loadProjectDetail($scope, $stateParams, $http) {
$http.get('http://localhost:8081/quan-tri/chi-tiet-du-an/' + $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) { function successCallback(response) {
console.log(response.data); console.log(response.data);
{ {
...@@ -118,7 +119,6 @@ function loadProjectDetail($scope,$stateParams,$http) { ...@@ -118,7 +119,6 @@ function loadProjectDetail($scope,$stateParams,$http) {
} }
function errorCallback(error) { function errorCallback(error) {
//error code
console.log("can't get data!!"); console.log("can't get data!!");
} }
} }
\ No newline at end of file
...@@ -3,69 +3,27 @@ ...@@ -3,69 +3,27 @@
</div> </div>
<div class="card-body"> <div class="card-body">
<form ng-controller="updateProject" ng-submit="updateProject(project)" name="formProject"> <form ng-controller="updateProject" ng-submit="updateProject(project)" name="formProject">
<div class="form-group"> <label>Tên Dự Án</label>
<div class="form-row"> <input type="text" ng-model="project.name" id="name"
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="project.name" id="name" class="form-control"
placeholder="Tên Dự Án" placeholder="Tên Dự Án"
required="required" autofocus="autofocus" name="txtName"> required="required" autofocus="autofocus" name="txtName"><br/>
<label for="name">Tên Dự Án</label> <label>Mô tả ngắn</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="project.descriptions" id="descriptions" <input type="text" ng-model="project.descriptions" id="descriptions"
class="form-control"
placeholder="Mô tả ngắn" placeholder="Mô tả ngắn"
required="required" name="txtDescriptions"> required="required" name="txtDescriptions"><br/>
<label for="descriptions">Mô tả ngắn</label> <select ng-model="project.status" autofocus="autofocus"
</div> required="required">
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="hidden" ng-model="project.id" id="id" class="form-control">
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<select ng-model="project.status" class="form-control" autofocus="autofocus" required="required">
<option value="">==> Trạng Thái</option> <option value="">==> Trạng Thái</option>
<option value="0">Dự Kiến</option> <option value="0">Dự Kiến</option>
<option value="1">Đang Tiến Hành</option> <option value="1">Đang Tiến Hành</option>
<option value="2">Đã Hoàn Thành</option> <option value="2">Đã Hoàn Thành</option>
</select> </select><br/>
</div> <input type="hidden" ng-model="project.id" id="id"><br/>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="project.startDate" id="startDate" class="form-control"
placeholder="Ngày Bắt Đầu" required="required">
<label for="startDate">Ngày Bắt Đầu</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="project.endDate" id="endDate" class="form-control"
placeholder="nick skype" required="required">
<label for="endDate">Ngày Kết Thúc</label>
</div>
</div>
</div>
</div>
<h3 ng-show="formProject.$valid" style="text-align: center; color: #1c7430">Bạn Có Thể Lưu</h3>
<div> <div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save"> <input type="submit" value="Save">
<input type="reset" value="Reset"> <input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button> <button type="button" ui-sref="project">Back</button>
</div> </div>
</form> </form>
</div> </div>
\ No newline at end of file
...@@ -4,8 +4,7 @@ ...@@ -4,8 +4,7 @@
<i class="fas fa-table"></i> Danh Sách Dự Án <i class="fas fa-table"></i> Danh Sách Dự Án
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="table-responsive" ng-controller="showProject"> <div class="table-responsive" >
<a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;"> <input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<table class="table table-bordered" id="dataTable" width="100%" <table class="table table-bordered" id="dataTable" width="100%"
cellspacing="0"> cellspacing="0">
...@@ -20,12 +19,16 @@ ...@@ -20,12 +19,16 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="project in listProject|filter:search"> <tr ng-repeat="project in pageListProject|filter:search">
<td>{{ project.name }}</td> <td>{{ project.name }}</td>
<td>{{ project.descriptions }}</td> <td>{{ project.descriptions }}</td>
<td>{{ project.startDate | date:"dd/MM/yyyy" }}</td> <td>{{ project.startDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.endDate | date:"dd/MM/yyyy" }}</td> <td>{{ project.endDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.status}}</td> <td>
<span ng-if="project.status == 0" style="color: #34ce57">Dự Kiến</span>
<span ng-if="project.status == 1" style="color: #0e90d2">Đang Tiến Hành</span>
<span ng-if="project.status == 2" style="color: #b21f2d" >Hoàn Thành</span>
</td>
<td><a ui-sref="groupProjectByProjectId({ID: project.id})" class="btn btn-info btn-circle btn-sm"> <td><a ui-sref="groupProjectByProjectId({ID: project.id})" class="btn btn-info btn-circle btn-sm">
Xem </a> Xem </a>
<a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm"> <a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm">
...@@ -35,6 +38,12 @@ ...@@ -35,6 +38,12 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm Dự Án Mới</a>
</div> </div>
</div> </div>
<!-- <pager-directive page="{{page}}" custom-path="{{customPath}}" pages-count="{{pagesCount}}" total-count="{{totalCount}}" search-func="getProject(page)"></pager-directive>-->
<div data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</div>
</div> </div>
angular.module("myApp").controller('projectViewsController', function ($scope, $http) {
//trang đang đứng trên font-end
$scope.currentPage = 1
//số item hiển thị trong 1 page
, $scope.numPerPage = 4
//tổng số page hiển thị trên thanh chọn
, $scope.maxSize = 5;
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listProject = response.data;
$scope.numPages = function () {
return Math.ceil($scope.listProject.length / $scope.numPerPage);
};
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.pageListProject = $scope.listProject.slice(begin, end);
});
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
});
\ No newline at end of file
<<<<<<< HEAD
angular.module("MyTimeSheet").controller("timesheetController", function($scope, $http,$window) {
=======
*/
angular.module("myApp").controller("timeSheetController", function($scope, $http,$window) {
>>>>>>> fcb3554c9480d927d3ff072584217224ddd37db6
console.log("Time Sheet controller");
$scope.ts = {
"title": "",
"content": "",
"note": ""
};
<<<<<<< HEAD
$http({
header : 'Access-Control-Allow-Origin: http://localhost:63342/MockProject_01/public/pages/timesheet/timesheet.html?_ijt=ee540pqfq7tplkmo9mjj447ne',
method : 'GET',
url : "http://localhost:8080/eproject/timesheet",
}).then(function successCallback(response) {
console.log(response)
$scope.timesheet=response.data;
}, function errorCallback(response) {
console.log(response)
});
});
=======
$scope.tsdto = {
"id": "",
"title": "",
"content": "",
"note": "",
"eprojectId": "",
"employeeId": ""
};
//get all time sheet
//function getAllTimesheet(){
$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)
});
//}
//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
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
};
$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);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
$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);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
// $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);
// };
// }
// };
>>>>>>> fcb3554c9480d927d3ff072584217224ddd37db6
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