diff --git a/src/pretix/control/templates/pretixcontrol/organizers/customer.html b/src/pretix/control/templates/pretixcontrol/organizers/customer.html index ee2d0e616..b39bbd5f7 100644 --- a/src/pretix/control/templates/pretixcontrol/organizers/customer.html +++ b/src/pretix/control/templates/pretixcontrol/organizers/customer.html @@ -22,54 +22,72 @@
-
+ {% csrf_token %} -
-
{% trans "Customer ID" %}
-
#{{ customer.identifier }}
- {% if customer.provider %} -
{% trans "SSO provider" %}
-
{{ customer.provider.name }}
- {% endif %} - {% if customer.external_identifier %} -
{% trans "External identifier" %}
-
{{ customer.external_identifier }}
- {% endif %} -
{% trans "Status" %}
-
- {% if not customer.is_active %} - {% trans "disabled" %} - {% elif not customer.is_verified %} - {% trans "not yet activated" %} - {% else %} - {% trans "active" %} +
+
{% trans "Customer ID" %}
+
#{{ customer.identifier }}
+ {% if customer.provider %} +
{% trans "SSO provider" %}
+
{{ customer.provider.name }}
{% endif %} -
-
{% trans "E-mail" %}
-
- {{ customer.email|default_if_none:"" }} - {% if customer.email and not customer.provider %} - + {% if customer.external_identifier %} +
{% trans "External identifier" %}
+
{{ customer.external_identifier }}
{% endif %} - -
{% trans "Name" %}
-
{{ customer.name }}
- {% if customer.phone %} -
{% trans "Phone" %}
-
{{ customer.phone }}
- {% endif %} -
{% trans "Locale" %}
-
{{ display_locale }}
-
{% trans "Registration date" %}
-
{{ customer.date_joined|date:"SHORT_DATETIME_FORMAT" }}
-
{% trans "Last login" %}
-
{% if customer.last_login %}{{ customer.last_login|date:"SHORT_DATETIME_FORMAT" }}{% else %} - –{% endif %}
- {% if customer.notes %} -
{% trans "Notes" %}
-
{{ customer.notes|linebreaks }}
+
{% trans "Status" %}
+
+ {% if not customer.is_active %} + {% trans "disabled" %} + {% elif not customer.is_verified %} + {% trans "not yet activated" %} + {% else %} + {% trans "active" %} + {% endif %} +
+
{% trans "E-mail" %}
+
+ {{ customer.email|default_if_none:"" }} + {% if customer.email and not customer.provider %} + + {% endif %} +
+
{% trans "Name" %}
+
{{ customer.name }}
+ {% if customer.phone %} +
{% trans "Phone" %}
+
{{ customer.phone }}
+ {% endif %} +
{% trans "Locale" %}
+
{{ display_locale }}
+
{% trans "Registration date" %}
+
{{ customer.date_joined|date:"SHORT_DATETIME_FORMAT" }}
+
{% trans "Last login" %}
+
{% if customer.last_login %}{{ customer.last_login|date:"SHORT_DATETIME_FORMAT" }}{% else %} + –{% endif %}
+ {% if customer.notes %} +
{% trans "Notes" %}
+
{{ customer.notes|linebreaks }}
+ {% endif %} +
+
+
+ {% trans "Lifetime spending" %} +
+ {% if lifetime_spending %} + {% for s in lifetime_spending %} + {% if s.spending >= 0 %} +
{{ s.spending|money:s.currency }}
+ {% elif s.spending < 0 %} +
{{ s.spending|money:s.currency }}
+ {% endif %} + {% endfor %} + {% else %} +
{{ 0|floatformat:2 }}
{% endif %}
diff --git a/src/pretix/control/views/organizer.py b/src/pretix/control/views/organizer.py index 81e82809e..d13c0a841 100644 --- a/src/pretix/control/views/organizer.py +++ b/src/pretix/control/views/organizer.py @@ -45,8 +45,8 @@ from django.core.exceptions import PermissionDenied, ValidationError from django.core.files import File from django.db import connections, transaction from django.db.models import ( - Count, Exists, IntegerField, Max, Min, OuterRef, Prefetch, ProtectedError, - Q, Subquery, Sum, + Count, Exists, F, IntegerField, Max, Min, OuterRef, Prefetch, + ProtectedError, Q, Subquery, Sum, ) from django.db.models.functions import Coalesce, Greatest from django.forms import DecimalField @@ -2312,6 +2312,14 @@ class CustomerDetailView(OrganizerDetailViewMixin, OrganizerPermissionRequiredMi o.icnt = annotated.get(o.pk)['icnt'] o.sales_channel_obj = scs[o.sales_channel] + ctx["lifetime_spending"] = ( + self.get_queryset() + .filter(status=Order.STATUS_PAID) + .values(currency=F("event__currency")) + .order_by("currency") + .annotate(spending=Sum("total")) + ) + return ctx diff --git a/src/pretix/static/pretixcontrol/scss/main.scss b/src/pretix/static/pretixcontrol/scss/main.scss index f55928db9..512b56b50 100644 --- a/src/pretix/static/pretixcontrol/scss/main.scss +++ b/src/pretix/static/pretixcontrol/scss/main.scss @@ -160,6 +160,12 @@ p.bigger { .helper-space-below { margin-bottom: 10px; } +.text-h1 { font-size: $font-size-h1; } +.text-h2 { font-size: $font-size-h2; } +.text-h3 { font-size: $font-size-h3; } +.text-h4 { font-size: $font-size-h4; } +.text-h5 { font-size: $font-size-h5; } +.text-h6 { font-size: $font-size-h6; } .section-moved { margin: 20px 0;