digitaleagenturnc/timemanagement/templates/timemanagement/timemanagement_update.html

123 lines
3.6 KiB
HTML

{% extends "users/base.html" %}
{% block content %}
{% load crispy_forms_tags %}
{% load counter_tag %}
{% if request.user.profile.agency.module_timemanagement %}
<div class="content-section col-5">
<h3>Arbeitstag am {{workday.start|date:"d.m.Y"}} {% if team == 1 %} von {{user.get_full_name}} {% endif %} bearbeiten</h3>
<hr>
<h5>Start- und Endzeitpunkt</h5>
<div class="col-6" style="margin-left: -10px;">
<form method="POST" class="">
{% csrf_token %}
{{form.media}}
{{form|crispy}}
</div>
<hr>
<h5>Pausen
{% if team == 1 %}
<a class="btn btn-primary btn-sm" style="float: right" href="{% url 'add-break' workday.pk 1 %}"><i class="fas fa-plus"></i></a>
{% else %}
<a class="btn btn-primary btn-sm" style="float: right" href="{% url 'add-break' workday.pk %}"><i class="fas fa-plus"></i></a>
{% endif %}
</h5>
<div col="col-10">
<table class="table table-hover" >
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Start</th>
<th scope="col">Ende</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody>
{% for break in workday.breaks.all %}
<tr id="wd_break_{{break.pk}}">
<td>{{forloop.counter}}</td>
<td>{{break.start|date:"H:i"}}</td>
<td>{{break.end|date:"H:i"}}</td>
<td><a class="btn btn-secondary btn-sm " style="float: right" onclick="javascript:$('#confirm-delete_{{break.pk}}').modal('toggle')"><small><i class="fas fa-trash" style="color: #000000"></i></small></a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<hr>
{% if team == 1 %}
<a class="btn" href="{% url 'tm-management' %} ">Abbrechen</a>
{% else %}
<a class="btn" href="{% url 'tm-team-single' user.pk workday.start.month workday.start.year %} ">Abbrechen</a>
{% endif %}
<button type="submit" class="btn btn-primary" style="float: right" id="addbreakbutton">Arbeitstag aktualisieren</button>
</form>
</div>
{% for break in workday.breaks.all %}
<div class="modal fade" id="confirm-delete_{{break.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">Pause löschen</h5>
</div>
<div class="modal-body">
Möchten Sie wirklich die Pause von {{break.start|date:"H:i"}} bis {{break.end|date:"H:i"}} löschen?
</div>
<div class="modal-footer">
<button class="btn btn-primary" id="dodel_{{break.pk}}" >Löschen</button>
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$("#dodel_{{break.pk}}").click(function(){
$.ajax(
{
type: "GET",
url: "{% url 'tm-ajax' %}",
data:{
action : "remove_break",
break: {{break.pk}},
},
success: function( data )
{
$("#wd_break_{{break.pk}}").remove();
$("#confirm-delete_{{break.pk}}").modal("toggle");
}
});
});
</script>
{% endfor %}
<script type="text/javascript">
$("#id_end").blur(function(){
checkBreaks();
})
$("#id_start").blur(function(){
checkBreaks();
})
function checkBreaks(){
$('.ui-datepicker-calendar').hide();
$('.ui-datepicker-header').hide();
new_start = $("#id_start").datepicker().val();
new_end = $("#id_end").datepicker().val();
if(new_start >= new_end){
$("#addbreakbutton").prop("disabled", true);
}
else{
$("#addbreakbutton").prop("disabled", false);
}
}
</script>
{% endif %}
{% endblock content %}