Modulcommit Zeiterfassung
This commit is contained in:
parent
787f08596c
commit
fe4115df40
Binary file not shown.
|
|
@ -372,7 +372,7 @@ def getsumworkday(workday):
|
||||||
mon, sec = divmod(finalsum, 60)
|
mon, sec = divmod(finalsum, 60)
|
||||||
hr, mon = divmod(mon, 60)
|
hr, mon = divmod(mon, 60)
|
||||||
#return ("%d Stunden und %02d:%02d" % (hr, mon, sec))
|
#return ("%d Stunden und %02d:%02d" % (hr, mon, sec))
|
||||||
return ("%d Stunden und %02d Minuten" % (hr, mon))
|
return ("%d Stunden, %02d Minuten" % (hr, mon))
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
def getsumbreak(workday):
|
def getsumbreak(workday):
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -13,7 +13,7 @@
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col">Start</th>
|
<th scope="col">Start</th>
|
||||||
<th scope="col">Ende</th>
|
<th scope="col">Ende</th>
|
||||||
<th scope="col">Stunden</th>
|
<th scope="col">Arbeitszeit</th>
|
||||||
<th scope="col">Pausen</th>
|
<th scope="col">Pausen</th>
|
||||||
<th scope="col">Gesamtzeit</th>
|
<th scope="col">Gesamtzeit</th>
|
||||||
<th scope="col">Gleitzeit in h</th>
|
<th scope="col">Gleitzeit in h</th>
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="table_contacts" >
|
<tbody id="table_contacts" >
|
||||||
{% for workday in workdays %}
|
{% for workday in workdays %}
|
||||||
<tr>
|
<tr id="wd_{{workday.pk}}">
|
||||||
<td>
|
<td>
|
||||||
{{forloop.counter}}
|
{{forloop.counter}}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -48,8 +48,8 @@
|
||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-secondary btn-sm ml-2" href=""><small><i class="fas fa-trash"></i></small></a>
|
<button class="btn btn-secondary btn-sm ml-2" onclick="javascript:$('#confirm-delete_{{workday.pk}}').modal('toggle')"><small><i class="fas fa-trash"></i></small></button>
|
||||||
<a class="btn btn-secondary btn-sm " href=""><small><i class="fas fa-pen"></i></small></a>
|
<button class="btn btn-secondary btn-sm " href=""><small><i class="fas fa-pen"></i></small></button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
@ -57,7 +57,44 @@
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% for workday in workdays %}
|
||||||
|
<div class="modal fade" id="confirm-delete_{{workday.pk}}" tabindex="-1" role="dialog" aria-labelledby="" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
Arbeitstag löschen
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
Möchten Sie wirklich den Arbeitstag am {{workday.start|date:"d.m"}} löschen?
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-danger" id="dodel_{{workday.pk}}" >Löschen</button>
|
||||||
|
<button type="button" class="btn btn-success" data-dismiss="modal">Abbrechen</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$("#dodel_{{workday.pk}}").click(function(){
|
||||||
|
$.ajax(
|
||||||
|
{
|
||||||
|
type: "GET",
|
||||||
|
url: "{% url 'tm-ajax' %}",
|
||||||
|
data:{
|
||||||
|
action : "remove_workday",
|
||||||
|
workday: {{workday.pk}},
|
||||||
|
},
|
||||||
|
success: function( data )
|
||||||
|
{
|
||||||
|
$("#wd_{{workday.pk}}").remove();
|
||||||
|
$("#confirm-delete_{{workday.pk}}").modal("toggle");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endfor %}
|
||||||
<style>
|
<style>
|
||||||
/* DATATABLES */
|
/* DATATABLES */
|
||||||
.paginate_button {
|
.paginate_button {
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ def TimeManagement(request):
|
||||||
def TimeAjax(request):
|
def TimeAjax(request):
|
||||||
data = {}
|
data = {}
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
|
# START WORKDAY
|
||||||
if request.GET["action"] == "start_day":
|
if request.GET["action"] == "start_day":
|
||||||
wd = Workday(user=request.user, agency=request.user.profile.agency, start=timezone.now())
|
wd = Workday(user=request.user, agency=request.user.profile.agency, start=timezone.now())
|
||||||
wd.save()
|
wd.save()
|
||||||
|
|
@ -24,6 +25,7 @@ def TimeAjax(request):
|
||||||
"wd_starttime" : wd.start.strftime("%H:%M:%S"),
|
"wd_starttime" : wd.start.strftime("%H:%M:%S"),
|
||||||
"wd_starttime_complete" : wd.start
|
"wd_starttime_complete" : wd.start
|
||||||
}
|
}
|
||||||
|
# END DAY
|
||||||
elif request.GET["action"] == "end_day":
|
elif request.GET["action"] == "end_day":
|
||||||
wd = list(Workday.objects.filter(user=request.user, agency=request.user.profile.agency, end=None))[0]
|
wd = list(Workday.objects.filter(user=request.user, agency=request.user.profile.agency, end=None))[0]
|
||||||
# END ALL BREAKS
|
# END ALL BREAKS
|
||||||
|
|
@ -54,6 +56,7 @@ def TimeAjax(request):
|
||||||
"success" : True,
|
"success" : True,
|
||||||
"break_starttime" : newbreak.start,
|
"break_starttime" : newbreak.start,
|
||||||
}
|
}
|
||||||
|
# END BREAK
|
||||||
elif request.GET["action"] == "end_break":
|
elif request.GET["action"] == "end_break":
|
||||||
wd = list(Workday.objects.filter(user=request.user, agency=request.user.profile.agency, end=None))[0]
|
wd = list(Workday.objects.filter(user=request.user, agency=request.user.profile.agency, end=None))[0]
|
||||||
toendbreak = list(wd.breaks.filter(end=None))[0]
|
toendbreak = list(wd.breaks.filter(end=None))[0]
|
||||||
|
|
@ -70,6 +73,16 @@ def TimeAjax(request):
|
||||||
"success" : True,
|
"success" : True,
|
||||||
"actualbreaktime" : breaksum*1000
|
"actualbreaktime" : breaksum*1000
|
||||||
}
|
}
|
||||||
|
# REMOVE WORKDAY
|
||||||
|
elif request.GET["action"] == "remove_workday":
|
||||||
|
wd = Workday.objects.get(pk=request.GET.get("workday"))
|
||||||
|
if(wd.user == request.user and wd.agency == request.user.profile.agency):
|
||||||
|
wd.delete()
|
||||||
|
data = {
|
||||||
|
"success" : True
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
data = { "success" : False}
|
||||||
else:
|
else:
|
||||||
data = {
|
data = {
|
||||||
"success" : False
|
"success" : False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue