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

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

# Conflicts:
#	pom.xml
#	src/main/resources/public/index.html
#	src/main/resources/public/pages/timesheet/timeSheetController.js
parents 53b79821 fcb3554c
......@@ -18,9 +18,13 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<<<<<<< HEAD
<<<<<<< HEAD
=======
<java.version>1.8</java.version>
>>>>>>> 049511c3b37f668c637022150c53bd25d9b8e61d
=======
<java.version>1.8</java.version>
>>>>>>> fcb3554c9480d927d3ff072584217224ddd37db6
</properties>
<dependencies>
......@@ -28,50 +32,45 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<<<<<<< HEAD
=======
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
>>>>>>> ed09ed47f5d092a7753469913def1ab676073023
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<<<<<<< HEAD
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
<version>1.2.17</version>
</dependency>
<<<<<<< HEAD
<<<<<<< HEAD
=======
>>>>>>> ed09ed47f5d092a7753469913def1ab676073023
=======
=======
>>>>>>> fcb3554c9480d927d3ff072584217224ddd37db6
<!-- <dependency>-->
<!-- <groupId>org.springframework.security</groupId>-->
<!-- <artifactId>spring-security-config</artifactId>-->
......@@ -79,7 +78,10 @@
<!-- <scope>runtime</scope>-->
<!-- </dependency>-->
<<<<<<< HEAD
>>>>>>> 049511c3b37f668c637022150c53bd25d9b8e61d
=======
>>>>>>> fcb3554c9480d927d3ff072584217224ddd37db6
</dependencies>
<build>
......
......@@ -449,7 +449,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">Project Name</a>
<a class="navbar-brand" href="index.html">Project Name</a>
</div>
<div class="collapse navbar-collapse bs-example-js-navbar-scrollspy">
<ul class="nav navbar-nav">
......
......@@ -138,13 +138,19 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
}
=======
<script src="pages/employee/employeeController.js"></script>
<!-- <script src="pages/project/projectController.js"></script>-->
<script src="pages/leaveform/leaveFormController.js"></script>
<script src="pages/homepage/homeController.js"></script>
<script src="pages/timesheet/timeSheetController.js"></script>
<script src="pages/timesheet/timeSheetDetailController.js"></script>
<script src="pages/leaveform/leaveFormDetailController.js"></script>
<script src="pages/employee/createEmployeeController.js"></script>
<link data-require="bootstrap-css@2.3.2" data-semver="2.3.2" rel="stylesheet"
href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css"/>
`
<!-- end anguarjs app-->
<link href="css/custom.css" rel="stylesheet">
<!--//Metis Menu -->
<style>
#chartdiv {
width: 100%;
......@@ -204,6 +210,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
});
});
</script>
<<<<<<< HEAD
<<<<<<< HEAD
<!-- Js -->
......@@ -785,5 +792,11 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
</footer>
>>>>>>> 14cbe76ccc34395abe463875cb178d2c872e3f85
</div>
=======
</head>
<body class="cbp-spmenu-push" ng-app="myApp">
<div ui-view="layout"></div>
>>>>>>> fcb3554c9480d927d3ff072584217224ddd37db6
</body>
</html>
\ No newline at end of file
......@@ -6333,7 +6333,7 @@ defaults._set('bar', {
defaults._set('horizontalBar', {
hover: {
mode: 'index',
mode: 'public.index',
axis: 'y'
},
......@@ -6389,7 +6389,7 @@ defaults._set('horizontalBar', {
return datasetLabel + ': ' + item.xLabel;
}
},
mode: 'index',
mode: 'public.index',
axis: 'y'
}
});
......
......@@ -227,48 +227,88 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
=======
.state("timeSheet", {
parent: 'layout2',
url: "/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: "/leaveform",
views: {
"content": {
templateUrl: "/pages/timesheet/timeSheet.html",
controller: "timeSheetController"
templateUrl: "pages/leaveform/leaveForm.html",
controller: "leaveFormController"
}
}
})
.state("timeSheetDetail", {
parent: 'layout2',
url: "/timesheetdetail/:id",
.state("leaveFormDetail", {
parent: 'layout1',
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"
}
}
})
});
......
<div>
<div class="main-content">
<div class="cbp-spmenu cbp-spmenu-vertical cbp-spmenu-left" id="cbp-spmenu-s1">
<!--left-fixed -navigation-->
<aside class="sidebar-left">
<nav class="navbar navbar-inverse">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".collapse"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<h1>
<a class="navbar-brand" href="index.html">
<i class="fa fa-users" aria-hidden="true"></i>
Human
<span
class="dashboard_text">Resource Management
</span>
</a>
</h1>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="sidebar-menu">
<li class="header">MAIN NAVIGATION</li>
<li class="treeview">
<a ui-sref="employees">
<i class="fa fa-user" aria-hidden="true"></i>
<span>Employee</span>
</a>
</li>
<li class="treeview">
<!-- <a ui-sref="project">-->
<i class="fa fa-laptop"></i>
<span>Project</span>
<a ui-sref="employees"></a>
<!-- <a ui-sref="report"></a>-->
<!-- <a ui-sref="project"></a>-->
<div ui-view="content">
</li>
<li class="treeview">
<li class="treeview">
<a ui-sref="news">
<i class="fa fa-newspaper-o" aria-hidden="true"></i>
<span>News</span>
</a>
</li>
<li>
<a ui-sref="leaveform">
<i class="fa fa-file-text-o" aria-hidden="true"></i>
<span>Leave From</span>
</a>
<a href="/employee/leavefrom.html"></a>
</li>
<li class="treeview">
<a ui-sref="timesheet" >
<i class="fa fa-edit"></i>
<span>Timesheet</span>
</a>
</li>
<
<li class="treeview">
<a href="#">
<i class="fa fa-envelope"></i>
<span>Mailbox</span>
<i class="fa fa-angle-left pull-right"></i>
<small class="label pull-right label-info1">08</small>
<span class="label label-primary1 pull-right">02</span>
</a>
<ul class="treeview-menu">
<li>
<a href="inbox.html">
<i class="fa fa-angle-right"></i>
Mail Inbox
</a>
</li>
<li>
<a href="compose.html">
<i class="fa fa-angle-right"></i>
Compose Mail
</a>
</li>
</ul>
</li>
<li class="treeview">
<a href="#">
<i class="fa fa-folder"></i>
<span>Examples</span>
<i class="fa fa-angle-left pull-right"></i>
</a>
<ul class="treeview-menu">
<li>
<a href="login.html">
<i class="fa fa-angle-right"></i>
Login
</a>
</li>
<li>
<a href="signup.html">
<i class="fa fa-angle-right"></i>
Register
</a>
</li>
<li>
<a href="blank-page.html">
<i class="fa fa-angle-right"></i>
Blank Page
</a>
</li>
</ul>
</li>
<li class="header">LABELS</li>
<li>
<a href="#">
<i class="fa fa-angle-right text-red"></i>
<span>Important</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-angle-right text-yellow"></i>
<span>Warning</span>
</a>
</li>
<li>
<a href="#">
<i class="fa fa-angle-right text-aqua"></i>
<span>Information</span>
</a>
</li>
</ul>
</div>
</nav>
</aside>
</div>
<!-- header-starts -->
<div class="sticky-header header-section ">
<div class="header-left">
<button id="showLeftPush">
<i class="fa fa-bars"></i>
</button>
<div class="profile_details_left">
<ul class="nofitications-dropdown">
<li class="dropdown head-dpdn">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i
class="fa fa-envelope"></i>
<span class="badge">4</span>
</a>
<ul class="dropdown-menu">
<li>
<div class="notification_header">
<h3>You have 3 new messages</h3>
</div>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/1.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li class="odd">
<a href="#">
<div class="user_img">
<img src="images/4.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/3.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/2.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<div class="notification_bottom">
<a href="#">See all messages</a>
</div>
</li>
</ul>
</li>
<li class="dropdown head-dpdn">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i
class="fa fa-bell"></i>
<span class="badge blue">4</span>
</a>
<ul class="dropdown-menu">
<li>
<div class="notification_header">
<h3>You have 3 new notification</h3>
</div>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/4.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li class="odd">
<a href="#">
<div class="user_img">
<img src="images/1.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/3.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<a href="#">
<div class="user_img">
<img src="images/2.jpg" alt="">
</div>
<div class="notification_desc">
<p>Lorem ipsum dolor amet</p>
<p>
<span>1 hour ago</span>
</p>
</div>
<div class="clearfix"></div>
</a>
</li>
<li>
<div class="notification_bottom">
<a href="#">See all notifications</a>
</div>
</li>
</ul>
</li>
<li class="dropdown head-dpdn">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<i
class="fa fa-tasks"></i>
<span class="badge blue1">8</span>
</a>
<ul class="dropdown-menu">
<li>
<div class="notification_header">
<h3>You have 8 pending task</h3>
</div>
</li>
<li>
<a href="#">
<div class="task-info">
<span class="task-desc">Database update</span>
<span class="percentage">40%</span>
<div class="clearfix"></div>
</div>
<div class="progress progress-striped active">
<div class="bar yellow" style="width:40%;"></div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info">
<span class="task-desc">Dashboard done</span>
<span class="percentage">90%</span>
<div class="clearfix"></div>
</div>
<div class="progress progress-striped active">
<div class="bar green" style="width:90%;"></div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info">
<span class="task-desc">Mobile App</span>
<span class="percentage">33%</span>
<div class="clearfix"></div>
</div>
<div class="progress progress-striped active">
<div class="bar red" style="width: 33%;"></div>
</div>
</a>
</li>
<li>
<a href="#">
<div class="task-info">
<span class="task-desc">Issues fixed</span>
<span class="percentage">80%</span>
<div class="clearfix"></div>
</div>
<div class="progress progress-striped active">
<div class="bar blue" style="width: 80%;"></div>
</div>
</a>
</li>
<li>
<div class="notification_bottom">
<a href="#">See all pending tasks</a>
</div>
</li>
</ul>
</li>
</ul>
<div class="clearfix"></div>
</div>
<!--notification menu end -->
<div class="clearfix"></div>
</div>
</nav>
<!-- /.Navbar-->
<div class="header-right">
<!--search-box-->
<div class="search-box">
<form class="input">
<input class="sb-search-input input__field--madoka" placeholder="Search..." type="search"
id="input-31"/>
<label class="input__label" for="input-31">
<svg class="graphic" width="100%" height="100%" viewBox="0 0 404 77" preserveAspectRatio="none">
<path d="m0,0l404,0l0,77l-404,0l0,-77z"/>
</svg>
</label>
</form>
</div>
<!--//end-search-box-->
<!-- -->
<div class="profile_details">
<ul>
<li class="dropdown profile_details_drop">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<div class="profile_img">
<span class="prfil-img"><img src="images/2.jpg" alt=""> </span>
<div class="user-name">
<p>Admin Name</p>
<span>Administrator</span>
</div>
<i class="fa fa-angle-down lnr"></i>
<i class="fa fa-angle-up lnr"></i>
<div class="clearfix"></div>
</div>
</a>
<ul class="dropdown-menu drp-mnu">
<li>
<a href="#">
<i class="fa fa-cog"></i>
Settings
</a>
</li>
<li>
<a href="#">
<i class="fa fa-user"></i>
My Account
</a>
</li>
<li>
<a href="#">
<i class="fa fa-suitcase"></i>
Profile
</a>
</li>
<li>
<a href="#">
<i class="fa fa-sign-out"></i>
Logout
</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
</div>
<!-- //header-ends -->
<!-- main content start-->
<div id="page-wrapper">
<div class="main-page">
<div ui-view="content">
</div>
</div>
</div>
<!--footer-->
<div class="content">
</div>
<footer id="myFooter">
<div class="container">
<div class="row">
<div class="col-sm-3 myCols">
<h5>Get started</h5>
<ul>
<li>
<a href="#">Home</a>
</li>
<li>
<a href="#">Sign up</a>
</li>
<li>
<a href="#">Downloads</a>
</li>
</ul>
</div>
<div class="col-sm-3 myCols">
<h5>About us</h5>
<ul>
<li>
<a href="#">Company Information</a>
</li>
<li>
<a href="#">Contact us</a>
</li>
<li>
<a href="#">Reviews</a>
</li>
</ul>
</div>
<div class="col-sm-3 myCols">
<h5>Support</h5>
<ul>
<li>
<a href="#">FAQ</a>
</li>
<li>
<a href="#">Help desk</a>
</li>
<li>
<a href="#">Forums</a>
</li>
</ul>
</div>
<div class="col-sm-3 myCols">
<h5>Legal</h5>
<ul>
<li>
<a href="#">Terms of Service</a>
</li>
<li>
<a href="#">Terms of Use</a>
</li>
<li>
<a href="#">Privacy Policy</a>
</li>
</ul>
</div>
</div>
</div>
<div class="social-networks">
<a href="#" class="twitter">
<i class="fa fa-twitter"></i>
</a>
<a href="#" class="facebook">
<i class="fa fa-facebook-official"></i>
</a>
<a href="#" class="google">
<i class="fa fa-google-plus"></i>
</a>
</div>
<!--//footer-->
</footer>
</div>
<div>
<div ui-view="content">
layout 2
</div>
</div>
<!--<link rel="stylesheet" href="../../css/bootstrap-combined.min.css">-->
<div class="container">
<div class="row">
<div class="col-md-8">
......@@ -23,8 +23,8 @@
<td>{{$index + 1}}</td>
<td>{{cata.name}}</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="#" ng-click="update(emp);">Edit</a> </td>
<td><a href="#/management/catagori/{{cata.id}}">Detail</a> </td>
<td><a href="#">Edit</a> </td>
</tr>
</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();
......@@ -35,21 +35,44 @@ angular.module("myApp").controller('homeController', function ($scope,$http, $st
$scope.catagoriById = Catagories.get({}, {myCatagoriesId: $stateParams.myCatagoriId});
//Delete News
$scope.deleteNews = function(newsId,catagoriId) {
if(confirm("Delete?")) {
$scope.deleteNews = function(newsId) {
if (confirm("Delete?")) {
$http({
method: 'DELETE',
url: 'http://localhost:8080/api/HR/catagori/' + catagoriId + '/news/' + newsId,
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
......@@ -13,7 +13,7 @@
{{catagori.name}}
</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
<i class="fs-12 m-l-5 fa fa-caret-right"></i>
</a>
......@@ -21,7 +21,7 @@
<!-- 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="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="row">
<div class="col-md-8">
<div >
<div>
<table class="table">
<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>
......@@ -21,17 +20,18 @@
</tr>
</thead>
<tbody>
<tr class="vide" ng-repeat="new in catagoriById.news">
<tr class="vide" ng-repeat="myNews in catagoriById.news">
<td>{{$index + 1}}</td>
<td>{{new.title}}</td>
<td>{{new.createdAt}}</td>
<td>{{new.content}}</td>
<td><button ng-click="editNews(new,catagoryById.id)">Edit</button> </td>
<td><button ng-click="deleteNews(new.id,catagoryById.id)">Delete</button> </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>
</div>
</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
<!--<!DOCTYPE html>-->
<!--<html lang="en" ng-app="myApp" ng-controller="timesheetController">-->
<!--<head>-->
<!-- <meta charset="UTF-8">-->
<!-- <title>Time Sheet</title>-->
<!-- <meta name="viewport" content="width=device-width, initial-scale=1">-->
<!-- <script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>-->
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"-->
<!-- integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"-->
<!-- crossorigin="anonymous"></script>-->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"-->
<!-- integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">-->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>-->
<!-- <script src="timeSheetController.js"></script>-->
<!--</head>-->
<!--<body>-->
<!--</body>-->
<!--</html>-->
<script>
function showAddLeaveFormFunction() {
var x = document.getElementById("addDivLF");
var n = document.getElementById("addLeaveForm");
if (x.style.display === "none") {
x.style.display = "block";
n.value = " Back";
} else {
x.style.display = "none";
n.value = "Add Leave Form";
}
}
</script>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><b>Leave Form</b></h2>
<label>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label>
</div>
<div class="col-sm-6">
<input id="addLeaveForm" class="btn btn-success" type="submit" name="addTS" value="Add Leave Form" data-toggle="modal" onclick="showAddLeaveFormFunction()"/>
......@@ -50,14 +46,18 @@
<tr>
<td><label>Employee Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="lfdto.employeeId" style="width: 100%;"/>
<input type="text" maxlength="10" value="" ng-model="lfdto.employeeId"/>
</td>
</tr>
<tr>
<td><label>Leave Type Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="lfdto.leaveTypeId" style="width: 100%;"/>
<!-- <input type="text" maxlength="10" value="" ng-model="lfdto.leaveTypeId" style="width: 100%;"/>-->
<select ng-model="lfdto.leaveTypeId">
<option value="">Select Leave Type</option>
<option ng-repeat="lf in leaveTypeList" value="{{lf.id}}">{{lf.name}}</option>
</select>
</td>
</tr>
<tr>
......@@ -109,7 +109,7 @@
</tr>
</thead>
<tbody>
<tr class="lff" ng-repeat="lf in leaveForms">
<tr class="lff" ng-repeat="lf in leaveForms | filter: search">
<td>{{$index + 1}}</td>
<td>{{lf.title}}</td>
<td>{{lf.content}}</td>
......@@ -121,7 +121,7 @@
<td><a ui-sref="leaveFormDetail({id: lf.id})" data-toggle="modal"><i class="fa fa-eye" data-toggle="tooltip" title="View"></i></a></td>
<td><a ui-sref="leaveForm" ng-click="getLf(lf);" onclick="document.getElementById('updateDivLF').style.display = 'block'" class="edit" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Edit">&#xE254;</i></a></td>
<td><a ui-sref="leaveForm" ng-click="delete(lf);" class="delete" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Delete">&#xE872;</i></a></td>
<td><a id="approved" ui-sref="leaveForm" ng-click="updateStatus(lf)" data-toggle="modal"><i class="fa fa-check" data-toggle="tooltip" title="Approved"></i></a></td>
<!-- <td><a ui-sref="leaveForm" ng-click="updateStatus(lf)" data-toggle="modal"><i id="approved" class="fa fa-check" data-toggle="tooltip" title="Approved"></i></a></td>-->
</tr>
</tbody>
</table>
......
/*
*/
angular.module("myApp").controller("leaveFormController", function($scope, $http, $route, $state) {
*/
angular.module("myApp").controller("leaveFormController", function($scope, $http, $state) {
console.log("Leave Form controller");
$scope.lf = {
......@@ -34,6 +33,16 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
console.log(response)
});
//get all leave type
$http({
method : 'GET',
url : "http://localhost:8080/employee/leaveType/getAll"
}).then(function successCallback(response) {
console.log(response);
$scope.leaveTypeList=response.data;
}, function errorCallback(response) {
console.log(response)
});
//delete leave form
$scope.delete = function (lf) {
$http({
......@@ -53,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);
......@@ -77,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);
......@@ -92,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);
......@@ -102,4 +111,5 @@ angular.module("myApp").controller("leaveFormController", function($scope, $http
$state.reload();
});
}
});
\ No newline at end of file
});
......@@ -13,7 +13,7 @@
<br><br>
<div>
<tr>
<input type="submit" name="submit" value="Duyệt" ui-sref="leaveForm" ng-click="updateStatus(leaveFormDetail.id)"/>
<!-- <input type="submit" name="submit" value="Duyệt" ui-sref="leaveForm" ng-click="updateStatus(leaveFormDetail.id)"/>-->
<input type="submit" name="submit" value="Quay lại" ui-sref="leaveForm"/>
</tr>
</div>
......
/*
*/
*/
angular.module("myApp").controller("leaveFormDetailController", function($scope, $http, $stateParams, $state) {
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;
......@@ -18,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
......@@ -3,53 +3,26 @@
</div>
<div class="card-body">
<form ng-controller="insertEmployeeProject" ng-submit="insert_employeeproject(employeeProject)" name="eproject">
<div class="form-group">
<div class="form-row">
<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 ng-repeat="project in pGroupProject" value="{{project.id}}">{{project.name}}
</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.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="TeamLead">TeamLead</option>
<option value="Member">Member</option>
<option value="HR">HR</option>
<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>
<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">Black</button>
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
......@@ -2,6 +2,8 @@ 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);
......@@ -11,14 +13,12 @@ function loadGroupProjectByProjectId($scope,$stateParams,$http) {
$scope.listGruopProject = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
}
// tạo controllers insert API
function insertEmployeeProject($scope, $http, $window) {
function insertEmployeeProject($scope, $http, $state) {
$scope.insert_employeeproject = function () {
$http({
//khai báo type
......@@ -34,29 +34,16 @@ function insertEmployeeProject($scope, $http, $window) {
}
// kết quả trả về (THEN)
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$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) {
//error code
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
$http.get("http://localhost:8081/quan-tri/danh-sach-du-an").then(successCallback, errorCallback);
......@@ -72,7 +59,7 @@ function insertEmployeeProject($scope, $http, $window) {
console.log("can't get data!!");
}
};
function deleteEmployeeProject($scope, $window, $http) {
function deleteEmployeeProject($scope, $window, $http,$state) {
$scope.deleteEmployeeProject = function (gruopProject) {
if (confirm("Bạn có chắc chắn muốn xóa ?")) {
$http({
......@@ -83,17 +70,52 @@ function deleteEmployeeProject($scope, $window, $http) {
'Content-Type': 'application/json'
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$window.location.reload();
$scope.view = response.data;
if($scope.view.status == 200){
// $window.location.reload();
$state.reload();
}
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't delete data!!");
}
}
};
};
\ No newline at end of file
};
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ 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">
<i class="fas fa-table"></i> Danh Sách Dự Án
<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" ng-controller="loadGroupProjectByProjectId">
<a ui-sref="addEmployeeProject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm thành viên</a>
<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">
......@@ -21,7 +22,7 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="gruopProject in listGruopProject">
<tr ng-repeat="gruopProject in pageGroupListProject">
<td>{{ gruopProject.employeeDTO.username }}</td>
<td>{{ gruopProject.employeeDTO.lastName }}</td>
<td>{{ gruopProject.employeeDTO.email}}</td>
......@@ -29,14 +30,19 @@
<td>{{ gruopProject.joinDate | date:"dd/MM/yyyy" }}</td>
<td>{{ gruopProject.outDate | date:"dd/MM/yyyy" }}</td>
<td>
<a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm">
Sửa </a>
<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>
data-ng-click="deleteEmployeeProject(gruopProject)">Xóa Thành Viên</a>
</tr>
</tbody>
</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 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
......@@ -3,50 +3,21 @@
</div>
<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="project.name" id="name" class="form-control"
placeholder="Tên Dự Án"
required="required" autofocus="autofocus">
<label for="name">Tên Dự Án</label>
</div>
</div>
<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>
<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>
<h1>{{view.message}}</h1>
<input type="submit" value="Save">
<input type="reset" value="Reset">
<button type="button" ui-sref="project">Black</button>
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ 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) {
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
function insertProject($scope, $http, $window,$state) {
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.project),
//kiểu dữ liệu API
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/#/project";
$state.go('project');
$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!!");
......@@ -66,15 +66,14 @@ function deleteProject($scope, $window, $http,$state) {
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
// $state.go('project');
$window.location.reload();
$scope.view = response.data;
if ($scope.view.status == 200) {
$state.reload();
}
}
//tạo funtion kiểm tra nếu thất bại
function errorCallback(error) {
//error code
console.log("can't delete data!!");
}
}
......@@ -82,7 +81,7 @@ function deleteProject($scope, $window, $http,$state) {
};
//tạo controller sửa theo id
function updateProject($scope, $window, $http,$state) {
function updateProject($scope, $http, $state) {
$scope.updateProject = function (project) {
if (confirm("Bạn có muốn sửa không ?")) {
$http({
......@@ -94,13 +93,13 @@ function updateProject($scope, $window, $http,$state) {
}
}).then(successCallback, errorCallback);
//tạo funtion nếu thành công!
function successCallback(response) {
$state.go('project');
// $window.location.href = "http://localhost:8081/#/project";
$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 update data!!");
......@@ -108,17 +107,18 @@ 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 successCallback(response) {
console.log(response.data);
{
$scope.project = response.data
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
function loadProjectDetail($scope, $stateParams, $http) {
$http.get('http://localhost:8081/quan-tri/chi-tiet-du-an/' + $stateParams.ID).then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.project = response.data
}
}
function errorCallback(error) {
console.log("can't get data!!");
}
}
\ No newline at end of file
......@@ -3,69 +3,27 @@
</div>
<div class="card-body">
<form ng-controller="updateProject" ng-submit="updateProject(project)" name="formProject">
<div class="form-group">
<div class="form-row">
<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"
required="required" autofocus="autofocus" name="txtName">
<label for="name">Tên Dự Án</label>
</div>
</div>
<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" name="txtDescriptions">
<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="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="0">Dự Kiến</option>
<option value="1">Đang Tiến Hành</option>
<option value="2">Đã Hoàn Thành</option>
</select>
</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 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>
<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">Black</button>
<button type="button" ui-sref="project">Back</button>
</div>
</form>
</div>
\ No newline at end of file
......@@ -4,8 +4,7 @@
<i class="fas fa-table"></i> Danh Sách Dự Án
</div>
<div class="card-body">
<div class="table-responsive" ng-controller="showProject">
<a ui-sref="addproject" class="btn btn-primary btn-circle btn-sm" style="margin-bottom: 10px;"> Thêm </a>
<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,12 +19,16 @@
</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.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">
Xem </a>
<a ui-sref="editproject({ID: project.id})" class="btn btn-warning btn-circle btn-sm">
......@@ -35,6 +38,12 @@
</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>
</div>
\ No newline at end of file
<!-- <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
<!--<!DOCTYPE html>-->
<!--<html lang="en" ng-app="myApp" ng-controller="timesheetController">-->
<!--<head>-->
<!-- <meta charset="UTF-8">-->
<!-- <title>Time Sheet</title>-->
<!-- <meta name="viewport" content="width=device-width, initial-scale=1">-->
<!-- <script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>-->
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"-->
<!-- integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"-->
<!-- crossorigin="anonymous"></script>-->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"-->
<!-- integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">-->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>-->
<!-- <script src="timeSheetController.js"></script>-->
<!--</head>-->
<!--<body>-->
<!--</body>-->
<!--</html>-->
<script>
function showAddTimeSheetFunction() {
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">
......@@ -25,11 +18,11 @@
<div class="col-sm-6">
<h2><b>TimeSheet</b></h2>
<label>
<input type="text" ng-model="search" placeholder="Search" style="color: black"/>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label>
</div>
<div class="col-sm-6">
<input id="addTimeSheet" class="btn btn-success" data-toggle="modal" type="submit" name="addTS" value="Add" onclick="showAddTimeSheetFunction()"/>
<input id="addTimeSheet" class="btn btn-success" data-toggle="modal" type="submit" name="addTS" value="Add TimeSheet" onclick="showAddTimeSheetFunction()"/>
</div>
</div>
</div>
......
<<<<<<< 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 = {
......@@ -9,6 +14,7 @@ angular.module("MyTimeSheet").controller("timesheetController", function($scope,
"content": "",
"note": ""
};
<<<<<<< HEAD
$http({
header : 'Access-Control-Allow-Origin: http://localhost:63342/MockProject_01/public/pages/timesheet/timesheet.html?_ijt=ee540pqfq7tplkmo9mjj447ne',
......@@ -20,4 +26,177 @@ angular.module("MyTimeSheet").controller("timesheetController", function($scope,
}, function errorCallback(response) {
console.log(response)
});
});
\ No newline at end of file
});
=======
$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
/*
*/
*/
angular.module("myApp").controller("timeSheetDetailController", function($scope, $http, $stateParams, $state) {
console.log("Time Sheet Detail Controller");
......
<!--<!DOCTYPE html>-->
<!--<html lang="en" ng-app="myApp" ng-controller="timesheetController">-->
<!--<head>-->
<!-- <meta charset="UTF-8">-->
<!-- <title>Time Sheet</title>-->
<!-- <meta name="viewport" content="width=device-width, initial-scale=1">-->
<!-- <script src="//unpkg.com/@uirouter/angularjs/release/angular-ui-router.min.js"></script>-->
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"-->
<!-- integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"-->
<!-- crossorigin="anonymous"></script>-->
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"-->
<!-- integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">-->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>-->
<!-- <script src="timeSheetController.js"></script>-->
<!--</head>-->
<!--<body>-->
<!--</body>-->
<!--</html>-->
<script>
function showAddTimeSheetFunction() {
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">
......@@ -25,11 +18,11 @@
<div class="col-sm-6">
<h2><b>TimeSheet</b></h2>
<label>
<input type="text" ng-model="search" placeholder="Search" style="color: black"/>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label>
</div>
<div class="col-sm-6">
<input id="addTimeSheet" class="btn btn-success" data-toggle="modal" type="submit" name="addTS" value="Add" onclick="showAddTimeSheetFunction()"/>
<input id="addTimeSheet" class="btn btn-success" data-toggle="modal" type="submit" name="addTS" value="Add TimeSheet" onclick="showAddTimeSheetFunction()"/>
</div>
</div>
</div>
......@@ -59,15 +52,21 @@
</tr>
<tr>
<td><label>Employee Project Id</label></td>
<!-- <td>-->
<!-- <input type="text" maxlength="10" value="" ng-model="tsdto.eprojectId" style="width: 100%;"/>-->
<!-- </td>-->
<td>
<input type="text" maxlength="10" value="" ng-model="tsdto.eprojectId" style="width: 100%;"/>
<select ng-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" style="width: 100%;"/>
<input type="text" maxlength="10" value="" ng-model="tsdto.employeeId"/>
</td>
</tr>
<tr>
......@@ -126,7 +125,7 @@
</tr>
</thead>
<tbody>
<tr class="tss" ng-repeat="ts in myTimeSheets | limitTo:numLimit:start">
<tr class="tss" ng-repeat="ts in myTimeSheets | limitTo:numLimit:start | filter: search">
<td>{{$index + 1}}</td>
<td>{{ts.title}}</td>
<td>{{ts.content}}</td>
......@@ -138,11 +137,10 @@
<td><a ui-sref="timeSheet" ng-click="getTs(ts);" onclick="document.getElementById('updateDivTS').style.display = 'block'"class="edit" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Edit">&#xE254;</i></a></td>
<td><a ui-sref="timeSheet" ng-click="delete(ts);"class="delete" data-toggle="modal"><i class="material-icons" data-toggle="tooltip" title="Delete">&#xE872;</i></a></td>
</tr>
<tr>
<td colspan="9" style='text-align: center'><span>Page# {{currentPage}} of {{pages}}</span>
<span style="float:left;padding:5px"><a ng-hide="hidePrev()" href="" ng-click="PrevPage()">Prev</a></span>
<span style="float:right;padding:5px"><a ng-hide="hideNext()" href="" ng-click="nextPage()">Next</a></span></td>
</tr>
<!-- <tr>-->
<!-- <h6><code>rotate</code> defaulted to <code>true</code> and <code>force-ellipses</code> set to <code>true</code>:</h6>-->
<!-- <ul uib-pagination total-items="getAllTimesheet()" ng-model="currentPage" max-size="maxSize" class="pagination-sm" boundary-link-number="true" ng-change ="pageChangedIndex()" items-per-page = "timesheetPerPage" ></ul>-->
<!-- </tr>-->
</tbody>
</table>
</div>
......
<<<<<<< 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 = {
......@@ -9,6 +14,7 @@ angular.module("MyTimeSheet").controller("timesheetController", function($scope,
"content": "",
"note": ""
};
<<<<<<< HEAD
$http({
header : 'Access-Control-Allow-Origin: http://localhost:63342/MockProject_01/public/pages/timesheet/timesheet.html?_ijt=ee540pqfq7tplkmo9mjj447ne',
......@@ -20,4 +26,177 @@ angular.module("MyTimeSheet").controller("timesheetController", function($scope,
}, function errorCallback(response) {
console.log(response)
});
});
\ No newline at end of file
});
=======
$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