Skip to content
Snippets Groups Projects
Verified Commit 2bbcbb26 authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Implement frontend

parent 7f3164c1
No related branches found
No related tags found
No related merge requests found
Showing
with 1221 additions and 4 deletions
{% extends "core/base_print.html" %}
{% load i18n static %}
{% block page_title %}
{{ group }} — {% trans "Corona" %}
{% endblock %}
{% block extra_head %}
<link rel="stylesheet" href="{% static 'ticdesk.css' %}">
{% endblock %}
{% block browser_title %}{{ group }} — {% trans "Corona" %}{% endblock %}
{% block content %}
<table>
<thead>
<tr>
<th class="table-print">{% trans "Last name" %}</th>
<th class="table-print">{% trans "First name" %}</th>
<th class="table-print">{% trans "Address" %}</th>
<th class="table-print">{% trans "Mobile number" %}</th>
<th class="table-print">{% trans "Arrival" %}</th>
<th class="table-print">{% trans "Departure" %}</th>
</tr>
</thead>
<tbody>
{% for person in group.members.all %}
<td class="table-print">{{ person.last_name }}</td>
<td class="table-print">{{ person.first_name }}</td>
<td class="table-print">{{ person.street }} {{ person.housenumber }}, {{ person.postal_code }} {{ person.place }}</td>
<td class="table-print">{{ person.mobile_number }}</td>
<td class="table-print"></td>
<td class="table-print"></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% extends "core/base_print.html" %}
{% load i18n static %}
{% block page_title %}
{{ group }} — {% trans "attendance list" %}
{% endblock %}
{% block extra_head %}
<link rel="stylesheet" href="{% static 'ticdesk.css' %}">
{% endblock %}
{% block browser_title %}{{ group }} — {% trans "attendance list" %}{% endblock %}
{% block content %}
<table>
<thead>
<tr>
<th class="table-print">{% trans "Last name" %}</th>
<th class="table-print">{% trans "First name" %}</th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
</tr>
</thead>
<tbody>
{% for person in group.members.all %}
<td class="table-print">{{ person.last_name }}</td>
<td class="table-print">{{ person.first_name }}</td>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
<th class="table-print"></th>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% extends "core/base_print.html" %}
{% load i18n static %}
{% block page_title %}
{{ group }} — {% trans "participant list" %}
{% endblock %}
{% block extra_head %}
<link rel="stylesheet" href="{% static 'css/ticdesk/ticdesk.css' %}">
{% endblock %}
{% block browser_title %}{{ group }} — {% trans "participant list" %}{% endblock %}
{% block content %}
<table>
<thead>
<tr>
<th class="table-print">{% trans "Photo" %}</th>
<th class="table-print">{% trans "Last name" %}</th>
<th class="table-print">{% trans "First name" %}</th>
<th class="table-print">{% trans "Date of birth" %}</th>
<th class="table-print">{% trans "Mobile number" %}</th>
<th class="table-print">{% trans "School" %}</th>
<th class="table-print">{% trans "Class" %}</th>
</tr>
</thead>
<tbody>
{% for person in group.members.all %}
<tr>
{% if person.photo %}
<td class="table-print">
<img class="person-photo-print" src="{{ person.photo.url }}"
alt="{{ registration.person.first_name }} {{ registration.person.last_name }}"/>
</td>
{% else %}
<td class="table-print">
<img class="person-photo-print" src="{% static 'img/fallback.png' %}"
alt="{{ registration.person.first_name }} {{ registration.person.last_name }}"/>
</td>
{% endif %}
<td class="table-print">{{ person.last_name }}</td>
<td class="table-print">{{ person.first_name }}</td>
<td class="table-print">{{ person.date_of_birth }}</td>
<td class="table-print">{{ person.mobile_number }}</td>
<td class="table-print">{{ person.school }}</td>
<td class="table-print">{{ person.school_class }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% extends "core/base_print.html" %}
{% load i18n static %}
{% block page_title %}
{{ group }} — {% trans "signature list" %}
{% endblock %}
{% block extra_head %}
<link rel="stylesheet" href="{% static 'ticdesk.css' %}">
{% endblock %}
{% block browser_title %}{{ group }} — {% trans "signature list" %}{% endblock %}
{% block content %}
<p>{% trans "Meeting"%}: ________________________________________ </p>
<table>
<thead>
<tr>
<th class="table-print">{% trans "Last name" %}</th>
<th class="table-print">{% trans "First name" %}</th>
<th class="table-print">{% trans "Signature" %}</th>
</tr>
</thead>
<tbody>
{% for person in group.members.all %}
<td class="table-print">{{ person.last_name }}</td>
<td class="table-print">{{ person.first_name }}</td>
<td class="table-print"></td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}
{% extends "core/base.html" %}
{% load material_form i18n %}
{% block page_title %}{% blocktrans %}Generate list{% endblocktrans %}{% endblock %}
{% block browser_title %}{% blocktrans %}Generate list{% endblocktrans %}{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
{% form form=generate_list_form %}{% endform %}
{% trans "Print" as caption %}
{% include "core/partials/save_button.html" with caption=caption icon=print%}
</form>
{% endblock %}
{% extends "core/base_print.html" %}
{% load i18n static %}
{% block page_title %}
{% trans "Voucher for "%} {{ voucher.event }}
{% endblock %}
{% block browser_title %}{% trans "Voucher for "%} {{ voucher.event }}{% endblock %}
{% block content %}
<div class="center-align">
<img src="{% firstof request.site.preferences.theme__logo.url aleksis_banner %}" alt="Logo" class="max-size-600 center">
<h3>{{ voucher.event }}<h3>
<h4>{{ voucher.code }}</h4>
<p>{% trans "Voucher for" %} {{ voucher.person.first_name }} {{ voucher.person.last_name }} {% trans "to visit event" %} {{ voucher.event }} {% trans "on" %} {{ voucher.event.date_event }} {% trans "at" %} {{ voucher.event.place }}!</p>
<p>{% trans "To use the voucher, register for the event " %} <a href="{% url 'register_event_by_id' voucher.event.id %}">{% trans "here" %}</a></p>
</div>
{% endblock %}
{% extends "core/base.html" %}
{% load material_form i18n %}
{% block page_title %}{% blocktrans %}Registration{% endblocktrans %}{% endblock %}
{% block browser_title %}{% blocktrans %}Registration{% endblocktrans %}{% endblock %}
{% block content %}
<h5>
{% blocktrans %}Registration{% endblocktrans %} {{ event.display_name }}
</h5>
<form method="post">
{% csrf_token %}
{% form form=register_form %}{% endform %}
{% include "core/partials/save_button.html" %}
</form>
{% endblock %}
{% extends "core/base.html" %}
{% load material_form i18n %}
{% block page_title %}{% blocktrans %}Edit voucher{% endblocktrans %}{% endblock %}
{% block browser_title %}{% blocktrans %}Edit voucher{% endblocktrans %}{% endblock %}
{% block content %}
<form method="post">
{% csrf_token %}
{% form form=edit_voucher_form %}{% endform %}
{% include "core/partials/save_button.html" %}
</form>
{% endblock %}
{% extends "core/base.html" %}
{% load material_form i18n %}
{% load render_table from django_tables2 %}
{% block page_title %}{% blocktrans %}Vouchers{% endblocktrans %}{% endblock %}
{% block browser_title %}{% blocktrans %}Vouchers{% endblocktrans %}{% endblock %}
{% block content %}
<h5>{% trans "Filter vouchers" %}</h5>
<form method="get">
{% form form=vouchers_filter.form %}{% endform %}
{% trans "Search" as caption %}
{% include "core/partials/save_button.html" with caption=caption icon="search" %}
<button type="reset" class="btn red waves-effect waves-light">
<i class="material-icons left">clear</i>
{% trans "Clear" %}
</button>
</form>
<h5>{% blocktrans %}Selected vouchers{% endblocktrans %}</h5>
{% render_table vouchers_table %}
{% endblock %}
{% load i18n %}
{% block subject %} {% trans "New event" %} {{ new_event }} {% endblock %}
{% block plain %}
{% blocktrans with new_event=new_event %} An event was created: {{ new_event }}{% endblocktrans %}
* {% trans "Group" %}: {{ new_event.group }}
* {% trans "Description" %}: {{ new_event.description }}
* {% trans "Published" %}: {{ new_event.published }}
* {% trans "Place" %}: {{ new_event.place }}
* {% trans "Date of event" %}: {{ new_event.date_event }}
* {% trans "Registration deadline" %}: {{ new_event.date_registration }}
* {% trans "Retraction deadline" %}: {{ new_event.date_retraction }}
* {% trans "Cost" %}: {{ new_event.cost }}
* {% trans "Max. participants" %}: {{ new_event.max_participants }}
* {% trans "Owners" %}:
{% for owner in new_event.group.owners.all %}
* {{ owner }}
{% endfor %}
* {% trans "Feedback aspects" %}:
{% for aspect in new_event.feedback_aspects.all %}
* {{ aspect }}
{% endfor %}
{% blocktrans with sender=person %}
The event was created by {{ sender }}
{% endblocktrans %}
{% trans "Your AlekSIS team" %}
{% endblock %}
{% block html %}
<main>
<p>{% blocktrans with new_event=new_event %} An event was created: {{ new_event }}{% endblocktrans %}</p>
<blockquote>
<h5>{{ new_event }}</h5>
<ul>
<li> {% trans "Group" %}: {{ new_event.group }}</li>
<li> {% trans "Description" %}: {{ new_event.description }}</li>
<li> {% trans "Published" %}: {{ new_event.published }}</li>
<li> {% trans "Place" %}: {{ new_event.place }}</li>
<li> {% trans "Date of event" %}: {{ new_event.date_event }}</li>
<li> {% trans "Registration deadline" %}: {{ new_event.date_registration }}</li>
<li> {% trans "Retraction deadline" %}: {{ new_event.date_retraction }}</li>
<li> {% trans "Cost" %}: {{ new_event.cost }}</li>
<li> {% trans "Max. participants" %}: {{ new_event.max_participants }}</li>
<li> {% trans "Owners" %}</li>
<ul>
{% for owner in new_event.group.owners.all %}
<li> {{ owner }}</li>
{% endfor %}
</ul>
<li> {% trans "Feedback aspects" %}</li>
<ul>
{% for aspect in new_event.feedback_aspects.all %}
<li> {{ aspect }}</li>
{% endfor %}
</ul>
</ul>
</blockquote>
<p>
{% blocktrans with sender=person %}
The event was created by {{ sender }}
{% endblocktrans %}
</p>
<p>
<i>{% trans "Your AlekSIS team" %}</i>
</p>
</main>
{% endblock %}
{% load i18n %}
{% block subject %} {% trans "New feedback on" %} {{ feedback.event }} {% endblock %}
{% block plain %}
{% blocktrans with feedback.event=feedback.event %}New feedback on: {{ feedback.event }}{% endblocktrans %}
*** {% trans "Event" %} *****
* {% trans "Event" %}: {{ feedback.event }}
**** {% trans "Person " %} ****
* {% trans "Name" %}: {{ feedback.person }}
* {% trans "Date of birth" %}: {{ feedback.person.date_of_birth }}
* {% trans "Email address" %}: {{ feedback.person.email }}
**** {% trans "Comments" %} ****
* {% trans "Private comment" %}: {{ feedback.comment_private }}
* {% trans "Public comment" %}: {{ feedback.comment_public }}
* {% trans "Public comment info" %}: {{ feedback.comment_public_info }}
**** {% trans 'Photos' %} ****
{% for photo in feedback.photos %}
* {{ photo }}
{% endfor %}
* {% trans "Photo licence" %}: {{ feedback.photos_licence }}
{% trans "Your AlekSIS team" %}
{% endblock %}
{% block html %}
<main>
<p>{% blocktrans with new_feedback.event=new_feedback.event %}New feedback.event: {{ feedback.event}}{% endblocktrans %}</p>
<blockquote>
<h5>{% trans "Event" %}</h5>
<ul>
<li>{% trans "Event" %}: {{ feedback.event.feedback.event }}</li>
</ul>
<h5>{% trans "Person" %</h5>
<ul>
<li>{% trans "Name" %}: {{ feedback.event.person }}</li>
<li>{% trans "Date of birth" %}: {{ feedback.event.date_of_birth }}</li>
<li>{% trans "Email address" %}: {{ feedback.event.person.email }}</li>
</ul>
<h5>{% trans "Comments" %}</h5>
<ul>
<li>{% trans "Private comment" %}: {{ feedback.comment_private }}</li>
<li>{% trans "Public comment" %}: {{ feedback.comment_public }}</li>
<li>{% trans "Public comment info" %}: {{ feedback.comment_public_info }}</li>
</ul>
<h5>{% trans "Photos" %}</h5>
{% for photo in feedback.photos %}
<img src="{{ photo }}" alt="Feedback photo"></img>
{% endfor %}
<ul>
<li>{% trans "Photo licence" %}: {{ feedback.photos_licence }}</li>
</ul>
</blockquote>
<p>
<i>{% trans "Your AlekSIS team" %}</i>
</p>
</main>
{% endblock %}
{% load i18n %}
{% block subject %} {% trans "New registration" %} {{ registration }} {% endblock %}
{% block plain %}
{% blocktrans with new_event=new_event %}New registration: {{ event }}{% endblocktrans %}
*** {% trans "Event" %} *****
* {% trans "Event" %}: {{ registration.event }}
**** {% trans "Person " %} ****
* {% trans "Name" %}: {{ registration.person }}
* {% trans "Date of birth" %}: {{ registration.date_of_birth }}
* {% trans "Email address" %}: {{ registration.person.email }}
* {% trans "Mobile number" %}: {{ registration.person.mobile_number }}
* {% trans "Street" %}: {{ registration.person.street }}
* {% trans "Housenumber" %}: {{ registration.person.housenumber }}
* {% trans "Postal code" %}: {{ registration.person.postal_code }}
* {% trans "Place" %}: {{ registration.person.place }}
**** {% trans "Guardian" %} ****
* {% trans "Name" %}: {{ registration.person.guardians.first }}
* {% trans "Email address" %}: {{ registration.person.guardians.first.email }}
* {% trans "Mobile number" %}: {{ registration.person.guardians.first.mobile_number }}
**** {% trans "Financial details" %}
* {% trans "Donation" %}: {{ registration.donation }}
{% if registration.iban %}
* {% trans "Accept SEPA" %}: {{ registration.accept_sepa }}
* {% trans "IBAN" %}: {{ registration.iban }}
{% endif %}
**** {% trans "Declarations" %} ****
* {% trans "Consent by parents" %}: {{ registration.accept_terms }}
* {% trans "Data protection" %}: {{ registration.accept_data }}
* {% trans "Terms and conditions" %}: {{ registration.accept_general_terms }}
{% trans "Your AlekSIS team" %}
{% endblock %}
{% block html %}
<main>
<p>{% blocktrans with new_event=new_event %}New registration: {{ registration}}{% endblocktrans %}</p>
<blockquote>
<h5>{% trans "Event" %}</h5>
<ul>
<li>{% trans "Event" %}: {{ registration.event }}</li>
</ul>
<h5>{% trans "Person " %</h5>
<ul>
<li>{% trans "Name" %}: {{ registration.person }}</li>
<li>{% trans "Date of birth" %}: {{ registration.date_of_birth }}</li>
<li>{% trans "Email address" %}: {{ registration.person.email }}</li>
<li>{% trans "Mobile number" %}: {{ registration.person.mobile_number }}</li>
<li>{% trans "Street" %}: {{ registration.person.street }}</li>
<li>{% trans "Housenumber" %}: {{ registration.person.housenumber }}</li>
<li>{% trans "Postal code" %}: {{ registration.person.postal_code }}</li>
<li>{% trans "Place" %}: {{ registration.person.place }}</li>
</ul>
<h5>{% trans "Guardian" %}</h5>
<ul>
<li>{% trans "Name" %}: {{ registration.person.guardians.first }}</li>
<li>{% trans "Email address" %}: {{ registration.person.guardians.first.email }}</li>
<li>{% trans "Mobile number" %}: {{ registration.person.guardians.first.mobile_number }}</li>
</ul>
<h5>{% trans "Financial details" %}</h5>
<ul>
<li>{% trans "Donation" %}: {{ registration.donation }}</li>
{% if registration.iban %}
<li>{% trans "Accept SEPA" %}: {{ registration.accept_sepa }}</li>
<li>{% trans "IBAN" %}: {{ registration.iban }}</li>
{% endif %}
</ul>
<h5>{% trans "Declarations" %}</h5>
<ul>
<li>{% trans "Consent by parents" %}: {{ registration.accept_terms }}</li>
<li>{% trans "Data protection" %}: {{ registration.accept_data }}</li>
<li>{% trans "Terms and conditions" %}: {{ registration.accept_general_terms }}</li>
</ul>
</blockquote>
<p>
<i>{% trans "Your AlekSIS team" %}</i>
</p>
</main>
{% endblock %}
......@@ -3,5 +3,39 @@ from django.urls import path
from . import views
urlpatterns = [
path("empty", views.empty, name="empty"),
path("event/<int:id_>/edit", views.edit_event, name="edit_event_by_id"),
path("event/<int:id_>/feedback", views.feedback_event, name="feedback_event_by_id"),
path("event/<int:id_>/register", views.register_event, name="register_event_by_id"),
path("events/create", views.edit_event, name="create_event"),
path("events/manage", views.ManageEvents.as_view(), name="manage_events"),
path("events/", views.events, name="events"),
path("vouchers/create", views.edit_voucher, name="create_vouchers"),
path("vouchers/<int:id_>/delete", views.delete_voucher, name="delete_voucher_by_id"),
path("vouchers/<int:id_>/edit", views.edit_voucher, name="edit_voucher_by_id"),
path("vouchers/<int:id_>/print", views.print_voucher, name="print_voucher_by_id"),
path("vouchers/", views.vouchers, name="vouchers"),
path("event/lists/generate", views.generate_lists, name="generate_lists"),
path("event/registrations/list", views.registrations, name="registrations"),
path("event/registrations/<int:id_>", views.registration, name="registration_by_id"),
path(
"event/registrations/<int:id_>/edit",
views.edit_registration,
name="edit_registration_by_id",
),
path(
"event/registrations/<int:id_>/delete",
views.delete_registration,
name="delete_registration_by_id",
),
path("event/feedback_aspects/list", views.feedback_aspects, name="feedback_aspects"),
path(
"event/feedback_aspects/create",
views.edit_feedback_aspect,
name="create_feedback_aspect",
),
path(
"event/feedback_aspects/<int:id_>/edit",
views.edit_feedback_aspect,
name="edit_feedback_aspect_by_id",
),
]
import os
import random
import string
from tempfile import mkstemp
from textwrap import wrap
from django import forms
from django.conf import settings
import requests
def subscribe_mailinglist(listname, mail):
form_data = {
"email": mail,
"list": listname,
"action": "subrequest",
"via_subrequest": 1,
}
return requests.post(get_site_preferences()["paweljong__wws_post_url"], data=form_data)
def form_to_text_table(form, width=74, sep=" | "):
output_list = []
for field_name, field in form.fields.items():
# Determine field value depending on field type
if isinstance(field, forms.ModelMultipleChoiceField):
value = "\n".join([choice.__str__() for choice in form.cleaned_data[field_name]])
elif isinstance(field, forms.ModelChoiceField):
value = dict(field.choices)[form.cleaned_data[field_name]]
else:
value = form.cleaned_data[field_name]
value = str(value)
# Store in output list
output_list.append((field.label, value))
# Determine maximum field widths
max_label = max([len(_[0]) for _ in output_list])
max_value = width - len(sep) - max_label
# Generate result text
res = []
for label, value in output_list:
# Wrap value to lines
lines = wrap(value, max_value)
if lines:
# Output first line with label name
res.append("%s%s%s" % (label.rjust(max_label), sep, lines.pop(0)))
# Output following lines without label, if any
for line in lines:
res.append("%s%s%s" % (" " * max_label, sep, line))
else:
# Output empty label row
res.append("%s%s" % (label.rjust(max_label), sep))
# Build text block and return
return "\n".join(res)
def upload_file_to_media_url(file, subdir="", prefix="upload_"):
fileext = os.path.splitext(file.name)[-1]
dest_abs = os.path.join(settings.MEDIA_ROOT, subdir)
dest_fd, dest_path = mkstemp(prefix=prefix, suffix=fileext, dir=dest_abs)
os.close(dest_fd)
with open(dest_path, "wb+") as dest_file:
for chunk in file.chunks():
dest_file.write(chunk)
basename = os.path.basename(dest_path)
url = "%s/%s/%s" % (settings.MEDIA_URL, subdir, basename)
return url
def generate_code():
alphabet = string.ascii_uppercase + string.digits
length = 8
code = "".join(random.choice(alphabet) for _ in range(length)) # noqa
return code
This diff is collapsed.
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