mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-29 04:40:55 +02:00
Improve activity interface
This commit is contained in:
@ -7,70 +7,7 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="activity_info" class="card bg-light shadow">
|
||||
<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>
|
||||
|
||||
<dt class="col-xl-6">{% trans 'start date'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">{{ activity.date_start }}</dd>
|
||||
|
||||
<dt class="col-xl-6">{% trans 'end date'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">{{ activity.date_end }}</dd>
|
||||
|
||||
{% 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 %}
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<dt class="col-xl-6">{% trans 'can invite'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">{{ activity.activity_type.can_invite|yesno }}</dd>
|
||||
|
||||
{% 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 %}
|
||||
|
||||
<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>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="card-footer text-center">
|
||||
{% if activity.open and ".change__open"|has_perm:activity %}
|
||||
<a class="btn btn-warning btn-sm my-1" href="{% url 'activity:activity_entry' pk=activity.pk %}"> {% trans "Entry page" %}</a>
|
||||
{% endif %}
|
||||
|
||||
{% if activity.valid and ".change__open"|has_perm:activity %}
|
||||
<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 %}
|
||||
{% if not activity.open and ".change__valid"|has_perm:activity %}
|
||||
<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 %}
|
||||
{% if ".change_"|has_perm:activity %}
|
||||
<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 %}
|
||||
<a class="btn btn-primary btn-sm my-1" href="{% url 'activity:activity_invite' pk=activity.pk %}"> {% trans "Invite" %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% include "activity/activity_info.html" %}
|
||||
|
||||
{% if guests.data %}
|
||||
<hr>
|
||||
|
@ -76,7 +76,10 @@
|
||||
note: id,
|
||||
guest: null
|
||||
}).done(function () {
|
||||
addMsg("Entrée effectuée !", "success", 4000);
|
||||
if (target.hasClass("table-info"))
|
||||
addMsg("Entrée effectuée, mais attention : la personne n'est plus adhérente Kfet.", "warning", 10000);
|
||||
else
|
||||
addMsg("Entrée effectuée !", "success", 4000);
|
||||
reloadTable(true);
|
||||
}).fail(function(xhr) {
|
||||
errMsg(xhr.responseJSON, 4000);
|
||||
@ -104,7 +107,10 @@
|
||||
note: target.attr("data-inviter"),
|
||||
guest: id
|
||||
}).done(function () {
|
||||
addMsg("Entrée effectuée !", "success", 4000);
|
||||
if (target.hasClass("table-info"))
|
||||
addMsg("Entrée effectuée, mais attention : la personne n'est plus adhérente Kfet.", "warning", 10000);
|
||||
else
|
||||
addMsg("Entrée effectuée !", "success", 4000);
|
||||
reloadTable(true);
|
||||
}).fail(function (xhr) {
|
||||
errMsg(xhr.responseJSON, 4000);
|
||||
|
78
templates/activity/activity_info.html
Normal file
78
templates/activity/activity_info.html
Normal file
@ -0,0 +1,78 @@
|
||||
{% load i18n %}
|
||||
{% load perms %}
|
||||
{% load pretty_money %}
|
||||
|
||||
{% url 'activity:activity_detail' activity.pk as activity_detail_url %}
|
||||
|
||||
<div id="activity_info" class="card bg-light shadow">
|
||||
<div class="card-header text-center">
|
||||
<h4>
|
||||
{% if request.path_info != activity_detail_url %}
|
||||
<a href="{{ activity_detail_url }}">{{ activity.name }}</a>
|
||||
{% else %}
|
||||
{{ activity.name }}
|
||||
{% endif %}
|
||||
</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>
|
||||
|
||||
<dt class="col-xl-6">{% trans 'start date'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">{{ activity.date_start }}</dd>
|
||||
|
||||
<dt class="col-xl-6">{% trans 'end date'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">{{ activity.date_end }}</dd>
|
||||
|
||||
{% 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 %}
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<dt class="col-xl-6">{% trans 'can invite'|capfirst %}</dt>
|
||||
<dd class="col-xl-6">{{ activity.activity_type.can_invite|yesno }}</dd>
|
||||
|
||||
{% 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 %}
|
||||
|
||||
<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>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<div class="card-footer text-center">
|
||||
{% if activity.open and activity.activity_type.manage_entries and ".change__open"|has_perm:activity %}
|
||||
<a class="btn btn-warning btn-sm my-1" href="{% url 'activity:activity_entry' pk=activity.pk %}"> {% trans "Entry page" %}</a>
|
||||
{% endif %}
|
||||
|
||||
{% if request.path_info == activity_detail_url %}
|
||||
{% if activity.valid and ".change__open"|has_perm:activity %}
|
||||
<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 %}
|
||||
{% if not activity.open and ".change__valid"|has_perm:activity %}
|
||||
<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 %}
|
||||
{% if ".change_"|has_perm:activity %}
|
||||
<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 %}
|
||||
<a class="btn btn-primary btn-sm my-1" href="{% url 'activity:activity_invite' pk=activity.pk %}"> {% trans "Invite" %}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
@ -2,6 +2,14 @@
|
||||
{% load render_table from django_tables2 %}
|
||||
{% load i18n crispy_forms_tags%}
|
||||
{% block content %}
|
||||
{% if started_activities %}
|
||||
<h2>{% trans "Current activity" %}</h2>
|
||||
{% for activity in started_activities %}
|
||||
{% include "activity/activity_info.html" %}
|
||||
<hr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<h2>{% trans "Upcoming activities" %}</h2>
|
||||
{% if upcoming.data %}
|
||||
{% render_table upcoming %}
|
||||
|
@ -19,10 +19,12 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
||||
<input type="radio" name="transaction_type" id="type_credit">
|
||||
{% trans "Credit" %}
|
||||
</label>
|
||||
<label type="type_debit" class="btn btn-sm btn-outline-primary">
|
||||
<input type="radio" name="transaction_type" id="type_debit">
|
||||
{% trans "Debit" %}
|
||||
</label>
|
||||
{% if not activities_open %}
|
||||
<label type="type_debit" class="btn btn-sm btn-outline-primary">
|
||||
<input type="radio" name="transaction_type" id="type_debit">
|
||||
{% trans "Debit" %}
|
||||
</label>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% for activity in activities_open %}
|
||||
<a href="{% url "activity:activity_entry" pk=activity.pk %}" class="btn btn-sm btn-outline-primary">
|
||||
|
Reference in New Issue
Block a user