258 lines
9.0 KiB
HTML
258 lines
9.0 KiB
HTML
{% extends "users/base.html" %}
|
|
{% load counter_tag %}
|
|
{% block content %}
|
|
<div class="content-section col-12">
|
|
|
|
<h3>Feiertage und Schließtage</i></b>{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Erstellen Sie hier Feiertage und Tage, an denen Ihre Agentur generell geschlossen hat." class="far fa-question-circle"></i></small>{% endif %}
|
|
<a class="btn btn-primary btn-sm" href="#/" onclick="javascript:$('#addMulitpleFreeDays').modal('toggle')" style="float: right;"><i class="fas fa-plus"></i> Feiertage</a>
|
|
<a class="btn btn-primary btn-sm mr-2" href="{% url 'tm-freedayadd' %}" style="float: right;"><i class="fas fa-plus"></i> Freier Tag</a>
|
|
</h3>
|
|
<hr>
|
|
<div class="content-section col-12">
|
|
<div class="table-responsive">
|
|
<table class="table table-hover" id="fdtable">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Name</th>
|
|
<th scope="col">Tag</th>
|
|
<!--<th scope="col">Logo</th> -->
|
|
{% if user|usergperm:"moduleorganizer" %}
|
|
<th scope="col"> </th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
<tbody id="table_freedays">
|
|
{% for fd in freedays %}
|
|
<tr>
|
|
<td>{{ fd.name }}</td>
|
|
<td>{{ fd.day|date:"d. F Y" }}</td>
|
|
<td>
|
|
{% if user|usergperm:"moduleorganizer" %}
|
|
<a style="float: right" class="btn btn-secondary btn-sm ml-2" href="{% url 'freeday-delete' fd.pk %}">
|
|
<i class="fas fa-trash"></i>
|
|
</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<button class="btn btn-secondary mt-2" onclick="javascript:$('#allDel').modal('toggle');" style="float: left;"><small><i class="fas fa-trash"></i></small></button>
|
|
</div>
|
|
<div class="modal fade" tabindex="-1" role="dialog" id="freedays_initloadinginfo" data-backdrop="static">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Feiertage laden</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>Sie haben das Modul Abwesenheitsplanung aktiviert. Sollen die Feiertage automatisch für die Postleitzahl {{request.user.profile.agency.plz}} geladen werden?</p>
|
|
<small>Sie können Feiertage auch nachträglich laden und verändern.</small>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary" onclick="javascript:loadFreeDays()">Feiertage laden</button>
|
|
<button type="button" class="btn " data-dismiss="modal">Abbrechen</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- PLZ MODAL -->
|
|
<div class="modal fade" tabindex="-1" role="dialog" id="plz_error" data-backdrop="static">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Postleitzahl nicht gefunden</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>Die Postleitzahl Ihrer Agentur konnte nicht gefunden. Bitte gehen Sie in den Bereich Einstellungen auf den Reiter Agentur, um dort eine gültige Postleizahl zu hinterlegen.</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary" data-dismiss="modal">Schließen</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Load freedays by year -->
|
|
<div class="modal fade" tabindex="-1" role="dialog" id="addMulitpleFreeDays" data-backdrop="static">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Feiertage laden</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
Laden Sie Feiertage für entsprechende Jahre nach. <br />
|
|
<small>Es werden immer automatisch die Feiertage für die nächsten zwei Jahre geladen. </small>
|
|
<hr>
|
|
<div class="form-group">
|
|
|
|
<label for="">Jahr:</label>
|
|
{% getsomeyears 2023 as years %}
|
|
<select class="form-control" id="yearvalue">
|
|
{% for y in years %}
|
|
<option val="{{y}}" {% if y == yearvalue %} selected{% endif%}>{{y}}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<hr>
|
|
<p>Wählen Sie aus, ob nur Feiertage für das Bundesland nach Ihrer PLZ geladen werden oder bundesweite Feiertage.</p>
|
|
<div class="custom-control custom-radio">
|
|
<input type="radio" class="custom-control-input" id="freedays_plz" name="landchoice" checked>
|
|
<label class="custom-control-label" for="freedays_plz">Feiertage für meine PLZ ({{user.profile.agency.plz}})</label>
|
|
</div>
|
|
|
|
|
|
<div class="custom-control custom-radio">
|
|
<input type="radio" class="custom-control-input" id="freedays_land" name="landchoice" >
|
|
<label class="custom-control-label" for="freedays_land">Deutschlandweite Feiertage</label>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary" onclick="javascript:loadCustomFreeDays()" >Feiertage laden</button>
|
|
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Load freedays by year -->
|
|
<div class="modal fade" tabindex="-1" role="dialog" id="allDel" data-backdrop="static">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Alle Feiertage löschen</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
Möchten Sie wirklich alle gespeicherten Feiertage löschen?
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary" onclick="javascript:doDelAll()" >Alle löschen</button>
|
|
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(document).ready(function(){
|
|
{% if init_freedays %}
|
|
$("#freedays_initloadinginfo").modal("toggle");
|
|
{% endif %}
|
|
$('#fdtable').DataTable({
|
|
"language": {
|
|
"search" : "Suche",
|
|
"info": "Zeige _START_ bis _END_ von _TOTAL_ Einträgen",
|
|
"lengthMenu": "Zeige _MENU_ Einträge",
|
|
"zeroRecords": "Nichts gefunden",
|
|
"infoEmpty": "Keine Einträge",
|
|
"paginate": {
|
|
"first": "Erste",
|
|
"last": "Letzte",
|
|
"next": "Nächste",
|
|
"previous": "Zurück"
|
|
},
|
|
},
|
|
"aaSorting": [],
|
|
"pageLength": 50,
|
|
"buttons" : {
|
|
"className" : "btn-danger"
|
|
}
|
|
});
|
|
})
|
|
|
|
function doDelAll(){
|
|
$("#allDel").modal("toggle");
|
|
$.ajax(
|
|
{
|
|
type: "GET",
|
|
url: "{% url 'dasettings-ajax' %}",
|
|
data:{
|
|
action : "delallfreedays",
|
|
},
|
|
success: function( data )
|
|
{
|
|
if(data["success"]){
|
|
window.location.href = "{% url 'tm-managemenetfreedays' %}";
|
|
}
|
|
else{
|
|
$("#plz_error").modal("toggle");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function loadFreeDays()
|
|
{
|
|
$("#freedays_initloadinginfo").modal("hide");
|
|
$.ajax(
|
|
{
|
|
type: "GET",
|
|
url: "{% url 'dasettings-ajax' %}",
|
|
data:{
|
|
action : "initloadfreedays",
|
|
},
|
|
success: function( data )
|
|
{
|
|
if(data["success"]){
|
|
window.location.href = "{% url 'tm-managemenetfreedays' %}";
|
|
}
|
|
else{
|
|
$("#plz_error").modal("toggle");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
function loadCustomFreeDays(){
|
|
year = $("#yearvalue").val();
|
|
agencyplz = $("#freedays_plz").prop("checked");
|
|
land = $("#freedays_land").prop("checked");
|
|
$('#addMulitpleFreeDays').modal('toggle');
|
|
$.ajax(
|
|
{
|
|
type: "GET",
|
|
url: "{% url 'dasettings-ajax' %}",
|
|
data:{
|
|
action : "initloadfreedaysmulti",
|
|
year : year,
|
|
agencyplz : agencyplz,
|
|
land : land
|
|
},
|
|
success: function( data )
|
|
{
|
|
if(data["success"]){
|
|
window.location.href = "{% url 'tm-managemenetfreedays' %}";
|
|
}
|
|
else{
|
|
$("#plz_error").modal("toggle");
|
|
}
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<style>
|
|
/* DATATABLES */
|
|
.paginate_button {
|
|
padding: 0px !important;
|
|
border: 0px !important;
|
|
}
|
|
</style>
|
|
{% endblock content %}
|