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

t

parent 049511c3
...@@ -44,7 +44,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony ...@@ -44,7 +44,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
` `
<!-- end anguarjs app--> <!-- end anguarjs app-->
<link href="css/custom.css" rel="stylesheet"> <link href="css/custom.css" rel="stylesheet">
<!--//Metis Menu -->
<style> <style>
#chartdiv { #chartdiv {
width: 100%; width: 100%;
...@@ -414,6 +414,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony ...@@ -414,6 +414,7 @@ SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony
</div> </div>
<!-- //header-ends --> <!-- //header-ends -->
<!-- main content start--> <!-- main content start-->
<div id="page-wrapper"> <div id="page-wrapper">
<div class="main-page"> <div class="main-page">
<div ui-view="layout"> <div ui-view="layout">
......
...@@ -6333,7 +6333,7 @@ defaults._set('bar', { ...@@ -6333,7 +6333,7 @@ defaults._set('bar', {
defaults._set('horizontalBar', { defaults._set('horizontalBar', {
hover: { hover: {
mode: 'index', mode: 'public.index',
axis: 'y' axis: 'y'
}, },
...@@ -6389,7 +6389,7 @@ defaults._set('horizontalBar', { ...@@ -6389,7 +6389,7 @@ defaults._set('horizontalBar', {
return datasetLabel + ': ' + item.xLabel; return datasetLabel + ': ' + item.xLabel;
} }
}, },
mode: 'index', mode: 'public.index',
axis: 'y' axis: 'y'
} }
}); });
......
...@@ -51,21 +51,21 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct ...@@ -51,21 +51,21 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
.state("timeSheet", { .state("timeSheet", {
parent: 'layout2', parent: 'layout1',
url: "/timesheet", url: "/timesheet",
views: { views: {
"content": { "content": {
templateUrl: "/pages/timesheet/timeSheet.html", templateUrl: "pages/timesheet/timeSheet.html",
controller: "timeSheetController" controller: "timeSheetController"
} }
} }
}) })
.state("timeSheetDetail", { .state("timeSheetDetail", {
parent: 'layout2', parent: 'layout1',
url: "/timesheetdetail/:id", url: "/timesheetdetail/:id",
views: { views: {
"content": { "content": {
templateUrl: "/pages/timesheet/timeSheetDetail.html", templateUrl: "pages/timesheet/timeSheetDetail.html",
controller: "timeSheetDetailController" controller: "timeSheetDetailController"
} }
} }
...@@ -75,7 +75,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct ...@@ -75,7 +75,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
url: "/leaveform", url: "/leaveform",
views: { views: {
"content": { "content": {
templateUrl: "/pages/leaveform/leaveForm.html", templateUrl: "pages/leaveform/leaveForm.html",
controller: "leaveFormController" controller: "leaveFormController"
} }
} }
...@@ -86,7 +86,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct ...@@ -86,7 +86,7 @@ angular.module("myApp", ["ngAnimate", "ui.router", "ui.bootstrap"]).config(funct
url: "/leaveformdetail/:id", url: "/leaveformdetail/:id",
views: { views: {
"content": { "content": {
templateUrl: "/pages/leaveform/leaveFormDetail.html", templateUrl: "pages/leaveform/leaveFormDetail.html",
controller: "leaveFormDetailController" controller: "leaveFormDetailController"
} }
} }
......
<div> <div>
<a ui-sref="employees"></a> <a ui-sref="employees"></a>
<!-- <a ui-sref="report"></a>--> <a ui-sref="report"></a>
<!-- <a ui-sref="project"></a>--> <a ui-sref="project"></a>
<div ui-view="content"> <div ui-view="content">
</div> </div>
......
<div> <div>
<div ui-view="content"> <div ui-view="content">
layout 2
</div> </div>
</div> </div>
<script>
function showAddLeaveFormFunction() {
const x = document.getElementById("addDivLF");
const n = document.getElementById("addLeaveForm");
if (x.style.display === "none") {
x.style.display = "block";
n.value = "Close";
} else {
x.style.display = "none";
n.value = "Add Leave Form";
}
}
</script>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><b>Leave Form</b></h2>
<label>
Search: <input type="text" ng-model="search" placeholder="Search" style="color: black; margin: 10px"/>
</label>
</div>
<div class="col-sm-6">
<input id="addLeaveForm" class="btn btn-success" type="submit" name="addTS" value="Add Leave Form" data-toggle="modal" onclick="showAddLeaveFormFunction()"/>
</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 leaveForms | filter: search">
<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>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
angular.module("myApp").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:8080/employee/leaveform/show"
}).then(function successCallback(response) {
console.log(response);
$scope.leaveForms=response.data;
}, function errorCallback(response) {
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({
method : 'DELETE',
url : "http://localhost:8080/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:8080/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:8080/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:8080/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="col-sm-12">
<div>
<br><br>
<div>
<tr>
<legend><p>Tiêu đề</p>{{leaveFormDetail.title}}</legend>
<h3>Nội dung</h3>
<td>{{leaveFormDetail.content}}</td>
</tr>
</div>
<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="Quay lại" ui-sref="leaveForm"/>
</tr>
</div>
<br><br>
</div>
</div>
</div>
</div>
\ No newline at end of file
/*
*/
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
}).then(function successCallback(response) {
console.log(response);
$scope.leaveFormDetail=response.data;
}, function errorCallback(response) {
console.log(response)
});
$scope.updateStatus = updateStatus;
function updateStatus(id){
$http({
method : 'POST',
url : "http://localhost:8080/employee/leaveform/"+id+"/status",
}).then(function successCallback(response) {
console.log(response);
$state.reload();
}, function errorCallback(response) {
console.log(response);
$state.reload();
});
}
});
\ No newline at end of file
<!DOCTYPE html>
<html lang="en" ng-app="MyTimeSheet" 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="../../js/angular.js"></script>-->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<script src="timesheetController.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-8">
<div>
<legend>Create Time Sheet</legend>
<table>
<tr>
<td><label>Title</label></td>
<td>
<input type="text" maxlength="29" ng-model="ts.title"/>
</td>
</tr>
<tr>
<td><label>Content</label></td>
<td>
<input type="text" maxlength="29" ng-model="ts.content"/>
</td>
</tr>
<tr>
<td><label>Note</label></td>
<td>
<input type="text" maxlength="29" ng-model="ts.note"/>
</td>
</tr>
</table>
</div>
<div>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Content</th>
<th>Note</th>
</tr>
</thead>
<tbody>
<tr class="vide" ng-repeat="ts in timesheet">
<td>{{$index + 1}}</td>
<td>{{ts.title}}</td>
<td>{{ts.content}}</td>
<td>{{ts.note}}</td>
<!-- <td><a href="#" ng-click="update(emp);">Update</a>-->
<!-- <td><a href="#" confirmed-click="delete(employee);" ng-confirm-click=" Do you want to delete this user?">Delete</a></td>-->
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
angular.module("MyTimeSheet").controller("timesheetController", function($scope, $http,$window) {
console.log("Time Sheet controller");
$scope.ts = {
"title": "",
"content": "",
"note": ""
};
$http({
header : 'Access-Control-Allow-Origin: http://localhost:63342/MockProject_01/public/pages/timesheet/timesheet.html?_ijt=ee540pqfq7tplkmo9mjj447ne',
method : 'GET',
url : "http://localhost:8080/eproject/timesheet",
}).then(function successCallback(response) {
console.log(response)
$scope.timesheet=response.data;
}, function errorCallback(response) {
console.log(response)
});
});
\ 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