Zeiterfassung Darstellung fertig, einige allgemeine Bugs behoben
This commit is contained in:
parent
5a015fe583
commit
a8ba4a3ad5
|
|
@ -11,27 +11,34 @@
|
|||
|
||||
<!-- TODO: Hier noch Jahr speichern und Monat usw. -->
|
||||
<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>
|
||||
<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" 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' 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}} {{active_year}}</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>
|
||||
<hr>
|
||||
{% for workday in workdays %}
|
||||
{% if workday.start.weekday == 0 %}
|
||||
{{workday.start|date:"W"}}. Woche
|
||||
{% if workday.start.weekday == 0 and forloop.counter > 1%}
|
||||
</div>
|
||||
<div class="col-12 mb-2" style="float: left;">
|
||||
<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 %}
|
||||
|
||||
<div class="card col-2">
|
||||
<div class="card col-2 mr-2" style="float: left; margin-top: -12px;">
|
||||
<div class="card-body">
|
||||
<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 />
|
||||
<small>
|
||||
{% getsumworkdayexcludebreak workday as sumworkday %}
|
||||
Arbeitszeit: {{ sumworkday }}<br />
|
||||
{% getsumbreak workday as sumbreakofday %}
|
||||
Pausen: {{sumbreakofday}} min. ({{workday.breaks.all|length}})
|
||||
{% getsumworkday workday as sumwd %}
|
||||
{% getsumworkday workday as sumwd %}<br />
|
||||
Gesamtzeit: {{sumwd}}<br />
|
||||
Gleitzeit:
|
||||
{% gettimeoveralldiff workday user as erg%}
|
||||
|
|
@ -43,11 +50,13 @@
|
|||
<span style="color: red">-{{erg.0}}</span>
|
||||
{% endif %}
|
||||
</small>
|
||||
<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>
|
||||
<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 %}
|
||||
|
||||
</div> <!-- CLOSE GRID DAY DIV -->
|
||||
{% if user.usertime.usetime_start == None %}
|
||||
<div class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" id="missingdatainfo">
|
||||
<div class="modal-dialog" role="document">
|
||||
|
|
@ -79,7 +88,7 @@
|
|||
})
|
||||
</script>
|
||||
|
||||
{% elif workdays|length == 0 %}
|
||||
{% elif userhasworkdays == False %}
|
||||
<div class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" id="initialload">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
|
|
@ -103,7 +112,7 @@
|
|||
<script type="text/javascript">
|
||||
|
||||
$(document).ready(function(){
|
||||
//$("#initialload").modal("toggle");
|
||||
$("#initialload").modal("toggle");
|
||||
});
|
||||
|
||||
function loadInitiDays(){
|
||||
|
|
|
|||
|
|
@ -284,33 +284,52 @@ def AbsenceManagmenet(request, activemonth=False, activeyear=False):
|
|||
@login_required
|
||||
def TimeManagement(request, activemonth=False, activeyear=False):
|
||||
# TODO: Abwesenheiten mit berücksichtigen!
|
||||
|
||||
# Setzt die Monatsausgabe auf Deutsch
|
||||
locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8')
|
||||
|
||||
# TODO: Hier noch umbauen, dass das Datum beim Wechsel mit auf diesen Monat gesetzt wird
|
||||
# TODO: Jahr fehlt auch noch :)
|
||||
# Hier wird der Monat und das Jahr für die Buttons gebaut
|
||||
if(activemonth == False):
|
||||
today = datetime.datetime.today()
|
||||
active_month = str(today.strftime("%B"))
|
||||
active_year = str(today.strftime("%Y"))
|
||||
activemonth = today.month
|
||||
else:
|
||||
today = datetime.datetime(2020, activemonth, 1)
|
||||
today = datetime.datetime(activeyear, activemonth, 1)
|
||||
active_month = activemonth
|
||||
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
|
||||
if(next_month == 13):
|
||||
next_month = 1
|
||||
next_year = int(next_year) + 1
|
||||
|
||||
prev_month = today.month - 1
|
||||
if(prev_month == 0):
|
||||
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 = {
|
||||
"next_month" : next_month,
|
||||
"prev_month" : prev_month,
|
||||
"next_year" : next_year,
|
||||
"prev_year" : prev_year,
|
||||
"active_year" : active_year,
|
||||
"active_month" : active_month,
|
||||
"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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue