diff --git a/dav_event_office/templates/dav_event_office/event_detail.html b/dav_event_office/templates/dav_event_office/event_detail.html index 3c7392f..fb390ab 100644 --- a/dav_event_office/templates/dav_event_office/event_detail.html +++ b/dav_event_office/templates/dav_event_office/event_detail.html @@ -1,6 +1,7 @@ {% extends 'dav_event_office/base.html' %} {% load bootstrap3 %} {% load i18n %} +{% load dav_events %} {% block head-title %}{{ event }} - {{ block.super }}{% endblock head-title %} @@ -8,52 +9,277 @@
-
-
- {{ event.render_as_html }} -
-
-
-
-
Status-Log
- {% for flag in event.flags.all %} +{% if not event.registration_required %} + +{% endif %} + +
+
+
+ {% render_event_status event %} +
+

{{ event }}

+
+
+
+
+ +
+
-
- {% bootstrap_icon 'check' %} - {{ flag.status.label }}: +
+ {% trans 'Leitung' %}: + {{ event.get_trainer_full_name }} + {% if event.trainer_email or event.trainer_phone %} + ({% if event.trainer_email %}{{ event.trainer_email }}{% endif %}{% if event.trainer_email and event.trainer_phone %}, {% endif %}{% if event.trainer_phone %}{{ event.trainer_phone }}{% endif %}) + {% endif %}
-
- {{ flag.timestamp|date:'l, d. F Y, H:i' }} {% trans 'Uhr' %}
- {% trans 'von' %} {{ flag.user.get_full_name|default:flag.user }} +
+ {% trans 'Teilnehmergebühr' %}: + {{ event.charge|floatformat:'-2' }} € +
+
+
+
+ {% trans 'Anmeldeschluss' %}: + {% if event.deadline %} + {{ event.deadline|date:'l, d. F Y' }} + {% else %} + - + {% endif %} +
+
+ {% trans 'Teilnehmerzahl' %}: + {{ event.min_participants }} - + {% if event.max_participants > 0 %} + {{ event.max_participants }} + {% else %} + ∞ + {% endif %}
- {% endfor %}
-
-
{% trans 'Veröffentlichung' %}
- {% if event.planned_publication_date %} - {{ event.planned_publication_date|date:'l, d. F Y' }} - {% else %} - {% trans 'Unverzüglich' %} - {% endif %} - {% if event.internal_note %} -
{% trans 'Bearbeitungshinweis' %}
-
{{ event.internal_note|linebreaksbr }}
- {% endif %} +
+
+
+ +
+
+ {{ event.render_as_html }}
+
+

{% trans 'Teilnehmer' %}

+
+ {% if registrations_support %} +
+ +
+
+ {% for registration in registrations %} +
+ {% csrf_token %} + + {% if has_permission_update_participants %} + +   + +   + {% endif %} + {% if registration.answered %} + + {% endif %} + {{ registration.get_full_name }} + ({{ registration.email_address }}, + {{ registration.phone_number }}) +   + + {% bootstrap_icon 'time' %} + {{ registration.created_at|date:'d. F Y, G:i' }} + +   + + {% bootstrap_icon 'info-sign' %} + + {% if registration.answered %} + + {% endif %} +
+ {% empty %} + {% trans 'Keine unbearbeiteten Anmeldungen vorhanden' %} + {% endfor %} +
+
+
+ {% endif %} + {% if participants %} + {% for form in participant_formset %} + {% with participant=form.instance %} + {% with position=participant.position %} +
+ +
+
+ {% bootstrap_form_errors form %} +
+ {% csrf_token %} + + + {% include './includes/participant_form.html' %} + {% if has_permission_update_participants %} + + {% endif %} +
+
+
+
+ {% endwith %} + {% endwith %} + {% endfor %} + {% else %} +
+
+ {% trans 'Es wurden noch keine Teilnehmer hinzugefügt.' %} +
+
+ {% endif %} + {% if participant_emails %} +
+
+ {% trans 'E-Mail-Adressen' %} ({% trans 'für Copy-Paste' %})
+
{{ participant_emails }}
+
+
+ {% endif %} +
{% endblock page-container-fluid %} \ No newline at end of file diff --git a/dav_event_office/templates/dav_event_office/event_list.html b/dav_event_office/templates/dav_event_office/event_list.html index d1b8700..4da5624 100644 --- a/dav_event_office/templates/dav_event_office/event_list.html +++ b/dav_event_office/templates/dav_event_office/event_list.html @@ -5,19 +5,13 @@ {% block page-container-fluid %} diff --git a/dav_event_office/templates/dav_event_office/includes/home_tiles.html b/dav_event_office/templates/dav_event_office/includes/home_tiles.html index c7f9807..6598069 100644 --- a/dav_event_office/templates/dav_event_office/includes/home_tiles.html +++ b/dav_event_office/templates/dav_event_office/includes/home_tiles.html @@ -4,15 +4,11 @@
-

