Abwesenheit OHNE Benachrichtigungen FERTIG

This commit is contained in:
Holger Trampe 2020-05-24 02:25:22 +02:00
parent 19447ce4f7
commit bcc87e7811
2 changed files with 52 additions and 5 deletions

View File

@ -4,10 +4,18 @@
{% load counter_tag %}
{% if request.user.profile.agency.module_timemanagement %}
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.bundle.min.js"></script>
<div class="content-section col-12">
<h3>Abwesenheiten{% if request.user.profile.showtooltips %}&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Bearbeiten Sie hier Ihre Abwesenheiten." class="far fa-question-circle"></i></small>{% endif %}</h3>
<h3>Abwesenheiten{% if request.user.profile.showtooltips %}&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Bearbeiten Sie hier Ihre Abwesenheiten." class="far fa-question-circle"></i></small>{% endif %}
</h3>
<hr>
{% if yearinfo != False %}
<p>Verbrauchte Urlaubstage: {{yearinfo.days_inuse}} | Verfügbar: {{yearinfo.days}}</p>
{% else %}
<p>Keine Abwesenheitsinformationen vorhanden</p>
{% endif %}
<div >
<ul class="nav nav-tabs " id="absencetabs" role="tablist" >
<li class="nav-item">
@ -31,8 +39,13 @@
</a>
</li>
{% endif %}
</ul>
</ul>
<div class="chart-container" style="position: absolute; height:160px; width:160px; margin-bottom: -150px; right: -15px; top:54px">
<canvas id="datainfo_restdays"></canvas>
</div>
</div>
<div class="tab-content" id="absencetabsContent">
<div class="tab-pane fade" id="team" role="tabpanel" aria-labelledby="team-tab">
@ -437,6 +450,27 @@ $('#absencetabs a').on('click', function (e) {
});
</script>
<script>
var ctx = document.getElementById("datainfo_restdays");
var myChart = new Chart(ctx, {
type: 'doughnut',
data: {
labels: ['Kontigent', 'Genutzt'],
datasets: [{
backgroundColor: ['#5a5c69','#ff304f'],
data: [{{kontingent}}, {{inuse}}]
}]
},
options : {
legend: {
display: false
}
}
});
</script>
{% else %}
<h3>Das Modul Abwesenheits- und Zeiterfassung wurde in ihrer Agentur deaktiviert.</h3>
{% endif %}

View File

@ -153,6 +153,16 @@ def AbsenceManagmenet(request, activemonth=False, activeyear=False):
if(tempTime.startdate == None):
missinguserdata.append(user)
kontingent = 0
inuse = 0
yearinfo = False
try:
yearinfo = list(UserYearAbsenceInfo.objects.filter(year=activeyear, user=request.user))[0]
inuse = int(yearinfo.days_inuse)
kontingent = int(yearinfo.days)
except:
pass
context = {
"active_link" : "abscence",
"usersofagency" : User.objects.filter(profile__agency=request.user.profile.agency).order_by("-last_name"),
@ -164,6 +174,9 @@ def AbsenceManagmenet(request, activemonth=False, activeyear=False):
"prevyear" : prevyear,
"activemonth" : activemonth,
"activeyear" : activeyear,
"inuse" : inuse,
"yearinfo" : yearinfo,
"kontingent" : kontingent,
"abscenceform" : AddAbsence(instance=request.user),
"userown" : Absence.objects.filter(agency=request.user.profile.agency, user=request.user).order_by("-start")
}