mirror of
https://github.com/pretix/pretix.git
synced 2026-08-07 10:17:49 +00:00
Replace checkin widget
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
{% load i18n %}
|
||||
{% load icon %}
|
||||
{% load humanize %}
|
||||
{% for cl in lists %}
|
||||
<a class="quotabox quotabox-full availability"
|
||||
href="{% url "control:event.orders.checkinlists.show" organizer=request.event.organizer.slug event=request.event.slug list=cl.id %}">
|
||||
<strong>{{ cl.name }}</strong>
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-success progress-bar-{{ cl.percent }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="numbers">
|
||||
{% icon "sign-in" %}
|
||||
{{ cl.checkin_count|default_if_none:0|intcomma }} /
|
||||
{{ cl.position_count|default_if_none:0|intcomma }}
|
||||
<br>
|
||||
{% icon "user" %}
|
||||
{% blocktrans trimmed with n=cl.inside_count|intcomma %}
|
||||
{{ n }} present
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
@@ -76,27 +76,51 @@
|
||||
{% if not request.event.has_subevents %}
|
||||
{% include "pretixcontrol/event/fragment_timeline.html" %}
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12 dashboard-quota-row">
|
||||
<div hx-get="{% url "control:event.index.quotas" organizer=request.organizer.slug event=request.event.slug %}"
|
||||
hx-trigger="load">
|
||||
{% for i in "12" %}
|
||||
<a class="quotabox quotabox-full">
|
||||
<strong>
|
||||
<span class="loading-mock loading-mock-text-short"></span>
|
||||
</strong>
|
||||
<div class="progress loading-mock"></div>
|
||||
<div class="numbers">
|
||||
<span class="loading-mock loading-mock-text-short"></span>
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">{% trans "Quotas" %}</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div hx-get="{% url "control:event.index.quotas" organizer=request.organizer.slug event=request.event.slug %}"
|
||||
hx-trigger="load">
|
||||
{% for i in "12" %}
|
||||
{% include "pretixcontrol/fragment_quota_box_mock.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
Checkin-lists
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">{% trans "Check-in lists" %}</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div hx-get="{% url "control:event.index.checkin" organizer=request.organizer.slug event=request.event.slug %}"
|
||||
hx-trigger="load">
|
||||
{% for i in "12" %}
|
||||
{% include "pretixcontrol/fragment_quota_box_mock.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% elif has_checkin_widgets %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title">{% trans "Check-in lists" %}</h2>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div hx-get="{% url "control:event.index.checkin" organizer=request.organizer.slug event=request.event.slug %}"
|
||||
hx-trigger="load">
|
||||
{% for i in "12" %}
|
||||
{% include "pretixcontrol/fragment_quota_box_mock.html" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
{% if widgets_override and 0 %}
|
||||
{{ widgets_override|safe }}
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
<a href="?{% url_replace request 'ordering' 'date_to' %}"><i class="fa fa-caret-up"></i></a>
|
||||
</th>
|
||||
<th>
|
||||
{% trans "Paid tickets per quota" %}
|
||||
{% trans "Quota utilization" %}
|
||||
</th>
|
||||
<th>
|
||||
{% trans "Status" %}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{% load i18n %}
|
||||
{% load humanize %}
|
||||
<a class="quotabox {% if full %}quotabox-full{% endif %}" data-toggle="tooltip_html" data-placement="top"
|
||||
title="{% trans "Quota:" %} {{ q.name|force_escape|force_escape }}{% if q.cached_avail.1 is not None %}<br>{% blocktrans with num=q.cached_avail.1 %}Currently available: {{ num }}{% endblocktrans %}{% endif %}"
|
||||
href="{% url "control:event.items.quotas.show" event=q.event.slug organizer=q.event.organizer.slug quota=q.pk %}">
|
||||
@@ -17,6 +18,9 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="numbers">
|
||||
{{ q.cached_availability_paid_orders|default_if_none:"?" }} / {{ q.size|default_if_none:"∞" }}
|
||||
{{ q.used|default_if_none:"∞" }} / {{ q.size|default_if_none:"∞" }}<br>
|
||||
{% blocktrans trimmed with n=q.cached_availability_paid_orders %}
|
||||
{{ n }} paid
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
</a>
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<a class="quotabox quotabox-full">
|
||||
<strong>
|
||||
<span class="loading-mock loading-mock-text-short"></span>
|
||||
</strong>
|
||||
<div class="progress loading-mock"></div>
|
||||
<div class="numbers">
|
||||
<span class="loading-mock loading-mock-text-short"></span>
|
||||
<br><span class="loading-mock loading-mock-text-short"></span>
|
||||
</div>
|
||||
</a>
|
||||
@@ -102,7 +102,7 @@
|
||||
<a href="?{% url_replace request 'filter-ordering' 'date_from' %}"><i class="fa fa-caret-up"></i></a>
|
||||
</th>
|
||||
<th>
|
||||
{% trans "Paid tickets per quota" %}
|
||||
{% trans "Quota utilization" %}
|
||||
</th>
|
||||
<th>
|
||||
{% trans "Status" %}
|
||||
|
||||
@@ -276,6 +276,7 @@ urlpatterns = [
|
||||
re_path(r'^dashboard/partials/logs$', dashboards.event_index_log_lazy, name='event.index.logs'),
|
||||
re_path(r'^dashboard/partials/warnings$', dashboards.event_index_warnings_lazy, name='event.index.warnings'),
|
||||
re_path(r'^dashboard/partials/quotas$', dashboards.event_index_quotas_lazy, name='event.index.quotas'),
|
||||
re_path(r'^dashboard/partials/checkin$', dashboards.event_index_checkin_lazy, name='event.index.checkin'),
|
||||
re_path(r'^dashboard/partials/comment$', event.EventComment.as_view(), name='event.index.comment'),
|
||||
re_path(r'^live/$', event.EventLive.as_view(), name='event.live'),
|
||||
re_path(r'^transfer_session/$', event.EventTransferSession.as_view(), name='event.transfer_session'),
|
||||
|
||||
@@ -239,29 +239,6 @@ def waitinglist_widgets(sender, subevent=None, lazy=False, **kwargs):
|
||||
return widgets
|
||||
|
||||
|
||||
@receiver(signal=event_dashboard_widgets)
|
||||
def checkin_widget(sender, subevent=None, lazy=False, **kwargs):
|
||||
widgets = []
|
||||
qs = sender.checkin_lists.filter(subevent=subevent)
|
||||
for cl in qs:
|
||||
widgets.append({
|
||||
'content': None if lazy else format_html(
|
||||
NUM_WIDGET,
|
||||
num='{}/{}'.format(intcomma(cl.inside_count), intcomma(cl.position_count)),
|
||||
text=format_html(_('Present – {list}'), list=cl.name)
|
||||
),
|
||||
'lazy': 'checkin-{}'.format(cl.pk),
|
||||
'display_size': 'small',
|
||||
'priority': 50,
|
||||
'url': reverse('control:event.orders.checkinlists.show', kwargs={
|
||||
'event': sender.slug,
|
||||
'organizer': sender.organizer.slug,
|
||||
'list': cl.pk
|
||||
})
|
||||
})
|
||||
return widgets
|
||||
|
||||
|
||||
@receiver(signal=event_dashboard_widgets)
|
||||
def welcome_wizard_widget(sender, **kwargs):
|
||||
template = get_template('pretixcontrol/event/dashboard_widget_welcome.html')
|
||||
@@ -334,6 +311,7 @@ def event_index(request, organizer, event):
|
||||
]
|
||||
ctx['today'] = now().astimezone(request.event.timezone).date()
|
||||
ctx['nearly_now'] = now().astimezone(request.event.timezone) - timedelta(seconds=20)
|
||||
ctx['has_checkin_widgets'] = not request.event.has_subevents or request.event.checkin_lists.filter(subevent=None).exists()
|
||||
resp = render(request, 'pretixcontrol/event/index.html', ctx)
|
||||
return resp
|
||||
|
||||
@@ -405,6 +383,17 @@ def event_index_quotas_lazy(request, organizer, event):
|
||||
)
|
||||
|
||||
|
||||
def event_index_checkin_lazy(request, organizer, event):
|
||||
lists = request.event.checkin_lists.filter(subevent=None)[:10]
|
||||
return render(
|
||||
request,
|
||||
'pretixcontrol/event/dashboard_partial_checkin.html',
|
||||
{
|
||||
'lists': lists,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def event_index_log_lazy(request, organizer, event):
|
||||
qs = request.event.logentry_set.all().select_related('user', 'content_type', 'api_token', 'oauth_application',
|
||||
'device').order_by('-datetime')
|
||||
|
||||
@@ -10,6 +10,14 @@ def prepare_quotas_for_boxes(quotas):
|
||||
for q in quotas:
|
||||
q.cached_avail = qa.results[q]
|
||||
q.cached_availability_paid_orders = qa.count_paid_orders.get(q, 0)
|
||||
q.used = (
|
||||
qa.count_paid_orders.get(q, 0) +
|
||||
qa.count_pending_orders.get(q, 0) +
|
||||
qa.count_exited_orders.get(q, 0) +
|
||||
qa.count_vouchers.get(q, 0) +
|
||||
qa.count_waitinglist.get(q, 0) +
|
||||
qa.count_cart.get(q, 0)
|
||||
)
|
||||
if q.size is not None:
|
||||
other_blocked = q.size - q.cached_availability_paid_orders - q.cached_avail[1]
|
||||
q.percent_paid = min(
|
||||
|
||||
Reference in New Issue
Block a user