Bugs von Basti

This commit is contained in:
Holger Trampe 2020-07-29 18:41:44 +02:00
parent 9bf58afc06
commit 3b662336a0
6 changed files with 150 additions and 144 deletions

View File

@ -430,9 +430,9 @@ def getabscenceday(loggeduser, user, daytocheck):
returnstat = False
if(loggeduser.has_perm("users.absencemanager")):
absencedays = Absence.objects.filter(agency=user.profile.agency, user=user, start=daytocheck) | (Absence.objects.filter(agency=user.profile.agency, user=user, start__lt=daytocheck) & Absence.objects.filter(agency=user.profile.agency, user=user, end__gt=daytocheck)) | Absence.objects.filter(agency=user.profile.agency, user=user, end=daytocheck)
absencedays = Absence.objects.filter(confirm_status=0, agency=user.profile.agency, user=user, start=daytocheck) | (Absence.objects.filter(confirm_status=0, agency=user.profile.agency, user=user, start__lt=daytocheck) & Absence.objects.filter(confirm_status=0, agency=user.profile.agency, user=user, end__gt=daytocheck)) | Absence.objects.filter(confirm_status=0, agency=user.profile.agency, user=user, end=daytocheck)
else:
absencedays = (Absence.objects.filter(agency=user.profile.agency, user=loggeduser, confirm_status=1) | Absence.objects.filter(agency=user.profile.agency, user=user, confirm_status=0)) & (Absence.objects.filter(agency=user.profile.agency, user=user, start=daytocheck) | (Absence.objects.filter(agency=user.profile.agency, user=user, start__lt=daytocheck) & Absence.objects.filter(agency=user.profile.agency, user=user, end__gt=daytocheck)) | Absence.objects.filter(agency=user.profile.agency, user=user, end=daytocheck) )
absencedays = (Absence.objects.filter(agency=user.profile.agency, user=loggeduser, confirm_status=1) | Absence.objects.filter(agency=user.profile.agency, user=user, confirm_status=0)) & (Absence.objects.filter(agency=user.profile.agency, user=user, start=daytocheck) | (Absence.objects.filter(agency=user.profile.agency, user=user, start__lt=daytocheck, confirm_status=0) & Absence.objects.filter(agency=user.profile.agency, user=user, end__gt=daytocheck)) | Absence.objects.filter(agency=user.profile.agency, user=user, end=daytocheck, confirm_status=0) )
if(len(absencedays) > 0):
returnstat = list(absencedays)[0]

View File

