Bug Abwesenheiten
This commit is contained in:
parent
b405019a35
commit
abe4997bf5
|
|
@ -32,7 +32,7 @@
|
|||
<button onclick="javascript:startDay()" type="button" id="" class="btn btn-success">Arbeitstag starten</button>
|
||||
</div>
|
||||
<hr>
|
||||
{% loadaccounttime user as actualaccounttime %}
|
||||
{% loadaccounttime request.user as actualaccounttime %}
|
||||
Gleitzeitkonto:
|
||||
{% if actualaccounttime.1 == 0 %}
|
||||
<b><span style="color: green">+{{actualaccounttime.0}} Stunden</span></b>
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@
|
|||
</thead>
|
||||
<tbody id="table_contacts" >
|
||||
{% for da in days_this_month %}
|
||||
|
||||
{% getabscenceday user user da as abday %}
|
||||
{% isfreedayname request.user da as isfreename %}
|
||||
{% getabscenceday user user da as abday %}
|
||||
|
||||
<tr id="da_{{da|date:"d-m-y"}}"
|
||||
{% if da.weekday == 5 or da.weekday == 6 %}
|
||||
|
|
@ -76,10 +76,41 @@
|
|||
{{da|date:"d.m.y"}}
|
||||
</td>
|
||||
<!-- START -->
|
||||
<td {% if abday != False %} colspan="3" {% endif %}>
|
||||
<td {% if abday != False or isfreename != False %} colspan="3" {% endif %}>
|
||||
|
||||
{% 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" %}
|
||||
<br />
|
||||
{{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 %}
|
||||
<span style="color: green">+{{erg.0}}</span>
|
||||
{% elif erg.1 == 1 %}
|
||||
<span>{{erg.0}}</span>
|
||||
{% else %}
|
||||
<span style="color: red">-{{erg.0}}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if breakmonthline < da %}
|
||||
<button class="btn btn-secondary btn-sm ml-2" onclick="window.location.href='{% url 'tm-update' workday.pk %}'"><small><i class="fas fa-pen"></i></small></button>
|
||||
<button class="btn btn-secondary btn-sm " onclick="javascript:$('#confirm-delete_{{workday.pk}}').modal('toggle')"><small><i class="fas fa-trash"></i></small></button>
|
||||
{% 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 %}
|
||||
</td>
|
||||
{% if abday == False %}
|
||||
{% if abday == False and isfreename == False %}
|
||||
|
||||
<!-- ENDE -->
|
||||
<td>
|
||||
{% counterWDreset %}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
/*}*/
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue