byceps/blueprints/admin/ticketing/checkin/templates/admin/ticketing/checkin/_ticket_list.html
{%- from 'macros/admin/ticketing.html' import render_ticket_flag_revoked, render_ticket_flag_user_checked_in %}
{%- from 'macros/admin/user.html' import render_user_microcard %}
{%- from 'macros/icons.html' import render_icon %}
{%- from 'macros/misc.html' import render_tag %}
{%- if tickets %}
<style>
.button.button-check-in:focus,
.button.button-check-in:hover {
background-color: #ffe777;
box-shadow: 0 0 0 0.125rem #666666;
color: currentColor;
outline: none;
}
</style>
<table class="itemlist is-vcentered is-wide">
<thead>
<tr>
<th>{{ _('Code') }}</th>
<th>{{ _('User') }}</th>
<th>{{ _('Owner') }}</th>
<th>{{ _('Seat') }}</th>
<th></th>
</tr>
</thead>
<tbody>
{%- for ticket in tickets|sort(attribute='created_at') %}
<tr>
<td>
<a href="{{ url_for('ticketing_admin.view_ticket', ticket_id=ticket.id) }}"><strong>{{ ticket.code }}</strong></a>
{%- if ticket.revoked %}<br>{{ render_ticket_flag_revoked() }}{% endif -%}
</td>
<td>
{%- if ticket.used_by -%}
{{ render_user_microcard(ticket.used_by) }}
{%- else -%}
{{ render_tag(_('nobody'), class='color-warning') }}
{%- endif -%}
</td>
<td>{{ render_user_microcard(ticket.owned_by, tiny_avatar=True) }}</td>
<td>
{%- if ticket.occupied_seat -%}
{{ ticket.occupied_seat.label|fallback(_('unnamed')) }}
{%- else -%}
{{ render_tag(_('no seat'), class='color-warning') }}
{%- endif -%}
</td>
<td style="text-align: right;">
{%- if ticket.revoked -%}
<div class="button is-compact button--disabled color-danger">{{ _('No entry!') }}</div>
{%- elif ticket.user_checked_in -%}
<div class="button is-compact button--disabled color-warning">{{ _('Already checked in!') }}</div>
{%- elif ticket.used_by and ticket.used_by.deleted -%}
<div class="button is-compact button--disabled color-danger"><div>{{ _('No entry!') }}<br><small>{{ _('Account has been deleted.') }}</small></div></div>
{%- elif ticket.used_by and ticket.used_by.suspended -%}
<div class="button is-compact button--disabled color-danger"><div>{{ _('No entry!') }}<br><small>{{ _('Account is suspended.') }}</small></div></div>
{%- elif ticket.used_by -%}
<a class="button button-check-in color-primary" data-action="check-in-user" href="{{ url_for('ticketing_checkin_admin.check_in_user', party_id=party.id, ticket_id=ticket.id) }}">{{ render_icon('ticketing-checkin') }} <span>{{ _('Check in') }}</span></a>
{%- endif -%}
</td>
</tr>
{%- endfor %}
</tbody>
</table>
{%- else %}
<div class="box">
<div class="dimmed-box centered">{{ _('none') }}</div>
</div>
{%- endif %}