627 lines
27 KiB
HTML
627 lines
27 KiB
HTML
{% load counter_tag %}
|
|
<table class="table table-striped table-sm table-bordered" id="timetable_team">
|
|
<tr>
|
|
<td id="9999999999_tableheadid">
|
|
<div class="btn-group ml-3 mb-2 mt-2" role="group" aria-label="calendarbuttons">
|
|
<button type="button" class="btn btn-primary mr-1" onclick="javascript:prevMonth()" ><i class="fas fa-arrow-circle-left"></i></button>
|
|
<button type="button" class="btn btn-primary mr-1" style="min-width: 150px !important;" onclick="javascript:fastChangeModal()">{{days_this_month.0|date:"F Y"}}</button>
|
|
<button type="button" class="btn btn-primary mr-1" onclick="javascript:nextMonth()"><i class="fas fa-arrow-circle-right"></i></button>
|
|
</div>
|
|
</td>
|
|
{% for da in days_this_month %}
|
|
<td id="{{forloop.counter0}}_tableheadid"><small>{{da|date:"d D"}}</small></td>
|
|
{% endfor %}
|
|
</tr>
|
|
|
|
{% for us in usersofagency %}
|
|
{% setdateforloopcounter forloop.counter %}
|
|
{% getactdateforloopcounter as actfcounter %}
|
|
<tr>
|
|
<td width="21%" id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_firstcolum">
|
|
<img class="commentimg mr-2" src="{{ us.profile.get_photo_url }}">
|
|
{{us.get_full_name}}
|
|
|
|
</td>
|
|
{% for da in days_this_month %}
|
|
|
|
{% isfreeday user da as isfree %}
|
|
{% isfreedayname user da as isfreename %}
|
|
{% getabscenceday user us da as abday %}
|
|
{% startdatecheck us da as startdatecheck %}
|
|
{% if isfree %}
|
|
<!-- FREEDAYS -->
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_free" style="background-color: #9C9C9C" data-toggle="tooltip" data-placement="top" title="{{isfreename}}">
|
|
<!-- USER NOT STARTED YET -->
|
|
{% elif startdatecheck == False %}
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_free" style="background-color: #d3d3d3">
|
|
{% elif da.weekday == 5 or da.weekday == 6 %}
|
|
<!-- WEEKEND -->
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_free" style="background-color: #d3d3d3">
|
|
{% elif abday != False %}
|
|
<!-- USER IS NOT THERE -->
|
|
{% if abday.confirm_status == 0 %}
|
|
{% if user|usergperm:"absencemanager" %}
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absence"
|
|
{% if abday.startday_info == "2" and abday.start.day == da.day %}
|
|
class="partialfilling negative"
|
|
style="background-size: 50% 100%;background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
|
|
class="partialfilling"
|
|
style="background-size: 50% 100%;background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
|
|
class="partialfilling negative"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.endday_info == "1" and abday.end.day == da.day %}
|
|
class="partialfilling "
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% else %}
|
|
style="background-color: {{abday.reason.color}}"
|
|
{% endif %}
|
|
data-toggle="tooltip" data-placement="top" title="{{abday.reason.name}} {% if abday.representator != None %} | Vertreter {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
|
|
{% elif abday.user == user %}
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absence"
|
|
{% if abday.startday_info == "2" and abday.start.day == da.day %}
|
|
class="partialfilling negative"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
|
|
class="partialfilling"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
|
|
class="partialfilling negative"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.endday_info == "1" and abday.end.day == da.day %}
|
|
class="partialfilling"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, {{abday.reason.color}} 0%, {{abday.reason.color}} 17%, {{abday.reason.color}} 33%, {{abday.reason.color}} 67%, {{abday.reason.color}} 83%, {{abday.reason.color}} 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% else %}
|
|
style="background-color: {{abday.reason.color}}"
|
|
{% endif %} data-toggle="tooltip" data-placement="top" title="{% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreter {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
|
|
{% else %}
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absence"
|
|
{% if abday.starday_info == 2 and abday.start.day == da.day %}
|
|
class="partialfilling negative"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.starday_info == 1 and abday.start.day == da.day %}
|
|
class="partialfilling"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
|
|
class="partialfilling negative"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% elif abday.endday_info == "1" and abday.end.day == da.day %}
|
|
class="partialfilling"
|
|
style="background-size: 50% 100%; background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */"
|
|
{% else %}
|
|
style="background-color: #858796"
|
|
{% endif %} data-toggle="tooltip" data-placement="top" title="{% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreter {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
|
|
{% endif %}
|
|
{% elif abday.confirm_status == 1 %}
|
|
{% if user|usergperm:"absencemanager" %}
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absencetoc"
|
|
{% if abday.startday_info == "2" and abday.start.day == da.day %}
|
|
class="partialfilling_nf negative_nf"
|
|
style="background-size: 50% 100%"
|
|
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
|
|
class="partialfilling_nf"
|
|
style="background-size: 50% 100%"
|
|
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
|
|
class="partialfilling_nf negative_nf"
|
|
style="background-size: 50% 100%"
|
|
{% elif abday.endday_info == "1" and abday.end.day == da.day %}
|
|
class="partialfilling_nf"
|
|
style="background-size: 50% 100%"
|
|
{% else %}
|
|
style="background-color: #858796"
|
|
{% endif %}
|
|
data-toggle="tooltip" data-placement="top" title="Nicht bestätigt | {{abday.reason.name}} {% if abday.representator != None %} | Vertreten durch {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %} ">
|
|
{% else %}
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{abday.pk}}_absencetoc"
|
|
{% if abday.startday_info == "2" and abday.start.day == da.day %}
|
|
class="partialfilling_nf negative_nf"
|
|
style="background-size: 50% 100%"
|
|
{% elif abday.startday_info == "1" and abday.start.day == da.day %}
|
|
class="partialfilling_nf"
|
|
style="background-size: 50% 100%"
|
|
{% elif abday.endday_info == "2" and abday.end.day == da.day %}
|
|
class="partialfilling_nf negative_nf"
|
|
style="background-size: 50% 100%"
|
|
{% elif abday.endday_info == "1" and abday.end.day == da.day %}
|
|
class="partialfilling_nf"
|
|
style="background-size: 50% 100%"
|
|
{% else %}
|
|
style="background-color: #858796"
|
|
{% endif %} data-toggle="tooltip" data-placement="top" title="Nicht bestätigt | {% if abday.user == user %} {{abday.reason.name}} {% else %} Abwesend {% endif %} {% if abday.representator != None %} | Vertreten durch {{abday.representator.first_name}} {{abday.representator.last_name}} {% endif %}">
|
|
{% endif %}
|
|
{% else %}
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{da|date:'Y-m-d'}}" {% if us.pk == user.pk or user|usergperm:"absencemanager" %}class="tm-ab-tdhover"{% endif %}>
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
<!-- NORMAL CHOICE -->
|
|
<td id="{{actfcounter}}_{{forloop.counter}}_{{us.pk}}_{{da|date:'Y-m-d'}}" {% if us.pk == user.pk or user|usergperm:"absencemanager" %}class="tm-ab-tdhover"{% endif %}>
|
|
{% endif %}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
|
|
|
|
|
|
<style type="text/css">
|
|
.partialfilling {
|
|
background-image: linear-gradient(to right, #36b9cc 0%, #36b9cc 17%, #36b9cc 33%, #36b9cc 67%, #36b9cc 83%, #36b9cc 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */
|
|
}
|
|
.partialfilling.negative {
|
|
background-image: linear-gradient(to left, #36b9cc 0%, #36b9cc 17%, #36b9cc 33%, #36b9cc 67%, #36b9cc 83%, #36b9cc 100%); /* your gradient */
|
|
background-position: 100% 100%;
|
|
}
|
|
|
|
.partialfilling_nf {
|
|
background-image: linear-gradient(to right, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
|
|
background-repeat: no-repeat; /* don't remove */
|
|
}
|
|
.partialfilling_nf.negative_nf {
|
|
background-image: linear-gradient(to left, #858796 0%, #858796 17%, #858796 33%, #858796 67%, #858796 83%, #858796 100%); /* your gradient */
|
|
background-position: 100% 100%;
|
|
}
|
|
</style>
|
|
|
|
|
|
<div class="modal fade" tabindex="-1" id="fastjumpmodal" data-backdrop="static">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Zeitraum auswählen</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="form-group">
|
|
<label for="exampleFormControlSelect1">Jahr auswählen</label>
|
|
{% getsomeyears activeyear as years %}
|
|
<select class="form-control" id="choosenyear">
|
|
{% for y in years %}
|
|
<option val="{{y}}" {% if y == activeyear %} selected{% endif%}>{{y}}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
{% getsomemonths as months %}
|
|
{% for m in months %}
|
|
<button class="btn
|
|
{% if forloop.counter == activemonth %} btn-primary {% else %} btn-secondary {% endif %}
|
|
btn-sm mr-2 mb-2" onclick="javascript:goFastToMonth({{forloop.counter}})">{{m}}</button>
|
|
{% endfor %}
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary " data-dismiss="modal">Schließen</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script type="text/javascript">
|
|
var choosenyear = "{{activeyear}}";
|
|
|
|
function goFastToMonth(month){
|
|
location.href = "/tm/abs/" + month +"/" + choosenyear
|
|
}
|
|
|
|
document.getElementById("choosenyear").addEventListener("change", function(){
|
|
choosenyear = $('#choosenyear :selected').val();
|
|
})
|
|
|
|
$(function () {
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
})
|
|
|
|
function fastChangeModal(){
|
|
$("#fastjumpmodal").modal("toggle");
|
|
}
|
|
|
|
|
|
//Set required repr or not
|
|
document.getElementById("id_reason").addEventListener("change", function(){
|
|
reasonid = $('#id_reason :selected').val();
|
|
//Get required-rep
|
|
$.ajax(
|
|
{
|
|
type: "GET",
|
|
url: "{% url 'tm-ajax' %}",
|
|
data:{
|
|
action : "checkrequired",
|
|
rid : reasonid
|
|
},
|
|
success : function(data){
|
|
//CHANGE REPRESENTOR
|
|
if(data["isreq"]){
|
|
$("#id_representator").prop('required',true);
|
|
$("label[for*='id_representator']").html("Vertreter*");
|
|
}
|
|
else{
|
|
$("#id_representator").prop('required',false);
|
|
$("label[for*='id_representator']").html("Vertreter");
|
|
}
|
|
//CHANGE HOLIDAYCOUNT
|
|
if(data["isholiday"] == false){
|
|
$("#noholidays_container").show();
|
|
$("#restholidays_container").hide();
|
|
$("#start_absence_contract").prop("disabled", false);
|
|
}
|
|
else{
|
|
$("#noholidays_container").hide();
|
|
$("#restholidays_container").show();
|
|
recalculateChoosenDaysAfterInit();
|
|
}
|
|
}
|
|
});
|
|
})
|
|
|
|
$("#id_activemonth").val("{{activemonth}}")
|
|
$("#id_activeyear").val("{{activeyear}}")
|
|
$("#id_prevmonth").val("{{prevmonth}}")
|
|
$("#id_nextmonth").val("{{nextmonth}}")
|
|
$("#id_prevyear").val("{{prevyear}}")
|
|
$("#id_nextyear").val("{{nextyear}}")
|
|
|
|
function prevMonth(){
|
|
$.ajax(
|
|
{
|
|
type: "GET",
|
|
url: "{% url 'tm-ajax' %}",
|
|
data:{
|
|
action : "getrenderedtable",
|
|
activeyear : {{prevyear}},
|
|
activemonth : {{prevmonth}}
|
|
},
|
|
beforeSend: function(request) {
|
|
$("#overlay").fadeIn();
|
|
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
|
},
|
|
success : function(data){
|
|
$("#overlay").fadeOut();
|
|
$("#rendered_table").html(data);
|
|
}
|
|
});
|
|
}
|
|
|
|
function nextMonth(){
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "{% url 'tm-ajax' %}",
|
|
data:{
|
|
action : "getrenderedtable",
|
|
activeyear : {{nextyear}},
|
|
activemonth : {{nextmonth}}
|
|
},
|
|
beforeSend: function(request) {
|
|
$("#overlay").fadeIn();
|
|
request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
|
},
|
|
success : function(data){
|
|
$("#overlay").fadeOut();
|
|
$("#rendered_table").html(data)
|
|
}
|
|
});
|
|
}
|
|
|
|
var selectedElements = [];
|
|
var active_row = "";
|
|
var sameday = false;
|
|
|
|
var user_has_right = "{{user|usergperm:"absencemanager"}}";
|
|
if(user_has_right == "True"){
|
|
user_has_right = true;
|
|
}
|
|
else{
|
|
user_has_right = false;
|
|
}
|
|
|
|
function recalculateChoosenDays(){
|
|
seldates = [];
|
|
userid = "";
|
|
for(i = 0; i < selectedElements.length; i++){
|
|
seldates.push(selectedElements[i].split("_")[3]);
|
|
userid = selectedElements[i].split("_")[2];
|
|
}
|
|
seldates.sort();
|
|
date_start = new Date(seldates[0])
|
|
date_end = new Date(seldates[seldates.length-1])
|
|
|
|
if(+date_start == +date_end){
|
|
sameday = true;
|
|
}
|
|
else{
|
|
sameday = false;
|
|
}
|
|
|
|
$("#div_id_end").show();
|
|
$("#div_id_end_ishalf").show();
|
|
|
|
$("#id_start").data("DateTimePicker").date(date_start);
|
|
$("#id_end").data("DateTimePicker").date(date_end);
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "{% url 'tm-ajax' %}",
|
|
data:{
|
|
action : "getrestholidays",
|
|
userid : userid,
|
|
startdate : date_start.getFullYear() + "__" + (date_start.getMonth()+1) + "__" + date_start.getDate(),
|
|
enddate : date_end.getFullYear() + "__" + (date_end.getMonth()+1) + "__" + date_end.getDate(),
|
|
//start_half : $("#id_start_ishalf").prop("checked"),
|
|
//end_half : $("#id_end_ishalf").prop("checked"),
|
|
startday_info : $("#id_startday_info").val(),
|
|
endday_info : $("#id_endday_info").val(),
|
|
},
|
|
success : function(data){
|
|
|
|
|
|
console.log(data);
|
|
|
|
$("#startAbsenceProgress").modal("show");
|
|
|
|
|
|
$("#holidayyear").html(date_start.getFullYear());
|
|
$("#restholidays").html(data["restholiday_thisyear"]);
|
|
$("#detail_rest").html(data["restholiday_thisyear"]);
|
|
$("#detail_resthol").html(data["restholiday_lastyear"]);
|
|
$("#detail_next").html(data["restholiday_nextyear"]);
|
|
$("#detail_next_rest").html(data["restholiday_nextyear_rest"]);
|
|
$("#detail_tocontract").html(data["need_days"]);
|
|
$("#detail_tocontract_overall").html(data["need_days"]);
|
|
|
|
$("#detail_sum").html(data["restholiday_thisyear"]+data["restholiday_lastyear"]+data["restholiday_nextyear"]+data["restholiday_nextyear_rest"]);
|
|
|
|
if(data["restholiday_thisyear"] < 0 || data["restholiday_lastyear"] < 0 || data["restholiday_nextyear"] < 0){
|
|
$("#start_absence_contract").prop("disabled", true);
|
|
}
|
|
else{
|
|
$("#start_absence_contract").prop("disabled", false);
|
|
}
|
|
|
|
if(seldates.length == 1){
|
|
$("#div_id_end").hide();
|
|
$("#div_id_endday_info").hide();
|
|
}
|
|
else{
|
|
$("#div_id_end").show();
|
|
$("#div_id_endday_info").show();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function recalculateChoosenDaysAfterInit(){
|
|
|
|
new_start = $("#id_start").datepicker().val();
|
|
new_end = $("#id_end").datepicker().val();
|
|
|
|
new_start = new_start.split(".");
|
|
new_end = new_end.split(".");
|
|
|
|
behindcheck_start = new Date(new_start[2], (parseInt(new_start[1])-1), new_start[0]);
|
|
behindcheck_end = new Date(new_end[2], (parseInt(new_end[1])-1), new_end[0]);
|
|
|
|
if(sameday){
|
|
behindcheck_end = behindcheck_start;
|
|
new_end = new_start;
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
type: "GET",
|
|
url: "{% url 'tm-ajax' %}",
|
|
data:{
|
|
action : "getrestholidays",
|
|
userid : userid,
|
|
startdate : new_start[2] + "__" + new_start[1] + "__" + new_start[0],
|
|
enddate : new_end[2] + "__" + new_end[1] + "__" + new_end[0],
|
|
//start_half : $("#id_start_ishalf").prop("checked"),
|
|
//end_half : $("#id_end_ishalf").prop("checked"),
|
|
startday_info : $("#id_startday_info").val(),
|
|
endday_info : $("#id_endday_info").val(),
|
|
},
|
|
success : function(data){
|
|
console.log(data);
|
|
$("#restholidays").html(data["restholiday_thisyear"]);
|
|
$("#detail_rest").html(data["restholiday_thisyear"]);
|
|
$("#detail_resthol").html(data["restholiday_lastyear"]);
|
|
$("#detail_next").html(data["restholiday_nextyear"]);
|
|
$("#holidayyear").html(new_start[2]);
|
|
$("#detail_sum").html(data["restholiday_thisyear"]+data["restholiday_lastyear"]+data["restholiday_nextyear"]+data["restholiday_nextyear_rest"]);
|
|
|
|
$("#detail_tocontract").html(data["need_days"]);
|
|
$("#detail_tocontract_overall").html(data["need_days"]);
|
|
|
|
if(data["two_years"] == true){
|
|
$("#detail_tocontract").html(data["need_days_this"]);
|
|
$("#two_years").show();
|
|
$("#holidayyear_next").html(new_end[2]);
|
|
$("#detail_next_rest").html(data["restholiday_nextyear_rest"]);
|
|
$("#detail_next").html(data["restholiday_nextyear"]);
|
|
$("#detail_tocontract_next").html(data["need_days_next"]);
|
|
$("#restholidays_next").html(data["restholiday_nextyear"]);
|
|
$("#detail_tocontract_overall").html(data["need_days_next"]+data["need_days_this"]);
|
|
}
|
|
else{
|
|
$("#two_years").hide();
|
|
}
|
|
|
|
behindcheck = false;
|
|
if(+behindcheck_start == +behindcheck_end){
|
|
behindcheck = true;
|
|
}
|
|
else if(+behindcheck_start < +behindcheck_end == true){
|
|
behindcheck = true;
|
|
}
|
|
|
|
if(behindcheck == false || data["restholiday_thisyear"] < 0 || data["restholiday_lastyear"] < 0 || data["restholiday_nextyear"] < 0 && data["startendcheck"]){
|
|
$("#start_absence_contract").prop("disabled", true);
|
|
}
|
|
else{
|
|
$("#start_absence_contract").prop("disabled", false);
|
|
}
|
|
|
|
if(seldates.length == 1){
|
|
$("#div_id_end").hide();
|
|
$("#div_id_end_ishalf").hide();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
/*
|
|
CHANGE LISTENER
|
|
*/
|
|
$("#id_start").blur(function(){
|
|
recalculateChoosenDaysAfterInit();
|
|
})
|
|
|
|
$("#id_end").blur(function(){
|
|
recalculateChoosenDaysAfterInit();
|
|
})
|
|
|
|
/*
|
|
$("#id_start_ishalf").change(function(){
|
|
recalculateChoosenDaysAfterInit();
|
|
})
|
|
|
|
$("#id_end_ishalf").change(function(){
|
|
recalculateChoosenDaysAfterInit();
|
|
})
|
|
*/
|
|
$("#id_startday_info").change(function(){
|
|
recalculateChoosenDaysAfterInit();
|
|
})
|
|
|
|
$("#id_endday_info").change(function(){
|
|
recalculateChoosenDaysAfterInit();
|
|
})
|
|
|
|
|
|
$( function() {
|
|
$( "#timetable_team" ).selectable({
|
|
filter: 'td',
|
|
start : function(){
|
|
if(selectedElements.length > 0){
|
|
selectedElements = [];
|
|
}
|
|
},
|
|
selecting: function(event, ui){
|
|
newid = ui["selecting"]["id"];
|
|
if(newid.split("_")[1] == "tableheadid" || newid.split("_")[3] == "firstcolum" || (newid.split("_")[2] != {{user.pk}} && user_has_right != true ) || newid.split("_")[3] == "free" || newid.split("_")[4] == "absence"){
|
|
|
|
if($("#" + newid).hasClass("negative")){
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling");
|
|
$("#" + newid).addClass("negative");
|
|
}
|
|
else if($("#" + newid).hasClass("partialfilling"))
|
|
{
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling");
|
|
}
|
|
else if($("#" + newid).hasClass("negative_nf")){
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling_nf");
|
|
$("#" + newid).addClass("negative_nf");
|
|
}
|
|
else if($("#" + newid).hasClass("partialfilling_nf"))
|
|
{
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling_nf");
|
|
}
|
|
else{
|
|
$("#" + newid).removeClass();
|
|
}
|
|
}
|
|
else if(newid.split("_")[4] == "absencetoc"){
|
|
if($("#" + newid).hasClass("negative")){
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling");
|
|
$("#" + newid).addClass("negative");
|
|
}
|
|
else if($("#" + newid).hasClass("partialfilling"))
|
|
{
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling");
|
|
}
|
|
else if($("#" + newid).hasClass("negative_nf")){
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling_nf");
|
|
$("#" + newid).addClass("negative_nf");
|
|
}
|
|
else if($("#" + newid).hasClass("partialfilling_nf"))
|
|
{
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling_nf");
|
|
}
|
|
else{
|
|
$("#" + newid).removeClass();
|
|
}
|
|
idtoopen = newid.split("_")[3];
|
|
openModalABChangeTable(idtoopen);
|
|
}
|
|
else{
|
|
if(selectedElements.length == 0){
|
|
active_row = newid.split("_")[0];
|
|
selectedElements.push(ui["selecting"]["id"]);
|
|
}
|
|
else if(newid.split("_")[0] != active_row){
|
|
|
|
if($("#" + newid).hasClass("negative")){
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling");
|
|
$("#" + newid).addClass("negative");
|
|
}
|
|
else if($("#" + newid).hasClass("partialfilling"))
|
|
{
|
|
$("#" + newid).removeClass();
|
|
$("#" + newid).addClass("partialfilling");
|
|
}
|
|
else{
|
|
$("#" + newid).removeClass();
|
|
}
|
|
}
|
|
else{
|
|
selectedElements.push(ui["selecting"]["id"]);
|
|
}
|
|
}
|
|
},
|
|
unselecting: function(event, ui){
|
|
selectedElements.splice(selectedElements.indexOf(ui["unselecting"]["id"]),1);
|
|
},
|
|
stop: function(){
|
|
//Selection ends, check if elements set and open modal
|
|
if(selectedElements.length > 0){
|
|
$("#timetable_team tbody tr").each(function(i) {
|
|
// find the first td in the row
|
|
var value = $(this).find("td:first").text();
|
|
// display the value in console
|
|
checkrow = parseInt(active_row)
|
|
if(i == (checkrow)){
|
|
$("#username_abscence").html(value);
|
|
$("#id_userid").val(selectedElements[0].split("_")[2])
|
|
}
|
|
});
|
|
recalculateChoosenDays();
|
|
}
|
|
}
|
|
});
|
|
} );
|
|
</script>
|
|
|
|
|
|
|