@ -1,6 +1,6 @@
{% load counter_tag %}
<table class="table table-striped table-sm table-bordered" id="timetable_team">
<tr>
<tr>
<td id="9999999999_tableheadid">
<div class="btn-group ml-3 mb-2 mt-2" role="group" aria-label="calendarbuttons">
<button type="button" class="btn btn-primary mr-1" onclick="javascript:prevMonth()" ><i class="fas fa-arrow-circle-left"></i></button>
@ -9,71 +9,71 @@
</div>
</td>
{% for da in days_this_month %}
{% isfreeday user da as isfree %}
{% isfreeday user da as isfree %}
<td id="{{forloop.counter0}}_tableheadid" {% if today == da %} style="background-color: #F2D488;" {% elif da.weekday == 5 or da.weekday == 6 %} style="background-color: #d3d3d3;" {% elif isfree %} style="background-color: #9C9C9C; color: #ffffff" {% endif %}><small>{{da|date:"d D"}}</small></td>
{% endfor %}
</tr>
</tr>
{% for us in usersofagency %}
{% setdateforloopcounter forloop.counter %}
{% getactdateforloopcounter as actfcounter %}
<tr>
<td width="21%" id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_firstcolum">
<img class="commentimg mr-2" src="{{ us.profile.get_photo_url }}">
<td width="21%" id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_firstcolum">
<img class="commentimg mr-2" src="{{ us.profile.get_photo_url }}">
<span class="us_fullname">{{us.get_full_name}}</span>
{% if user|usergperm:"absencemanager" %}
{% if user|usergperm:"absencemanager" %}
{% kontingent us as userkontingent %}
<span class="badge badge-primary badge-counter" style="float: right;" >{{userkontingent}}</span>
{% endif %}
</td>
{% for da in days_this_month %}
{% for da in days_this_month %}
{% isfreeday user da as isfree %}
{% isfreedayname user da as isfreename %}
{% getabscenceday user us da as abday %}
{% startdatecheck us da as startdatecheck %}
{% getthisdaynotworking us da as thisdaynotworking %}
{% getabscenceday user us da as abday %}
{% startdatecheck us da as startdatecheck %}
{% getthisdaynotworking us da as thisdaynotworking %}
{% if isfree %}
<!-- FREEDAYS -->
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_free" style="background-color: #9C9C9C" data-toggle="tooltip" data-placement="top" title="{{isfreename}}">
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_free" style="background-color: #9C9C9C" data-toggle="tooltip" data-placement="top" title="{{isfreename}}">
<!-- USER NOT STARTED YET -->
{% elif startdatecheck == False %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_free" style="background-color: #d3d3d3">
{% elif thisdaynotworking == True %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_free" style="background-color: #d3d3d3">
{% elif abday != False %}
<!-- USER IS NOT THERE -->
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_free" style="background-color: #d3d3d3">
{% elif abday != False %}
<!-- USER IS NOT THERE -->
{% if abday.confirm_status == 0 %}
{% if user|usergperm:"absencemanager" %}
{% if user|usergperm:"absencemanager" %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absence"
{% if abday.startday_info == "2" and abday.start.day == da.day %}
class="partialfilling negative"
{% if abday.startday_info == "2" and abday.start.day == da.day %}
class="partialfilling negative"
style="background-size: 50% 100%;background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
class="partialfilling"
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
class="partialfilling"
style="background-size: 50% 100%;background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
class="partialfilling negative"
class="partialfilling negative"
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% elif abday.endday_info == "1" and abday.end.day == da.day %}
class="partialfilling "
class="partialfilling "
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% else %}
{% else %}
style="background-color: {{abday.reason.color}}"
{% endif %}
{% endif %}
data-toggle="tooltip" data-placement="top" title="{{abday.reason.name}} {% if abday.representator != None %} | Vertreter {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
{% elif abday.user == user %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absence"
{% if abday.startday_info == "2" and abday.start.day == da.day %}
class="partialfilling negative"
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absence"
{% if abday.startday_info == "2" and abday.start.day == da.day %}
class="partialfilling negative"
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
class="partialfilling"
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
class="partialfilling"
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
@ -84,17 +84,17 @@
class="partialfilling"
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% else %}
{% else %}
style="background-color: {{abday.reason.color}}"
{% endif %} data-toggle="tooltip" data-placement="top" title="{% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreter {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
{% endif %} data-toggle="tooltip" data-placement="top" title="{% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreter {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
{% else %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absence"
{% if abday.starday_info == 2 and abday.start.day == da.day %}
class="partialfilling negative"
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absence"
{% if abday.starday_info == 2 and abday.start.day == da.day %}
class="partialfilling negative"
style="background-size: 50% 100%; background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% elif abday.starday_info == 1 and abday.start.day == da.day %}
class="partialfilling"
{% elif abday.starday_info == 1 and abday.start.day == da.day %}
class="partialfilling"
style="background-size: 50% 100%; background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
@ -105,52 +105,52 @@
class="partialfilling"
style="background-size: 50% 100%; background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
background-repeat: no-repeat; /* don't remove */"
{% else %}
{% else %}
style="background-color: #858796"
{% endif %} data-toggle="tooltip" data-placement="top" title="{% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreter {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
{% endif %}
{% endif %} data-toggle="tooltip" data-placement="top" title="{% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreter {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
{% endif %}
{% elif abday.confirm_status == 1 %}
{% if user|usergperm:"absencemanager" %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absencetoc"
{% if abday.startday_info == "2" and abday.start.day == da.day %}
class="partialfilling_nf negative_nf"
{% if user|usergperm:"absencemanager" %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absencetoc"
{% if abday.startday_info == "2" and abday.start.day == da.day %}
class="partialfilling_nf negative_nf"
style="background-size: 50% 100%"
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
class="partialfilling_nf"
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
class="partialfilling_nf"
style="background-size: 50% 100%"
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
class="partialfilling_nf negative_nf"
class="partialfilling_nf negative_nf"
style="background-size: 50% 100%"
{% elif abday.endday_info == "1" and abday.end.day == da.day %}
class="partialfilling_nf"
class="partialfilling_nf"
style="background-size: 50% 100%"
{% else %}
{% else %}
style="background-color: #858796"
{% endif %}
{% endif %}
data-toggle="tooltip" data-placement="top" title="Nicht bestätigt | {{abday.reason.name}} {% if abday.representator != None %} | Vertreten durch {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
{% else %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absencetoc"
{% if abday.startday_info == "2" and abday.start.day == da.day %}
class="partialfilling_nf negative_nf"
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absencetoc"
{% if abday.startday_info == "2" and abday.start.day == da.day %}
class="partialfilling_nf negative_nf"
style="background-size: 50% 100%"
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
class="partialfilling_nf"
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
class="partialfilling_nf"
style="background-size: 50% 100%"
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
class="partialfilling_nf negative_nf"
class="partialfilling_nf negative_nf"
style="background-size: 50% 100%"
{% elif abday.endday_info == "1" and abday.end.day == da.day %}
class="partialfilling_nf"
class="partialfilling_nf"
style="background-size: 50% 100%"
{% else %}
{% else %}
style="background-color: #858796"
{% endif %} data-toggle="tooltip" data-placement="top" title="Nicht bestätigt | {% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreten durch {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %}">
{% endif %} data-toggle="tooltip" data-placement="top" title="Nicht bestätigt | {% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreten durch {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %}">
{% endif %}
{% else %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{da|date:'Y-m-d'}}" {% if us.pk == user.pk or user|usergperm:"absencemanager" %}class="tm-ab-tdhover"{% endif %}>
{% endif %}
<!-- NORMAL CHOICE -->
<!-- NORMAL CHOICE -->
<!-- HEutigen Tag einfärben -->
{% elif today == da %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{da|date:'Y-m-d'}}" {% if us.pk == user.pk or user|usergperm:"absencemanager" %}class="tm-ab-tdhover"{% endif %} style="background-color: #F2D488" >
@ -158,13 +158,13 @@
{% else %}
<!-- Unterscheidung zwischen Wochenende zur Färbung -->
{% if da.weekday == 5 or da.weekday == 6 %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{da|date:'Y-m-d'}}" {% if us.pk == user.pk or user|usergperm:"absencemanager" %}class="tm-ab-tdhover"{% endif %} style="background-color: #e1e1e1;" >
{% else %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{da|date:'Y-m-d'}}" {% if us.pk == user.pk or user|usergperm:"absencemanager" %}class="tm-ab-tdhover"{% endif %} >
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{da|date:'Y-m-d'}}" {% if us.pk == user.pk or user|usergperm:"absencemanager" %}class="tm-ab-tdhover"{% endif %} style="background-color: #e1e1e1;" >
{% else %}
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{da|date:'Y-m-d'}}" {% if us.pk == user.pk or user|usergperm:"absencemanager" %}class="tm-ab-tdhover"{% endif %} >
{% endif %}
{% endif %}
</td>
{% endfor %}
{% endfor %}
</tr>
{% endfor %}
</table>
@ -179,7 +179,7 @@
.partialfilling.negative {
background-image: linear-gradient(to left, #36b9cc 0%, #36b9cc 17%, #36b9cc 33%, #36b9cc 67%, #36b9cc 83%, #36b9cc 100%); /* your gradient */
background-position: 100% 100%;
}
}
.partialfilling_nf {
background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
@ -188,7 +188,7 @@
.partialfilling_nf.negative_nf {
background-image: linear-gradient(to left, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
background-position: 100% 100%;
}
}
</style>
@ -212,15 +212,15 @@
</select>
</div>
{% getsomemonths as months %}
{% for m in months %}
<button class="btn
{% for m in months %}
<button class="btn
{% if forloop.counter == activemonth %} btn-primary {% else %} btn-secondary {% endif %}
btn-sm mr-2 mb-2" onclick="javascript:goFastToMonth({{forloop.counter}})">{{m}}</button>
{% endfor %}
</div>
<div class="modal-footer">
<div class="modal-footer">
<button type="button" class="btn btn-primary " data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
</div>
@ -229,12 +229,12 @@
<script type="text/javascript">
var choosenyear = "{{activeyear}}";
function goFastToMonth(month){
function goFastToMonth(month){
location.href = "/tm/abs/" + month +"/" + choosenyear
}
document.getElementById("choosenyear").addEventListener("change", function(){
choosenyear = $('#choosenyear :selected').val();
choosenyear = $('#choosenyear :selected').val();
})
$(function () {
@ -256,7 +256,7 @@ document.getElementById("id_reason").addEventListener("change", function(){
url: "{% url 'tm-ajax' %}",
data:{
action : "checkrequired",
rid : reasonid
rid : reasonid
},
success : function(data){
//CHANGE REPRESENTOR
@ -296,9 +296,9 @@ function prevMonth(){
type: "GET",
url: "{% url 'tm-ajax' %}",
data:{
action : "getrenderedtable",
action : "getrenderedtable",
activeyear : {{prevyear}},
activemonth : {{prevmonth}}
activemonth : {{prevmonth}}
},
beforeSend: function(request) {
$("#overlay").fadeIn();
@ -316,9 +316,9 @@ function nextMonth(){
type: "GET",
url: "{% url 'tm-ajax' %}",
data:{
action : "getrenderedtable",
action : "getrenderedtable",
activeyear : {{nextyear}},
activemonth : {{nextmonth}}
activemonth : {{nextmonth}}
},
beforeSend: function(request) {
$("#overlay").fadeIn();
@ -353,7 +353,7 @@ function recalculateChoosenDays(){
seldates.sort();
date_start = new Date(seldates[0])
date_end = new Date(seldates[seldates.length-1])
if(+date_start == +date_end){
sameday = true;
}
@ -370,7 +370,7 @@ function recalculateChoosenDays(){
type: "GET",
url: "{% url 'tm-ajax' %}",
data:{
action : "getrestholidays",
action : "getrestholidays",
userid : userid,
startdate : date_start.getFullYear() + "__" + (date_start.getMonth()+1) + "__" + date_start.getDate(),
enddate : date_end.getFullYear() + "__" + (date_end.getMonth()+1) + "__" + date_end.getDate(),
@ -380,7 +380,7 @@ function recalculateChoosenDays(){
endday_info : $("#id_endday_info").val(),
},
success : function(data){
console.log(data)
if(data["other_absences"] != false){
$("#otherholidays").show();
@ -401,34 +401,38 @@ function recalculateChoosenDays(){
$("#startAbsenceProgress").modal("show");
$("#holidayyear").html(date_start.getFullYear());
$("#restholidays").html(data["restholiday_thisyear"]);
$("#detail_rest").html(data["restholiday_thisyear"]);
$("#detail_resthol").html(data["restholiday_lastyear"]);
$("#detail_next").html(data["restholiday_nextyear"]);
$("#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){
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);
$("#start_absence_contract").prop("disabled", false);
}
/*
if(seldates.length == 1){
$("#div_id_end").hide();
$("#div_id_endday_info").hide();
}
else{
$("#div_id_end").show();
$("#div_id_endday_info").show();
}
*/
$("#div_id_end").show();
$("#div_id_endday_info").show();
/*}*/
}
});
}
@ -439,7 +443,7 @@ function recalculateChoosenDaysAfterInit(){
new_start = new_start.split(".");
new_end = new_end.split(".");
behindcheck_start = new Date(new_start[2], (parseInt(new_start[1])-1), new_start[0]);
behindcheck_end = new Date(new_end[2], (parseInt(new_end[1])-1), new_end[0]);
@ -453,7 +457,7 @@ function recalculateChoosenDaysAfterInit(){
type: "GET",
url: "{% url 'tm-ajax' %}",
data:{
action : "getrestholidays",
action : "getrestholidays",
userid : userid,
startdate : new_start[2] + "__" + new_start[1] + "__" + new_start[0],
enddate : new_end[2] + "__" + new_end[1] + "__" + new_end[0],
@ -463,7 +467,7 @@ function recalculateChoosenDaysAfterInit(){
endday_info : $("#id_endday_info").val(),
},
success : function(data){
console.log(data);
if(data["other_absences"] != false){
@ -481,7 +485,7 @@ function recalculateChoosenDaysAfterInit(){
else{
$("#ownholidays").hide();
}
$("#restholidays").html(data["restholiday_thisyear"]);
$("#detail_rest").html(data["restholiday_thisyear"]);
$("#detail_resthol").html(data["restholiday_lastyear"]);
@ -504,7 +508,7 @@ function recalculateChoosenDaysAfterInit(){
$("#detail_tocontract_overall").html(data["need_days_next"]+data["need_days_this"]);
}
else{
$("#two_years").hide();
$("#two_years").hide();
}
behindcheck = false;
@ -513,20 +517,20 @@ function recalculateChoosenDaysAfterInit(){
}
else if(+behindcheck_start < +behindcheck_end == true){
behindcheck = true;
}
}
if(behindcheck == false || data["restholiday_thisyear"] < 0 || data["restholiday_lastyear"] < 0 || data["restholiday_nextyear"] < 0 && data["startendcheck"] || data["restholiday_thisyear"] < 0 || data["restholiday_nextyear"] < 0 || data["userown_absences"] != false)
{
$("#start_absence_contract").prop("disabled", true);
{
$("#start_absence_contract").prop("disabled", true);
}
else{
$("#start_absence_contract").prop("disabled", false);
$("#start_absence_contract").prop("disabled", false);
}
if(seldates.length == 1){
$("#div_id_end").hide();
$("#div_id_end_ishalf").hide();
}
//if(seldates.length == 1){
$("#div_id_end").show();
$("#div_id_end_ishalf").show();
//}
}
});
}
@ -564,66 +568,66 @@ $( function() {
filter: 'td',
start : function(){
if(selectedElements.length > 0){
selectedElements = [];
}
selectedElements = [];
}
},
selecting: function(event, ui){
selecting: function(event, ui){
newid = ui["selecting"]["id"];
if(newid.split("_")[1] == "tableheadid" || newid.split("_")[3] == "firstcolum" || (newid.split("_")[2] != {{user.pk}} && user_has_right != true ) || newid.split("_")[3] == "free" || newid.split("_")[4] == "absence"){
if($("#" + newid).hasClass("negative")){
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("negative");
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("negative");
}
else if($("#" + newid).hasClass("partialfilling"))
{
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("partialfilling");
}
else if($("#" + newid).hasClass("negative_nf")){
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling_nf");
$("#" + newid).addClass("negative_nf");
$("#" + newid).addClass("partialfilling_nf");
$("#" + newid).addClass("negative_nf");
}
else if($("#" + newid).hasClass("partialfilling_nf"))
{
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling_nf");
$("#" + newid).addClass("partialfilling_nf");
}
else{
$("#" + newid).removeClass();
}
$("#" + newid).removeClass();
}
}
else if(newid.split("_")[4] == "absencetoc"){
if($("#" + newid).hasClass("negative")){
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("negative");
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("negative");
}
else if($("#" + newid).hasClass("partialfilling"))
{
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("partialfilling");
}
else if($("#" + newid).hasClass("negative_nf")){
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling_nf");
$("#" + newid).addClass("negative_nf");
$("#" + newid).addClass("partialfilling_nf");
$("#" + newid).addClass("negative_nf");
}
else if($("#" + newid).hasClass("partialfilling_nf"))
{
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling_nf");
$("#" + newid).addClass("partialfilling_nf");
}
else{
$("#" + newid).removeClass();
}
idtoopen = newid.split("_")[3];
openModalABChangeTable(idtoopen);
$("#" + newid).removeClass();
}
idtoopen = newid.split("_")[3];
openModalABChangeTable(idtoopen);
}
else{
if(selectedElements.length == 0){
if(selectedElements.length == 0){
active_row = newid.split("_")[0];
selectedElements.push(ui["selecting"]["id"]);
}
@ -631,25 +635,25 @@ $( function() {
if($("#" + newid).hasClass("negative")){
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("negative");
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("negative");
}
else if($("#" + newid).hasClass("partialfilling"))
{
$("#" + newid).removeClass();
$("#" + newid).addClass("partialfilling");
$("#" + newid).addClass("partialfilling");
}
else{
$("#" + newid).removeClass();
$("#" + newid).removeClass();
}
}
else{
selectedElements.push(ui["selecting"]["id"]);
}
}
selectedElements.push(ui["selecting"]["id"]);
}
}
},
unselecting: function(event, ui){
selectedElements.splice(selectedElements.indexOf(ui["unselecting"]["id"]),1);
unselecting: function(event, ui){
selectedElements.splice(selectedElements.indexOf(ui["unselecting"]["id"]),1);
},
stop: function(){
//Selection ends, check if elements set and open modal
@ -657,19 +661,16 @@ $( function() {
$("#timetable_team tbody tr").each(function(i) {
// find the first td in the row
var value = $(this).find("td:first").find("span:first").text();
// display the value in console
checkrow = parseInt(active_row);
if(i == (checkrow)){
// display the value in console
checkrow = parseInt(active_row);
if(i == (checkrow)){
$("#username_abscence").html(value);
$("#id_userid").val(selectedElements[0].split("_")[2])
}
});
recalculateChoosenDays();
recalculateChoosenDays();
}
}
});
} );
</script>

View File

@ -34,7 +34,7 @@
<td>{{forloop.counter}}</td>
<td>{{break.start|date:"H:i"}}</td>
<td>{{break.end|date:"H:i"}}</td>
<td><button class="btn btn-secondary btn-sm " style="float: right" onclick="javascript:$('#confirm-delete_{{break.pk}}').modal('toggle')"><small><i class="fas fa-trash"></i></small></button></td>
<td><a class="btn btn-secondary btn-sm " style="float: right" onclick="javascript:$('#confirm-delete_{{break.pk}}').modal('toggle')"><small><i class="fas fa-trash" style="color: #000000"></i></small></a></td>
</tr>
{% endfor %}
</tbody>

View File

@ -134,8 +134,7 @@ def AbsenceManagmenet(request, activemonth=False, activeyear=False):
if(request.method == "POST"):
'''
Nachdem eine neue Abwesenheit gespeichert wurde, geht es zur normalen Seite zurück, jedoch mit den Daten des
aktuell angezeigten Monate/Jahr
Nachdem eine neue Abwesenheit gespeichert wurde, geht es zur normalen Seite zurück, jedoch mit den Daten des aktuell angezeigten Monate/Jahr
'''
if(request.POST.get("form_type") == "absenceform"):
@ -332,7 +331,7 @@ def TimeManagement(request, activemonth=False, activeyear=False):
"days_this_month" : get_datetime_range(int(active_year), int(activemonth)),
"workdays" : Workday.objects.filter(agency=request.user.profile.agency, user=request.user, start__month=activemonth, start__year=active_year).order_by("start").exclude(end=None),
"userhasworkdays" : user_has_workdays
}
}
return render(request, 'timemanagement/timemanagement_management.html', context)

View File

@ -170,6 +170,12 @@
</li>
{% endif %}
<!--
TODO: Counter einfügen, der in der Navi zeigt, wie viele ausstehende Anträge es gibt
-->
{% if request.user.profile.agency.module_timemanagement %}
{% if active_link == 'abscence' %}
<li class="nav-item active">