nk20/templates/activity/activity_detail.html

76 lines
1.9 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-08-06 15:41:30 +00:00
{% include "activity/activity_info.html" %}
2020-03-27 18:47:43 +00:00
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');
2020-07-30 13:49:59 +00:00
$("#guests_table").load(location.pathname + " #guests_table");
2020-03-27 20:18:27 +00:00
})
.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 %}