Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
internship
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
Valentin Skripnikov
internship
Commits
b0acfdc3
Commit
b0acfdc3
authored
Feb 08, 2018
by
Alina Habibulina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ time period
parent
2aaa9b5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
1 deletion
+90
-1
src/main/webapp/js/Player.js
src/main/webapp/js/Player.js
+90
-1
No files found.
src/main/webapp/js/Player.js
View file @
b0acfdc3
...
...
@@ -81,6 +81,13 @@ var portal = {
createPlayer
:
function
(){
portal
.
clearPlayer
();
portal
.
player
=
AS
.
FORMS
.
createPlayer
();
AS
.
FORMS
.
bus
.
on
(
AS
.
FORMS
.
EVENT_TYPE
.
formShow
,
function
(
event
,
model
,
view
)
{
if
(
model
.
formCode
===
"
timesheet
"
)
{
model
.
on
(
AS
.
FORMS
.
EVENT_TYPE
.
dataLoad
,
function
()
{
portal
.
main
(
portal
.
player
.
view
.
getViewWithId
(
"
main_script
"
),
portal
.
player
.
model
.
getModelWithId
(
"
main_script
"
));
});
}
});
AS
.
FORMS
.
ApiUtils
.
simpleAsyncGet
(
'
rest/api/registry/create_doc?registryCode=registry_timesheets
'
,
function
(
result
){
if
(
result
.
errorCode
!=
"
0
"
)
{
AS
.
SERVICES
.
hideWaitWindow
();
...
...
@@ -92,7 +99,9 @@ var portal = {
portal
.
player
.
view
.
setEditable
(
true
);
portal
.
player
.
showFormData
(
result
.
documentID
,
0
,
result
.
dataUUID
);
portal
.
player
.
view
.
appendTo
(
$
(
'
#form_player_div
'
));
}},
'
json
'
);
}
},
'
json
'
);
},
saveData
:
function
(){
...
...
@@ -113,9 +122,89 @@ var portal = {
ShowMessage
(
"
Данные сохранены
"
);
}
});
},
main
:
function
(
view
,
model
)
{
var
serverDateTime
=
portal
.
player
.
model
.
getModelWithId
(
"
ts_date_created
"
).
value
;
var
serverDate
=
serverDateTime
.
substr
(
0
,
serverDateTime
.
length
-
9
);
var
serverWeekDay
=
new
Date
(
serverDate
).
getDay
();
switch
(
serverWeekDay
){
case
0
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
7
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
1
));
// 1й день пндк нашей недели
break
;
case
1
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
6
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
0
));
// 1й день пндк нашей недели
break
;
case
2
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
5
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
1
)));
// 1й день пндк нашей недели
break
;
case
3
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
4
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
2
)));
// 1й день пндк нашей недели
break
;
case
4
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
3
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
3
)));
// 1й день пндк нашей недели
break
;
case
5
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
2
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
4
)));
// 1й день пндк нашей недели
break
;
case
6
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
1
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
5
)));
// 1й день пндк нашей недели
break
;
case
7
:
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_to
"
).
setValue
(
WeekCalculating
(
serverDate
,
0
));
//0 день воскресение прошлой недели
portal
.
player
.
model
.
getModelWithId
(
"
ts_period_date_from
"
).
setValue
(
WeekCalculating
(
serverDate
,
(
-
6
)));
// 1й день пндк нашей недели
break
;
}
function
WeekCalculating
(
fullDate
,
shift
){
var
year
=
fullDate
.
substr
(
0
,
(
fullDate
.
length
-
6
));
var
month
=
fullDate
.
substr
(
5
,
(
fullDate
.
length
));
month
=
month
.
substr
(
0
,
(
month
.
length
-
3
));
var
day
=
fullDate
.
substr
(
8
,
fullDate
.
length
);
day
=
parseInt
(
day
)
+
shift
;
switch
(
month
){
case
"
01
"
:
case
"
03
"
:
case
"
05
"
:
case
"
07
"
:
case
"
08
"
:
case
"
10
"
:
case
"
12
"
:
if
(
parseInt
(
day
)
>
31
)
{
month
=
parseInt
(
month
)
+
1
;
day
=
"
01
"
;}
break
;
case
"
04
"
:
case
"
06
"
:
case
"
09
"
:
case
"
11
"
:
if
(
parseInt
(
day
)
>
30
)
{
month
=
parseInt
(
month
)
+
1
;
day
=
"
01
"
;}
break
;
case
"
02
"
:
if
((
parseInt
(
year
)
%
4
==
0
)
||
(
parseInt
(
year
)
%
400
==
0
))
{
if
(
parseInt
(
day
)
>
29
)
{
month
=
parseInt
(
month
)
+
1
;
day
=
"
01
"
;}
}
else
{
if
(
parseInt
(
day
)
>
28
)
{
month
=
parseInt
(
month
)
+
1
;
day
=
"
01
"
;}
}
break
;
}
if
((
parseInt
(
month
)
+
shift
)
>
12
)
{
month
=
"
01
"
;
year
=
year
+
1
;
}
/////если месяцев больше 12, то увелививаем год
if
(
parseInt
(
day
)
<
10
)
day
=
"
0
"
+
day
;
var
finalDate
=
year
+
"
-
"
+
month
+
"
-
"
+
day
;
return
finalDate
;
}
}
};
//переменные для WaitCircles();
var
currentTime
=
Date
.
now
(),
r
=
40
,
...
...
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