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
0fe58fd7
Commit
0fe58fd7
authored
Jun 15, 2019
by
Phạm Duy Phi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
483f0e7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
129 deletions
+9
-129
src/main/resources/public/pages/timesheet/timeSheetController.js
...n/resources/public/pages/timesheet/timeSheetController.js
+9
-129
No files found.
src/main/resources/public/pages/timesheet/timeSheetController.js
View file @
0fe58fd7
/*
*/
angular
.
module
(
"
myApp
"
).
controller
(
"
timeSheetController
"
,
function
(
$scope
,
$http
,
$state
)
{
angular
.
module
(
"
MyTimeSheet
"
).
controller
(
"
timesheetController
"
,
function
(
$scope
,
$http
,
$window
)
{
console
.
log
(
"
Time Sheet controller
"
);
$scope
.
ts
=
{
"
id
"
:
""
,
"
title
"
:
""
,
"
content
"
:
""
,
"
note
"
:
""
,
"
eproject
"
:
""
,
"
updatedAt
"
:
""
"
note
"
:
""
};
$scope
.
tsdto
=
{
"
id
"
:
""
,
"
title
"
:
""
,
"
content
"
:
""
,
"
note
"
:
""
,
"
eprojectId
"
:
""
,
"
employeeId
"
:
""
};
//get all time sheet
$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
/show
"
url
:
"
http://localhost:8080/eproject/timesheet
"
,
}).
then
(
function
successCallback
(
response
)
{
console
.
log
(
response
)
;
$scope
.
myTimeSheets
=
response
.
data
;
console
.
log
(
response
)
$scope
.
timesheet
=
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
();
});
}
}).
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
);
};
}
};
}]);
\ No newline at end of file
});
\ 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