chrono/chrono/manager/templates/chrono/manager_event_check_booking...

78 lines
3.8 KiB
HTML

{% load i18n %}
<td class="booking-username main-list" {% if agenda.booking_extra_user_block_template %}data-extra-user-block-url="{% if booking.kind == "subscription" %}{% url 'chrono-manager-subscription-extra-user-block' pk=agenda.pk subscription_pk=booking.pk %}{% else %}{% url 'chrono-manager-booking-extra-user-block' pk=agenda.pk booking_pk=booking.pk %}{% endif %}"{% endif %}>
{% if agenda.booking_extra_user_block_template %}<span class="togglable"></span>{% endif %}
{{ booking.get_user_block }}{% if booking.places_count > 1 %} ({{ booking.places_count }} {% trans "places" %}){% endif %}
</td>
<td class="booking-status {% if booking.kind != "subscription" and booking.cancellation_datetime is None and booking.user_was_present is None %}without-status{% endif %}" data-{{ booking.kind }}-id="{{ booking.id }}">
{% if booking.kind == "subscription" %}
({% trans "Not booked" %})
{% elif booking.cancellation_datetime is None %}
{{ booking.user_was_present|yesno:_('Present,Absent,-') }}
{% if booking.user_was_present is not None and booking.user_check_type_label %}
({{ booking.user_check_type_label }})
{% endif %}
{% else %}
({% trans "Cancelled" %})
{% endif %}
{% if not event.checked or not agenda.disable_check_update %}
{% if booking.user_was_present is not None %}
<form method="post" action="{% url 'chrono-manager-booking-reset' pk=agenda.pk booking_pk=booking.pk %}" class="with-ajax reset">
{% csrf_token %}
<a href="#">{% trans "Reset" context "check" %}</a>
<script>
$(function() {
$('td.booking-status[data-{{ booking.kind }}-id="{{ booking.id }}"] form.reset a').on('click',
function(e) {
e.preventDefault();
$(this).parents('form.reset').submit();
});
});
</script>
</form>
{% endif %}
{% endif %}
</td>
{% if not event.checked or not agenda.disable_check_update %}
<td class="booking-actions" data-{{ booking.kind }}-id="{{ booking.id }}">
{% if booking.kind == "subscription" %}
<form method="post" action="{% url 'chrono-manager-subscription-presence' pk=agenda.pk subscription_pk=booking.pk event_pk=event.pk %}" class="with-ajax presence">
{% else %}
<form method="post" action="{% url 'chrono-manager-booking-presence' pk=agenda.pk booking_pk=booking.pk %}" class="with-ajax presence">
{% endif %}
{% csrf_token %}
<button class="submit-button"
{% if booking.user_was_present is True %}disabled{% endif %}
>{% trans "Presence" %}</button>
{% if booking.presence_form.check_type.field.choices.1 %}{{ booking.presence_form.check_type }}{% endif %}
<script>
$(function() {
$('td.booking-actions[data-{{ booking.kind }}-id="{{ booking.id }}"] form.presence select').on('change',
function() {
$(this).parents('form.presence').submit();
});
});
</script>
</form>
{% if booking.kind == "subscription" %}
<form method="post" action="{% url 'chrono-manager-subscription-absence' pk=agenda.pk subscription_pk=booking.pk event_pk=event.pk %}" class="with-ajax absence">
{% else %}
<form method="post" action="{% url 'chrono-manager-booking-absence' pk=agenda.pk booking_pk=booking.pk %}" class="with-ajax absence">
{% endif %}
{% csrf_token %}
<button class="submit-button"
{% if booking.user_was_present is False %}disabled{% endif %}
>{% trans "Absence" %}</button>
{% if booking.absence_form.check_type.field.choices.1 %}{{ booking.absence_form.check_type }}{% endif %}
<script>
$(function() {
$('td.booking-actions[data-{{ booking.kind }}-id="{{ booking.id }}"] form.absence select').on('change',
function() {
$(this).parents('form.absence').submit();
});
});
</script>
</form>
</td>
{% endif %}