Skip to content
Snippets Groups Projects
Commit 6796d66b authored by Tom Teichler's avatar Tom Teichler 🍻
Browse files

Merge branch 'master' of edugit.org:Teckids/hacknfun/AlekSIS-App-Paweljong

parents be8cfac9 de443ada
No related branches found
No related tags found
No related merge requests found
......@@ -253,3 +253,6 @@ rules.add_perm("paweljong.can_retract_registration_rule", can_retract_registrati
can_view_terms_predicate = has_person & (is_participant)
rules.add_perm("paweljong.can_view_terms_rule", can_view_terms_predicate)
can_mark_payment_as_payed_predicate = has_person & (is_organiser)
rules.add_perm("paweljong.mark_payment_payed_rule", can_mark_payment_as_payed_predicate)
......@@ -14,6 +14,7 @@
{% has_perm 'paweljong.delete_registration' user registration as can_delete_registration %}
{% has_perm 'paweljong.send_notification_mail' user registration as can_send_notification %}
{% has_perm 'paweljong.can_retract_registration_rule' user registration as can_retract_registration %}
{% has_perm 'paweljong.mark_payment_payed_rule' user registration as can_mark_registration_payed %}
{% has_perm 'tezor.view_invoice_rule' user registration as can_view_invoice %}
{% has_perm 'core.edit_person_rule' user person as can_change_person %}
......@@ -282,11 +283,7 @@
<i class="material-icons iconify" data-icon="{{ invoice.get_variant_icon }}"></i>
</td>
<td>
<select name="variant" disabled>
{% for choice in invoice.get_variant_choices %}
<option value="{{ choice.0 }}" {% if invoice.variant == choice.0 %}selected{% endif %}>{{ choice.1 }}</option>
{% endfor %}
</select>
{{ invoice.variant }}
</td>
</tr>
<tr>
......@@ -305,6 +302,16 @@
{{ invoice.due_date }}
</td>
</tr>
{% if can_mark_registration_payed and not invoice.status == "confirmed" %}
<tr>
<td>
<a href="{% url 'pay_registration_by_pk' registration.pk %}" class="btn waves-effect waves-light">
<i class="material-icons left iconify" data-icon="mdi:account-check"></i>
{% trans "Mark payed" %}
</a>
</td>
</tr>
{% endif %}
</table>
</div>
</div>
......
......@@ -84,6 +84,11 @@ urlpatterns = [
views.CheckInRegistration.as_view(),
name="check_in_registration_by_pk",
),
path(
"event/registrations/<int:pk>/pay",
views.MarkRegistrationPayed.as_view(),
name="pay_registration_by_pk",
),
path(
"event/registrations/<int:pk>/retract",
views.RetractRegistration.as_view(),
......
......@@ -25,6 +25,7 @@ from rules.contrib.views import PermissionRequiredMixin, permission_required
from templated_email import send_templated_mail
from aleksis.apps.postbuero.models import MailAddress
from aleksis.apps.tezor.models.invoice import Invoice
from aleksis.core.mixins import AdvancedCreateView, AdvancedDeleteView, AdvancedEditView
from aleksis.core.models import Activity, Group, Person
from aleksis.core.util import messages
......@@ -1034,3 +1035,22 @@ class CheckInRegistration(PermissionRequiredMixin, View):
messages.error(self.request, _("Person is already checked in!"))
return redirect("event_detail_by_name", slug=registration.event.slug)
class MarkRegistrationPayed(PermissionRequiredMixin, View):
permission_required = "paweljong.mark_payment_payed_rule"
def get_object(self, *args, **kwargs):
registration = EventRegistration.objects.get(id=self.kwargs["pk"])
invoice = registration.get_invoice()
return invoice
def get(self, *args, **kwargs):
invoice = self.get_object()
invoice.status = "confirmed"
invoice.save()
messages.success(request, _("Successfully marked as payed!"))
return redirect("registration_by_pk", pk=invoice.for_object.pk)
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