1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-30 19:32:21 +00:00
nk20/templates/activity/activity_detail.html

139 lines
5.4 KiB
HTML
Raw Normal View History

2020-03-27 18:47:43 +00:00
{% extends "base.html" %}
{% load static %}
{% load i18n %}
{% load render_table from django_tables2 %}
{% load pretty_money %}
2020-03-27 20:18:27 +00:00
{% load perms %}
2020-03-27 18:47:43 +00:00
{% block content %}
2020-03-27 21:48:20 +00:00
<div id="activity_info" class="card bg-light shadow">
2020-03-27 20:18:27 +00:00
<div class="card-header text-center">
<h4>{{ activity.name }}</h4>
</div>
<div class="card-body" id="profile_infos">
<dl class="row">
<dt class="col-xl-6">{% trans 'description'|capfirst %}</dt>
<dd class="col-xl-6"> {{ activity.description }}</dd>
<dt class="col-xl-6">{% trans 'type'|capfirst %}</dt>
<dd class="col-xl-6"> {{ activity.activity_type }}</dd>
2020-03-27 18:47:43 +00:00
2020-03-27 20:18:27 +00:00
<dt class="col-xl-6">{% trans 'start date'|capfirst %}</dt>
<dd class="col-xl-6">{{ activity.date_start }}</dd>
2020-03-27 18:47:43 +00:00
2020-03-27 20:18:27 +00:00
<dt class="col-xl-6">{% trans 'end date'|capfirst %}</dt>
<dd class="col-xl-6">{{ activity.date_end }}</dd>
2020-03-27 18:47:43 +00:00
2020-04-01 18:56:24 +00:00
{% if ".view_"|has_perm:activity.creater %}
<dt class="col-xl-6">{% trans 'creater'|capfirst %}</dt>
<dd class="col-xl-6"><a href="{% url "member:user_detail" pk=activity.creater.pk %}">{{ activity.creater }}</a></dd>
{% endif %}
2020-03-27 20:18:27 +00:00
<dt class="col-xl-6">{% trans 'organizer'|capfirst %}</dt>
<dd class="col-xl-6"><a href="{% url "member:club_detail" pk=activity.organizer.pk %}">{{ activity.organizer }}</a></dd>
2020-03-27 18:47:43 +00:00
2020-03-27 20:18:27 +00:00
<dt class="col-xl-6">{% trans 'attendees club'|capfirst %}</dt>
<dd class="col-xl-6"><a href="{% url "member:club_detail" pk=activity.attendees_club.pk %}">{{ activity.attendees_club }}</a></dd>
2020-03-27 18:47:43 +00:00
2020-03-27 20:18:27 +00:00
<dt class="col-xl-6">{% trans 'can invite'|capfirst %}</dt>
<dd class="col-xl-6">{{ activity.activity_type.can_invite|yesno }}</dd>
2020-03-27 18:47:43 +00:00
2020-03-27 20:18:27 +00:00
{% if activity.activity_type.can_invite %}
<dt class="col-xl-6">{% trans 'guest entry fee'|capfirst %}</dt>
<dd class="col-xl-6">{{ activity.activity_type.guest_entry_fee|pretty_money }}</dd>
{% endif %}
2020-03-27 21:48:20 +00:00
<dt class="col-xl-6">{% trans 'valid'|capfirst %}</dt>
<dd class="col-xl-6">{{ activity.valid|yesno }}</dd>
<dt class="col-xl-6">{% trans 'opened'|capfirst %}</dt>
<dd class="col-xl-6">{{ activity.open|yesno }}</dd>
2020-03-27 20:18:27 +00:00
</dl>
</div>
2020-03-27 18:47:43 +00:00
2020-03-27 20:18:27 +00:00
<div class="card-footer text-center">
2020-04-01 18:56:24 +00:00
{% if activity.open and ".change__open"|has_perm:activity %}
2020-03-28 00:45:13 +00:00
<a class="btn btn-warning btn-sm my-1" href="{% url 'activity:activity_entry' pk=activity.pk %}"> {% trans "Entry page" %}</a>
{% endif %}
2020-04-01 18:56:24 +00:00
{% if activity.valid and ".change__open"|has_perm:activity %}
2020-03-27 21:48:20 +00:00
<a class="btn btn-warning btn-sm my-1" id="open_activity"> {% if activity.open %}{% trans "close"|capfirst %}{% else %}{% trans "open"|capfirst %}{% endif %}</a>
{% endif %}
2020-04-01 18:56:24 +00:00
{% if not activity.open and ".change__valid"|has_perm:activity %}
2020-03-27 21:48:20 +00:00
<a class="btn btn-success btn-sm my-1" id="validate_activity"> {% if activity.valid %}{% trans "invalidate"|capfirst %}{% else %}{% trans "validate"|capfirst %}{% endif %}</a>
{% endif %}
2020-04-01 18:56:24 +00:00
{% if ".view_"|has_perm:activity %}
2020-03-27 20:18:27 +00:00
<a class="btn btn-primary btn-sm my-1" href="{% url 'activity:activity_update' pk=activity.pk %}"> {% trans "edit"|capfirst %}</a>
{% endif %}
{% if activity.activity_type.can_invite and not activity_started %}
2020-03-27 20:18:27 +00:00
<a class="btn btn-primary btn-sm my-1" href="{% url 'activity:activity_invite' pk=activity.pk %}"> {% trans "Invite" %}</a>
2020-03-27 18:47:43 +00:00
{% endif %}
2020-03-27 20:18:27 +00:00
</div>
2020-03-27 18:47:43 +00:00
</div>
2020-03-27 20:18:27 +00:00
{% if guests.data %}
<hr>
<h2>{% trans "Guests list" %}</h2>
<div id="guests_table">
{% render_table guests %}
</div>
{% endif %}
{% endblock %}
2020-03-27 18:47:43 +00:00
2020-03-27 20:18:27 +00:00
{% block extrajavascript %}
<script>
function remove_guest(guest_id) {
$.ajax({
url:"/api/activity/guest/" + guest_id + "/",
method:"DELETE",
headers: {"X-CSRFTOKEN": CSRF_TOKEN}
})
.done(function() {
addMsg('Invité supprimé','success');
$("#guests_table").load(location.href + " #guests_table");
})
.fail(function(xhr, textStatus, error) {
errMsg(xhr.responseJSON);
});
}
2020-03-27 21:48:20 +00:00
$("#open_activity").click(function() {
$.ajax({
url: "/api/activity/activity/{{ activity.pk }}/",
type: "PATCH",
dataType: "json",
headers: {
"X-CSRFTOKEN": CSRF_TOKEN
},
data: {
open: {{ activity.open|yesno:'false,true' }}
}
}).done(function () {
reloadWithTurbolinks();
}).fail(function (xhr) {
errMsg(xhr.responseJSON);
});
});
$("#validate_activity").click(function () {
$.ajax({
url: "/api/activity/activity/{{ activity.pk }}/",
type: "PATCH",
dataType: "json",
headers: {
"X-CSRFTOKEN": CSRF_TOKEN
},
data: {
valid: {{ activity.valid|yesno:'false,true' }}
}
}).done(function () {
reloadWithTurbolinks();
}).fail(function (xhr) {
errMsg(xhr.responseJSON);
});
});
2020-03-27 20:18:27 +00:00
</script>
2020-03-27 18:47:43 +00:00
{% endblock %}