mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-11-26 18:37:12 +00:00
Merge branch 'front_activity' into 'beta'
Cards for activity templates See merge request bde/nk20!100
This commit is contained in:
commit
5ba18a2d89
@ -1,22 +1,23 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load static %}
|
{% comment %}
|
||||||
{% load i18n %}
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
{% endcomment %}
|
||||||
|
{% load i18n perms %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
{% load pretty_money %}
|
|
||||||
{% load perms %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% include "activity/includes/activity_info.html" %}
|
||||||
{% include "activity/activity_info.html" %}
|
|
||||||
|
|
||||||
{% if guests.data %}
|
{% if guests.data %}
|
||||||
<hr>
|
<div class="card bg-white mb-3">
|
||||||
<h2>{% trans "Guests list" %}</h2>
|
<h3 class="card-header text-center">
|
||||||
|
{% trans "Guests list" %}
|
||||||
|
</h3>
|
||||||
<div id="guests_table">
|
<div id="guests_table">
|
||||||
{% render_table guests %}
|
{% render_table guests %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extrajavascript %}
|
{% block extrajavascript %}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load static %}
|
{% comment %}
|
||||||
{% load i18n %}
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
{% endcomment %}
|
||||||
|
{% load static i18n pretty_money perms %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
{% load pretty_money %}
|
|
||||||
{% load perms %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -18,7 +18,8 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for a in activities_open %}
|
{% for a in activities_open %}
|
||||||
<a href="{% url "activity:activity_entry" pk=a.pk %}" class="btn btn-sm btn-outline-primary{% if a.pk == activity.pk %} active{% endif %}">
|
<a href="{% url "activity:activity_entry" pk=a.pk %}"
|
||||||
|
class="btn btn-sm btn-outline-primary{% if a.pk == activity.pk %} active{% endif %}">
|
||||||
{% trans "Entries" %} {{ a.name }}
|
{% trans "Entries" %} {{ a.name }}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -35,7 +36,8 @@
|
|||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div id="entry_table">
|
<div id="entry_table">
|
||||||
<h2 class="text-center">{{ entries.count }} {% if entries.count >= 2 %}{% trans "entries" %}{% else %}{% trans "entry" %}{% endif %}</h2>
|
<h2 class="text-center">{{ entries.count }}
|
||||||
|
{% if entries.count >= 2 %}{% trans "entries" %}{% else %}{% trans "entry" %}{% endif %}</h2>
|
||||||
{% render_table table %}
|
{% render_table table %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@ -77,15 +79,16 @@
|
|||||||
guest: null
|
guest: null
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
if (target.hasClass("table-info"))
|
if (target.hasClass("table-info"))
|
||||||
addMsg("Entrée effectuée, mais attention : la personne n'est plus adhérente Kfet.", "warning", 10000);
|
addMsg(
|
||||||
|
"Entrée effectuée, mais attention : la personne n'est plus adhérente Kfet.",
|
||||||
|
"warning", 10000);
|
||||||
else
|
else
|
||||||
addMsg("Entrée effectuée !", "success", 4000);
|
addMsg("Entrée effectuée !", "success", 4000);
|
||||||
reloadTable(true);
|
reloadTable(true);
|
||||||
}).fail(function (xhr) {
|
}).fail(function (xhr) {
|
||||||
errMsg(xhr.responseJSON, 4000);
|
errMsg(xhr.responseJSON, 4000);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
let line_obj = $("#buttons_guest_" + id);
|
let line_obj = $("#buttons_guest_" + id);
|
||||||
if (line_obj.length || target.attr('class').includes("table-success")) {
|
if (line_obj.length || target.attr('class').includes("table-success")) {
|
||||||
line_obj.remove();
|
line_obj.remove();
|
||||||
@ -94,9 +97,12 @@
|
|||||||
|
|
||||||
let tr = "<tr class='text-center'>" +
|
let tr = "<tr class='text-center'>" +
|
||||||
"<td id='buttons_guest_" + id + "' style='table-danger center' colspan='5'>" +
|
"<td id='buttons_guest_" + id + "' style='table-danger center' colspan='5'>" +
|
||||||
"<button id='transaction_guest_" + id + "' class='btn btn-secondary'>Payer avec la note de l'hôte</button> " +
|
"<button id='transaction_guest_" + id +
|
||||||
"<button id='transaction_guest_" + id + "_especes' class='btn btn-secondary'>Payer en espèces</button> " +
|
"' class='btn btn-secondary'>Payer avec la note de l'hôte</button> " +
|
||||||
"<button id='transaction_guest_" + id + "_cb' class='btn btn-secondary'>Payer en CB</button></td>" +
|
"<button id='transaction_guest_" + id +
|
||||||
|
"_especes' class='btn btn-secondary'>Payer en espèces</button> " +
|
||||||
|
"<button id='transaction_guest_" + id +
|
||||||
|
"_cb' class='btn btn-secondary'>Payer en CB</button></td>" +
|
||||||
"<tr>";
|
"<tr>";
|
||||||
$(tr).insertAfter(target);
|
$(tr).insertAfter(target);
|
||||||
|
|
||||||
@ -108,7 +114,9 @@
|
|||||||
guest: id
|
guest: id
|
||||||
}).done(function () {
|
}).done(function () {
|
||||||
if (target.hasClass("table-info"))
|
if (target.hasClass("table-info"))
|
||||||
addMsg("Entrée effectuée, mais attention : la personne n'est plus adhérente Kfet.", "warning", 10000);
|
addMsg(
|
||||||
|
"Entrée effectuée, mais attention : la personne n'est plus adhérente Kfet.",
|
||||||
|
"warning", 10000);
|
||||||
else
|
else
|
||||||
addMsg("Entrée effectuée !", "success", 4000);
|
addMsg("Entrée effectuée !", "success", 4000);
|
||||||
reloadTable(true);
|
reloadTable(true);
|
||||||
@ -119,14 +127,22 @@
|
|||||||
|
|
||||||
let credit = function (credit_id, credit_name) {
|
let credit = function (credit_id, credit_name) {
|
||||||
return function () {
|
return function () {
|
||||||
$.post("/api/note/transaction/transaction/",
|
$.post("/api/note/transaction/transaction/", {
|
||||||
{
|
|
||||||
"csrfmiddlewaretoken": CSRF_TOKEN,
|
"csrfmiddlewaretoken": CSRF_TOKEN,
|
||||||
"quantity": 1,
|
"quantity": 1,
|
||||||
"amount": {{ activity.activity_type.guest_entry_fee }},
|
"amount": {
|
||||||
"reason": "Crédit " + credit_name + " (invitation {{ activity.name }})",
|
{
|
||||||
|
activity.activity_type.guest_entry_fee
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"reason": "Crédit " + credit_name +
|
||||||
|
" (invitation {{ activity.name }})",
|
||||||
"valid": true,
|
"valid": true,
|
||||||
"polymorphic_ctype": {{ notespecial_ctype }},
|
"polymorphic_ctype": {
|
||||||
|
{
|
||||||
|
notespecial_ctype
|
||||||
|
}
|
||||||
|
},
|
||||||
"resourcetype": "SpecialTransaction",
|
"resourcetype": "SpecialTransaction",
|
||||||
"source": credit_id,
|
"source": credit_id,
|
||||||
"destination": target.attr('data-inviter'),
|
"destination": target.attr('data-inviter'),
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load static %}
|
{% comment %}
|
||||||
{% load i18n %}
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
{% load crispy_forms_tags %}
|
{% endcomment %}
|
||||||
|
{% load i18n crispy_forms_tags %}
|
||||||
|
{% block contenttitle %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
<div class="card bg-white mb-3">
|
||||||
|
<h3 class="card-header text-center">
|
||||||
|
{{ title }}
|
||||||
|
</h3>
|
||||||
|
<div class="card-body">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
|
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,15 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
{% load render_table from django_tables2 %}
|
|
||||||
{% load i18n crispy_forms_tags %}
|
|
||||||
{% block content %}
|
|
||||||
<form method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
{{ form|crispy }}
|
|
||||||
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block extrajavascript %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
@ -1,41 +1,50 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
{% comment %}
|
||||||
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
{% endcomment %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
{% load i18n crispy_forms_tags%}
|
{% load i18n %}
|
||||||
|
{% block contenttitle %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if started_activities %}
|
{% if started_activities %}
|
||||||
<h2>{% trans "Current activity" %}</h2>
|
<div class="card bg-info mb-3">
|
||||||
|
<h3 class="card-header text-center">
|
||||||
|
{% trans "Current activity" %}
|
||||||
|
</h3>
|
||||||
|
<div class="card-body">
|
||||||
{% for activity in started_activities %}
|
{% for activity in started_activities %}
|
||||||
{% include "activity/activity_info.html" %}
|
{% include "activity/includes/activity_info.html" %}
|
||||||
<hr>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
</div>
|
||||||
|
|
||||||
<h2>{% trans "Upcoming activities" %}</h2>
|
|
||||||
{% if upcoming.data %}
|
|
||||||
{% render_table upcoming %}
|
|
||||||
{% else %}
|
|
||||||
<div class="alert alert-warning">
|
|
||||||
{% trans "There is no planned activity." %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<a class="btn btn-primary" href="{% url 'activity:activity_create' %}" data-turbolinks="false">{% trans 'New activity' %}</a>
|
<div class="card bg-light mb-3">
|
||||||
|
<h3 class="card-header text-center">
|
||||||
<hr>
|
{% trans "Upcoming activities" %}
|
||||||
|
</h3>
|
||||||
<h2>{% trans "All activities" %}</h2>
|
{% if upcoming.data %}
|
||||||
|
{% render_table upcoming %}
|
||||||
|
{% else %}
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
{% trans "There is no planned activity." %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
<div class="card-footer">
|
||||||
|
<a class="btn btn-sm btn-success" href="{% url 'activity:activity_create' %}" data-turbolinks="false">
|
||||||
|
<i class="fa fa-calendar-plus-o" aria-hidden="true"></i>
|
||||||
|
{% trans 'New activity' %}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card bg-light mb-3">
|
||||||
|
<h3 class="card-header text-center">
|
||||||
|
{% trans "All activities" %}
|
||||||
|
</h3>
|
||||||
{% render_table table %}
|
{% render_table table %}
|
||||||
{% endblock %}
|
</div>
|
||||||
|
|
||||||
{% block extrajavascript %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
$(document).ready(function($) {
|
|
||||||
$(".table-row").click(function() {
|
|
||||||
window.document.location = $(this).data("href");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -1,10 +1,10 @@
|
|||||||
{% load i18n %}
|
{% comment %}
|
||||||
{% load perms %}
|
SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
{% load pretty_money %}
|
{% endcomment %}
|
||||||
|
{% load i18n perms pretty_money %}
|
||||||
{% url 'activity:activity_detail' activity.pk as activity_detail_url %}
|
{% url 'activity:activity_detail' activity.pk as activity_detail_url %}
|
||||||
|
|
||||||
<div id="activity_info" class="card bg-light shadow">
|
<div id="activity_info" class="card bg-light shadow mb-3">
|
||||||
<div class="card-header text-center">
|
<div class="card-header text-center">
|
||||||
<h4>
|
<h4>
|
||||||
{% if request.path_info != activity_detail_url %}
|
{% if request.path_info != activity_detail_url %}
|
@ -117,7 +117,7 @@ class ActivityInviteView(ProtectQuerysetMixin, ProtectedCreateView):
|
|||||||
"""
|
"""
|
||||||
model = Guest
|
model = Guest
|
||||||
form_class = GuestForm
|
form_class = GuestForm
|
||||||
template_name = "activity/activity_invite.html"
|
template_name = "activity/activity_form.html"
|
||||||
|
|
||||||
def get_sample_object(self):
|
def get_sample_object(self):
|
||||||
""" Creates a standart Guest binds to the Activity"""
|
""" Creates a standart Guest binds to the Activity"""
|
||||||
|
Loading…
Reference in New Issue
Block a user