Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
QLNS_N01
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Văn Hiếu
QLNS_N01
Commits
09b68c7e
Commit
09b68c7e
authored
Jun 06, 2019
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
480f4a72
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
362 additions
and
89 deletions
+362
-89
src/main/java/com/itsol/quantrivanphong/QuantrivanphongApplication.java
...com/itsol/quantrivanphong/QuantrivanphongApplication.java
+2
-0
src/main/java/com/itsol/quantrivanphong/report/timesheet/business/TimeSheetBusiness.java
...vanphong/report/timesheet/business/TimeSheetBusiness.java
+13
-12
src/main/java/com/itsol/quantrivanphong/report/timesheet/controller/TimeSheetController.java
...hong/report/timesheet/controller/TimeSheetController.java
+11
-11
src/main/java/com/itsol/quantrivanphong/report/timesheet/dto/TimeSheetDTO.java
...ol/quantrivanphong/report/timesheet/dto/TimeSheetDTO.java
+2
-1
src/main/java/com/itsol/quantrivanphong/report/timesheet/repository/TimeSheetRepository.java
...hong/report/timesheet/repository/TimeSheetRepository.java
+1
-1
src/main/resources/public/index.html
src/main/resources/public/index.html
+0
-1
src/main/resources/public/js/app.js
src/main/resources/public/js/app.js
+1
-1
src/main/resources/public/pages/timesheet/app.js
src/main/resources/public/pages/timesheet/app.js
+114
-0
src/main/resources/public/pages/timesheet/index.html
src/main/resources/public/pages/timesheet/index.html
+17
-0
src/main/resources/public/pages/timesheet/timesheet.html
src/main/resources/public/pages/timesheet/timesheet.html
+109
-39
src/main/resources/public/pages/timesheet/timesheetController.js
...n/resources/public/pages/timesheet/timesheetController.js
+92
-23
No files found.
src/main/java/com/itsol/quantrivanphong/QuantrivanphongApplication.java
View file @
09b68c7e
...
@@ -2,10 +2,12 @@ package com.itsol.quantrivanphong;
...
@@ -2,10 +2,12 @@ package com.itsol.quantrivanphong;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
@SpringBootApplication
@SpringBootApplication
@EnableJpaAuditing
@EnableJpaAuditing
//@ComponentScan(basePackages = {"com.itsol.quantrivanphong.report.timesheet.controller", "com.itsol.quantrivanphong.report.timesheet.business"})
public
class
QuantrivanphongApplication
{
public
class
QuantrivanphongApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/itsol/quantrivanphong/report/timesheet/business/TimeSheetBusiness.java
View file @
09b68c7e
...
@@ -21,10 +21,10 @@ public class TimeSheetBusiness {
...
@@ -21,10 +21,10 @@ public class TimeSheetBusiness {
EProjectRepository
eProjectRepository
;
EProjectRepository
eProjectRepository
;
@Autowired
@Autowired
EmployeeRepository
employeeRepository
;
EmployeeRepository
employeeRepository
;
public
String
insertTimeSheet
(
int
employee_Id
,
TimeSheetDTO
timeSheetDTO
)
{
public
String
insertTimeSheet
(
TimeSheetDTO
timeSheetDTO
)
{
String
message
;
String
message
;
Employee
employee
=
employeeRepository
.
findEmployeeById
(
employee_Id
);
Employee
employee
=
employeeRepository
.
findEmployeeById
(
timeSheetDTO
.
getEmployeeId
()
);
Eproject
eproject
=
eProjectRepository
.
findEprojectByIdAndEmployee
(
timeSheetDTO
.
getEproject
_i
d
(),
employee
);
Eproject
eproject
=
eProjectRepository
.
findEprojectByIdAndEmployee
(
timeSheetDTO
.
getEproject
I
d
(),
employee
);
if
(
eproject
!=
null
)
{
if
(
eproject
!=
null
)
{
// SimpleDateFormat formatter= new SimpleDateFormat("dd-MM-yyyy HH:mm");
// SimpleDateFormat formatter= new SimpleDateFormat("dd-MM-yyyy HH:mm");
// Date date = new Date(System.currentTimeMillis());
// Date date = new Date(System.currentTimeMillis());
...
@@ -49,14 +49,15 @@ public class TimeSheetBusiness {
...
@@ -49,14 +49,15 @@ public class TimeSheetBusiness {
return
message
;
return
message
;
}
}
public
String
deleteTimeSheet
(
int
employee_Id
,
int
timeSheet_
Id
)
{
public
String
deleteTimeSheet
(
int
timesheet
Id
)
{
String
message
;
String
message
;
Employee
employee
=
employeeRepository
.
findEmployeeById
(
employee_Id
);
// Employee employee = employeeRepository.findEmployeeById(timeSheetDTO.getEmployeeId());
Eproject
eproject
=
eProjectRepository
.
findEprojectByEmployee
(
employee
);
// Eproject eproject = eProjectRepository.findEprojectByEmployee(employee);
TimeSheet
timeSheet
=
timeSheetRepository
.
findTimeSheetByEprojectAndId
(
eproject
,
timeSheet_Id
);
// TimeSheet timeSheet = timeSheetRepository.findTimeSheetByEprojectAndId(eproject, timeSheetDTO.getId());
TimeSheet
timeSheet
=
timeSheetRepository
.
findTimeSheetById
(
timesheetId
);
if
(
timeSheet
!=
null
)
{
if
(
timeSheet
!=
null
)
{
timeSheetRepository
.
delete
(
timeSheet
);
timeSheetRepository
.
delete
(
timeSheet
);
if
(
timeSheetRepository
.
findTimeSheetBy
EprojectAndId
(
eproject
,
timeSheet_
Id
)
==
null
)
{
if
(
timeSheetRepository
.
findTimeSheetBy
Id
(
timesheet
Id
)
==
null
)
{
message
=
"Delete success"
;
message
=
"Delete success"
;
}
else
{
}
else
{
message
=
"Delete failed"
;
message
=
"Delete failed"
;
...
@@ -72,15 +73,15 @@ public class TimeSheetBusiness {
...
@@ -72,15 +73,15 @@ public class TimeSheetBusiness {
}
}
@Transactional
@Transactional
public
String
updateTimeSheet
(
int
employee_Id
,
TimeSheetDTO
timeSheetDTO
,
int
timesheet_Id
)
{
public
String
updateTimeSheet
(
TimeSheetDTO
timeSheetDTO
)
{
String
message
;
String
message
;
Employee
employee
=
employeeRepository
.
findEmployeeById
(
employee_Id
);
Employee
employee
=
employeeRepository
.
findEmployeeById
(
timeSheetDTO
.
getEmployeeId
()
);
Eproject
eproject
=
eProjectRepository
.
findEprojectByEmployee
(
employee
);
Eproject
eproject
=
eProjectRepository
.
findEprojectByEmployee
(
employee
);
TimeSheet
timeSheet
=
timeSheetRepository
.
findTimeSheetByEprojectAndId
(
eproject
,
time
sheet_Id
);
TimeSheet
timeSheet
=
timeSheetRepository
.
findTimeSheetByEprojectAndId
(
eproject
,
time
SheetDTO
.
getId
()
);
if
(
eproject
!=
null
)
{
if
(
eproject
!=
null
)
{
if
(
timeSheet
!=
null
)
{
if
(
timeSheet
!=
null
)
{
int
i
=
timeSheetRepository
.
updateTimeSheet
(
timeSheetDTO
.
getTitle
(),
timeSheetDTO
.
getContent
()
int
i
=
timeSheetRepository
.
updateTimeSheet
(
timeSheetDTO
.
getTitle
(),
timeSheetDTO
.
getContent
()
,
timeSheetDTO
.
getNote
(),
time
sheet_Id
);
,
timeSheetDTO
.
getNote
(),
time
SheetDTO
.
getId
()
);
if
(
i
==
1
)
{
if
(
i
==
1
)
{
message
=
"Update success"
;
message
=
"Update success"
;
}
else
{
}
else
{
...
...
src/main/java/com/itsol/quantrivanphong/report/timesheet/controller/TimeSheetController.java
View file @
09b68c7e
...
@@ -16,13 +16,13 @@ import java.util.List;
...
@@ -16,13 +16,13 @@ import java.util.List;
public
class
TimeSheetController
{
public
class
TimeSheetController
{
@Autowired
@Autowired
TimeSheetBusiness
timeSheetBusiness
;
TimeSheetBusiness
timeSheetBusiness
;
@PostMapping
(
path
=
"/
{employee_Id}/
timesheet"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
@PostMapping
(
path
=
"/timesheet"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
public
ResponseEntity
<
String
>
insertTimeSheet
(
@PathVariable
int
employee_Id
,
@Valid
@RequestBody
TimeSheetDTO
timeSheetDTO
)
{
public
ResponseEntity
<
String
>
addTimeSheet
(
@RequestBody
TimeSheetDTO
timeSheetDTO
)
{
String
message
;
String
message
;
try
{
try
{
if
(
timeSheetDTO
.
getTitle
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Tiêu đề không được để trống"
);
if
(
timeSheetDTO
.
getTitle
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Tiêu đề không được để trống"
);
if
(
timeSheetDTO
.
getContent
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Nội dung không được để trống"
);
if
(
timeSheetDTO
.
getContent
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Nội dung không được để trống"
);
message
=
timeSheetBusiness
.
insertTimeSheet
(
employee_Id
,
timeSheetDTO
);
message
=
timeSheetBusiness
.
insertTimeSheet
(
timeSheetDTO
);
}
catch
(
InputException
e
)
{
}
catch
(
InputException
e
)
{
message
=
e
.
getMessage
();
message
=
e
.
getMessage
();
}
}
...
@@ -30,24 +30,24 @@ public class TimeSheetController {
...
@@ -30,24 +30,24 @@ public class TimeSheetController {
return
ResponseEntity
.
ok
(
message
);
return
ResponseEntity
.
ok
(
message
);
}
}
@DeleteMapping
(
"/
{employee_Id}/timesheet/{timesheet_
Id}"
)
@DeleteMapping
(
"/
timesheet/delete/{timesheet
Id}"
)
public
ResponseEntity
<
String
>
deleteTimeSheet
(
@PathVariable
int
employee_Id
,
@Valid
@PathVariable
int
timesheet_
Id
)
{
public
ResponseEntity
<
String
>
deleteTimeSheet
(
@PathVariable
int
timesheet
Id
)
{
return
ResponseEntity
.
ok
(
timeSheetBusiness
.
deleteTimeSheet
(
employee_Id
,
timesheet_
Id
));
return
ResponseEntity
.
ok
(
timeSheetBusiness
.
deleteTimeSheet
(
timesheet
Id
));
}
}
@GetMapping
(
path
=
"/timesheet"
)
@GetMapping
(
path
=
"/timesheet
/show
"
)
public
List
<
TimeSheet
>
showAllTimeSheet
()
{
public
List
<
TimeSheet
>
showAllTimeSheet
()
{
return
timeSheetBusiness
.
findAll
();
return
timeSheetBusiness
.
findAll
();
}
}
@PostMapping
(
path
=
"/
{employee_Id}/timesheet/{timesheet_Id}
"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
@PostMapping
(
path
=
"/
timesheet/update
"
,
consumes
=
"application/json"
,
produces
=
"application/json"
)
public
ResponseEntity
<
String
>
updateTimeSheet
(
@
PathVariable
int
employee_Id
,
@PathVariable
int
timesheet_Id
,
@Valid
@
RequestBody
TimeSheetDTO
timeSheetDTO
)
{
public
ResponseEntity
<
String
>
updateTimeSheet
(
@RequestBody
TimeSheetDTO
timeSheetDTO
)
{
String
message
;
String
message
;
try
{
try
{
if
(
timeSheetDTO
.
getTitle
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Tiêu đề không được để trống"
);
if
(
timeSheetDTO
.
getTitle
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Tiêu đề không được để trống"
);
if
(
timeSheetDTO
.
getContent
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Nội dung không được để trống"
);
if
(
timeSheetDTO
.
getContent
().
trim
().
equals
(
""
))
throw
new
InputException
(
"Nội dung không được để trống"
);
message
=
timeSheetBusiness
.
updateTimeSheet
(
employee_Id
,
timeSheetDTO
,
timesheet_Id
);
message
=
timeSheetBusiness
.
updateTimeSheet
(
timeSheetDTO
);
}
catch
(
InputException
e
)
{
}
catch
(
InputException
e
)
{
message
=
e
.
getMessage
();
message
=
e
.
getMessage
();
}
}
...
@@ -62,7 +62,7 @@ public class TimeSheetController {
...
@@ -62,7 +62,7 @@ public class TimeSheetController {
// return ResponseEntity.ok(message);
// return ResponseEntity.ok(message);
// }
// }
@GetMapping
(
"/
{employee_Id}/timesheet
"
)
@GetMapping
(
"/
timesheet/show/{employee_Id}
"
)
public
ResponseEntity
<
List
<
TimeSheet
>>
showTimeSheetById
(
@PathVariable
int
employee_Id
)
{
public
ResponseEntity
<
List
<
TimeSheet
>>
showTimeSheetById
(
@PathVariable
int
employee_Id
)
{
return
ResponseEntity
.
ok
(
timeSheetBusiness
.
findTimeSheetById
(
employee_Id
));
return
ResponseEntity
.
ok
(
timeSheetBusiness
.
findTimeSheetById
(
employee_Id
));
}
}
...
...
src/main/java/com/itsol/quantrivanphong/report/timesheet/dto/TimeSheetDTO.java
View file @
09b68c7e
...
@@ -9,10 +9,11 @@ import lombok.NoArgsConstructor;
...
@@ -9,10 +9,11 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@NoArgsConstructor
public
class
TimeSheetDTO
{
public
class
TimeSheetDTO
{
private
int
id
;
private
int
id
;
private
int
employeeId
;
private
String
title
;
private
String
title
;
private
String
content
;
private
String
content
;
private
String
note
;
private
String
note
;
private
String
checked
;
private
String
checked
;
private
boolean
status
;
private
boolean
status
;
private
int
eproject
_i
d
;
private
int
eproject
I
d
;
}
}
src/main/java/com/itsol/quantrivanphong/report/timesheet/repository/TimeSheetRepository.java
View file @
09b68c7e
...
@@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.Query;
...
@@ -9,7 +9,7 @@ import org.springframework.data.jpa.repository.Query;
import
java.util.List
;
import
java.util.List
;
public
interface
TimeSheetRepository
extends
JpaRepository
<
TimeSheet
,
Integer
>
{
public
interface
TimeSheetRepository
extends
JpaRepository
<
TimeSheet
,
Integer
>
{
//
TimeSheet findTimeSheetById(int id);
TimeSheet
findTimeSheetById
(
int
id
);
// @Query("select ts from TimeSheet ts order by ts.createdAt desc")
// @Query("select ts from TimeSheet ts order by ts.createdAt desc")
// List<TimeSheet> getAllTimeSheet();
// List<TimeSheet> getAllTimeSheet();
...
...
src/main/resources/public/index.html
View file @
09b68c7e
...
@@ -32,7 +32,6 @@ Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, Sony
...
@@ -32,7 +32,6 @@ Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, Sony
<!--End khai báo controllers-->
<!--End khai báo controllers-->
</head>
</head>
<body
ng-app=
"myApp"
>
<body
ng-app=
"myApp"
>
<!--start-main-->
<div
class=
"container"
>
<div
class=
"container"
>
...
...
src/main/resources/public/js/app.js
View file @
09b68c7e
...
@@ -78,4 +78,4 @@ angular.module("myApp", ["ui.router"]).config(function($stateProvider, $urlRoute
...
@@ -78,4 +78,4 @@ angular.module("myApp", ["ui.router"]).config(function($stateProvider, $urlRoute
}
}
})
})
});
});
\ No newline at end of file
src/main/resources/public/pages/timesheet/app.js
0 → 100644
View file @
09b68c7e
// /**
// *
// */
// angular.module("myApp", ["ui.router"]).config(function($stateProvider, $urlRouterProvider,$locationProvider) {
//
// $locationProvider.hashPrefix('');
// $urlRouterProvider.otherwise("/index");
//
// $stateProvider
//
// //index layout riêng
// .state("index", {
// url: "/index",
// views:{
// "index":{
// templateUrl: "pages/index/index.htm",
// controller: "indexController"
// },
// "banner":{
// templateUrl: "pages/index/banner.htm"
// }
// }
// })
//
// // State chứa layout chung cho các trang
// .state('app', {
// abstract: true,
// views: {
// 'main_layout': {
// templateUrl: 'main_layout.html',
// }
// }
// })
//
// // Các state bên dưới kế thừa state app
//
// .state("tintuc", { // Khai báo một state
// parent: 'app',
// url: "/tintuc", // URL hiển thị
// views:{
// "content":{
// templateUrl: "pages/tintuc/tintuc.htm",
// controller: "tintucController" // khai báo controller
// }
// }
// })
//
// .state("tuyendung", {
// parent: 'app',
// url: "/tuyendung",
// views:{
// "content":{
// templateUrl: "pages/tuyendung/tuyendung.htm",
// controller: "tuyendungController"
// }
// }
// })
//
// // .state("lienhe", {
// // parent: 'app',
// // url: "/lienhe",
// // views:{
// // "content":{
// // templateUrl: "pages/lienhe/lienhe.htm",
// // controller: "lienheController"
// // }
// // }
// // })
//
// .state("gioithieu", {
// parent: 'app',
// url: "/gioithieu",
// views:{
// "content":{
// templateUrl: "pages/gioithieu/gioithieu.htm",
// controller: "gioithieuController"
// }
// }
// })
//
// });
//
//--------------------Phi--------------------------------
const
report
=
angular
.
module
(
'
quantrivanphong
'
,
[
'
ngRoute
'
]);
report
.
config
(
function
(
$routeProvider
)
{
$routeProvider
.
when
(
'
/timesheet
'
,
{
templateUrl
:
'
timesheet.html
'
,
controller
:
'
showTimeSheetController
'
})
});
report
.
controller
(
'
showTimeSheetController
'
,
function
(
$scope
,
$http
)
{
$scope
.
timesheet
=
{
"
id
"
:
""
,
"
title
"
:
""
,
"
content
"
:
""
,
"
note
"
:
""
,
"
eproject
"
:
""
,
"
createdAt
"
:
""
};
$http
({
method
:
'
GET
'
,
url
:
"
http://localhost:8080/eproject/timesheet/show
"
,
}).
then
(
function
successCallback
(
response
)
{
console
.
log
(
response
);
$scope
.
timesheets
=
response
.
data
;
},
function
errorCallback
(
response
)
{
console
.
log
(
response
)
});
});
src/main/resources/public/pages/timesheet/index.html
0 → 100644
View file @
09b68c7e
<!DOCTYPE html>
<html
lang=
"en"
ng-app =
"quantrivanphong"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
Report
</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.7.8/angular.min.js"
></script>
<script
src=
"app.js"
></script>
</head>
<body>
<div
ng-view
></div>
</body>
</html>
\ No newline at end of file
src/main/resources/public/pages/timesheet/timesheet.html
View file @
09b68c7e
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
ng-app=
"MyTimeSheet"
ng-controller=
"timesheetController"
>
<html
lang=
"en"
>
<head>
<head>
<meta
charset=
"UTF-8"
>
<meta
charset=
"UTF-8"
>
<title>
Time Sheet
</title>
<title>
Time Sheet
</title>
...
@@ -11,58 +11,128 @@
...
@@ -11,58 +11,128 @@
<script
src=
"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"
></script>
<script
src=
"https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"
></script>
<script
src=
"timesheetController.js"
></script>
<script
src=
"timesheetController.js"
></script>
<!-- <script>-->
<!-- function myFunction() {-->
<!-- const x = document.getElementById("mydiv");-->
<!-- if (x.style.display === "none") {-->
<!-- x.style.display = "block";-->
<!-- } else {-->
<!-- x.style.display = "none";-->
<!-- }-->
<!-- }-->
<!-- </script>-->
</head>
</head>
<body>
<body
ng-controller=
"showTimeSheetController"
>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-md-8"
>
<div
class=
"col-md-8"
>
<div>
<!-- <div>-->
<legend>
Create Time Sheet
</legend>
<!-- <legend>Create Time Sheet</legend>-->
<table>
<!-- <table>-->
<tr>
<!-- <tr>-->
<td><label>
Title
</label></td>
<!-- <td><label>Title</label></td>-->
<td>
<!-- <td>-->
<input
type=
"text"
maxlength=
"29"
ng-model=
"ts.title"
/>
<!-- <input type="text" maxlength="29" ng-model="tsdto.title"/>-->
</td>
<!-- </td>-->
</tr>
<!-- </tr>-->
<tr>
<!-- <tr>-->
<td><label>
Content
</label></td>
<!-- <td><label>Content</label></td>-->
<td>
<!-- <td>-->
<input
type=
"text"
maxlength=
"29"
ng-model=
"ts.content"
/>
<!-- <input type="text" maxlength="29" ng-model="tsdto.content"/>-->
</td>
<!-- </td>-->
</tr>
<!-- </tr>-->
<tr>
<!-- <tr>-->
<td><label>
Note
</label></td>
<!-- <td><label>Note</label></td>-->
<td>
<!-- <td>-->
<input
type=
"text"
maxlength=
"29"
ng-model=
"ts.note"
/>
<!-- <input type="text" maxlength="29" ng-model="tsdto.note"/>-->
</td>
<!-- </td>-->
</tr>
<!-- </tr>-->
</table>
<!-- <tr>-->
</div>
<!-- <td><label>Employee Id</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdto.employeeId"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Employee Project Id</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdto.eprojectId"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td></td>-->
<!-- <td>-->
<!-- <input type="submit" name="submit" value="Submit" ng-click="save();"/>-->
<!-- <input type="submit" name="clear" value="Clear" ng-click="tsdto = null"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<!-- </div>-->
<div>
<div>
<table
class=
"table"
>
<table
class=
"table"
>
<thead>
<thead>
<tr>
<tr>
<th>
ID
</th>
<th>
ID
</th>
<th>
Title
</th>
<th>
Title
</th>
<th>
Content
</th>
<th>
Content
</th>
<th>
Note
</th>
<th>
Note
</th>
</tr>
<th>
Employee Project Id
</th>
<th>
Created at
</th>
</tr>
</thead>
</thead>
<tbody>
<tbody>
<tr
class=
"vide"
ng-repeat=
"ts in timesheet"
>
<tr
class=
"showTimeSheet"
ng-repeat=
"timesheet in timesheets"
>
<td>
{{$index + 1}}
</td>
<td>
{{$index + 1}}
</td>
<td>
{{ts.title}}
</td>
<td>
{{timesheet.title}}
</td>
<td>
{{ts.content}}
</td>
<td>
{{timesheet.content}}
</td>
<td>
{{ts.note}}
</td>
<td>
{{timesheet.note}}
</td>
<td>
{{timesheet.eproject.project.name}}
</td>
<td>
{{timesheet.createdAt}}
</td>
<!-- <td><a href="#" ng-click="update(emp);">Update</a>--
>
<td><a
href=
"#"
onclick=
"myFunction()"
ng-click=
"update(timesheet);"
>
Update
</a
>
<!-- <td><a href="#" confirmed-click="delete(employee);" ng-confirm-click=" Do you want to delete this user?">Delete</a></td>--
>
<td><a
href=
"http://localhost:8080/pages/timesheet/timesheet.html"
ng-click=
"delete(timesheet);"
>
Delete
</a></td
>
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
</div>
</div>
<!-- <div id="mydiv" style="display: none">-->
<!-- <legend>Update Time Sheet</legend>-->
<!-- <table>-->
<!-- <tr>-->
<!-- <td><label>Employee Id</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdtou.employeeId"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Title</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdtou.title"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Content</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdtou.content"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td><label>Note</label></td>-->
<!-- <td>-->
<!-- <input type="text" maxlength="29" ng-model="tsdtou.note"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>-->
<!-- <input type="submit" name="update" value="Update" ng-click="updatedto();"/>-->
<!-- <input type="submit" name="clear" value="Clear" ng-click="tsdtou = null"/>-->
<!-- </td>-->
<!-- </tr>-->
<!-- </table>-->
<!-- </div>-->
</div>
</div>
</div>
</div>
</div>
</div>
...
...
src/main/resources/public/pages/timesheet/timesheetController.js
View file @
09b68c7e
//
//
//
angular
.
module
(
"
MyTimeSheet
"
,[]).
controller
(
"
timesheetController
"
,
function
(
$scope
,
$http
,
$window
)
{
// angular.module("MyTimeSheet",[]).controller("timesheetController", function($scope, $http, $window) {
console
.
log
(
"
Time Sheet controller
"
);
// console.log("Time Sheet controller");
//
$scope
.
ts
=
{
// $scope.ts = {
"
title
"
:
""
,
// "id": "",
"
content
"
:
""
,
// "title": "",
"
note
"
:
""
// "content": "",
};
// "note": "",
// "eproject": "",
$http
({
// "createdAt": ""
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
"
,
// $scope.tsdto = {
}).
then
(
function
successCallback
(
response
)
{
// "title": "",
console
.
log
(
response
)
// "content": "",
$scope
.
timesheet
=
response
.
data
;
// "note": "",
},
function
errorCallback
(
response
)
{
// "employeeId": "",
console
.
log
(
response
)
// "eprojectId": ""
});
// };
});
//
\ No newline at end of file
// $scope.tsdtou = {
// "id": "",
// "title": "",
// "content": "",
// "note": "",
// "employeeId": ""
// };
//
// $http({
// method : 'GET',
// url : "http://localhost:8080/eproject/timesheet/show",
// }).then(function successCallback(response) {
// console.log(response);
// $scope.timesheet = response.data;
// }, function errorCallback(response) {
// console.log(response)
// });
//
//
// $scope.save = save;
// function save(){
// console.log($scope.tsdto);
// $http({
// method : 'POST',
// url : "http://localhost:8080/eproject/timesheet",
// data: $scope.tsdto
// }).then(function successCallback(response) {
// console.log(response);
// $window.location.href ='http://localhost:8080/#/eproject/timesheet';
// }, function errorCallback(response) {
// console.log(response)
// });
// }
//
//
// $scope.update = function (ts) {
// $scope.tsdtou.id = ts.id;
// $scope.tsdtou.title = ts.title;
// $scope.tsdtou.content = ts.content;
// $scope.tsdtou.note = ts.note;
// };
//
// $scope.updatedto = function () {
// console.log($scope.tsdtou);
// $http({
// method : 'POST',
// url : 'http://localhost:8080/eproject/timesheet/update',
// data: $scope.tsdtou
// }).then(function successCallback(response) {
// console.log(response);
// $window.location.href ='http://localhost:8080/eproject/timesheet#!';
// }, function errorCallback(response) {
// console.log(response)
// });
// };
//
//
// $scope.delete = function (ts) {
// $http({
// method : 'DELETE',
// url : 'http://localhost:8080/eproject/timesheet/delete/'+ts.id,
// }).then(function successCallback(response) {
// console.log(response);
// $window.location.href ='http://localhost:8080/#/eproject/timesheet#!';
// }, function errorCallback(response) {
// console.log(response)
// });
// }
// });
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment