Bug zwischenstand

This commit is contained in:
Holger Trampe 2020-09-16 11:57:34 +02:00
parent 8af1eeb37a
commit 557b3fb0a4
5 changed files with 99 additions and 24 deletions

View File

@ -37,6 +37,9 @@ Gleitzeitkonto:
<b><span style="color: red">-{{actualaccounttime.0}}&nbsp;Stunden</span></b>
{% endif %}
</div>
<script type="text/javascript">
@ -87,6 +90,9 @@ Gleitzeitkonto:
$("#starttime").html("{{formattetstarttime_last_start}}");
$("#endtime").html("{{formattetstarttime_last_end}}");
$("#breaksum").html("00:00:00");
$("#timemanagement_clock").toggle();
//day info
{% else %}
@ -233,6 +239,7 @@ Gleitzeitkonto:
}
start = data["wd_starttime_complete"];
realTimeClock();
location.href = location.href;
}
});
@ -274,7 +281,6 @@ Gleitzeitkonto:
realTimeClock();
}
});
}
</script>

View File

@ -225,8 +225,48 @@
</div>
</div>
<!-- Modal with all users for OnClick-Add-Absence -->
{% if user|usergperm:"absencemanager" %}
<div class="modal fade" tabindex="-1" id="chooseUserForNewAbsence" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Mitarbeiter auswählen</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Bitte wählen Sie den Mitarbeiter aus, für den Sie eine neue Abwesenheit anlegen wollen.
<hr>
<div style="float: left;">
{% for us in usersofagency %}
<button class="btn btn-primary mr-2 mb-2" onclick="javascript:loadNewAbsenceByUser({{us.pk}})">
{{us.get_full_name}}
</button>
{% endfor %}
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary " data-dismiss="modal">Abbrechen</button>
</div>
</div>
</div>
</div>
{% endif %}
<script type="text/javascript">
function loadNewAbsenceByUser(userid){
$("#chooseUserForNewAbsence").modal("toggle");
recalculateChoosenDays(userid);
}
function showNewAbsenceByUser(){
$("#chooseUserForNewAbsence").modal("toggle");
}
var choosenyear = "{{activeyear}}";
function goFastToMonth(month){
@ -334,6 +374,8 @@ function nextMonth(){
var selectedElements = [];
var active_row = "";
var sameday = false;
var userid = "";
var user_has_right = "{{user|usergperm:"absencemanager"}}";
if(user_has_right == "True"){
@ -343,9 +385,12 @@ else{
user_has_right = false;
}
function recalculateChoosenDays(){
function recalculateChoosenDays(userid=false){
seldates = [];
userid = "";
//Click on Table
if(userid == false){
for(i = 0; i < selectedElements.length; i++){
seldates.push(selectedElements[i].split("_")[3]);
userid = selectedElements[i].split("_")[2];
@ -354,18 +399,38 @@ function recalculateChoosenDays(){
date_start = new Date(seldates[0])
date_end = new Date(seldates[seldates.length-1])
if(+date_start == +date_end){
sameday = true;
}
else{
sameday = false;
}
}
//Click on Button
else{
//Show Modal with all users of agency
$("#chooseUserForNewAbsence").modal("toggle");
//Set initial Date-Infos
var today = new Date();
var tempdate_user = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
date_start = new Date(tempdate_user);
date_end = new Date(tempdate_user);
sameday = true;
userid = userid.toString();
}
$("#div_id_end").show();
$("#div_id_end_ishalf").show();
$("#id_start").data("DateTimePicker").date(date_start);
$("#id_end").data("DateTimePicker").date(date_end);
console.log(userid);
$.ajax({
type: "GET",
url: "{% url 'tm-ajax' %}",
@ -381,7 +446,6 @@ function recalculateChoosenDays(){
},
success : function(data){
console.log(data)
if(data["other_absences"] != false){
$("#otherholidays").show();
$("#otherholidays_users").html(data["other_absences"]);
@ -421,6 +485,8 @@ function recalculateChoosenDays(){
$("#start_absence_contract").prop("disabled", false);
}
$("#username_abscence").html(data["choosenuser_name"]);
/*
if(seldates.length == 1){
@ -438,6 +504,8 @@ function recalculateChoosenDays(){
}
function recalculateChoosenDaysAfterInit(){
console.log("CHANGE!")
console.log(userid);
new_start = $("#id_start").datepicker().val();
new_end = $("#id_end").datepicker().val();
@ -468,8 +536,6 @@ function recalculateChoosenDaysAfterInit(){
},
success : function(data){
console.log(data);
if(data["other_absences"] != false){
$("#otherholidays").show();
$("#otherholidays_users").html(data["other_absences"]);

View File

@ -8,6 +8,8 @@
<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 %}
<small><i onclick="javascript:$('#youtubevideoinformation').modal('toggle');" class="far fa-play-circle"></i></small>
{% if user|usergperm:"absencemanager" %}<button class="btn btn-primary btn-sm" onclick="javascript:showNewAbsenceByUser()" style="float: right;"><i class="fas fa-plus"></i>&nbsp;Abwesenheit</button> {% endif %}
</h3>
<hr>

View File

@ -906,7 +906,8 @@ def TimeAjax(request):
"need_days_next" : need_days_next,
"need_days_this" : need_days_this,
"other_absences" : other_absences_string,
"userown_absences" : userown_absences_string
"userown_absences" : userown_absences_string,
"choosenuser_name" : user.first_name + " " + user.last_name
}
# REQUEST USER NO RIGHTS
else:

View File

@ -987,7 +987,7 @@ def absencecheck(user, daytocheck):
return returnstat
# CRONJOBS UM 00:01!
# CRONJOBS UM 00:05!
def cronactionsdaily(request, code):
data = {}
if(code == settings.CRONAPIKEY):
@ -1044,7 +1044,7 @@ def cronactionsdaily(request, code):
targettworktime = user.usertime.wd_so
# Es wird nur ein Arbeitstag erstellt, wenn KEINE Abwesenheiten vorliegen und der Nutzer an diesem Tag arbeiten muss
if(workdays_yesterday == 0 and absencecheck(user, yesterday) == False and targettworktime > 0.0):
if(workdays_yesterday == 0 and absencecheck(user, yesterday) == False and targettworktime > 0.0 and user.usertime.usetime_start <= today):
workdaytemp = Workday(user=user, agency=user.profile.agency, start=datetime(yesterday.year, yesterday.month, yesterday.day, 8, 0), end=datetime(yesterday.year, yesterday.month, yesterday.day, 8, 0), target=targettworktime)
workdaytemp.save()