From 4cb162de87509ed4ba200fcf9d44885f64826ba0 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss <erdnaxe@crans.org> Date: Tue, 25 Aug 2020 18:36:49 +0200 Subject: [PATCH] Card for wei templates --- .../templates/activity/activity_list.html | 4 +- apps/member/templates/member/base.html | 2 +- apps/wei/templates/wei/base.html | 111 ++++++++++++++- apps/wei/templates/wei/bus_detail.html | 57 +++++++- apps/wei/templates/wei/bus_form.html | 26 ++-- apps/wei/templates/wei/bus_tables.html | 50 ------- apps/wei/templates/wei/busteam_detail.html | 63 +++++++- apps/wei/templates/wei/busteam_form.html | 26 ++-- apps/wei/templates/wei/busteam_tables.html | 54 ------- apps/wei/templates/wei/survey.html | 4 - apps/wei/templates/wei/survey_closed.html | 4 - apps/wei/templates/wei/survey_end.html | 4 - apps/wei/templates/wei/weiclub_detail.html | 134 +++++++++++++++--- apps/wei/templates/wei/weiclub_form.html | 28 ++-- apps/wei/templates/wei/weiclub_info.html | 81 ----------- apps/wei/templates/wei/weiclub_tables.html | 82 ----------- .../wei/templates/wei/weimembership_form.html | 4 - .../wei/templates/wei/weimembership_list.html | 4 - .../wei/weiregistration_confirm_delete.html | 4 - .../templates/wei/weiregistration_form.html | 72 +++++----- .../templates/wei/weiregistration_list.html | 4 - 21 files changed, 419 insertions(+), 399 deletions(-) delete mode 100644 apps/wei/templates/wei/bus_tables.html delete mode 100644 apps/wei/templates/wei/busteam_tables.html delete mode 100644 apps/wei/templates/wei/weiclub_info.html delete mode 100644 apps/wei/templates/wei/weiclub_tables.html diff --git a/apps/activity/templates/activity/activity_list.html b/apps/activity/templates/activity/activity_list.html index 0a1eb4de..1fadd164 100644 --- a/apps/activity/templates/activity/activity_list.html +++ b/apps/activity/templates/activity/activity_list.html @@ -8,11 +8,11 @@ SPDX-License-Identifier: GPL-3.0-or-later {% block content %} {% if started_activities %} -<div class="card bg-info mb-3"> +<div class="card bg-secondary text-white mb-3"> <h3 class="card-header text-center"> {% trans "Current activity" %} </h3> - <div class="card-body"> + <div class="card-body text-dark"> {% for activity in started_activities %} {% include "activity/includes/activity_info.html" %} {% endfor %} diff --git a/apps/member/templates/member/base.html b/apps/member/templates/member/base.html index b474f736..650cd951 100644 --- a/apps/member/templates/member/base.html +++ b/apps/member/templates/member/base.html @@ -37,7 +37,6 @@ SPDX-License-Identifier: GPL-3.0-or-later {% elif club %} {% include "member/includes/club_info.html" %} {% endif %} - {% endblock %} </div> <div class="card-footer"> {% if user_object %} @@ -66,6 +65,7 @@ SPDX-License-Identifier: GPL-3.0-or-later {% endif %} </div> </div> + {% endblock %} </div> <div class="col-xl-8"> {% block profile_content %}{% endblock %} diff --git a/apps/wei/templates/wei/base.html b/apps/wei/templates/wei/base.html index 24778baf..db8f2c40 100644 --- a/apps/wei/templates/wei/base.html +++ b/apps/wei/templates/wei/base.html @@ -1 +1,110 @@ -{% extends "member/base.html" %} +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n pretty_money perms %} +{% block contenttitle %}{% endblock %} + +{# Use a fluid-width container #} +{% block containertype %}container-fluid{% endblock %} + +{% block content %} +<div class="row mt-4"> + <div class="col-xl-4"> + {% block profile_info %} + {% if club %} + <div class="card bg-light"> + <h4 class="card-header text-center"> + {{ club.name }} + </h4> + <div class="card-top text-center"> + <a href="{% url 'member:club_update_pic' club.pk %}"> + <img src="{{ club.note.display_image.url }}" class="img-thumbnail mt-2"> + </a> + </div> + <div class="card-body" id="profile_infos"> + <dl class="row"> + <dt class="col-xl-6">{% trans 'name'|capfirst %}</dt> + <dd class="col-xl-6">{{ club.name }}</dd> + + {% if club.require_memberships %} + <dt class="col-xl-6">{% trans 'date start'|capfirst %}</dt> + <dd class="col-xl-6">{{ club.date_start }}</dd> + + <dt class="col-xl-6">{% trans 'date end'|capfirst %}</dt> + <dd class="col-xl-6">{{ club.date_end }}</dd> + + <dt class="col-xl-6">{% trans 'year'|capfirst %}</dt> + <dd class="col-xl-6">{{ club.year }}</dd> + + {% if club.membership_fee_paid == club.membership_fee_unpaid %} + <dt class="col-xl-6">{% trans 'membership fee'|capfirst %}</dt> + <dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd> + {% else %} + {% with bde_kfet_fee=club.parent_club.membership_fee_paid|add:club.parent_club.parent_club.membership_fee_paid %} + <dt class="col-xl-6">{% trans 'WEI fee (paid students)'|capfirst %}</dt> + <dd class="col-xl-6">{{ club.membership_fee_paid|add:bde_kfet_fee|pretty_money }} + <i class="fas fa-question-circle" + title="{% trans "The BDE membership is included in the WEI registration." %}"></i></dd> + {% endwith %} + + {% with bde_kfet_fee=club.parent_club.membership_fee_unpaid|add:club.parent_club.parent_club.membership_fee_unpaid %} + <dt class="col-xl-6">{% trans 'WEI fee (unpaid students)'|capfirst %}</dt> + <dd class="col-xl-6">{{ club.membership_fee_unpaid|add:bde_kfet_fee|pretty_money }} + <i class="fas fa-question-circle" + title="{% trans "The BDE membership is included in the WEI registration." %}"></i></dd> + {% endwith %} + {% endif %} + {% endif %} + + {% if "note.view_note"|has_perm:club.note %} + <dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt> + <dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd> + {% endif %} + + {% if "note.change_alias"|has_perm:club.note.alias_set.first %} + <dt class="col-xl-4"><a + href="{% url 'member:club_alias' club.pk %}">{% trans 'aliases'|capfirst %}</a></dt> + <dd class="col-xl-8 text-truncate">{{ club.note.alias_set.all|join:", " }}</dd> + {% endif %} + + <dt class="col-xl-4">{% trans 'email'|capfirst %}</dt> + <dd class="col-xl-8"><a href="mailto:{{ club.email }}">{{ club.email }}</a></dd> + </dl> + </div> + <div class="card-footer text-center"> + {% if True %} + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_list' %}"> {% trans "WEI list" %}</a> + {% endif %} + {% if club.is_current_wei %} + {% if can_add_first_year_member %} + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_1A' wei_pk=club.pk %}" + data-turbolinks="false"> {% trans "Register 1A" %}</a> + {% endif %} + {% if can_add_any_member %} + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_2A' wei_pk=club.pk %}" + data-turbolinks="false"> {% trans "Register 2A+" %}</a> + {% endif %} + {% if "wei.change_"|has_perm:club %} + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_update' pk=club.pk %}" + data-turbolinks="false"> {% trans "Edit" %}</a> + {% endif %} + {% if can_add_bus %} + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:add_bus' pk=club.pk %}" + data-turbolinks="false"> {% trans "Add bus" %}</a> + {% endif %} + {% url 'wei:wei_detail' club.pk as club_detail_url %} + {%if request.path_info != club_detail_url %} + <a class="btn btn-primary btn-sm my-1" href="{{ club_detail_url }}">{% trans 'View WEI' %}</a> + {% endif %} + {% endif %} + </div> + </div> + {% endif %} + {% endblock %} + </div> + <div class="col-xl-8"> + {% block profile_content %}{% endblock %} + </div> +</div> +{% endblock %} \ No newline at end of file diff --git a/apps/wei/templates/wei/bus_detail.html b/apps/wei/templates/wei/bus_detail.html index fc5d14a2..00c901e7 100644 --- a/apps/wei/templates/wei/bus_detail.html +++ b/apps/wei/templates/wei/bus_detail.html @@ -1,9 +1,54 @@ {% extends "wei/base.html" %} - -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} +{% load render_table from django_tables2 %} +{% load i18n %} {% block profile_content %} -{% include "wei/bus_tables.html" %} -{% endblock %} +<div class="card"> + <div class="card-header text-center"> + <h4>{{ object.name }}</h4> + </div> + + <div class="card-body"> + {{ object.description }} + </div> + + <div class="card-footer text-center"> + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:update_bus' pk=object.pk %}" + data-turbolinks="false">{% trans "Edit" %}</a> + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:add_team' pk=object.pk %}" + data-turbolinks="false">{% trans "Add team" %}</a> + </div> +</div> + +<hr> + +{% if teams.data %} +<div class="card"> + <div class="card-header position-relative" id="clubListHeading"> + <a class="font-weight-bold"> + <i class="fa fa-bus"></i> {% trans "Teams" %} + </a> + </div> + {% render_table teams %} +</div> + +<hr> +{% endif %} + +{% if memberships.data %} +<div class="card"> + <div class="card-header position-relative" id="clubListHeading"> + <a class="font-weight-bold"> + <i class="fa fa-bus"></i> {% trans "Members" %} + </a> + </div> + {% render_table memberships %} +</div> + +<hr> + +<a href="{% url 'wei:wei_memberships_bus_pdf' wei_pk=club.pk bus_pk=object.pk %}" data-turbolinks="false"> + <button class="btn btn-block btn-danger"><i class="fa fa-file-pdf-o"></i> {% trans "View as PDF" %}</button> +</a> +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/apps/wei/templates/wei/bus_form.html b/apps/wei/templates/wei/bus_form.html index 3a2abfae..c62fec40 100644 --- a/apps/wei/templates/wei/bus_form.html +++ b/apps/wei/templates/wei/bus_form.html @@ -1,15 +1,21 @@ {% extends "wei/base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} {% load crispy_forms_tags %} {% load i18n %} -{% block profile_info %} - {% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} -<form method="post"> -{% csrf_token %} -{{ form|crispy }} -<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> -</form> -{% endblock %} +<div class="card bg-light mb-3"> + <h3 class="card-header text-center"> + {{ title }} + </h3> + <div class="card-body"> + <form method="post"> + {% csrf_token %} + {{ form|crispy }} + <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> + </form> + </div> +</div> +{% endblock %} \ No newline at end of file diff --git a/apps/wei/templates/wei/bus_tables.html b/apps/wei/templates/wei/bus_tables.html deleted file mode 100644 index 46509d8d..00000000 --- a/apps/wei/templates/wei/bus_tables.html +++ /dev/null @@ -1,50 +0,0 @@ -{% load render_table from django_tables2 %} -{% load i18n %} - -<div class="card"> - <div class="card-header text-center"> - <h4>{{ object.name }}</h4> - </div> - - - <div class="card-body"> - {{ object.description }} - </div> - - <div class="card-footer text-center"> - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:update_bus' pk=object.pk %}" data-turbolinks="false">{% trans "Edit" %}</a> - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:add_team' pk=object.pk %}" data-turbolinks="false">{% trans "Add team" %}</a> - </div> -</div> - -<hr> - -{% if teams.data %} - <div class="card"> - <div class="card-header position-relative" id="clubListHeading"> - <a class="font-weight-bold"> - <i class="fa fa-bus"></i> {% trans "Teams" %} - </a> - </div> - {% render_table teams %} - </div> - - <hr> -{% endif %} - -{% if memberships.data %} - <div class="card"> - <div class="card-header position-relative" id="clubListHeading"> - <a class="font-weight-bold"> - <i class="fa fa-bus"></i> {% trans "Members" %} - </a> - </div> - {% render_table memberships %} - </div> - - <hr> - - <a href="{% url 'wei:wei_memberships_bus_pdf' wei_pk=club.pk bus_pk=object.pk %}" data-turbolinks="false"> - <button class="btn btn-block btn-danger"><i class="fa fa-file-pdf-o"></i> {% trans "View as PDF" %}</button> - </a> -{% endif %} diff --git a/apps/wei/templates/wei/busteam_detail.html b/apps/wei/templates/wei/busteam_detail.html index e262d64f..f77dc3c9 100644 --- a/apps/wei/templates/wei/busteam_detail.html +++ b/apps/wei/templates/wei/busteam_detail.html @@ -1,9 +1,60 @@ {% extends "wei/base.html" %} - -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} +{% load render_table from django_tables2 %} +{% load i18n %} {% block profile_content %} -{% include "wei/busteam_tables.html" %} -{% endblock %} +<div class="card"> + <div class="card-header text-center"> + <h4>{{ bus.name }}</h4> + </div> + + <div class="card-body"> + {{ bus.description }} + </div> + + <div class="card-footer text-center"> + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:update_bus' pk=bus.pk %}" + data-turbolinks="false">{% trans "Edit" %}</a> + <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:add_team' pk=bus.pk %}" + data-turbolinks="false">{% trans "Add team" %}</a> + </div> +</div> + +<hr> + +<div class="card"> + <div class="card-header text-center" + style="background-color: #{{ object.color|stringformat:"06X" }}; color: #{{ -16777215|add:object.color|stringformat:"06X"|slice:"1:" }};"> + <h4>{{ object.name }}</h4> + </div> + + <div class="card-body"> + {{ object.description }} + </div> + + <div class="card-footer text-center"> + <a class="btn btn-primary btn-sm my-1" + href="{% url 'wei:update_bus_team' pk=object.pk %}">{% trans "Edit" %}</a> + </div> +</div> + +<hr> + +{% if memberships.data or True %} +<div class="card"> + <div class="card-header position-relative" id="clubListHeading"> + <a class="font-weight-bold"> + <i class="fa fa-bus"></i> {% trans "Teams" %} + </a> + </div> + {% render_table memberships %} +</div> + +<hr> + +<a href="{% url 'wei:wei_memberships_team_pdf' wei_pk=club.pk bus_pk=object.bus.pk team_pk=object.pk %}" + data-turbolinks="false"> + <button class="btn btn-block btn-danger"><i class="fa fa-file-pdf-o"></i> {% trans "View as PDF" %}</button> +</a> +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/apps/wei/templates/wei/busteam_form.html b/apps/wei/templates/wei/busteam_form.html index 3a2abfae..c62fec40 100644 --- a/apps/wei/templates/wei/busteam_form.html +++ b/apps/wei/templates/wei/busteam_form.html @@ -1,15 +1,21 @@ {% extends "wei/base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} {% load crispy_forms_tags %} {% load i18n %} -{% block profile_info %} - {% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} -<form method="post"> -{% csrf_token %} -{{ form|crispy }} -<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> -</form> -{% endblock %} +<div class="card bg-light mb-3"> + <h3 class="card-header text-center"> + {{ title }} + </h3> + <div class="card-body"> + <form method="post"> + {% csrf_token %} + {{ form|crispy }} + <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> + </form> + </div> +</div> +{% endblock %} \ No newline at end of file diff --git a/apps/wei/templates/wei/busteam_tables.html b/apps/wei/templates/wei/busteam_tables.html deleted file mode 100644 index 433405b8..00000000 --- a/apps/wei/templates/wei/busteam_tables.html +++ /dev/null @@ -1,54 +0,0 @@ -{% load render_table from django_tables2 %} -{% load i18n %} - -<div class="card"> - <div class="card-header text-center"> - <h4>{{ bus.name }}</h4> - </div> - - - <div class="card-body"> - {{ bus.description }} - </div> - - <div class="card-footer text-center"> - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:update_bus' pk=bus.pk %}" data-turbolinks="false">{% trans "Edit" %}</a> - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:add_team' pk=bus.pk %}" data-turbolinks="false">{% trans "Add team" %}</a> - </div> -</div> - -<hr> - -<div class="card"> - <div class="card-header text-center" style="background-color: #{{ object.color|stringformat:"06X" }}; color: #{{ -16777215|add:object.color|stringformat:"06X"|slice:"1:" }};"> - <h4>{{ object.name }}</h4> - </div> - - - <div class="card-body"> - {{ object.description }} - </div> - - <div class="card-footer text-center"> - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:update_bus_team' pk=object.pk %}">{% trans "Edit" %}</a> - </div> -</div> - -<hr> - -{% if memberships.data or True %} - <div class="card"> - <div class="card-header position-relative" id="clubListHeading"> - <a class="font-weight-bold"> - <i class="fa fa-bus"></i> {% trans "Teams" %} - </a> - </div> - {% render_table memberships %} - </div> - - <hr> - - <a href="{% url 'wei:wei_memberships_team_pdf' wei_pk=club.pk bus_pk=object.bus.pk team_pk=object.pk %}" data-turbolinks="false"> - <button class="btn btn-block btn-danger"><i class="fa fa-file-pdf-o"></i> {% trans "View as PDF" %}</button> - </a> -{% endif %} diff --git a/apps/wei/templates/wei/survey.html b/apps/wei/templates/wei/survey.html index 357693fb..4bf18325 100644 --- a/apps/wei/templates/wei/survey.html +++ b/apps/wei/templates/wei/survey.html @@ -2,10 +2,6 @@ {% load i18n %} {% load crispy_forms_tags %} -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} <div class="card"> <div class="card-header text-center"> diff --git a/apps/wei/templates/wei/survey_closed.html b/apps/wei/templates/wei/survey_closed.html index 719168be..e4da253d 100644 --- a/apps/wei/templates/wei/survey_closed.html +++ b/apps/wei/templates/wei/survey_closed.html @@ -2,10 +2,6 @@ {% load i18n %} {% load crispy_forms_tags %} -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} <div class="card"> <div class="card-header text-center"> diff --git a/apps/wei/templates/wei/survey_end.html b/apps/wei/templates/wei/survey_end.html index a141a036..af6dace8 100644 --- a/apps/wei/templates/wei/survey_end.html +++ b/apps/wei/templates/wei/survey_end.html @@ -2,10 +2,6 @@ {% load i18n %} {% load crispy_forms_tags %} -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} <div class="card"> <div class="card-header text-center"> diff --git a/apps/wei/templates/wei/weiclub_detail.html b/apps/wei/templates/wei/weiclub_detail.html index 52d918f1..40786add 100644 --- a/apps/wei/templates/wei/weiclub_detail.html +++ b/apps/wei/templates/wei/weiclub_detail.html @@ -1,30 +1,118 @@ {% extends "wei/base.html" %} - -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load render_table from django_tables2 %} +{% load i18n perms %} {% block profile_content %} -{% include "wei/weiclub_tables.html" %} +<div class="card bg-white mb-3"> + <div class="card-header text-center"> + <h4>Week-End d'Intégration</h4> + </div> + <div class="card-body"> + <p class="lead font-italic"> + Le WEI (Week-End d’Intégration), ou 3 jours d’immersion dans les profondeurs du + monde post-préparatoire. + </p> + <p> + Que serait une école sans son week-end d’intégration ? Quelques semaines après la + rentrée, on embarque tous et toutes à bord de bus à thèmes pour quelques jours + inoubliables dans une destination inconnue. L’objectif de ce week-end : permettre aux + nouvel·les arrivant·es de se lâcher après 2 ans de dur labeur (voire 3 pour les plus + chanceux), de découvrir l’ambiance familiale de l’ENS ainsi que de nouer des liens avec + ceux·elles qu’ils côtoieront par la suite. Dose de chants et de fun garantie ! + </p> + </div> + {% if club.is_current_wei %} + <div class="card-footer text-center"> + {% if not my_registration %} + {% if not not_first_year %} + <a class="btn btn-success" href="{% url "wei:wei_register_1A_myself" wei_pk=club.pk %}" data-turbolinks="false"> + {% trans "Register to the WEI! – 1A" %} + </a> + {% endif %} + <a class="btn btn-success" href="{% url "wei:wei_register_2A_myself" wei_pk=club.pk %}" data-turbolinks="false"> + {% trans "Register to the WEI! – 2A+" %}</a> + {% else %} + <a class="btn btn-warning" href="{% url "wei:wei_update_registration" pk=my_registration.pk %}" + data-turbolinks="false"> + {% trans "Update my registration" %} + </a> + {% endif %} + </div> + {% endif %} +</div> + +{% if buses.data %} +<div class="card bg-white mb-3"> + <div class="card-header position-relative" id="clubListHeading"> + <span class="font-weight-bold"> + <i class="fa fa-bus"></i> {% trans "Buses" %} + </span> + </div> + {% render_table buses %} +</div> +{% endif %} + +{% if member_list.data %} +<div class="card bg-white mb-3"> + <div class="card-header position-relative" id="clubListHeading"> + <a class="stretched-link font-weight-bold text-decoration-none" + href="{% url "wei:wei_memberships" pk=club.pk %}"> + <i class="fa fa-users"></i> {% trans "Members of the WEI" %} + </a> + </div> + {% render_table member_list %} +</div> +{% endif %} + +{% if history_list.data %} +<div class="card bg-white mb-3"> + <div class="card-header position-relative" id="historyListHeading"> + <a class="stretched-link font-weight-bold text-decoration-none" {% if "note.view_note"|has_perm:club.note %} + href="{% url 'note:transactions' pk=club.note.pk %}" {% endif %}> + <i class="fa fa-euro"></i> {% trans "Transaction history" %} + </a> + </div> + <div id="history_list"> + {% render_table history_list %} + </div> +</div> +{% endif %} + +{% if pre_registrations.data %} +<div class="card bg-white mb-3"> + <div class="card-header position-relative" id="historyListHeading"> + <a class="stretched-link font-weight-bold text-decoration-none" + href="{% url 'wei:wei_registrations' pk=club.pk %}"> + <i class="fa fa-user-plus"></i> {% trans "Unvalidated registrations" %} + </a> + </div> + <div id="history_list"> + {% render_table pre_registrations %} + </div> +</div> +{% endif %} {% endblock %} {% block extrajavascript %} - <script> - function refreshHistory() { - $("#history_list").load("{% url 'wei:wei_detail' pk=object.pk %} #history_list"); - $("#profile_infos").load("{% url 'wei:wei_detail' pk=object.pk %} #profile_infos"); - } +<script> + function refreshHistory() { + $("#history_list").load("{% url 'wei:wei_detail' pk=object.pk %} #history_list"); + $("#profile_infos").load("{% url 'wei:wei_detail' pk=object.pk %} #profile_infos"); + } - $(document).ready(function() { - $(".no-perm").parent().addClass("d-none"); - if ($("a[data-type='validate-membership']:not(.d-none)").length === 0) { - $("a[data-type='validate-membership']").parent().addClass("d-none"); - $("#validate-membership-header").addClass("d-none"); - } - if ($("a[data-type='delete-membership']:not(.d-none)").length === 0) { - $("a[data-type='delete-membership']").parent().addClass("d-none"); - $("#delete-membership-header").addClass("d-none"); - } - }); - </script> -{% endblock %} + $(document).ready(function () { + $(".no-perm").parent().addClass("d-none"); + if ($("a[data-type='validate-membership']:not(.d-none)").length === 0) { + $("a[data-type='validate-membership']").parent().addClass("d-none"); + $("#validate-membership-header").addClass("d-none"); + } + if ($("a[data-type='delete-membership']:not(.d-none)").length === 0) { + $("a[data-type='delete-membership']").parent().addClass("d-none"); + $("#delete-membership-header").addClass("d-none"); + } + }); +</script> +{% endblock %} \ No newline at end of file diff --git a/apps/wei/templates/wei/weiclub_form.html b/apps/wei/templates/wei/weiclub_form.html index 30af2ea7..c62fec40 100644 --- a/apps/wei/templates/wei/weiclub_form.html +++ b/apps/wei/templates/wei/weiclub_form.html @@ -1,17 +1,21 @@ {% extends "wei/base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} {% load crispy_forms_tags %} {% load i18n %} -{% block profile_info %} - {% if club %} - {% include "wei/weiclub_info.html" %} - {% endif %} -{% endblock %} - {% block profile_content %} - <form method="post"> - {% csrf_token %} - {{ form|crispy }} - <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> - </form> -{% endblock %} +<div class="card bg-light mb-3"> + <h3 class="card-header text-center"> + {{ title }} + </h3> + <div class="card-body"> + <form method="post"> + {% csrf_token %} + {{ form|crispy }} + <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> + </form> + </div> +</div> +{% endblock %} \ No newline at end of file diff --git a/apps/wei/templates/wei/weiclub_info.html b/apps/wei/templates/wei/weiclub_info.html deleted file mode 100644 index ef9af818..00000000 --- a/apps/wei/templates/wei/weiclub_info.html +++ /dev/null @@ -1,81 +0,0 @@ -{% load i18n static pretty_money perms %} -<div class="card bg-light shadow"> - <div class="card-header text-center"> - <h4>{{ club.name }} </h4> - </div> - <div class="card-top text-center"> - <a href="{% url 'member:club_update_pic' club.pk %}"> - <img src="{{ club.note.display_image.url }}" class="img-thumbnail mt-2" > - </a> - </div> - <div class="card-body" id="profile_infos"> - <dl class="row"> - <dt class="col-xl-6">{% trans 'name'|capfirst %}</dt> - <dd class="col-xl-6">{{ club.name }}</dd> - - {% if club.require_memberships %} - <dt class="col-xl-6">{% trans 'date start'|capfirst %}</dt> - <dd class="col-xl-6">{{ club.date_start }}</dd> - - <dt class="col-xl-6">{% trans 'date end'|capfirst %}</dt> - <dd class="col-xl-6">{{ club.date_end }}</dd> - - <dt class="col-xl-6">{% trans 'year'|capfirst %}</dt> - <dd class="col-xl-6">{{ club.year }}</dd> - - {% if club.membership_fee_paid == club.membership_fee_unpaid %} - <dt class="col-xl-6">{% trans 'membership fee'|capfirst %}</dt> - <dd class="col-xl-6">{{ club.membership_fee_paid|pretty_money }}</dd> - {% else %} - {% with bde_kfet_fee=club.parent_club.membership_fee_paid|add:club.parent_club.parent_club.membership_fee_paid %} - <dt class="col-xl-6">{% trans 'WEI fee (paid students)'|capfirst %}</dt> - <dd class="col-xl-6">{{ club.membership_fee_paid|add:bde_kfet_fee|pretty_money }} - <i class="fas fa-question-circle" title="{% trans "The BDE membership is included in the WEI registration." %}"></i></dd> - {% endwith %} - - {% with bde_kfet_fee=club.parent_club.membership_fee_unpaid|add:club.parent_club.parent_club.membership_fee_unpaid %} - <dt class="col-xl-6">{% trans 'WEI fee (unpaid students)'|capfirst %}</dt> - <dd class="col-xl-6">{{ club.membership_fee_unpaid|add:bde_kfet_fee|pretty_money }} - <i class="fas fa-question-circle" title="{% trans "The BDE membership is included in the WEI registration." %}"></i></dd> - {% endwith %} - {% endif %} - {% endif %} - - {% if "note.view_note"|has_perm:club.note %} - <dt class="col-xl-6">{% trans 'balance'|capfirst %}</dt> - <dd class="col-xl-6">{{ club.note.balance | pretty_money }}</dd> - {% endif %} - - {% if "note.change_alias"|has_perm:club.note.alias_set.first %} - <dt class="col-xl-4"><a href="{% url 'member:club_alias' club.pk %}">{% trans 'aliases'|capfirst %}</a></dt> - <dd class="col-xl-8 text-truncate">{{ club.note.alias_set.all|join:", " }}</dd> - {% endif %} - - <dt class="col-xl-4">{% trans 'email'|capfirst %}</dt> - <dd class="col-xl-8"><a href="mailto:{{ club.email }}">{{ club.email }}</a></dd> - </dl> - </div> - <div class="card-footer text-center"> - {% if True %} - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_list' %}"> {% trans "WEI list" %}</a> - {% endif %} - {% if club.is_current_wei %} - {% if can_add_first_year_member %} - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_1A' wei_pk=club.pk %}" data-turbolinks="false"> {% trans "Register 1A" %}</a> - {% endif %} - {% if can_add_any_member %} - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_2A' wei_pk=club.pk %}" data-turbolinks="false"> {% trans "Register 2A+" %}</a> - {% endif %} - {% if "wei.change_"|has_perm:club %} - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_update' pk=club.pk %}" data-turbolinks="false"> {% trans "Edit" %}</a> - {% endif %} - {% if can_add_bus %} - <a class="btn btn-primary btn-sm my-1" href="{% url 'wei:add_bus' pk=club.pk %}" data-turbolinks="false"> {% trans "Add bus" %}</a> - {% endif %} - {% url 'wei:wei_detail' club.pk as club_detail_url %} - {%if request.path_info != club_detail_url %} - <a class="btn btn-primary btn-sm my-1" href="{{ club_detail_url }}">{% trans 'View WEI' %}</a> - {% endif %} - {% endif %} - </div> -</div> diff --git a/apps/wei/templates/wei/weiclub_tables.html b/apps/wei/templates/wei/weiclub_tables.html deleted file mode 100644 index 20887384..00000000 --- a/apps/wei/templates/wei/weiclub_tables.html +++ /dev/null @@ -1,82 +0,0 @@ -{% load render_table from django_tables2 %} -{% load i18n %} -{% load perms %} -<div class="card"> - <div class="card-header text-center"> - <h4>WEI</h4> - </div> - <div class="card-body"> - <p>LE WEI, c'est cool !</p> - </div> - - {% if club.is_current_wei %} - <div class="card-footer text-center"> - {% if not my_registration %} - {% if not not_first_year %} - <a href="{% url "wei:wei_register_1A_myself" wei_pk=club.pk %}" data-turbolinks="false"><button class="btn btn-success">{% trans "Register to the WEI! – 1A" %}</button></a> - {% endif %} - <a href="{% url "wei:wei_register_2A_myself" wei_pk=club.pk %}" data-turbolinks="false"><button class="btn btn-success">{% trans "Register to the WEI! – 2A+" %}</button></a> - {% else %} - <a href="{% url "wei:wei_update_registration" pk=my_registration.pk %}" data-turbolinks="false"><button class="btn btn-warning">{% trans "Update my registration" %}</button></a> - {% endif %} - </div> - {% endif %} -</div> - -<hr> - -{% if buses.data %} - <div class="card"> - <div class="card-header position-relative" id="clubListHeading"> - <a class="font-weight-bold"> - <i class="fa fa-bus"></i> {% trans "Buses" %} - </a> - </div> - {% render_table buses %} - </div> - - <hr> -{% endif %} - -{% if member_list.data %} - <div class="card"> - <div class="card-header position-relative" id="clubListHeading"> - <a class="stretched-link font-weight-bold" href="{% url "wei:wei_memberships" pk=club.pk %}"> - <i class="fa fa-users"></i> {% trans "Members of the WEI" %} - </a> - </div> - {% render_table member_list %} - </div> - - <hr> -{% endif %} - -{% if history_list.data %} - <div class="card"> - <div class="card-header position-relative" id="historyListHeading"> - <a class="stretched-link font-weight-bold" {% if "note.view_note"|has_perm:club.note %} href="{% url 'note:transactions' pk=club.note.pk %}" {% endif %}> - <i class="fa fa-euro"></i> {% trans "Transaction history" %} - </a> - </div> - <div id="history_list"> - {% render_table history_list %} - </div> - </div> - - <hr> -{% endif %} - -{% if pre_registrations.data %} - <div class="card"> - <div class="card-header position-relative" id="historyListHeading"> - <a class="stretched-link font-weight-bold" href="{% url 'wei:wei_registrations' pk=club.pk %}"> - <i class="fa fa-user-plus"></i> {% trans "Unvalidated registrations" %} - </a> - </div> - <div id="history_list"> - {% render_table pre_registrations %} - </div> - </div> - - <hr> -{% endif %} diff --git a/apps/wei/templates/wei/weimembership_form.html b/apps/wei/templates/wei/weimembership_form.html index ba4401ef..fd721f9f 100644 --- a/apps/wei/templates/wei/weimembership_form.html +++ b/apps/wei/templates/wei/weimembership_form.html @@ -4,10 +4,6 @@ {% load pretty_money %} {% load perms %} -{% block profile_info %} - {% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} <div class="card bg-light shadow"> <div class="card-header text-center"> diff --git a/apps/wei/templates/wei/weimembership_list.html b/apps/wei/templates/wei/weimembership_list.html index e0ed72fa..76643c06 100644 --- a/apps/wei/templates/wei/weimembership_list.html +++ b/apps/wei/templates/wei/weimembership_list.html @@ -2,10 +2,6 @@ {% load i18n %} {% load render_table from django_tables2 %} -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} <input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note/bus/équipe ..."> <hr> diff --git a/apps/wei/templates/wei/weiregistration_confirm_delete.html b/apps/wei/templates/wei/weiregistration_confirm_delete.html index 68d9c4a3..79aff24e 100644 --- a/apps/wei/templates/wei/weiregistration_confirm_delete.html +++ b/apps/wei/templates/wei/weiregistration_confirm_delete.html @@ -2,10 +2,6 @@ {% load i18n %} {% load crispy_forms_tags %} -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} <div class="card bg-light shadow"> <div class="card-header text-center"> diff --git a/apps/wei/templates/wei/weiregistration_form.html b/apps/wei/templates/wei/weiregistration_form.html index 5bec2c0f..fae85e0f 100644 --- a/apps/wei/templates/wei/weiregistration_form.html +++ b/apps/wei/templates/wei/weiregistration_form.html @@ -1,44 +1,50 @@ {% extends "wei/base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} {% load i18n %} {% load crispy_forms_tags %} -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} - <form method="post"> - {% csrf_token %} - {{ form|crispy }} - {{ membership_form|crispy }} - <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> - </form> +<div class="card bg-light mb-3"> + <h3 class="card-header text-center"> + {{ title }} + </h3> + <div class="card-body"> + <form method="post"> + {% csrf_token %} + {{ form|crispy }} + {{ membership_form|crispy }} + <button class="btn btn-primary" type="submit">{% trans "Submit" %}</button> + </form> + </div> +</div> {% endblock %} {% block extrajavascript %} - {% if not object.membership %} - <script> - $(document).ready(function() { - function refreshTeams() { - let buses = []; - $("input[name='bus']:checked").each(function(ignored) { - buses.push($(this).parent().text().trim()); +{% if not object.membership %} +<script> + $(document).ready(function () { + function refreshTeams() { + let buses = []; + $("input[name='bus']:checked").each(function (ignored) { + buses.push($(this).parent().text().trim()); + }); + console.log(buses); + $("input[name='team']").each(function () { + let label = $(this).parent(); + $(this).parent().addClass('d-none'); + buses.forEach(function (bus) { + if (label.text().includes(bus)) + label.removeClass('d-none'); }); - console.log(buses); - $("input[name='team']").each(function() { - let label = $(this).parent(); - $(this).parent().addClass('d-none'); - buses.forEach(function(bus) { - if (label.text().includes(bus)) - label.removeClass('d-none'); - }); - }); - } + }); + } - $("input[name='bus']").change(refreshTeams); + $("input[name='bus']").change(refreshTeams); - refreshTeams(); - }); - </script> - {% endif %} -{% endblock %} + refreshTeams(); + }); +</script> +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/apps/wei/templates/wei/weiregistration_list.html b/apps/wei/templates/wei/weiregistration_list.html index 0fa8ef0f..3e0a3295 100644 --- a/apps/wei/templates/wei/weiregistration_list.html +++ b/apps/wei/templates/wei/weiregistration_list.html @@ -2,10 +2,6 @@ {% load i18n %} {% load render_table from django_tables2 %} -{% block profile_info %} -{% include "wei/weiclub_info.html" %} -{% endblock %} - {% block profile_content %} <input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ..."> <hr> -- GitLab