Commit d353e507 authored by Alina Habibulina's avatar Alina Habibulina

+ week score v3

parent 088145dd
......@@ -92,40 +92,39 @@ var portal = {
});
var formExistance;
////формирование Пн и Вскр для формирования поискового запроса по форме
var cur_date = new Date();
var StrPeriod = timeComputing(cur_date); //строка Пнд+" "+Вскр
var StrMonday = StrPeriod.substring(0, 10);
var StrSunday = StrPeriod.substring(11);
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();
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', function(){formExistance = false;});
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){
AS.SERVICES.hideWaitWindow();
portal.player.view.setEditable(true);
portal.player.showFormData("097a00e2-430c-436d-92e5-c2ea8edc5b30", 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');
}
});
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();
portal.player.view.setEditable(true);
portal.player.showFormData(result.documentID, 0, result.dataUUID);
portal.player.view.appendTo($('#form_player_div'));
ShowMessage("Документ успешно создан!");
}
}, 'json');
}
});
},
saveData : function(){
......@@ -136,8 +135,6 @@ var portal = {
return;
}
countingScore();
var data = portal.player.model.asfDataId;
portal.player.saveFormData(function(data){
if(_.isUndefined(data)){
......@@ -157,12 +154,16 @@ var portal = {
var StrSunday = period.substring(11);
portal.player.model.getModelWithId("ts_period_date_from").setValue(StrMonday);
portal.player.model.getModelWithId("ts_period_date_to").setValue(StrSunday);
portal.player.model.on("valueChange", function(){
countingScore();
});
}
};
function countingScore(){
////Расчет итогового количества часов происходит при нажатии кнопки сохранения
var table = portal.player.model.getModelWithId("ts_timesheet_table").getAsfData().findElement().data;
var table = portal.player.model.getModelWithId("ts_timesheet_table").getAsfData().findElement().data;;
var score = 0, monday = 0, tuesday = 0, wednesday = 0, thursday = 0, friday = 0, saturday = 0, sunday = 0;
for (var i = 10; i < table.length; i++){
var row = Number.parseInt(i/10);
......@@ -251,7 +252,7 @@ var authFunc = function(){
AS.SERVICES.showWaitWindow();
AS.OPTIONS.login = $("input#login").val();
AS.OPTIONS.password = $("input#password").val();
portal.createPlayer(user);
portal.createPlayer();
$(".form_player_container").show();
$(".login-form").remove();
$(".saveBtn").show();
......@@ -275,5 +276,5 @@ $(document).ready(function(){
$(".saveBtn").on("click", function(event){
AS.SERVICES.showWaitWindow();
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