From abe4997bf55abaa5d13a7d59626d2a57e4bd2da1 Mon Sep 17 00:00:00 2001 From: "holger.trampe" Date: Wed, 14 Apr 2021 16:06:35 +0200 Subject: [PATCH] Bug Abwesenheiten --- .../timemanagement/realtime_dropdown.html | 2 +- .../timemanagement/rendered_table.html | 14 ++- .../timemanagement_teamview_single.html | 46 +++++-- .../timemanagement/tm_ab_management.html | 116 ++++++++++++++++++ 4 files changed, 164 insertions(+), 14 deletions(-) diff --git a/timemanagement/templates/timemanagement/realtime_dropdown.html b/timemanagement/templates/timemanagement/realtime_dropdown.html index c94c280..b04fd17 100644 --- a/timemanagement/templates/timemanagement/realtime_dropdown.html +++ b/timemanagement/templates/timemanagement/realtime_dropdown.html @@ -32,7 +32,7 @@
-{% loadaccounttime user as actualaccounttime %} +{% loadaccounttime request.user as actualaccounttime %} Gleitzeitkonto: {% if actualaccounttime.1 == 0 %} +{{actualaccounttime.0}} Stunden diff --git a/timemanagement/templates/timemanagement/rendered_table.html b/timemanagement/templates/timemanagement/rendered_table.html index 295ae58..21b7934 100644 --- a/timemanagement/templates/timemanagement/rendered_table.html +++ b/timemanagement/templates/timemanagement/rendered_table.html @@ -329,7 +329,7 @@ if(user_has_right == "True"){ else{ user_has_right = false; } - +/* function recalculateChoosenDays(userid=false){ seldates = []; @@ -441,12 +441,14 @@ function recalculateChoosenDays(userid=false){ else{ */ - $("#div_id_end").show(); - $("#div_id_endday_info").show(); + //$("#div_id_end").show(); + //$("#div_id_endday_info").show(); /*}*/ - } - }); -} + // } + //}); +//} + +/* function recalculateChoosenDaysAfterInit(){ new_start = $("#id_start").datepicker().val(); diff --git a/timemanagement/templates/timemanagement/timemanagement_teamview_single.html b/timemanagement/templates/timemanagement/timemanagement_teamview_single.html index b8651b9..6829fc3 100644 --- a/timemanagement/templates/timemanagement/timemanagement_teamview_single.html +++ b/timemanagement/templates/timemanagement/timemanagement_teamview_single.html @@ -50,8 +50,8 @@ {% for da in days_this_month %} - - {% getabscenceday user user da as abday %} + {% isfreedayname request.user da as isfreename %} + {% getabscenceday user user da as abday %} - + - {% if abday != False %} + {% if abday != False or isfreename != False %} + {% if isfreename != False %} + {{isfreename}} + + {% for workday in workdays %} + {% if workday.start|date:"d-m-y" == da|date:"d-m-y" %} +
+ {{workday.start|date:"H:i"}} - {{workday.end|date:"H:i"}}, + {% getsumworkdayexcludebreak workday as sumworkday %} + {{ sumworkday }}, + {% getsumbreak workday as sumbreakofday %} + {{sumbreakofday}} min. ({{workday.breaks.all|length}}), + {% getsumworkday workday as sumwd %} + {{sumwd}}, + {% gettimeoveralldiff workday user as erg%} + {% if erg.1 == 0 %} + +{{erg.0}} + {% elif erg.1 == 1 %} + {{erg.0}} + {% else %} + -{{erg.0}} + {% endif %} + + {% if breakmonthline < da %} + + + {% endif %} + {% endif %} + {% endfor %} + + {% else %} {{abday.reason}} + {% endif %} {% if abday.start == da%} {% if abday.startday_info == "1" %} (nur Vormittags) @@ -110,7 +141,7 @@ - {% elif abday.startday_info == "2" %} + {% elif abday.startday_info == "2" %} (nur Nachmittags) {% for workday in workdays %} @@ -207,7 +238,7 @@ {% endif %} {% endif %} - {% else %} + {% if abday == False %} {% counterWDreset %} {% for workday in workdays %} @@ -231,7 +262,8 @@ {% endif %} {% endif %} - {% if abday == False %} + {% if abday == False and isfreename == False %} + {% counterWDreset %} diff --git a/timemanagement/templates/timemanagement/tm_ab_management.html b/timemanagement/templates/timemanagement/tm_ab_management.html index b620a0b..11e67f3 100644 --- a/timemanagement/templates/timemanagement/tm_ab_management.html +++ b/timemanagement/templates/timemanagement/tm_ab_management.html @@ -639,6 +639,122 @@ function goFastToMonth(month){ location.href = "/tm/abs/" + month +"/" + choosenyear } +function recalculateChoosenDays(userid=false){ + seldates = []; + + //Click on Table + if(userid == false){ + + for(i = 0; i < selectedElements.length; i++){ + seldates.push(selectedElements[i].split("_")[3]); + userid = selectedElements[i].split("_")[2]; + } + seldates.sort(); + date_start = new Date(seldates[0]) + date_end = new Date(seldates[seldates.length-1]) + + + if(+date_start == +date_end){ + sameday = true; + } + else{ + sameday = false; + } + } + //Click on Button + else{ + //Show Modal with all users of agency + $("#chooseUserForNewAbsence").modal("toggle"); + + //Set initial Date-Infos + var today = new Date(); + var tempdate_user = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate(); + + date_start = new Date(tempdate_user); + date_end = new Date(tempdate_user); + sameday = true; + userid = userid.toString(); + } + $("#div_id_end").show(); + $("#div_id_end_ishalf").show(); + + $("#id_start").data("DateTimePicker").date(date_start); + $("#id_end").data("DateTimePicker").date(date_end); + + localStorage.setItem("ab_userid", userid); + $("#id_userid").val(userid); + + + $.ajax({ + type: "GET", + url: "{% url 'tm-ajax' %}", + data:{ + action : "getrestholidays", + userid : localStorage.getItem("ab_userid"), + startdate : date_start.getFullYear() + "__" + (date_start.getMonth()+1) + "__" + date_start.getDate(), + enddate : date_end.getFullYear() + "__" + (date_end.getMonth()+1) + "__" + date_end.getDate(), + //start_half : $("#id_start_ishalf").prop("checked"), + //end_half : $("#id_end_ishalf").prop("checked"), + startday_info : $("#id_startday_info").val(), + endday_info : $("#id_endday_info").val(), + }, + success : function(data){ + + if(data["other_absences"] != false){ + $("#otherholidays").show(); + $("#otherholidays_users").html(data["other_absences"]); + } + else{ + $("#otherholidays").hide(); + } + + if(data["userown_absences"] != false){ + $("#ownholidays").show(); + $("#ownholidays_users").html(data["userown_absences"]); + } + else{ + $("#ownholidays").hide(); + } + + $("#startAbsenceProgress").modal("show"); + + + $("#holidayyear").html(date_start.getFullYear()); + $("#restholidays").html(data["restholiday_thisyear"]); + $("#detail_rest").html(data["restholiday_lastyear"]); + $("#detail_rest_2").html(data["restholiday_lastyear"]); + $("#detail_resthol").html(data["restholiday_lastyear"]); + $("#detail_next").html(data["restholiday_nextyear"]); + $("#detail_next_rest").html(data["restholiday_nextyear_rest"]); + $("#detail_tocontract").html(data["need_days"]); + $("#detail_tocontract_overall").html(data["need_days"]); + + $("#detail_sum").html(data["restholiday_thisyear"]+data["restholiday_lastyear"]+data["restholiday_nextyear"]+data["restholiday_nextyear_rest"]); + + if(data["restholiday_thisyear"] < 0 || data["restholiday_lastyear"] < 0 || data["restholiday_nextyear"] < 0){ + $("#start_absence_contract").prop("disabled", true); + } + else{ + $("#start_absence_contract").prop("disabled", false); + } + + $("#username_abscence").html(data["choosenuser_name"]); + + /* + + if(seldates.length == 1){ + $("#div_id_end").hide(); + $("#div_id_endday_info").hide(); + } + else{ + + */ + $("#div_id_end").show(); + $("#div_id_endday_info").show(); + /*}*/ + } + }); +}