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

+ week score v2

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