digitaleagenturnc/timemanagement/templates/timemanagement/tm_ab_all.html

104 lines
3.5 KiB
HTML

<div class="row col-12 mt-3" >
<div class="table-responsive">
<table class="table table-hover" id="table_allabsences">
<thead>
<tr>
<th scope="col">Vorname</th>
<th scope="col">Nachname</th>
<th scope="col">Start</th>
<th scope="col">Ende</th>
<th scope="col">Grund</th>
<th scope="col">Info</th>
<th scope="col">Status</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody id="">
{% for abday in allabsences %}
<tr id="tableele_ab_{{abday.pk}}">
<td>{{abday.user.first_name}}</td>
<td>{{abday.user.last_name}}</td>
<td>{{abday.start|date:"d.M Y"}}</td>
<td>{{abday.end|date:"d.M Y"}}</td>
<td>{{abday.reason.name}}</td>
<td>{{abday.info}}</td>
<td>{% if abday.confirm_status == 0 %} Genehmigt {% elif abday.confirm_status == 1 %} Beantragt {% else %} Abgelehnt {% endif %}</td>
<td style="float: right !important; min-width: 100%">
<button type="button" style="float: right; margin-left: 2px;" class="btn btn-secondary btn-sm" onclick="javascript:$('#confirm-delete_{{abday.pk}}').modal('toggle')"><i class="fas fa-trash"></i></button>
<button type="button " style="float: right" class="btn btn-secondary btn-sm mr-1" onclick="javascript:changeAbsence({{abday.pk}})"><i class="fas fa-pen"></i></button>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script type="text/javascript">
function changeAbsence(abscencepk){
location.href = "/tm/abs/update/" + abscencepk + "/"
}
$(document).ready(function(){
$('#table_allabsences').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"
},
},
"pageLength": 50,
"buttons" : {
"className" : "btn-danger"
}
});
});
</script>
{% for ab in allabsences %}
<div class="modal fade" id="confirm-delete_{{ab.pk}}" tabindex="-1" role="dialog" aria-labelledby="" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Abwesenheit löschen</h5>
</div>
<div class="modal-body">
Möchten Sie wirklich die Abwesenheit von {{ab.user.first_name}} {{ab.user.last_name}} vom {{ab.start|date:"d.m.Y"}} bis {{ab.end|date:"d.m.Y"}} löschen?
</div>
<div class="modal-footer">
<button class="btn btn-primary" id="ab_{{ab.pk}}" >Löschen</button>
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("#ab_{{ab.pk}}").click(function(){
$.ajax(
{
type: "GET",
url: "{% url 'tm-ajax' %}",
data:{
action : "remove_absence",
ab: {{ab.pk}},
},
success: function( data )
{
location.href = "{% url 'tma-management' activemonth activeyear %}"
}
});
});
</script>
{% endfor %}