Skip to content
Snippets Groups Projects
Commit d4e61f4e authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Refactor and redesign booking edit and new views

parent 46fceabe
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -46,8 +46,10 @@ class BookBookingForm(forms.ModelForm):
upload = forms.FileField(label='Scan der Rechnung', required=False)
status = forms.ChoiceField(choices=status_choices, label='Status')
layout = Layout(Row('description', 'justification', 'contact'),
Row('account', 'status', 'planned_amount'),
layout = Layout(Fieldset("Allgemeines",
Row('description', 'justification', 'contact'),
Row('account', 'status', 'planned_amount')
),
Fieldset('Details',
Row('firma', 'invoice_number', 'amount'),
Row('invoice_date', 'maturity', 'submission_date', 'booking_date'),
......
......@@ -2,24 +2,22 @@
{% load material_form %}
<main>
<h4>Buchung bearbeiten</h4>
<h4>Buchung bearbeiten</h4>
<form method="POST" style="background: #eee">
<form method="POST">
{% csrf_token %}
{% form form=form %}
{% endform %}
<span class="right">
<button type="submit" class="waves-effect waves-light btn green">
<i class="material-icons left">send</i> Änderungen übernehmen
<i class="material-icons left">save</i> Änderungen übernehmen
</button>
<a href="{% url 'booking' 0 %}">
<button type="button" class="waves-effect waves-light btn grey">
<a href="{% url 'booking' %}" class="waves-effect waves-light btn red">
<i class="material-icons left">cancel</i> Abbrechen
</button>
</a>
</span>
</form>
</main>
{% include 'partials/footer.html' %}
......@@ -3,20 +3,19 @@
<main>
<h4>Neue Buchung</h4>
<h4>Neue Buchung</h4>
<form method="POST" style="background: #eee">
<form method="POST">
{% csrf_token %}
{% form form=form %}
{% endform %}
<span class="right">
<button type="submit" class="waves-effect waves-light btn green">
<i class="material-icons left">send</i> Buchung anlegen
<i class="material-icons left">save</i> Buchung anlegen
</button>
<a href="{% url 'booking' %}">
<button type="button" class="waves-effect waves-light btn grey">
<a href="{% url 'booking' %}" class="waves-effect waves-light btn red">
<i class="material-icons left">cancel</i> Abbrechen
</button>
</a>
</span>
</form>
......
......@@ -120,7 +120,7 @@ def book(request, id):
form = BookBookingForm(request.POST, request.FILES, instance=booking)
if form.is_valid():
form.save()
messages.success(request, "Die Änderungen an der Buchung wurden erfolgreich übernommen.")
return redirect(reverse('booking'))
context = {'form': form}
return render(request, template, context)
......@@ -135,6 +135,7 @@ def new_booking(request):
form = BookBookingForm(request.POST, request.FILES)
if form.is_valid():
form.save()
messages.success(request, "Die Buchung wurde erfolgreich angelegt.")
return redirect(reverse('booking'))
context = {'form': form}
......
......@@ -201,7 +201,7 @@
</li>
{% endif %}
{% if perms.fibu.manage_booking %}
<li class="url-booking">
<li class="url-booking url-booking_book url-new_booking">
<a href="{% url 'booking' 0 %}"><i class="material-icons">receipt</i>Buchungen
</a>
</li>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment