Commit fcb6432d authored by đinh thị đầm's avatar đinh thị đầm

t

parent 7ee28f85
This diff is collapsed.
......@@ -50,48 +50,88 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
})
.state("timeSheet", {
// .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: "/timesheet",
url: "/leaveform",
views: {
"content": {
templateUrl: "pages/timesheet/timeSheet.html",
controller: "timeSheetController"
templateUrl: "pages/leaveform/leaveForm.html",
controller: "leaveFormController"
}
}
})
.state("timeSheetDetail", {
.state("leaveFormDetail", {
parent: 'layout1',
url: "/timesheetdetail/:id",
url: "/leaveformdetail/:id",
views: {
"content": {
templateUrl: "pages/timesheet/timeSheetDetail.html",
controller: "timeSheetDetailController"
templateUrl: "pages/leaveform/leaveFormDetail.html",
controller: "leaveFormDetailController"
}
}
})
.state("leaveForm", {
parent: 'layout2',
url: "/leaveform",
views: {
"content": {
templateUrl: "pages/leaveform/leaveForm.html",
controller: "leaveFormController"
.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("leaveFormDetail", {
parent: 'layout2',
url: "/leaveformdetail/:id",
})
.state("project", {
parent: 'layout1',
url: "/project",
views: {
"content": {
templateUrl: "pages/leaveform/leaveFormDetail.html",
controller: "leaveFormDetailController"
templateUrl: "pages/project/project.html",
controller: "projectController"
}
}
})
.state("news",{
parent:'layout1',
url:"/news",
views:{
"content":{
templateUrl:"pages/homepage/catagoriManagements.html",
controller:"homeController"
}
}
})
});
......
angular.module("myApp").factory('News', function ($resource) {
return $resource('http://localhost:8080/api/news/:id', {id: '@myNewsId'},{
'get': {
method: 'GET',
isArray: false
}
});
});
angular.module('myApp').factory('Catagories', function ($resource) {
return $resource('http://localhost:8080/api/catalogies/:id', {id: '@myCatagoriesId'});
});
angular.module('myApp').factory('LatestNews', function ($resource) {
return $resource('http://localhost:8080/api/catalogi/:id/latestNews', {id: '@CatagoriesId'},{
'get': {
method: 'GET',
isArray: true
}
});
});
angular.module('myApp').factory('NewsByCatagori', function ($resource) {
return $resource('http://localhost:8080/api/catalogi/:id/news', {id: '@catagoriesId'},{
'get': {
method: 'GET',
isArray: true
}
});
});
<div class="container">
<div class="row">
<div class="col-md-8">
<div>
<table class="table">
<thead>
<tr>
<tr>
<td colspan="12">LIST OF CATAGORIES</td>
</tr>
<th>ID</th>
<th>Catagori Name</th>
<th>Number of News</th>
<th>Detail</th>
<th>Edit</th>
</tr>
</thead>
<tbody>
<tr class="vide" ng-repeat="cata in catagories">
<td>{{$index + 1}}</td>
<td>{{cata.name}}</td>
<td>{{cata.news.length}}</td>
<td><a href="#/management/catagori/{{cata.id}}">Detail</a> </td>
<td><a href="#">Edit</a> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
angular.module("myApp").controller('homeController', function ($scope,$http, $state,News, $window,$stateParams,Catagories,LatestNews) {
$scope.catagories = Catagories.query();
$scope.currentPage = 1
,$scope.numPerPage = 6
,$scope.maxSize = 5;
$scope.catagoriDetail = Catagories.get({}, {myCatagoriesId: $stateParams.catagoriId}).$promise.then(
function (value) {
$scope.todos = value.news;
$scope.catagori = value;
$scope.numPages = function () {
return Math.ceil($scope.todos.length / $scope.numPerPage);
};
console.log( $scope.todos.length);
$scope.$watch('currentPage + numPerPage', function () {
var begin = (($scope.currentPage - 1) * $scope.numPerPage)
, end = begin + $scope.numPerPage;
$scope.myNews = $scope.todos.slice(begin, end);
});
},
function (error) {
console.log()
}
);
$scope.newsById = News.get({}, {myNewsId: $stateParams.Id1});
$scope.show = function(id){
$scope.newestNews = LatestNews.get({}, {CatagoriesId: id});
};
$scope.catagoriById = Catagories.get({}, {myCatagoriesId: $stateParams.myCatagoriId});
//Delete News
$scope.deleteNews = function(newsId) {
if (confirm("Delete?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8080/api/HR/news/' + newsId,
headers: {
'Content-Type': 'application/json'
}
}).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) {
console.log(status);
});
}
};
});
\ No newline at end of file
<!-- Post -->
<section class="bg0 p-t-70">
<div class="container">
<div >
<div class="p-b-20">
<!-- Entertainment -->
<div class="tab01 p-b-20" data-ng-repeat="catagori in catagories">
<div class="tab01-head how2 how2-cl1 bocl12 flex-s-c m-r-10 m-r-0-sr991" >
<!-- Brand tab -->
<h3 class="f1-m-2 cl12 tab01-title">
{{catagori.name}}
</h3>
<a href="http://localhost:8080/#/news/catagori/{{catagori.id}}" class="tab01-link f1-s-1 cl9 hov-cl10 trans-03">
View all
<i class="fs-12 m-l-5 fa fa-caret-right"></i>
</a>
</div>
<!-- Tab panes -->
<div class="tab-content p-t-35" style="overflow: hidden">
<!-- - -->
<div class="tab-pane fade show active" id="tab1-1" role="tabpanel">
<div class="row">
<div class="col-sm-6 p-r-25 p-r-15-sr991" data-ng-repeat="new in catagori.news| limitTo: 6">
<!-- Item post -->
<div class="flex-wr-sb-s m-b-30">
<a href="#" class="size-w-1 wrap-pic-w hov1 trans-03">
<img src="{{new.thumbnail}}" alt="IMG">
</a>
<div class="size-w-2">
<h5 class="p-b-5">
<a href="http://localhost:8080/index.html#/news/{{new.id}}" class="f1-s-5 cl3 hov-cl10 trans-03">
{{new.content}}
</a>
</h5>
<span class="cl8">
<a href="http://localhost:8080/index.html#/news/{{new.id}}" class="f1-s-6 cl8 hov-cl10 trans-03">
Detail >>
</a>
</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Content -->
<section class="bg0 p-b-140 p-t-10">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-10 col-lg-8 p-b-30">
<div class="p-r-10 p-r-0-sr991">
<!-- Blog Detail -->
<div class="p-b-70">
<h3 class="f1-l-3 cl2 p-b-16 p-t-33 respon2">
{{newsById.content}}
</h3>
<div class="wrap-pic-max-w p-b-30">
<img src="{{newsById.thumbnail}}" alt="IMG">
</div>
<p class="f1-s-11 cl6 p-b-25">
Curabitur volutpat bibendum molestie. Vestibulum ornare gravida semper. Aliquam a dui suscipit, fringilla metus id, maximus leo. Vivamus sapien arcu, mollis eu pharetra vitae, condimentum in orci. Integer eu sodales dolor. Maecenas elementum arcu eu convallis rhoncus. Donec tortor sapien, euismod a faucibus eget, porttitor quis libero.
</p>
<p class="f1-s-11 cl6 p-b-25">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sit amet est vel orci luctus sollicitudin. Duis eleifend vestibulum justo, varius semper lacus condimentum dictum. Donec pulvinar a magna ut malesuada. In posuere felis diam, vel sodales metus accumsan in. Duis viverra dui eu pharetra pellentesque. Donec a eros leo. Quisque sed ligula vitae lorem efficitur faucibus. Praesent sit amet imperdiet ante. Nulla id tellus auctor, dictum libero a, malesuada nisi. Nulla in porta nibh, id vestibulum ipsum. Praesent dapibus tempus erat quis aliquet. Donec ac purus id sapien condimentum feugiat.
</p>
<p class="f1-s-11 cl6 p-b-25">
Praesent vel mi bibendum, finibus leo ac, condimentum arcu. Pellentesque sem ex, tristique sit amet suscipit in, mattis imperdiet enim. Integer tempus justo nec velit fringilla, eget eleifend neque blandit. Sed tempor magna sed congue auctor. Mauris eu turpis eget tortor ultricies elementum. Phasellus vel placerat orci, a venenatis justo. Phasellus faucibus venenatis nisl vitae vestibulum. Praesent id nibh arcu. Vivamus sagittis accumsan felis, quis vulputate
</p>
<!-- Tag -->
<div class="flex-s-s p-t-12 p-b-15">
<span class="f1-s-12 cl5 m-r-8">
Tags:
</span>
<div class="flex-wr-s-s size-w-0">
<a href="#" class="f1-s-12 cl8 hov-link1 m-r-15">
Streetstyle
</a>
<a href="#" class="f1-s-12 cl8 hov-link1 m-r-15">
Crafts
</a>
</div>
</div>
<!-- Share -->
<div class="flex-s-s">
<span class="f1-s-12 cl5 p-t-1 m-r-15">
Share:
</span>
<div class="flex-wr-s-s size-w-0">
<a href="#" class="dis-block f1-s-13 cl0 bg-facebook borad-3 p-tb-4 p-rl-18 hov-btn1 m-r-3 m-b-3 trans-03">
<i class="fab fa-facebook-f m-r-7"></i>
Facebook
</a>
<a href="#" class="dis-block f1-s-13 cl0 bg-twitter borad-3 p-tb-4 p-rl-18 hov-btn1 m-r-3 m-b-3 trans-03">
<i class="fab fa-twitter m-r-7"></i>
Twitter
</a>
<a href="#" class="dis-block f1-s-13 cl0 bg-google borad-3 p-tb-4 p-rl-18 hov-btn1 m-r-3 m-b-3 trans-03">
<i class="fab fa-google-plus-g m-r-7"></i>
Google+
</a>
<a href="#" class="dis-block f1-s-13 cl0 bg-pinterest borad-3 p-tb-4 p-rl-18 hov-btn1 m-r-3 m-b-3 trans-03">
<i class="fab fa-pinterest-p m-r-7"></i>
Pinterest
</a>
</div>
</div>
</div>
<!-- Leave a comment -->
<div>
<h4 class="f1-l-4 cl3 p-b-12">
Leave a Comment
</h4>
<p class="f1-s-13 cl8 p-b-40">
Your email address will not be published. Required fields are marked *
</p>
<form>
<textarea class="bo-1-rad-3 bocl13 size-a-15 f1-s-13 cl5 plh6 p-rl-18 p-tb-14 m-b-20" name="msg" placeholder="Comment..."></textarea>
<input class="bo-1-rad-3 bocl13 size-a-16 f1-s-13 cl5 plh6 p-rl-18 m-b-20" type="text" name="name" placeholder="Name*">
<input class="bo-1-rad-3 bocl13 size-a-16 f1-s-13 cl5 plh6 p-rl-18 m-b-20" type="text" name="email" placeholder="Email*">
<input class="bo-1-rad-3 bocl13 size-a-16 f1-s-13 cl5 plh6 p-rl-18 m-b-20" type="text" name="website" placeholder="Website">
<button class="size-a-17 bg2 borad-3 f1-s-12 cl0 hov-btn1 trans-03 p-rl-15 m-t-10">
Post Comment
</button>
</form>
</div>
</div>
</div>
<!-- Sidebar -->
<div class="col-md-10 col-lg-4 p-b-30">
<div class="p-l-10 p-rl-0-sr991 p-t-70">
<!-- Category -->
<div class="p-b-60">
<div class="how2 how2-cl4 flex-s-c">
<h3 class="f1-m-2 cl3 tab01-title">
Category
</h3>
</div>
<ul class="p-t-35">
<li class="how-bor3 p-rl-4" data-ng-repeat="catagori in catagories">
<a href="#" class="dis-block f1-s-10 text-uppercase cl2 hov-cl10 trans-03 p-tb-13">
{{catagori.name}}
</a>
</li>
</ul>
</div>
<!-- Tag -->
<div>
<div class="how2 how2-cl4 flex-s-c m-b-30">
<h3 class="f1-m-2 cl3 tab01-title">
Tags
</h3>
</div>
<div class="flex-wr-s-s m-rl--5">
<a href="#" class="flex-c-c size-h-2 bo-1-rad-20 bocl12 f1-s-1 cl8 hov-btn2 trans-03 p-rl-20 p-tb-5 m-all-5" data-ng-repeat="catagori in catagories">
{{catagori.name}}
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
\ No newline at end of file
<section class="bg0 p-t-70">
<div class="container">
<div >
<div class="p-b-20">
<!-- Entertainment -->
<div class="tab01 p-b-20" >
<div class="tab01-head how2 how2-cl1 bocl12 flex-s-c m-r-10 m-r-0-sr991" >
<!-- Brand tab -->
<h3 class="f1-m-2 cl12 tab01-title">
{{catagori.name}}
</h3>
</div>
<!-- Tab panes -->
<div class="tab-content p-t-35" style="overflow: hidden">
<!-- - -->
<div class="tab-pane fade show active" id="tab1-1" role="tabpanel">
<div class="row">
<div class="col-sm-6 p-r-25 p-r-15-sr991" data-ng-repeat="new in myNews">
<!-- Item post -->
<div class="flex-wr-sb-s m-b-30">
<a href="#" class="size-w-1 wrap-pic-w hov1 trans-03">
<img src="{{new.thumbnail}}" alt="IMG">
</a>
<div class="size-w-2">
<h5 class="p-b-5">
<a href="http://localhost:8080/index.html#/news/{{new.id}}" class="f1-s-5 cl3 hov-cl10 trans-03">
{{new.content}}
</a>
</h5>
<span class="cl8">
<a href="http://localhost:8080/index.html#/news/{{new.id}}" class="f1-s-6 cl8 hov-cl10 trans-03">
Detail >>
</a>
</span>
</div>
</div>
</div>
</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>
</div>
</section>
\ No newline at end of file
<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>
<div class="container">
<div >
<div>
<table class="table" >
<thead>
<tr>
<tr>
<a ui-sref="CatagoriManagement"><< Back</a>
<td colspan="12"><h1 style="font-size: 30px;text-align: center">{{catagoriById.name}}</h1></td>
</tr>
<th>STT</th>
<th>News title</th>
<th>Create Date</th>
<th>Content</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<tr class="vide" ng-repeat="myNews in catagoriById.news">
<td>{{$index + 1}}</td>
<td>{{myNews.title}}</td>
<td>{{myNews.createdAt}}</td>
<td>{{myNews.content}}</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 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>
</tbody>
</table>
</div>Add
</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>
function showAddLeaveFormFunction() {
const x = document.getElementById("addDivLF");
const n = document.getElementById("addLeaveForm");
var x = document.getElementById("addDivLF");
var n = document.getElementById("addLeaveForm");
if (x.style.display === "none") {
x.style.display = "block";
n.value = "Close";
n.value = " Back";
} else {
x.style.display = "none";
n.value = "Add Leave Form";
......
......@@ -62,7 +62,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
console.log($scope.lfdto);
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/add",
url : "http://localhost:8080/timesheet/leaveform/add",
data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
......@@ -86,7 +86,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
function update(){
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/update",
url : "http://localhost:8080/timesheet/leaveform/update",
data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
......@@ -101,7 +101,7 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
function updateStatus(lf){
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/"+lf.id+"/status",
url : "http://localhost:8080/timesheet/leaveform/"+lf.id+"/status",
// data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
......
......@@ -5,7 +5,7 @@ angular.module("myApp").controller("leaveFormDetailController", function($scope,
console.log("Leave Form Detail Controller");
$http({
method : 'GET',
url : "http://localhost:8080/employee/leaveform/" + $stateParams.id
url : "http://localhost:8080/timesheet/leaveform/" + $stateParams.id
}).then(function successCallback(response) {
console.log(response);
$scope.leaveFormDetail=response.data;
......@@ -17,7 +17,7 @@ angular.module("myApp").controller("leaveFormDetailController", function($scope,
function updateStatus(id){
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/"+id+"/status",
url : "http://localhost:8080/timesheet/leaveform/"+id+"/status",
}).then(function successCallback(response) {
console.log(response);
$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
<div class="card-header">
<i class="fas fa-table"></i> Thành thành viên mới của dự án
</div>
<div class="card-body">
<form ng-controller="insertEmployeeProject" ng-submit="insert_employeeproject(employeeProject)" name="eproject">
<label>Tên Dự Án</label>
<select ng-model="employeeProject.projectId" autofocus="autofocus" required="required">
<option value=""> ==> Tên Dự Án</option>
<option ng-repeat="project in pGroupProject" value="{{project.id}}">{{project.name}}</option>
</select><br/>
<label>Tài khoản nhân viên</label>
<input type="text" ng-model="employeeProject.userName" id="employee"
placeholder="Tài khoản nhân viên" required="required"><br/>
<label>Chức Vụ</label>
<select ng-model="employeeProject.position" autofocus="autofocus"
required="required">
<option value="">==> Chức Vụ</option>
<option value="TeamLead">TeamLead</option>
<option value="Member">Member</option>
</select><br/>
<h1>{{view.message}}</h1>
<div>
<input type="submit" value="Lưu">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
var app = angular.module('myApp');
app.controller('loadGroupProjectByProjectId', loadGroupProjectByProjectId);
app.controller('insertEmployeeProject', insertEmployeeProject);
app.controller('deleteEmployeeProject', deleteEmployeeProject);
app.controller('updateGroutpProject', updateGroutpProject);
app.controller('loadEmployeeProjectDetail', loadEmployeeProjectDetail);
// controlers tạo Get API
function loadGroupProjectByProjectId($scope,$stateParams,$http) {
$http.get('http://localhost:8081/thong-tin-du-an/'+ $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.listGruopProject = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
// tạo controllers insert API
function insertEmployeeProject($scope, $http, $state) {
$scope.insert_employeeproject = function () {
$http({
//khai báo type
method: 'POST',
//đường dẫn API
url: 'http://localhost:8081/them-thanh-vien',
//truyền dữ liệu nhập trên cline vào data
data: angular.toJson($scope.employeeProject),
//kiểu dữ liệu API
headers: {
'Content-Type': 'application/json'
}
// kết quả trả về (THEN)
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if($scope.view.status == 200){
$state.go('groupProjectByProjectId', {ID: $scope.employeeProject.projectId});
}
}
function errorCallback(error) {
console.log("can't insert data!!");
}
}
// get Project
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.pGroupProject = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
};
function deleteEmployeeProject($scope, $window, $http,$state) {
$scope.deleteEmployeeProject = function (gruopProject) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8081/xoa-thanh-vien-du-an',
data: $scope.gruopProject,
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$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;
}
}
function errorCallback(error) {
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
<div class="card-header">
<i class="fas fa-table"></i> Cập nhật chức vụ của nhân viên trong nhóm
</div>
<div class="card-body">
<form ng-controller="updateGroutpProject" ng-submit="updatePositionProject(gruopProject)" name="formProject">
<input type="hidden" ng-model="gruopProject.id" id="id"><br/>
<input type="hidden" ng-model="gruopProject.projectDTO.id" id="idProject"><br/>
<label>Tài khoản nhân viên</label>
<input type="text" ng-model="gruopProject.employeeDTO.username" id="descriptions"
placeholder="Tài khoản nhân viên"
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-header" ng-controller="loadGroupProjectByProjectId">
<i class="fas fa-table" ></i> Thành Viên Trong Nhóm Dự Án <div ng-model="ProjectName.name"></div>
</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ài khoản</th>
<th>Tên</th>
<th>Email</th>
<th>Chức Vụ</th>
<th>Ngày Vào</th>
<th>Ngày Ra</th>
<th>Thao Tác</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="gruopProject in pageGroupListProject">
<td>{{ gruopProject.employeeDTO.username }}</td>
<td>{{ gruopProject.employeeDTO.lastName }}</td>
<td>{{ gruopProject.employeeDTO.email}}</td>
<td>{{ gruopProject.position}}</td>
<td>{{ gruopProject.joinDate | date:"dd/MM/yyyy" }}</td>
<td>{{ gruopProject.outDate | date:"dd/MM/yyyy" }}</td>
<td>
<a ui-sref="editEmployeeProject({ID: gruopProject.id})" class="btn btn-warning btn-circle btn-sm">
Cập Nhật </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="deleteEmployeeProject"
data-ng-click="deleteEmployeeProject(gruopProject)">Xóa Thành Viên</a>
</tr>
</tbody>
</table>
<a ui-sref="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 data-pagination="" data-num-pages="numPages()"
data-current-page="currentPage" data-max-size="maxSize"
data-boundary-links="true">
</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
<div class="container">
Project works
</div>
<div class="card-header">
<i class="fas fa-table"></i> Thêm mới dự án
</div>
<div class="card-body" ng-app="ProjectApiModule">
<div class="card-body">
<form ng-controller="insertProject" ng-submit="insert_project()">
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.name" id="name" class="form-control"
placeholder="Tên Dự Án"
required="required" autofocus="autofocus">
<label for="name">Tên Dự Án</label>
<span>{{lstProject.name}}</span>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="text" ng-model="lstProject.descriptions" id="descriptions"
class="form-control"
placeholder="Mô tả ngắn"
required="required">
<label for="descriptions">Mô tả ngắn</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="lstProject.startDate" id="startDate" class="form-control"
placeholder="Ngày Bắt Đầu" required="required">
<label for="startDate">Ngày Bắt Đầu</label>
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<input type="date" ng-model="lstProject.endDate" id="endDate" class="form-control"
placeholder="nick skype" required="required">
<label for="endDate">Ngày Kết Thuc</label>
</div>
</div>
</div>
</div>
<label>Tên Dự Án</label>
<input type="text" ng-model="project.name" id="name" placeholder="Tên Dự Án"
required="required" style="height: 20px;"><br/>
<label>Mô tả ngắn</label>
<input type="text" ng-model="project.descriptions" id="descriptions" placeholder="Mô tả ngắn"
required="required"><br/>
<label>Ngày bắt đầu</label>
<input type="date" ng-model="project.startDate" id="startDate" placeholder="Ngày Bắt Đầu" required="required"><br/>
<label>Ngày kết thúc</label>
<input type="date" ng-model="project.endDate" id="endDate" placeholder="nick skype" required="required"><br/>
<div>
<input type="submit" value="Lưu">
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
<script src="pages/project/project/projectController.js"></script>
\ No newline at end of file
var app = angular.module('myApp');
app.controller('showProject', showProject);
// app.controller('showProject', showProject);
app.controller('insertProject', insertProject);
app.controller('deleteProject', deleteProject);
app.controller('updateProject', updateProject);
app.controller('loadProjectDetail', loadProjectDetail);
// controlers tạo Get API
function showProject($scope, $http) {
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
function successCallback(response) {
//success code
console.log(response.data);
{
$scope.listProject = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
};
// tạo controllers insert APT
function insertProject($scope, $http) {
// 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
function insertProject($scope, $http, $state) {
$scope.insert_project = function () {
$http({
//khai báo type
method: 'POST',
//đường dẫn API
url: 'http://localhost:8081/quan-tri/them-du-an',
//truyền dữ liệu nhập trên cline vào data
data: angular.toJson($scope.lstProject),
//kiểu dữ liệu API
data: angular.toJson($scope.project),
headers: {
'Content-Type': 'application/json'
}
// kết quả trả về (THEN)
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$window.location.href = 'http://localhost:8081';
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('project');
}
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't insert data!!");
......@@ -52,8 +53,8 @@ function insertProject($scope, $http) {
}
};
//delete project theo id
function deleteProject($scope, $window, $http) {
// delete project theo id
function deleteProject($scope, $window, $http,$state) {
$scope.deleteProject = function (project) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
......@@ -63,22 +64,61 @@ function deleteProject($scope, $window, $http) {
headers: {
'Content-Type': 'application/json'
}
}).then(function (response) {
$window.location.href = 'http://localhost:8081';
}, function (data, status) {
});
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
function errorCallback(error) {
console.log("can't delete data!!");
}
}
};
};
//tạo controller sửa theo id
function updateProject($scope, $http, $state) {
$scope.updateProject = function (project) {
if (confirm("Bạn có muốn sửa không ?")) {
$http({
method: 'PUT',
url: 'http://localhost:8081/quan-tri/sua-du-an',
data: angular.toJson($scope.project),
headers: {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
function successCallback(response) {
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.go('project');
}
}
function errorCallback(error) {
//error code
console.log("can't update data!!");
}
}
};
};
function loadProjectDetail($scope, $stateParams, $http) {
$http.get('http://localhost:8081/quan-tri/chi-tiet-du-an/' + $stateParams.ID).then(successCallback, errorCallback);
//tạo service lấy id của đường dẫn
angular.module('ProjectApiModule.Services', []).factory('projectGetService', function ($resource) {
return $resource('http://localhost:8081/quan-tri/chi-tiet-du-an/:id', {id: '@myCarId'}, {
update: {
method: 'PUT'
}
});
});
function successCallback(response) {
console.log(response.data);
{
$scope.project = response.data
}
}
//service kiểm tra id có tồn tại không
\ No newline at end of file
function errorCallback(error) {
console.log("can't get data!!");
}
}
\ No newline at end of file
<div class="card-header">
<i class="fas fa-table"></i> Sửa Dự Án
</div>
<div class="card-body">
<form ng-controller="updateProject" ng-submit="updateProject(project)" name="formProject">
<label>Tên Dự Án</label>
<input type="text" ng-model="project.name" id="name"
placeholder="Tên Dự Án"
required="required" autofocus="autofocus" name="txtName"><br/>
<label>Mô tả ngắn</label>
<input type="text" ng-model="project.descriptions" id="descriptions"
placeholder="Mô tả ngắn"
required="required" name="txtDescriptions"><br/>
<select ng-model="project.status" autofocus="autofocus"
required="required">
<option value="">==> Trạng Thái</option>
<option value="0">Dự Kiến</option>
<option value="1">Đang Tiến Hành</option>
<option value="2">Đã Hoàn Thành</option>
</select><br/>
<input type="hidden" ng-model="project.id" id="id"><br/>
<div>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
......@@ -3,9 +3,8 @@
<div class="card-header">
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body" ng-app="ProjectApiModule">
<div class="table-responsive" ng-controller="showProject">
<a href="#" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<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">
......@@ -20,20 +19,31 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="project in listProject|filter:search">
<tr ng-repeat="project in pageListProject|filter:search">
<td>{{ project.name }}</td>
<td>{{ project.descriptions }}</td>
<td>{{ project.startDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.endDate | date:"dd/MM/yyyy" }}</td>
<td>{{ project.statusGet }}</td>
<td><a data-ng-href="#" class="btn btn-info btn-circle btn-sm">
Xem </a> <a data-ng-href="#" class="btn btn-warning btn-circle btn-sm">
<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">
Xem </a>
<a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm">
Sửa </a>
<a class="btn btn-danger btn-circle btn-sm" ng-controller="deleteProject"
data-ng-click="deleteProject(project)">Xóa</a>
data-ng-click="deleteProject(project.id)">Xóa</a>
</tr>
</tbody>
</table>
<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>
<!-- <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>
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
/**
*
*/
angular.module("myApp").controller("projectController", function($scope, $http,$window) {
console.log("projectController");
});
\ No newline at end of file
/*
*/
angular.module("myApp").controller("timeSheetController", function($scope, $http,$window) {
console.log("Time Sheet controller");
$scope.ts = {
"title": "",
"content": "",
"note": ""
};
$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);
// };
// }
// };
<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>Trạng thái</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, $state) {
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);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
});
\ No newline at end of file
<script>
function showAddTimeSheetFunction() {
var x = document.getElementById("addDivTS");
var 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">
<div class="row">
<div class="col-sm-6">
<h2><b>TimeSheet</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="addTimeSheet" class="btn btn-success" data-toggle="modal" type="submit" name="addTS" value="Add TimeSheet" onclick="showAddTimeSheetFunction()"/>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="addDivTS" style="display: none">
<h2><b>Add TimeSheet</b></h2>
<table class="table table-striped table-hover">
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="tsdto.title" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.content" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.note" style="width: 100%;"/>
</td>
</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>
<select ng-model="tsdto.eprojectId">
<option value="">Select Project</option>
<option ng-repeat="ep in eProjectList" value="{{ep.id}}">{{ep.project.name}}</option>
</select>
</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" class="btn-primary" data-toggle="modal" value="Confirm" ng-click="save();"/>
<input type="submit" name="clear" class="btn-dark" data-toggle="modal" value="Clear" ng-click="tsdto = null"/>
</td>
</tr>
</table>
</div>
<div id="updateDivTS" style="display: none">
<h2><b>Edit TimeSheet</b></h2>
<table class="table table-striped table-hover">
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="tsdto.title" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.content" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="10000" ng-model="tsdto.note" style="width: 100%;"/>
</td>
</tr>
<tr>
<td></td>
<td >
<input type="submit" class="btn-primary" data-toggle="modal" name="submit" value="Confirm" ng-click="update();"/>
<!-- <input type="submit" class="btn-primary" data-toggle="modal" name="clear" value="Clear" ng-click="tsdto = null"/>-->
<input type="submit" class="btn-dark" data-toggle="modal" name="close" value="Close" onclick="document.getElementById('updateDivTS').style.display = 'none'"/>
</td>
</tr>
</table>
</div>
<div>
<table class="table table-striped table-hover">
<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 | filter: search">
<td>{{$index + 1}}</td>
<td>{{ts.title}}</td>
<td>{{ts.content}}</td>
<td>{{ts.note}}</td>
<td>{{ts.eproject.project.name}}</td>
<td>{{ts.updatedAt}}</td>
<td><a ui-sref="timeSheetDetail({id: ts.id})"data-toggle="modal"><i class="fa fa-eye" data-toggle="tooltip" title="View"></i></a></td>
<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>-->
<!-- <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>
</div>
</div>
</div>
</div>
\ 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