Zeiterfassung Darstellung fertig, einige allgemeine Bugs behoben
This commit is contained in:
parent
5a015fe583
commit
a8ba4a3ad5
|
|
@ -11,18 +11,25 @@
|
||||||
|
|
||||||
<!-- TODO: Hier noch Jahr speichern und Monat usw. -->
|
<!-- TODO: Hier noch Jahr speichern und Monat usw. -->
|
||||||
<div class="btn-group" role="group" aria-label="" style="min-width: 100% !important">
|
<div class="btn-group" role="group" aria-label="" style="min-width: 100% !important">
|
||||||
<button type="button" class="btn btn-primary mr-1" onclick="{% url 'tm-management' prev_month 2020 %}" ><i class="fas fa-arrow-circle-left"></i></button>
|
<a type="button" class="btn btn-primary mr-1" href="{% url 'tm-management' prev_month prev_year %}" ><i class="fas fa-arrow-circle-left"></i></a>
|
||||||
<button type="button" class="btn btn-primary mr-1" style="min-width: 150px !important;" onclick="">{{active_month}}</button>
|
<button type="button" class="btn btn-primary mr-1" style="min-width: 150px !important;" onclick="">{{active_month}} {{active_year}}</button>
|
||||||
<button type="button" class="btn btn-primary mr-1" onclick="{% url 'tm-management' next_month 2020 %}"><i class="fas fa-arrow-circle-right"></i></button>
|
<a type="button" class="btn btn-primary mr-1" href="{% url 'tm-management' next_month next_year %}"><i class="fas fa-arrow-circle-right"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
|
||||||
{% for workday in workdays %}
|
{% for workday in workdays %}
|
||||||
{% if workday.start.weekday == 0 %}
|
{% if workday.start.weekday == 0 and forloop.counter > 1%}
|
||||||
{{workday.start|date:"W"}}. Woche
|
</div>
|
||||||
|
<div class="col-12 mb-2" style="float: left;">
|
||||||
<hr>
|
<hr>
|
||||||
|
<div style="float: left;"><h4>{{workday.start|date:"W"}}. Woche</h4></div>
|
||||||
|
<br /><br />
|
||||||
|
{% elif forloop.counter == 1 %}
|
||||||
|
<div class="col-12 mb-2" style="float: left;">
|
||||||
|
<hr>
|
||||||
|
<div style="float: left;"><h4>{{workday.start|date:"W"}}. Woche</h4></div>
|
||||||
|
<br /><br />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="card col-2">
|
<div class="card col-2 mr-2" style="float: left; margin-top: -12px;">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">{{workday.start|date:"l"}}, {{workday.start|date:"d.m"}}</h5>
|
<h5 class="card-title">{{workday.start|date:"l"}}, {{workday.start|date:"d.m"}}</h5>
|
||||||
Von {{workday.start|date:"H:i"}} bis {{workday.end|date:"H:i"}}<br />
|
Von {{workday.start|date:"H:i"}} bis {{workday.end|date:"H:i"}}<br />
|
||||||
|
|
@ -31,7 +38,7 @@
|
||||||
Arbeitszeit: {{ sumworkday }}<br />
|
Arbeitszeit: {{ sumworkday }}<br />
|
||||||
{% getsumbreak workday as sumbreakofday %}
|
{% getsumbreak workday as sumbreakofday %}
|
||||||
Pausen: {{sumbreakofday}} min. ({{workday.breaks.all|length}})
|
Pausen: {{sumbreakofday}} min. ({{workday.breaks.all|length}})
|
||||||
{% getsumworkday workday as sumwd %}
|
{% getsumworkday workday as sumwd %}<br />
|
||||||
Gesamtzeit: {{sumwd}}<br />
|
Gesamtzeit: {{sumwd}}<br />
|
||||||
Gleitzeit:
|
Gleitzeit:
|
||||||
{% gettimeoveralldiff workday user as erg%}
|
{% gettimeoveralldiff workday user as erg%}
|
||||||
|
|
@ -43,11 +50,13 @@
|
||||||
<span style="color: red">-{{erg.0}}</span>
|
<span style="color: red">-{{erg.0}}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</small>
|
</small>
|
||||||
</div>
|
<button style="float: right; margin-right: 10px; margin-bottom: -40px;" class="btn btn-secondary btn-sm " onclick="javascript:$('#confirm-delete_{{workday.pk}}').modal('toggle')"><small><i class="fas fa-trash"></i></small></button>
|
||||||
</div>
|
<button style="float: right; margin-right: -22px; margin-bottom: -40px;" 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>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</div> <!-- CLOSE GRID DAY DIV -->
|
||||||
{% if user.usertime.usetime_start == None %}
|
{% if user.usertime.usetime_start == None %}
|
||||||
<div class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" id="missingdatainfo">
|
<div class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" id="missingdatainfo">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
|
|
@ -79,7 +88,7 @@
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% elif workdays|length == 0 %}
|
{% elif userhasworkdays == False %}
|
||||||
<div class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" id="initialload">
|
<div class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" id="initialload">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
|
|
@ -103,7 +112,7 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
//$("#initialload").modal("toggle");
|
$("#initialload").modal("toggle");
|
||||||
});
|
});
|
||||||
|
|
||||||
function loadInitiDays(){
|
function loadInitiDays(){
|
||||||
|
|
|
||||||
|
|
@ -284,33 +284,52 @@ def AbsenceManagmenet(request, activemonth=False, activeyear=False):
|
||||||
@login_required
|
@login_required
|
||||||
def TimeManagement(request, activemonth=False, activeyear=False):
|
def TimeManagement(request, activemonth=False, activeyear=False):
|
||||||
# TODO: Abwesenheiten mit berücksichtigen!
|
# TODO: Abwesenheiten mit berücksichtigen!
|
||||||
|
# Setzt die Monatsausgabe auf Deutsch
|
||||||
locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8')
|
locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8')
|
||||||
|
|
||||||
# TODO: Hier noch umbauen, dass das Datum beim Wechsel mit auf diesen Monat gesetzt wird
|
# Hier wird der Monat und das Jahr für die Buttons gebaut
|
||||||
# TODO: Jahr fehlt auch noch :)
|
|
||||||
if(activemonth == False):
|
if(activemonth == False):
|
||||||
today = datetime.datetime.today()
|
today = datetime.datetime.today()
|
||||||
active_month = str(today.strftime("%B"))
|
active_month = str(today.strftime("%B"))
|
||||||
|
active_year = str(today.strftime("%Y"))
|
||||||
|
activemonth = today.month
|
||||||
else:
|
else:
|
||||||
today = datetime.datetime(2020, activemonth, 1)
|
today = datetime.datetime(activeyear, activemonth, 1)
|
||||||
active_month = activemonth
|
active_month = activemonth
|
||||||
active_month = str(today.strftime("%B"))
|
active_month = str(today.strftime("%B"))
|
||||||
|
active_year = str(today.strftime("%Y"))
|
||||||
|
|
||||||
|
prev_year = active_year
|
||||||
|
next_year = active_year
|
||||||
|
|
||||||
next_month = today.month + 1
|
next_month = today.month + 1
|
||||||
if(next_month == 13):
|
if(next_month == 13):
|
||||||
next_month = 1
|
next_month = 1
|
||||||
|
next_year = int(next_year) + 1
|
||||||
|
|
||||||
prev_month = today.month - 1
|
prev_month = today.month - 1
|
||||||
if(prev_month == 0):
|
if(prev_month == 0):
|
||||||
prev_month = 12
|
prev_month = 12
|
||||||
|
prev_year = int(prev_year) - 1
|
||||||
|
|
||||||
|
# Initialprüfung, ob Arbeitstage vorliegen
|
||||||
|
tempworkday = Workday.objects.filter(agency=request.user.profile.agency, user=request.user).order_by("start").exclude(end=None)[:1]
|
||||||
|
|
||||||
|
user_has_workdays = False
|
||||||
|
if len(tempworkday) == 1:
|
||||||
|
user_has_workdays = True
|
||||||
|
|
||||||
|
# Hier werden nur die Arbeitstage gefiltert, die auch aktuell zur Ansicht stehen sollen
|
||||||
context = {
|
context = {
|
||||||
"next_month" : next_month,
|
"next_month" : next_month,
|
||||||
"prev_month" : prev_month,
|
"prev_month" : prev_month,
|
||||||
|
"next_year" : next_year,
|
||||||
|
"prev_year" : prev_year,
|
||||||
|
"active_year" : active_year,
|
||||||
"active_month" : active_month,
|
"active_month" : active_month,
|
||||||
"active_link" : "timemanagement",
|
"active_link" : "timemanagement",
|
||||||
"workdays" : Workday.objects.filter(agency=request.user.profile.agency, user=request.user).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
|
||||||
}
|
}
|
||||||
return render(request, 'timemanagement/timemanagement_management.html', context)
|
return render(request, 'timemanagement/timemanagement_management.html', context)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue