Added Freefield
This commit is contained in:
parent
392f892e98
commit
886d1ff0d7
|
|
@ -148,11 +148,12 @@ class UpdateWorkdayForm(forms.ModelForm):
|
|||
labels = {
|
||||
"start" : "Start",
|
||||
"end" : "Ende",
|
||||
"target" : "Zielarbeitszeit"
|
||||
"target" : "Zielarbeitszeit",
|
||||
"freefield" : "Notiz"
|
||||
}
|
||||
|
||||
fields = [
|
||||
"start", "end", "target"
|
||||
"start", "end", "target", "freefield"
|
||||
]
|
||||
widgets = {
|
||||
'start': DatePickerInput(options={"format":'HH:mm', "locale":'de'}),
|
||||
|
|
@ -172,11 +173,12 @@ class AddWorkdayForm(forms.ModelForm):
|
|||
labels = {
|
||||
"start" : "Start",
|
||||
"end" : "Ende",
|
||||
"target" : "Zielarbeitszeit"
|
||||
"target" : "Zielarbeitszeit",
|
||||
"freefield" : "Notiz"
|
||||
}
|
||||
|
||||
fields = [
|
||||
"start", "end", "target"
|
||||
"start", "end", "target", "freefield"
|
||||
]
|
||||
widgets = {
|
||||
'start': DatePickerInput(options={"format":'DD.MM.YYYY HH:mm', "locale":'de'}),
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class Workday(models.Model):
|
|||
start = models.DateTimeField(default=None, null=True, blank=True)
|
||||
end = models.DateTimeField(default=None, null=True, blank=True)
|
||||
target = models.FloatField(default=8.0)
|
||||
freefield = models.TextField(max_length=10000, default="", blank=True)
|
||||
history = HistoricalRecords()
|
||||
|
||||
class Breaks(models.Model):
|
||||
|
|
|
|||
|
|
@ -5,16 +5,16 @@
|
|||
{% if request.user.profile.agency.module_timemanagement %}
|
||||
<!-- TASK: Hier verhindern, dass der AN die Zielarbeitszeit nicht selber ändern kann sondern die geladen wird, die in den Vertragsdaten steht -->
|
||||
<!-- TASK: Unterschied manuelles Eintragen von Arbeitstagen -->
|
||||
<div class="content-section col-5">
|
||||
<div class="content-section col-6">
|
||||
<h3>Arbeitstag {% if team == 1 %} von {{user.get_full_name}} {% endif %} hinzufügen</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>
|
||||
<a class="btn" href="{% url 'tm-management' %} ">Abbrechen</a>
|
||||
<button type="submit" class="btn btn-primary" style="float: right" id="addbreakbutton">Arbeitstag hinzufügen</button>
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@
|
|||
{% endfor %}
|
||||
|
||||
</td>
|
||||
<td>
|
||||
<td style="text-align: right;">
|
||||
|
||||
{% counterWDreset %}
|
||||
{% for workday in workdays %}
|
||||
|
|
@ -307,8 +307,34 @@
|
|||
|
||||
|
||||
{% counterWDUp %}
|
||||
|
||||
{% if workday.freefield != "" %}
|
||||
|
||||
<a href="#/" onclick="javascript:$('#wd_freefield_{{workday.pk}}').modal('toggle');"><i class="fas fa-eye"></i></a>
|
||||
<div class="modal fade" id="wd_freefield_{{workday.pk}}" tabindex="-1" role="dialog" data-backdrop="static">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Notiz zum Arbeitstag {{workday.start|date:"d.m.Y"}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" style="text-align: left;">
|
||||
<p>{{workday.freefield}}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if breakmonthline < da %}
|
||||
<button class="btn btn-secondary btn-sm ml-2" onclick="window.location.href='{% url 'tm-update' workday.pk %}'"><small><i class="fas fa-pen"></i></small></button>
|
||||
<button class="btn btn-secondary btn-sm ml-2" onclick="window.location.href='{% url 'tm-update' workday.pk %}'"><small><i class="fas fa-pen"></i></small></button>
|
||||
<button class="btn btn-secondary btn-sm " onclick="javascript:$('#confirm-delete_{{workday.pk}}').modal('toggle')"><small><i class="fas fa-trash"></i></small></button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
<td style="text-align: right;">
|
||||
|
||||
{% counterWDreset %}
|
||||
{% for workday in workdays %}
|
||||
|
|
@ -325,6 +325,32 @@
|
|||
|
||||
{% counterWDUp %}
|
||||
|
||||
{% if workday.freefield != "" %}
|
||||
|
||||
<a href="#/" onclick="javascript:$('#wd_freefield_{{workday.pk}}').modal('toggle');"><i class="fas fa-eye"></i></a>
|
||||
<div class="modal fade" id="wd_freefield_{{workday.pk}}" tabindex="-1" role="dialog" data-backdrop="static">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Notiz zum Arbeitstag {{workday.start|date:"d.m.Y"}}</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body" style="text-align: left;">
|
||||
<p>{{workday.freefield}}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
||||
<button class="btn btn-secondary btn-sm ml-2" onclick="window.location.href='{% url 'tm-update' workday.pk 1 %}'"><small><i class="fas fa-pen"></i></small></button>
|
||||
<button class="btn btn-secondary btn-sm " onclick="javascript:$('#confirm-delete_{{workday.pk}}').modal('toggle')"><small><i class="fas fa-trash"></i></small></button>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
{% load crispy_forms_tags %}
|
||||
{% load counter_tag %}
|
||||
{% if request.user.profile.agency.module_timemanagement %}
|
||||
<div class="content-section col-5">
|
||||
<div class="content-section col-6">
|
||||
|
||||
<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 %}
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ def TimeManagementTeamSingle(request, pk, activemonth=False, activeyear=False):
|
|||
|
||||
# Requestet User has no rights...
|
||||
else:
|
||||
messages.success(request, f'Das würfen Sie nicht!')
|
||||
messages.success(request, f'Das dürfen Sie nicht!')
|
||||
return redirect("tm-management")
|
||||
|
||||
|
||||
|
|
@ -425,6 +425,7 @@ def TimeUpdate(request, pk, team=0):
|
|||
|
||||
workday.start = start
|
||||
workday.end = end
|
||||
workday.freefield = form["freefield"].value()
|
||||
workday.target = form["target"].value()
|
||||
workday.save()
|
||||
messages.success(request, f'Arbeitstag aktualisiert')
|
||||
|
|
@ -457,7 +458,7 @@ def TimeAdd(request, team=0, pk=0):
|
|||
|
||||
#end = datetime.datetime(int(workday.end.year), int(workday.end.month), int(workday.end.day), int(((str(form["end"].value()).split(":"))[0])), int(((str(form["end"].value()).split(":"))[1])))
|
||||
|
||||
workday = Workday(start=form.cleaned_data["start"], end=form.cleaned_data["end"], target=form.cleaned_data["target"], user=user, agency=request.user.profile.agency)
|
||||
workday = Workday(start=form.cleaned_data["start"], end=form.cleaned_data["end"], target=form.cleaned_data["target"], user=user, freefield=form.cleaned_data["freefield"], agency=request.user.profile.agency)
|
||||
|
||||
if workday.start.day != workday.end.day or workday.start.month != workday.end.month or workday.start.year != workday.end.year or workday.start > workday.end:
|
||||
messages.success(request, f'Der Arbeitstag darf nur an einem Tag stattfinden und das Ende muss nach dem Anfang liegen.')
|
||||
|
|
|
|||
Loading…
Reference in New Issue