Commit 088145dd authored by Alina Habibulina's avatar Alina Habibulina

+ week score v2

parent 4f417583
...@@ -69,6 +69,7 @@ function ShowMessage(message){ ...@@ -69,6 +69,7 @@ function ShowMessage(message){
}, 3000); }, 3000);
}; };
var user;
var portal = { var portal = {
player : null, player : null,
...@@ -98,16 +99,17 @@ var portal = { ...@@ -98,16 +99,17 @@ var portal = {
var StrMonday = StrPeriod.substring(0, 10); var StrMonday = StrPeriod.substring(0, 10);
var StrSunday = StrPeriod.substring(11); var StrSunday = StrPeriod.substring(11);
AS.FORMS.ApiUtils.simpleAsyncGet("rest/api/asforms/search", function(success){ AS.FORMS.ApiUtils.simpleAsyncGet("rest/api/person/auth", function(userData){
AS.FORMS.ApiUtils.simpleAsyncGet("rest/api/asforms/search?modifiedFrom="+StrMonday+"&modifiedTo="+StrSunday+"&formCode=timesheet&field=ts_author&type=partial&recordsCount=1&search="+userData.lastname, function(success){ ////rest/api/asforms/search?modifiedFrom=2018-02-12&modifiedTo=2018-02-18&formCode=timesheet&field=ts_author&type=partial&recordsCount=1&search=Хабибулина
AS.SERVICES.hideWaitWindow(); AS.SERVICES.hideWaitWindow();
portal.player.view.setEditable(true); portal.player.view.setEditable(true);
portal.player.showFormData("6af6bf3d-a093-4a33-990c-2ec98c15423a",1, success); portal.player.showFormData("6af6bf3d-a093-4a33-990c-2ec98c15423a",1, success);
portal.player.view.appendTo($('#form_player_div')); portal.player.view.appendTo($('#form_player_div'));
ShowMessage("Документ успешно открыт!"); ShowMessage("Документ успешно открыт!");
var formExistance = true; var formExistance = true;
}, 'json', {'modifiedFrom': StrMonday, 'modifiedTo': StrSunday,'formCode':'timesheet','recordsCount':1,'sortDir':'desc'}, function(){formExistance = false;}); }, 'json', function(){formExistance = false;});
if (formExistance == false) if (formExistance)
{ {
AS.FORMS.ApiUtils.simpleAsyncGet('rest/api/registry/create_doc?registryCode=registry_timesheets', function(result){ AS.FORMS.ApiUtils.simpleAsyncGet('rest/api/registry/create_doc?registryCode=registry_timesheets', function(result){
if(result.errorCode != "0") { if(result.errorCode != "0") {
...@@ -123,6 +125,7 @@ var portal = { ...@@ -123,6 +125,7 @@ var portal = {
} }
}, 'json'); }, 'json');
} }
});
}, },
saveData : function(){ saveData : function(){
...@@ -179,11 +182,11 @@ function countingScore(){ ...@@ -179,11 +182,11 @@ function countingScore(){
function timeComputing(serverDateTime){ function timeComputing(serverDateTime){
function zeroCheck(num){ function zeroCheck(num){
if (num < 10) {num = "0"+ num;} if (num <= 9) {num = "0"+ num;}
return num; return num;
}; };
var WeekDay = new Date(serverDateTime); var WeekDay = new Date(serverDateTime);
WeekDay = WeekDay.getDay() + 1; WeekDay = WeekDay.getDay();
var shift = 7 - WeekDay; var shift = 7 - WeekDay;
var sunday = new Date(serverDateTime); var sunday = new Date(serverDateTime);
sunday.setDate(sunday.getDate() + shift); sunday.setDate(sunday.getDate() + shift);
...@@ -248,7 +251,7 @@ var authFunc = function(){ ...@@ -248,7 +251,7 @@ var authFunc = function(){
AS.SERVICES.showWaitWindow(); AS.SERVICES.showWaitWindow();
AS.OPTIONS.login = $("input#login").val(); AS.OPTIONS.login = $("input#login").val();
AS.OPTIONS.password = $("input#password").val(); AS.OPTIONS.password = $("input#password").val();
portal.createPlayer(); portal.createPlayer(user);
$(".form_player_container").show(); $(".form_player_container").show();
$(".login-form").remove(); $(".login-form").remove();
$(".saveBtn").show(); $(".saveBtn").show();
...@@ -274,4 +277,3 @@ $(document).ready(function(){ ...@@ -274,4 +277,3 @@ $(document).ready(function(){
portal.saveData(); portal.saveData();
}); });
}); });
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