Veranstaltungen

+

Veranstaltungen (für Geschäftstelle)

- Blah. + Hier sind alle Veranstaltungen gelistet.

@@ -22,16 +18,14 @@ Du wirst dann per E-Mail auf dem laufenden gehalten.

-

Teilnehmer

+

Teilnehmer (für Geschäftstelle)

- Fasel. + Hier sind alle angemeldeten Teilnehmer gelistet.

- Teilnehmer + Teilnehmer

diff --git a/dav_event_office/templates/dav_event_office/includes/participant_form.html b/dav_event_office/templates/dav_event_office/includes/participant_form.html new file mode 100644 index 0000000..4eb0e04 --- /dev/null +++ b/dav_event_office/templates/dav_event_office/includes/participant_form.html @@ -0,0 +1,46 @@ +{% load bootstrap3 %} +
+
+ {% bootstrap_field form.personal_names %} +
+
+ {% bootstrap_field form.family_names %} +
+
+
+
+ {% bootstrap_field form.address %} +
+
+
+
+ {% bootstrap_field form.postal_code %} +
+
+ {% bootstrap_field form.city %} +
+
+
+
+ {% bootstrap_field form.email_address %} +
+
+ {% bootstrap_field form.phone_number %} +
+
+
+
+ {% bootstrap_field form.dav_number %} +
+
+ {% bootstrap_field form.emergency_contact %} +
+
+
+
+ {% bootstrap_field form.experience %} +
+
+ {% bootstrap_field form.note %} +
+
\ No newline at end of file diff --git a/dav_event_office/templates/dav_event_office/participant_list.html b/dav_event_office/templates/dav_event_office/participant_list.html new file mode 100644 index 0000000..09d4f22 --- /dev/null +++ b/dav_event_office/templates/dav_event_office/participant_list.html @@ -0,0 +1,120 @@ +{% extends 'dav_event_office/base.html' %} +{% load bootstrap3 %} +{% load i18n %} +{% load dav_events %} + +{% block page-container-fluid %} + + +
+ + + + + + + + + + + + + + + + + + + + + {% for participant in participant_list %} + {% with event=participant.event %} + + {% with number=event.get_number %} + + {% endwith %} + + + + + + + {% endwith %} + {% endfor %} + +
{% trans 'Veranstaltung' %}{% trans 'Datum' %}{% trans 'Nachname' %}{% trans 'Vorname' %}{% trans 'Mitgliedsnummer' %}{% trans 'Teilnehmergebühr' %}
+ {{ number }} + + {{ event.get_numeric_date }} + + {{ participant.family_names }} + + {{ participant.personal_names }} + + {{ participant.dav_number }} + +
+ {% csrf_token %} + + {% if event.charge and participant.paid %} + +   + ({{ event.charge|floatformat:'-2' }} €) + {% elif event.charge %} + +   + ({{ event.charge|floatformat:'-2' }} €) + {% else %} + + {% bootstrap_icon 'piggy-bank' %} + + {% endif %} +
+
+ +
+{% endblock page-container-fluid %} \ No newline at end of file diff --git a/dav_event_office/urls.py b/dav_event_office/urls.py index e023335..e2686c2 100644 --- a/dav_event_office/urls.py +++ b/dav_event_office/urls.py @@ -4,6 +4,7 @@ from . import views urlpatterns = [ url(r'^home$', views.HomeView.as_view(), name='root'), + url(r'^participants$', views.ParticipantListView.as_view(), name='participant-list'), url(r'^$', views.EventListView.as_view(), name='event-list'), url(r'^(?P\d+)/', views.EventDetailView.as_view(), name='event-detail'), ] diff --git a/dav_event_office/views.py b/dav_event_office/views.py index 63a4612..54c9f8e 100644 --- a/dav_event_office/views.py +++ b/dav_event_office/views.py @@ -1,44 +1,64 @@ # -*- coding: utf-8 -*- +from django.contrib import messages from django.contrib.auth.decorators import login_required from django.core.exceptions import PermissionDenied +from django.http import HttpResponseRedirect +from django.shortcuts import get_object_or_404 +from django.urls import reverse from django.utils.decorators import method_decorator from django.views import generic -from dav_events.models import Event +from dav_events.models import Participant from dav_events.roles import has_role +from dav_events.views.events import EventListView as _EventListView, EventRegistrationsView as _EventRegistrationsView class HomeView(generic.TemplateView): template_name = 'dav_event_office/home.html' -class OfficePermissionMixin(object): - def enforce_permission(self, request): - user = request.user - if user.is_superuser: - return None - elif has_role(user, 'manager_super'): - return None - elif has_role(user, 'event_office'): - return None - raise PermissionDenied('event_office') - - -class EventListView(OfficePermissionMixin, generic.ListView): - model = Event +class EventListView(_EventListView): template_name = 'dav_event_office/event_list.html' @method_decorator(login_required) def dispatch(self, request, *args, **kwargs): - self.enforce_permission(request) + if not has_role(request.user, 'office'): + raise PermissionDenied('Zugang nur für die Geschäftsstelle') return super(EventListView, self).dispatch(request, *args, **kwargs) -class EventDetailView(OfficePermissionMixin, generic.DetailView): - model = Event +class EventDetailView(_EventRegistrationsView): template_name = 'dav_event_office/event_detail.html' @method_decorator(login_required) def dispatch(self, request, *args, **kwargs): - self.enforce_permission(request) + if not has_role(request.user, 'office'): + raise PermissionDenied('Zugang nur für die Geschäftsstelle') return super(EventDetailView, self).dispatch(request, *args, **kwargs) + + +class ParticipantListView(generic.ListView): + model = Participant + template_name = 'dav_event_office/participant_list.html' + + def post(self, request, *args, **kwargs): + action = request.POST.get('action') + if action == 'confirm_payment': + participant_id = request.POST.get('id') + participant = get_object_or_404(Participant, pk=participant_id) + participant.paid = True + participant.save() + elif action == 'revoke_payment': + participant_id = request.POST.get('id') + participant = get_object_or_404(Participant, pk=participant_id) + participant.paid = False + participant.save() + else: + messages.error(request, 'unsupported action: {}'.format(action)) + return HttpResponseRedirect(reverse('dav_event_office:participant-list')) + + @method_decorator(login_required) + def dispatch(self, request, *args, **kwargs): + if not has_role(request.user, 'office'): + raise PermissionDenied('Zugang nur für die Geschäftsstelle') + return super(ParticipantListView, self).dispatch(request, *args, **kwargs) diff --git a/dav_events/views/events.py b/dav_events/views/events.py index 07cde08..82b45d9 100644 --- a/dav_events/views/events.py +++ b/dav_events/views/events.py @@ -413,7 +413,7 @@ class EventRegistrationsView(EventPermissionMixin, generic.DetailView): return self.render_to_response(self.get_context_data(create_participant_form=form)) else: messages.error(request, 'unsupported action: {}'.format(action)) - return HttpResponseRedirect(reverse('dav_events:registrations', kwargs={'pk': event.pk})) + return self.render_to_response(self.get_context_data()) @method_decorator(login_required) def dispatch(self, request, *args, **kwargs):