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 returnstat = False
if(loggeduser.has_perm("users.absencemanager")): 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: 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): if(len(absencedays) > 0):
returnstat = list(absencedays)[0] returnstat = list(absencedays)[0]

View File

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

View File

@ -34,7 +34,7 @@
<td>{{forloop.counter}}</td> <td>{{forloop.counter}}</td>
<td>{{break.start|date:"H:i"}}</td> <td>{{break.start|date:"H:i"}}</td>
<td>{{break.end|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> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -134,8 +134,7 @@ def AbsenceManagmenet(request, activemonth=False, activeyear=False):
if(request.method == "POST"): if(request.method == "POST"):
''' '''
Nachdem eine neue Abwesenheit gespeichert wurde, geht es zur normalen Seite zurück, jedoch mit den Daten des Nachdem eine neue Abwesenheit gespeichert wurde, geht es zur normalen Seite zurück, jedoch mit den Daten des aktuell angezeigten Monate/Jahr
aktuell angezeigten Monate/Jahr
''' '''
if(request.POST.get("form_type") == "absenceform"): 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)), "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), "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 "userhasworkdays" : user_has_workdays
} }
return render(request, 'timemanagement/timemanagement_management.html', context) return render(request, 'timemanagement/timemanagement_management.html', context)

View File

@ -170,6 +170,12 @@
</li> </li>
{% endif %} {% 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 request.user.profile.agency.module_timemanagement %}
{% if active_link == 'abscence' %} {% if active_link == 'abscence' %}
<li class="nav-item active"> <li class="nav-item active">