Commit 392c9e18 authored by Phạm Duy Phi's avatar Phạm Duy Phi

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

# Conflicts:
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/application.properties
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/log4j.properties
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/public/fonts/glyphicons-halflings-regular.eot
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/public/fonts/glyphicons-halflings-regular.ttf
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/public/fonts/glyphicons-halflings-regular.woff
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/public/fonts/glyphicons-halflings-regular.woff2
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/public/js/angular-route.js
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/public/js/angular-ui-router.min.js
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/public/js/jquery-3.2.1.min.js
#	classes/artifacts/quantrivanphong_war_exploded/WEB-INF/classes/static/admin/js/Chart.js
#	src/main/resources/public/index.html
#	src/main/resources/public/pages/employee/createEmployee.html
parents 24e27c4f 3cff4d6d
This diff is collapsed.
angular.module("myApp").controller('IssuesShowController', function ($scope,$stateParams,$http,$state,$filter) {
//lấy danh sách +phân trang+tìm kiếm
$scope.ListIssues = [];
$scope.currentPage = 1;
$scope.numPerPage = 3;
$scope.maxSize = 5;
$scope.numberOfPage = numberOfPage;
$scope.dataHasLoaded = false;
//mới thêm
$scope.makeEmployee = function () {
$scope.ListIssues = [];
for (i = 1; i <= 100; i++) {
$scope.ListIssues.push({text: 'issue ' + i, done: false});
}
};
$scope.keyword = "";
$scope.getAll = getAll;
$scope.getTotalItems = getTotalItems;
getAll();
function getTotalItems() {
return $filter('filter')($scope.ListIssues, {'title': $scope.keyword}).length;
}
$scope.pageChangedIndex = function(){
console.log($scope.currentPage);
}
function numberOfPage() {
return Math.ceil($scope.ListIssues.length / $scope.numPerPage);
};
function getAll() {
$http.get('http://localhost:8081/danh-sach-issues').then(successCallback, errorCallback);
function successCallback(response) {
console.log(response.data);
{
$scope.ListIssues = response.data;
}
}
}
function errorCallback(error) {
//error code
console.log("can't get data!!");
}
//end
//update
$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" ng-controller="showComment()" ng-repeat="comment in CommentIssues">
<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="container">
<div class="row">
<div class="col-md-8">
<tr>
<td><a ui-sref="addIssues" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h4></h4>
<tr></tr>
<input class="search" ng-model="keyword" type="text" placeholder="Search" ng-change="currentPage =1">
<tr></tr>
<h2>Danh Sách Issue</h2>
<table class="table">
<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 ListIssues| filter:{title:keyword} |lmto:3:3*(currentPage-1) track by $index">
<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 style="width: 200px">
<a ui-sref="IssuesComment({IssuesId : issue.id})" class="btn btn-info btn-circle btn-sm">
Chi Tiết </a>
<a ng-click="updateIssues(issue)">
<button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="IssuesDeleteController"
data-ng-click="IssuesDelete(issue)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
</tr>
</tbody>
</table>
<uib-pagination total-items="getTotalItems()" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pageChangedIndex()" rotate="true"
items-per-page="numPerPage"></uib-pagination>
</div>
</div>
</div>
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) {
$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() {
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()"/>
<div class="col-sm-4 pull-right">
<label>PageSize:</label>
<select ng-value="leaveFormPerPage" ng-model="leaveFormPerPage" class="form-control">
<option>3</option>
<option>5</option>
<option>50</option>
<option>100</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div id="addDivLF" style="display: none">
<h2><b>Add Leave Form</b></h2>
<table class="table table-striped table-hover">
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="lfdto.title" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="lfdto.content" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Employee Id</label></td>
<td>
<input type="text" maxlength="10" value="" ng-model="lfdto.employeeId"/>
</td>
</tr>
<tr>
<td><label>Leave Type Id</label></td>
<td>
<!-- <input type="text" maxlength="10" value="" ng-model="lfdto.leaveTypeId" 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>
<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-danger" data-toggle="modal" value="Clear" ng-click="lfdto = null"/>
</td>
</tr>
</table>
</div>
<div id="updateDivLF" style="display: none">
<h2><b>Edit Leave Form</b></h2>
<table class="table table-striped table-hover">
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="300" ng-model="lfdto.title" style="width: 100%;"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="10000" ng-model="lfdto.content" 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-danger" data-toggle="modal" name="clear" value="Clear" ng-click="lfdto = null"/>-->
<input type="submit" class="btn-dark" data-toggle="modal" name="close" value="Close" onclick="document.getElementById('updateDivLF').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>Employee</th>
<th>Leave Type</th>
<th>Create At</th>
<th>Status</th>
<th colspan="4"></th>
</tr>
</thead>
<tbody>
<tr class="lff" ng-repeat="lf in searched = (leaveFormList | filter:search | orderBy : base :reverse) | beginningLeaveForm:(currentPage-1)*leaveFormPerPage | limitTo:leaveFormPerPage">
<td>{{$index + 1}}</td>
<td>{{lf.title}}</td>
<td>{{lf.content}}</td>
<td>{{lf.employee.lastName}}</td>
<td>{{lf.leaveType.name}}</td>
<td>{{lf.updatedAt}}</td>
<td id="checkStatus">{{lf.status}}</td>
<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 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>
</div>
<div class="col-md-12" ng-show="filterLeaveForm == 0">
<div class="col-md-12">
<h4>No records found..</h4>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 pull-left">
<h5>Showing {{ searched.length }} of {{ entireLeaveForm}} entries</h5>
</div>
<uib-pagination total-items="filterLeaveForm" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pagePosition(currentPage)" rotate="true"
items-per-page="leaveFormPerPage"></uib-pagination>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp")
.filter('beginningLeaveForm', function() {
return function(input, begin) {
if (input) {
begin = +begin;
return input.slice(begin);
}
return [];
}
})
.controller("leaveFormController", function($scope, $http, $state) {
console.log("Leave Form controller");
$scope.lf = {
"id": "",
"title": "",
"content": "",
"employee": "",
"leaveType": "",
"updatedAt": "",
"status": ""
};
$scope.lfdto = {
"id": "",
"title": "",
"content": "",
"employeeId": "",
"leaveTypeId": ""
};
//get all leave form
$http({
method : 'GET',
url : "http://localhost:8081/employee/leaveform/show"
}).then(function successCallback(response) {
console.log(response);
$scope.leaveFormList = response.data;
$scope.currentPage = 1;
$scope.leaveFormPerPage = 3;
$scope.filterLeaveForm = $scope.leaveFormList.length;
$scope.entireLeaveForm = $scope.leaveFormList.length;
}, function errorCallback(response) {
console.log(response)
});
$scope.pagePosition = function(pageNumber) {
$scope.currentPage = pageNumber;
};
$scope.filter = function() {
$timeout(function() {
$scope.filterLeaveForm = $scope.searched.length;
}, 20);
};
$scope.sortWith = function(base) {
$scope.base = base;
$scope.reverse = !$scope.reverse;
};
//get all leave type
$http({
method : 'GET',
url : "http://localhost:8081/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({
method : 'DELETE',
url : "http://localhost:8081/employee/leaveform/delete/" + lf.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.lfdto);
$http({
method : 'POST',
url : "http://localhost:8081/employee/leaveform/add",
data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
$scope.getLf = getLf;
function getLf(lf) {
$scope.lfdto.id = lf.id;
$scope.lfdto.title = lf.title;
$scope.lfdto.content = lf.content;
$scope.lfdto.employeeId = lf.employee.id;
$scope.lfdto.leaveTypeId = lf.leaveType.id;
}
$scope.update = update;
function update(){
$http({
method : 'POST',
url : "http://localhost:8081/employee/leaveform/update",
data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
$scope.updateStatus = updateStatus;
function updateStatus(lf){
$http({
method : 'POST',
url : "http://localhost:8081/employee/leaveform/"+lf.id+"/status",
// data: $scope.lfdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
});
<div class="container">
<div class="row">
<div class="row">
<form ng-controller="insertEmployeeProject" ng-submit="insert_employeeproject(employeeProject)" name="eproject">
<h1 style="text-align: center">Thành thành viên mới của dự án</h1>
<div class="form-row">
<div class="col">
<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>
<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">
<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>
</div>
</div>
<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>
</div>
</div>
\ No newline at end of file
<div class="container">
<div class="row">
<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">
<label>Chức Vụ</label>
<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>
</div>
\ No newline at end of file
<div class="container">
<div class="row">
<div class="col-md-8">
<tr>
<td><a ui-sref="addEmployeeProject" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h4></h4>
<tr></tr>
<input type="text" ng-model="search" placeholder="Search" style="margin-bottom: 10px;">
<tr></tr>
<h2 style="text-align: center">Thành Viên Trong Nhóm Dự Án</h2>
<table class="table">
<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 listGruopProject |filter:search| lmto:3:3*(currentPage-1) track by $index">
<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 style="width: 200px">
<a ui-sref="editEmployeeProject({ID: gruopProject.id})">
<button class="btn btn-primary btn-xs" data-title="Cập Nhật" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="deleteEmployeeProject"
data-ng-click="deleteEmployeeProject(gruopProject)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
</tr>
</tbody>
</table>
<uib-pagination total-items="getTotalItems()" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pageChangedIndex()" rotate="true"
items-per-page="numPerPage"></uib-pagination>
</div>
<button type="button" ui-sref="project">Back</button>
</div>
</div>
\ No newline at end of file
angular.module("myApp").controller('groupProjectShowController', function ($scope,$stateParams,$http,$filter) {
$scope.listGruopProject = [];
$scope.currentPage = 1;
$scope.numPerPage = 3;
$scope.maxSize = 5;
$scope.numberOfPage = numberOfPage;
$scope.dataHasLoaded = false;
$scope.getAll = getAll;
$scope.getTotalItems = getTotalItems;
getAll();
function getTotalItems() {
return $filter('filter')($scope.listGruopProject).length;
}
$scope.pageChangedIndex = function(){
console.log($scope.currentPage);
}
function numberOfPage() {
return Math.ceil($scope.listGruopProject.length / $scope.numPerPage);
};
function getAll() {
$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) {
//error code
console.log("can't get data!!");
}
}
});
\ No newline at end of file
<div class="container">
<div class="row">
<form ng-controller="updateProject" ng-submit="updateProject(project)" name="formProject">
<h1 style="text-align: center">Cập nhật dự án dự án</h1>
<div class="form-row">
<div class="col">
<label>Tên Dự Án</label>
<input type="text" maxlength="29" ng-model="project.name" required="required"/>
<label>Mô tả ngắn</label>
<input type="text" maxlength="29" ng-model="project.descriptions" required="required"/>
<label>Trạng Thái</label>
<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>
</div>
<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>
</div>
<div class="container">
<div class="row">
<div class="col-md-8">
<tr>
<td><a ui-sref="addproject" class="btn btn-success" data-toggle="modal"><i
class="fa fa-user-plus"></i> <span>Thêm Dự Án Mới</span></a></a></td>
</tr>
<h4></h4>
<tr></tr>
<!-- <input type="text" ng-model="search" placeholder="Search">-->
<input class="search" ng-model="keyword" type="text" placeholder="Search" ng-change="currentPage =1">
<tr></tr>
<h2 style="text-align: center">Thông tin dự án</h2>
<table class="table">
<thead>
<tr>
<th>Tên Dự Án</th>
<th>Mô tả ngắn</th>
<th>Ngày bắt đầu</th>
<th>Hạn giao</th>
<th>Trạng Thái</th>
<th style="width: 250px">Thao Tác</th>
</tr>
</thead>
<tbody>
<tr class="vide"
ng-repeat="project in listProject| filter:{name:keyword} | lmto:3:3*(currentPage-1) track by $index">
<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>
<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>
<!-- thao tác-->
<td style="width: 250px">
<a ui-sref="groupProjectByProjectId({ID: project.id})" class="btn btn-info btn-circle btn-sm">
Chi Tiết Nhóm</a>
<a ui-sref="editproject({ID: project.id})">
<button class="btn btn-primary btn-xs" data-title="Edit" data-toggle="modal"
data-target="#edit"><span class="glyphicon glyphicon-pencil"></span></button>
</a>
<a ng-controller="deleteProject" data-ng-click="deleteProject(project.id)">
<button class="btn btn-danger btn-xs" data-title="Delete" data-toggle="modal"
data-target="#delete">
<span class="glyphicon glyphicon-trash"></span></button>
</a>
</td>
</tr>
</tbody>
</table>
<uib-pagination total-items="getTotalItems()" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pageChangedIndex()" rotate="true"
items-per-page="numPerPage"></uib-pagination>
</div>
</div>
</div>
angular.module("myApp").controller('projectViewsController', function ($scope, $http,$filter) {
$scope.listProject = [];
$scope.currentPage = 1;
$scope.numPerPage = 3;
$scope.maxSize = 5;
$scope.numberOfPage = numberOfPage;
$scope.dataHasLoaded = false;
//mới thêm
$scope.makeEmployee = function () {
$scope.listProject = [];
for (i = 1; i <= 100; i++) {
$scope.listProject.push({text: 'project ' + i, done: false});
}
};
$scope.keyword = "";
//mới thêm
$scope.getAll = getAll;
$scope.getTotalItems = getTotalItems;
getAll();
function getTotalItems() {
return $filter('filter')($scope.listProject, {'name': $scope.keyword}).length;
}
$scope.pageChangedIndex = function(){
console.log($scope.currentPage);
}
function numberOfPage() {
return Math.ceil($scope.listProject.length / $scope.numPerPage);
};
function getAll() {
$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) {
console.log("can't get data!!");
}
}
});
\ No newline at end of file
/*
*/
angular.module("myApp")
.filter('beginningTimeSheet', function() {
return function(input, begin) {
if (input) {
begin = +begin;
return input.slice(begin);
}
return [];
}
})
.controller("timeSheetController", function($scope, $http, $state) {
console.log("Time Sheet controller");
$scope.ts = {
"title": "",
"content": "",
"note": ""
};
$scope.tsdto = {
"id": "",
"title": "",
"content": "",
"note": "",
"eprojectId": "",
"employeeId": ""
};
//get all time sheet
$http({
method: 'GET',
url: "http://localhost:8081/eproject/timesheet/show"
}).then(function successCallback(response) {
console.log(response);
$scope.timeSheetList = response.data;
$scope.currentPage = 1;
$scope.timeSheetPerPage = 3;
$scope.filterTimeSheet = $scope.timeSheetList.length;
$scope.entireTimeSheet = $scope.timeSheetList.length;
}, function errorCallback(response) {
console.log(response)
});
$scope.pagePosition = function(pageNumber) {
$scope.currentPage = pageNumber;
};
$scope.filter = function() {
$timeout(function() {
$scope.filterTimeSheet = $scope.searched.length;
}, 20);
};
$scope.sortWith = function(base) {
$scope.base = base;
$scope.reverse = !$scope.reverse;
};
//get all eproject
$http({
method: 'GET',
url: "http://localhost:8081/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:8081/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:8081/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:8081/eproject/timesheet/update",
data: $scope.tsdto
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
});
<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 class="col-sm-4 pull-right">
<label>PageSize:</label>
<select ng-value="timeSheetPerPage" ng-model="timeSheetPerPage" class="form-control">
<option>3</option>
<option>5</option>
<option>50</option>
<option>100</option>
</select>
</div>
</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>Project</th>
<th>Create at</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<tr class="tss" ng-repeat="ts in searched = (timeSheetList | filter:search | orderBy : base :reverse) | beginningTimeSheet:(currentPage-1)*timeSheetPerPage | limitTo:timeSheetPerPage">
<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 class="col-md-12" ng-show="filterTimeSheet == 0">
<div class="col-md-12">
<h4>No records found..</h4>
</div>
</div>
<div class="col-md-12">
<div class="col-md-6 pull-left" ng-show="filterTimeSheet > 0">
<h5>Showing {{ searched.length }} of {{ entireTimeSheet}} entries</h5>
</div>
<uib-pagination total-items="filterTimeSheet" boundary-link-numbers="true" ng-model="currentPage"
ng-change="pagePosition(currentPage)" rotate="true"
items-per-page="timeSheetPerPage"></uib-pagination>
</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