Commit d353e507 authored by Alina Habibulina's avatar Alina Habibulina

+ week score v3

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