diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index 25981cf..e8a52dd 100644 Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index cdd6d9c..94eddbb 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -357,3 +357,30 @@ def getdailybreaktimetoday(user): breaksum += (b.end - b.start).seconds return breaksum*1000 +@register.simple_tag +def getsumworkday(workday): + + sum_break = 0 + + if(len(workday.breaks.all()) > 0): + + for ele in workday.breaks.all(): + sum_break += (ele.end - ele.start).seconds + + finalsum = ((workday.end - workday.start).seconds - sum_break) + + mon, sec = divmod(finalsum, 60) + hr, mon = divmod(mon, 60) + #return ("%d Stunden und %02d:%02d" % (hr, mon, sec)) + return ("%d Stunden und %02d Minuten" % (hr, mon)) + +@register.simple_tag +def getsumbreak(workday): + sum_break = 0 + + if(len(workday.breaks.all()) > 0): + + for ele in workday.breaks.all(): + sum_break += (ele.end - ele.start).seconds + + return int(sum_break/60) \ No newline at end of file diff --git a/timemanagement/__pycache__/views.cpython-38.pyc b/timemanagement/__pycache__/views.cpython-38.pyc index 9197295..1e7c11a 100644 Binary files a/timemanagement/__pycache__/views.cpython-38.pyc and b/timemanagement/__pycache__/views.cpython-38.pyc differ diff --git a/timemanagement/templates/timemanagement/timemanagement_management.html b/timemanagement/templates/timemanagement/timemanagement_management.html index 7ad4256..1510267 100644 --- a/timemanagement/templates/timemanagement/timemanagement_management.html +++ b/timemanagement/templates/timemanagement/timemanagement_management.html @@ -1,11 +1,64 @@ {% extends "users/base.html" %} {% block content %} +{% load counter_tag %} {% if request.user.profile.agency.module_timemanagement %}

Zeiterfassung 


+ +
+ + + + + + + + + + + + + + + + {% for workday in workdays %} + + + + + + + + + + + {% endfor %} + +
#StartEndeStundenPausenGesamtzeitGleitzeit in h 
+ {{forloop.counter}} + + {{workday.start}} + + {{workday.end}} + + {{ workday.end|timeuntil:workday.start }} + + {% getsumbreak workday as sumbreakofday %} + {{sumbreakofday}} min. ({{workday.breaks.all|length}}) + + + {% getsumworkday workday as sumwd %} + {{sumwd}} + + + + +
+
+ - {% else %} diff --git a/timemanagement/views.py b/timemanagement/views.py index 20a139c..655fbda 100644 --- a/timemanagement/views.py +++ b/timemanagement/views.py @@ -7,7 +7,8 @@ from django.utils import timezone @login_required def TimeManagement(request): context = { - "active_link" : "timemanagement" + "active_link" : "timemanagement", + "workdays" : Workday.objects.filter(agency=request.user.profile.agency, user=request.user).order_by("-start") } return render(request, 'timemanagement/timemanagement_management.html', context)