Filter members

This commit is contained in:
Yohann D'ANELLO 2020-07-31 17:01:52 +02:00
parent bd35e4e21e
commit fd705adb05
6 changed files with 242 additions and 108 deletions

View File

@ -130,3 +130,31 @@ class MembershipTable(tables.Table):
template_name = 'django_tables2/bootstrap4.html'
fields = ('user', 'club', 'date_start', 'date_end', 'roles', 'fee', )
model = Membership
class ClubManagerTable(tables.Table):
"""
List managers of a club.
"""
def render_user(self, value):
# If the user has the right, link the displayed user with the page of its detail.
s = value.username
if PermissionBackend.check_perm(get_current_authenticated_user(), "auth.view_user", value):
s = format_html("<a href={url}>{name}</a>",
url=reverse_lazy('member:user_detail', kwargs={"pk": value.pk}), name=s)
return s
def render_roles(self, record):
roles = record.roles.all()
return ", ".join(str(role) for role in roles)
class Meta:
attrs = {
'class': 'table table-condensed table-striped table-hover',
'style': 'table-layout: fixed;'
}
template_name = 'django_tables2/bootstrap4.html'
fields = ('user', 'user.first_name', 'user.last_name', 'roles', )
model = Membership

View File

@ -30,7 +30,7 @@ from permission.views import ProtectQuerysetMixin
from .forms import ProfileForm, ClubForm, MembershipForm, CustomAuthenticationForm, UserForm, MembershipRolesForm
from .models import Club, Membership
from .tables import ClubTable, UserTable, MembershipTable
from .tables import ClubTable, UserTable, MembershipTable, ClubManagerTable
class CustomLoginView(LoginView):
@ -338,6 +338,10 @@ class ClubDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
if PermissionBackend.check_perm(self.request.user, "member.change_club_membership_start", club):
club.update_membership_dates()
managers = Membership.objects.filter(club=self.object, roles__name="Bureau de club")\
.order_by('user__last_name').all()
context["managers"] = ClubManagerTable(data=managers, prefix="managers-")
club_transactions = Transaction.objects.all().filter(Q(source=club.note) | Q(destination=club.note))\
.filter(PermissionBackend.filter_queryset(self.request.user, Transaction, "view"))\
.order_by('-created_at')
@ -672,21 +676,33 @@ class ClubMembersListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableV
Q(user__note__alias__normalized_name__iregex='^' + Alias.normalize(pattern))
)
if 'only_active' in self.request.GET:
only_active = self.request.GET["only_active"] != '0'
else:
only_active = True
only_active = "only_active" not in self.request.GET or self.request.GET["only_active"] != '0'
if only_active:
qs = qs.filter(date_start__lte=timezone.now().today(), date_end__gte=timezone.now().today())
if "roles" in self.request.GET:
if not self.request.GET["roles"]:
return qs.none()
roles_str = self.request.GET["roles"].replace(' ', '').split(',')
roles_int = map(int, roles_str)
qs = qs.filter(roles__in=roles_int)
qs = qs.order_by('-date_start', 'user__username')
return qs.distinct()
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["club"] = Club.objects.filter(
club = Club.objects.filter(
PermissionBackend.filter_queryset(self.request.user, Club, "view")
).get(pk=self.kwargs["pk"])
context["club"] = club
applicable_roles = Role.objects.filter(Q(weirole__isnull=not hasattr(club, 'weiclub'))
& (Q(for_club__isnull=True) | Q(for_club=club))).all()
context["applicable_roles"] = applicable_roles
context["only_active"] = "only_active" not in self.request.GET or self.request.GET["only_active"] != '0'
return context

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-30 17:22+0200\n"
"POT-Creation-Date: 2020-07-31 17:00+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -186,12 +186,12 @@ msgstr ""
msgid "Type"
msgstr ""
#: apps/activity/tables.py:77 apps/member/forms.py:104
#: apps/activity/tables.py:77 apps/member/forms.py:102
#: apps/registration/forms.py:64 apps/treasury/forms.py:120
msgid "Last name"
msgstr ""
#: apps/activity/tables.py:79 apps/member/forms.py:109
#: apps/activity/tables.py:79 apps/member/forms.py:107
#: apps/registration/forms.py:69 apps/treasury/forms.py:122
#: templates/note/transaction_form.html:126
msgid "First name"
@ -261,12 +261,12 @@ msgstr ""
msgid "create"
msgstr ""
#: apps/logs/models.py:61 apps/note/tables.py:143
#: apps/logs/models.py:61 apps/note/tables.py:161
#: templates/activity/activity_detail.html:67
msgid "edit"
msgstr ""
#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:148
#: apps/logs/models.py:62 apps/note/tables.py:138 apps/note/tables.py:166
#: apps/wei/tables.py:65
msgid "delete"
msgstr ""
@ -295,39 +295,47 @@ msgstr ""
msgid "member"
msgstr ""
#: apps/member/forms.py:58 apps/member/views.py:81
#: apps/member/forms.py:58 apps/member/views.py:82
msgid "An alias with a similar name already exists."
msgstr ""
#: apps/member/forms.py:83 apps/registration/forms.py:44
#: apps/member/forms.py:81 apps/registration/forms.py:44
msgid "Inscription paid by Société Générale"
msgstr ""
#: apps/member/forms.py:85 apps/registration/forms.py:46
#: apps/member/forms.py:83 apps/registration/forms.py:46
msgid "Check this case is the Société Générale paid the inscription."
msgstr ""
#: apps/member/forms.py:90 apps/registration/forms.py:51
#: apps/member/forms.py:88 apps/registration/forms.py:51
msgid "Credit type"
msgstr ""
#: apps/member/forms.py:91 apps/registration/forms.py:52
#: apps/member/forms.py:89 apps/registration/forms.py:52
msgid "No credit"
msgstr ""
#: apps/member/forms.py:93
#: apps/member/forms.py:91
msgid "You can credit the note of the user."
msgstr ""
#: apps/member/forms.py:97 apps/registration/forms.py:57
#: apps/member/forms.py:95 apps/registration/forms.py:57
msgid "Credit amount"
msgstr ""
#: apps/member/forms.py:114 apps/registration/forms.py:74
#: apps/member/forms.py:112 apps/registration/forms.py:74
#: apps/treasury/forms.py:124 templates/note/transaction_form.html:132
msgid "Bank"
msgstr ""
#: apps/member/forms.py:138
msgid "User"
msgstr ""
#: apps/member/forms.py:152
msgid "Roles"
msgstr ""
#: apps/member/models.py:34
#: templates/registration/future_profile_detail.html:40
#: templates/wei/weimembership_form.html:48
@ -525,7 +533,7 @@ msgstr ""
msgid "fee"
msgstr ""
#: apps/member/models.py:303 apps/member/views.py:535 apps/wei/views.py:787
#: apps/member/models.py:303 apps/member/views.py:534 apps/wei/views.py:787
msgid "User is not a member of the parent club"
msgstr ""
@ -534,7 +542,7 @@ msgstr ""
msgid "The role {role} does not apply to the club {club}."
msgstr ""
#: apps/member/models.py:321 apps/member/views.py:544
#: apps/member/models.py:321 apps/member/views.py:543
msgid "User is already a member of the club"
msgstr ""
@ -555,80 +563,84 @@ msgstr ""
msgid "Renew"
msgstr ""
#: apps/member/views.py:56 templates/member/profile_info.html:47
#: apps/member/views.py:57 templates/member/profile_info.html:47
#: templates/registration/future_profile_detail.html:48
#: templates/wei/weimembership_form.html:130
msgid "Update Profile"
msgstr ""
#: apps/member/views.py:69 apps/registration/forms.py:23
#: apps/member/views.py:70 apps/registration/forms.py:23
msgid "This address must be valid."
msgstr ""
#: apps/member/views.py:126
#: apps/member/views.py:127
msgid "Profile detail"
msgstr ""
#: apps/member/views.py:160
#: apps/member/views.py:161
msgid "Search user"
msgstr ""
#: apps/member/views.py:194 apps/member/views.py:376
#: apps/member/views.py:195 apps/member/views.py:381
msgid "Note aliases"
msgstr ""
#: apps/member/views.py:208
#: apps/member/views.py:209
msgid "Update note picture"
msgstr ""
#: apps/member/views.py:266 templates/member/profile_info.html:43
#: apps/member/views.py:267 templates/member/profile_info.html:43
msgid "Manage auth token"
msgstr ""
#: apps/member/views.py:294
#: apps/member/views.py:295
msgid "Create new club"
msgstr ""
#: apps/member/views.py:306
#: apps/member/views.py:307
msgid "Search club"
msgstr ""
#: apps/member/views.py:331
#: apps/member/views.py:332
msgid "Club detail"
msgstr ""
#: apps/member/views.py:393
#: apps/member/views.py:398
msgid "Update club"
msgstr ""
#: apps/member/views.py:427
#: apps/member/views.py:432
msgid "Add new member to the club"
msgstr ""
#: apps/member/views.py:530 apps/wei/views.py:778
#: apps/member/views.py:529 apps/wei/views.py:778
msgid ""
"This user don't have enough money to join this club, and can't have a "
"negative balance."
msgstr ""
#: apps/member/views.py:548
#: apps/member/views.py:547
msgid "The membership must start after {:%m-%d-%Y}."
msgstr ""
#: apps/member/views.py:553
#: apps/member/views.py:552
msgid "The membership must begin before {:%m-%d-%Y}."
msgstr ""
#: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574
#: apps/member/views.py:569 apps/member/views.py:571 apps/member/views.py:573
#: apps/registration/views.py:295 apps/registration/views.py:297
#: apps/registration/views.py:299
msgid "This field is required."
msgstr ""
#: apps/member/views.py:634
#: apps/member/views.py:641
msgid "Manage roles of an user in the club"
msgstr ""
#: apps/member/views.py:666
msgid "Members of the club"
msgstr ""
#: apps/note/admin.py:121 apps/note/models/transactions.py:106
msgid "source"
msgstr ""
@ -784,7 +796,7 @@ msgid "transaction templates"
msgstr ""
#: apps/note/models/transactions.py:112 apps/note/models/transactions.py:125
#: apps/note/tables.py:33 apps/note/tables.py:42
#: apps/note/tables.py:35 apps/note/tables.py:44
msgid "used alias"
msgstr ""
@ -796,7 +808,7 @@ msgstr ""
msgid "reason"
msgstr ""
#: apps/note/models/transactions.py:151 apps/note/tables.py:95
#: apps/note/models/transactions.py:151 apps/note/tables.py:113
msgid "invalidity reason"
msgstr ""
@ -858,25 +870,25 @@ msgstr ""
msgid "membership transactions"
msgstr ""
#: apps/note/tables.py:57
#: apps/note/tables.py:63
msgid "Click to invalidate"
msgstr ""
#: apps/note/tables.py:57
#: apps/note/tables.py:63
msgid "Click to validate"
msgstr ""
#: apps/note/tables.py:93
#: apps/note/tables.py:111
msgid "No reason specified"
msgstr ""
#: apps/note/tables.py:122 apps/note/tables.py:150 apps/wei/tables.py:66
#: apps/note/tables.py:140 apps/note/tables.py:168 apps/wei/tables.py:66
#: templates/treasury/sogecredit_detail.html:59
#: templates/wei/weiregistration_confirm_delete.html:32
msgid "Delete"
msgstr ""
#: apps/note/tables.py:145 apps/wei/tables.py:42 apps/wei/tables.py:43
#: apps/note/tables.py:163 apps/wei/tables.py:42 apps/wei/tables.py:43
#: templates/member/club_info.html:67 templates/note/conso_form.html:128
#: templates/wei/bus_tables.html:15 templates/wei/busteam_tables.html:15
#: templates/wei/busteam_tables.html:33 templates/wei/weiclub_info.html:68
@ -1828,11 +1840,28 @@ msgstr ""
msgid "Club listing"
msgstr ""
#: templates/member/club_members.html:16
msgid "Display only active memberships"
msgstr ""
#: templates/member/club_members.html:21
msgid "Filter roles:"
msgstr ""
#: templates/member/club_members.html:37
#: templates/wei/weimembership_list.html:18
msgid "There is no membership found with this pattern."
msgstr ""
#: templates/member/club_tables.html:7
msgid "Club managers"
msgstr ""
#: templates/member/club_tables.html:20
msgid "Club members"
msgstr ""
#: templates/member/club_tables.html:20 templates/member/profile_tables.html:28
#: templates/member/club_tables.html:33 templates/member/profile_tables.html:28
#: templates/wei/weiclub_tables.html:105
msgid "Transaction history"
msgstr ""
@ -2469,10 +2498,6 @@ msgid ""
" "
msgstr ""
#: templates/wei/weimembership_list.html:18
msgid "There is no membership found with this pattern."
msgstr ""
#: templates/wei/weimembership_list.html:24
msgid "View unvalidated registrations..."
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-30 17:22+0200\n"
"POT-Creation-Date: 2020-07-31 17:00+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -187,12 +187,12 @@ msgstr "supprimer"
msgid "Type"
msgstr "Type"
#: apps/activity/tables.py:77 apps/member/forms.py:104
#: apps/activity/tables.py:77 apps/member/forms.py:102
#: apps/registration/forms.py:64 apps/treasury/forms.py:120
msgid "Last name"
msgstr "Nom de famille"
#: apps/activity/tables.py:79 apps/member/forms.py:109
#: apps/activity/tables.py:79 apps/member/forms.py:107
#: apps/registration/forms.py:69 apps/treasury/forms.py:122
#: templates/note/transaction_form.html:126
msgid "First name"
@ -262,12 +262,12 @@ msgstr "Nouvelles données"
msgid "create"
msgstr "Créer"
#: apps/logs/models.py:61 apps/note/tables.py:143
#: apps/logs/models.py:61 apps/note/tables.py:161
#: templates/activity/activity_detail.html:67
msgid "edit"
msgstr "Modifier"
#: apps/logs/models.py:62 apps/note/tables.py:120 apps/note/tables.py:148
#: apps/logs/models.py:62 apps/note/tables.py:138 apps/note/tables.py:166
#: apps/wei/tables.py:65
msgid "delete"
msgstr "Supprimer"
@ -296,39 +296,47 @@ msgstr "journaux de modifications"
msgid "member"
msgstr "adhérent"
#: apps/member/forms.py:58 apps/member/views.py:81
#: apps/member/forms.py:58 apps/member/views.py:82
msgid "An alias with a similar name already exists."
msgstr "Un alias avec un nom similaire existe déjà."
#: apps/member/forms.py:83 apps/registration/forms.py:44
#: apps/member/forms.py:81 apps/registration/forms.py:44
msgid "Inscription paid by Société Générale"
msgstr "Inscription payée par la Société générale"
#: apps/member/forms.py:85 apps/registration/forms.py:46
#: apps/member/forms.py:83 apps/registration/forms.py:46
msgid "Check this case is the Société Générale paid the inscription."
msgstr "Cochez cette case si la Société Générale a payé l'inscription."
#: apps/member/forms.py:90 apps/registration/forms.py:51
#: apps/member/forms.py:88 apps/registration/forms.py:51
msgid "Credit type"
msgstr "Type de rechargement"
#: apps/member/forms.py:91 apps/registration/forms.py:52
#: apps/member/forms.py:89 apps/registration/forms.py:52
msgid "No credit"
msgstr "Pas de rechargement"
#: apps/member/forms.py:93
#: apps/member/forms.py:91
msgid "You can credit the note of the user."
msgstr "Vous pouvez créditer la note de l'utisateur avant l'adhésion."
#: apps/member/forms.py:97 apps/registration/forms.py:57
#: apps/member/forms.py:95 apps/registration/forms.py:57
msgid "Credit amount"
msgstr "Montant à créditer"
#: apps/member/forms.py:114 apps/registration/forms.py:74
#: apps/member/forms.py:112 apps/registration/forms.py:74
#: apps/treasury/forms.py:124 templates/note/transaction_form.html:132
msgid "Bank"
msgstr "Banque"
#: apps/member/forms.py:138
msgid "User"
msgstr "Utilisateur"
#: apps/member/forms.py:152
msgid "Roles"
msgstr "Rôles"
#: apps/member/models.py:34
#: templates/registration/future_profile_detail.html:40
#: templates/wei/weimembership_form.html:48
@ -530,7 +538,7 @@ msgstr "l'adhésion finit le"
msgid "fee"
msgstr "cotisation"
#: apps/member/models.py:303 apps/member/views.py:535 apps/wei/views.py:787
#: apps/member/models.py:303 apps/member/views.py:534 apps/wei/views.py:787
msgid "User is not a member of the parent club"
msgstr "L'utilisateur n'est pas membre du club parent"
@ -539,7 +547,7 @@ msgstr "L'utilisateur n'est pas membre du club parent"
msgid "The role {role} does not apply to the club {club}."
msgstr "Le rôle {role} ne s'applique pas au club {club}."
#: apps/member/models.py:321 apps/member/views.py:544
#: apps/member/models.py:321 apps/member/views.py:543
msgid "User is already a member of the club"
msgstr "L'utilisateur est déjà membre du club"
@ -560,57 +568,57 @@ msgstr "adhésions"
msgid "Renew"
msgstr "Renouveler"
#: apps/member/views.py:56 templates/member/profile_info.html:47
#: apps/member/views.py:57 templates/member/profile_info.html:47
#: templates/registration/future_profile_detail.html:48
#: templates/wei/weimembership_form.html:130
msgid "Update Profile"
msgstr "Modifier le profil"
#: apps/member/views.py:69 apps/registration/forms.py:23
#: apps/member/views.py:70 apps/registration/forms.py:23
msgid "This address must be valid."
msgstr "Cette adresse doit être valide."
#: apps/member/views.py:126
#: apps/member/views.py:127
msgid "Profile detail"
msgstr "Détails de l'utilisateur"
#: apps/member/views.py:160
#: apps/member/views.py:161
msgid "Search user"
msgstr "Chercher un utilisateur"
#: apps/member/views.py:194 apps/member/views.py:376
#: apps/member/views.py:195 apps/member/views.py:381
msgid "Note aliases"
msgstr "Alias de la note"
#: apps/member/views.py:208
#: apps/member/views.py:209
msgid "Update note picture"
msgstr "Modifier la photo de la note"
#: apps/member/views.py:266 templates/member/profile_info.html:43
#: apps/member/views.py:267 templates/member/profile_info.html:43
msgid "Manage auth token"
msgstr "Gérer les jetons d'authentification"
#: apps/member/views.py:294
#: apps/member/views.py:295
msgid "Create new club"
msgstr "Créer un nouveau club"
#: apps/member/views.py:306
#: apps/member/views.py:307
msgid "Search club"
msgstr "Chercher un club"
#: apps/member/views.py:331
#: apps/member/views.py:332
msgid "Club detail"
msgstr "Détails du club"
#: apps/member/views.py:393
#: apps/member/views.py:398
msgid "Update club"
msgstr "Modifier le club"
#: apps/member/views.py:427
#: apps/member/views.py:432
msgid "Add new member to the club"
msgstr "Ajouter un nouveau membre au club"
#: apps/member/views.py:530 apps/wei/views.py:778
#: apps/member/views.py:529 apps/wei/views.py:778
msgid ""
"This user don't have enough money to join this club, and can't have a "
"negative balance."
@ -618,24 +626,28 @@ msgstr ""
"Cet utilisateur n'a pas assez d'argent pour rejoindre ce club et ne peut pas "
"avoir un solde négatif."
#: apps/member/views.py:548
#: apps/member/views.py:547
msgid "The membership must start after {:%m-%d-%Y}."
msgstr "L'adhésion doit commencer après le {:%d/%m/%Y}."
#: apps/member/views.py:553
#: apps/member/views.py:552
msgid "The membership must begin before {:%m-%d-%Y}."
msgstr "L'adhésion doit commencer avant le {:%d/%m/%Y}."
#: apps/member/views.py:570 apps/member/views.py:572 apps/member/views.py:574
#: apps/member/views.py:569 apps/member/views.py:571 apps/member/views.py:573
#: apps/registration/views.py:295 apps/registration/views.py:297
#: apps/registration/views.py:299
msgid "This field is required."
msgstr "Ce champ est requis."
#: apps/member/views.py:634
#: apps/member/views.py:641
msgid "Manage roles of an user in the club"
msgstr "Gérer les rôles d'un utilisateur dans le club"
#: apps/member/views.py:666
msgid "Members of the club"
msgstr "Membres du club"
#: apps/note/admin.py:121 apps/note/models/transactions.py:106
msgid "source"
msgstr "source"
@ -792,7 +804,7 @@ msgid "transaction templates"
msgstr "modèles de transaction"
#: apps/note/models/transactions.py:112 apps/note/models/transactions.py:125
#: apps/note/tables.py:33 apps/note/tables.py:42
#: apps/note/tables.py:35 apps/note/tables.py:44
msgid "used alias"
msgstr "alias utilisé"
@ -804,7 +816,7 @@ msgstr "quantité"
msgid "reason"
msgstr "raison"
#: apps/note/models/transactions.py:151 apps/note/tables.py:95
#: apps/note/models/transactions.py:151 apps/note/tables.py:113
msgid "invalidity reason"
msgstr "Motif d'invalidité"
@ -870,25 +882,25 @@ msgstr "Transaction d'adhésion"
msgid "membership transactions"
msgstr "Transactions d'adhésion"
#: apps/note/tables.py:57
#: apps/note/tables.py:63
msgid "Click to invalidate"
msgstr "Cliquez pour dévalider"
#: apps/note/tables.py:57
#: apps/note/tables.py:63
msgid "Click to validate"
msgstr "Cliquez pour valider"
#: apps/note/tables.py:93
#: apps/note/tables.py:111
msgid "No reason specified"
msgstr "Pas de motif spécifié"
#: apps/note/tables.py:122 apps/note/tables.py:150 apps/wei/tables.py:66
#: apps/note/tables.py:140 apps/note/tables.py:168 apps/wei/tables.py:66
#: templates/treasury/sogecredit_detail.html:59
#: templates/wei/weiregistration_confirm_delete.html:32
msgid "Delete"
msgstr "Supprimer"
#: apps/note/tables.py:145 apps/wei/tables.py:42 apps/wei/tables.py:43
#: apps/note/tables.py:163 apps/wei/tables.py:42 apps/wei/tables.py:43
#: templates/member/club_info.html:67 templates/note/conso_form.html:128
#: templates/wei/bus_tables.html:15 templates/wei/busteam_tables.html:15
#: templates/wei/busteam_tables.html:33 templates/wei/weiclub_info.html:68
@ -1888,11 +1900,28 @@ msgstr "Créer un club"
msgid "Club listing"
msgstr "Liste des clubs"
#: templates/member/club_members.html:16
msgid "Display only active memberships"
msgstr "N'afficher que les adhésions encore valides"
#: templates/member/club_members.html:21
msgid "Filter roles:"
msgstr "Filtrer par rôle :"
#: templates/member/club_members.html:37
#: templates/wei/weimembership_list.html:18
msgid "There is no membership found with this pattern."
msgstr "Il n'y a pas d'adhésion trouvée avec cette entrée."
#: templates/member/club_tables.html:7
msgid "Club managers"
msgstr "Bureau du club"
#: templates/member/club_tables.html:20
msgid "Club members"
msgstr "Membres du club"
#: templates/member/club_tables.html:20 templates/member/profile_tables.html:28
#: templates/member/club_tables.html:33 templates/member/profile_tables.html:28
#: templates/wei/weiclub_tables.html:105
msgid "Transaction history"
msgstr "Historique des transactions"
@ -2591,10 +2620,6 @@ msgstr ""
"l'inscription au WEI.\n"
" "
#: templates/wei/weimembership_list.html:18
msgid "There is no membership found with this pattern."
msgstr "Il n'y a pas d'adhésion trouvée avec cette entrée."
#: templates/wei/weimembership_list.html:24
msgid "View unvalidated registrations..."
msgstr "Voir les inscriptions non validées ..."

View File

@ -3,11 +3,30 @@
{% load render_table from django_tables2 %}
{% block profile_info %}
{% include "member/club_info.html" %}
{% include "member/club_info.html" %}
{% endblock %}
{% block profile_content %}
<input id="searchbar" type="text" class="form-control" placeholder="Nom/prénom/note ...">
<div class="form-group">
<div class="form-check">
<label class="form-check-label" for="only_active">
<input type="checkbox" class="checkboxinput form-check-input" id="only_active"
{% if only_active %}checked{% endif %}>
{% trans "Display only active memberships" %}
</label>
</div>
</div>
<div id="div_id_roles" class="form-group">
<label for="id_roles" class="col-form-label">{% trans "Filter roles:" %}</label>
<div class="">
<select name="roles" class="selectmultiple form-control" id="roles" multiple="">
{% for role in applicable_roles %}
<option value="{{ role.id }}" selected>{{ role.name }}</option>
{% endfor %}
</select>
</div>
</div>
<hr>
<div id="memberships_table">
@ -22,21 +41,29 @@
{% endblock %}
{% block extrajavascript %}
<script type="text/javascript">
$(document).ready(function() {
let old_pattern = null;
let searchbar_obj = $("#searchbar");
<script type="text/javascript">
$(document).ready(function () {
let searchbar_obj = $("#searchbar");
let only_active_obj = $("#only_active");
let roles_obj = $("#roles");
function reloadTable() {
let pattern = searchbar_obj.val();
function reloadTable() {
let pattern = searchbar_obj.val();
if (pattern === old_pattern)
return;
let roles = [];
$("#roles option:selected").each(function() {
roles.push($(this).val());
});
let roles_str = roles.join(',');
$("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20") + " #memberships_table");
}
$("#memberships_table").load(location.pathname + "?search=" + pattern.replace(" ", "%20")
+ "&only_active=" + (only_active_obj.is(':checked') ? '1' : '0')
+ "&roles=" + roles_str + " #memberships_table");
}
searchbar_obj.keyup(reloadTable);
});
</script>
searchbar_obj.keyup(reloadTable);
only_active_obj.change(reloadTable);
roles_obj.change(reloadTable);
});
</script>
{% endblock %}

View File

@ -1,5 +1,18 @@
{% load render_table from django_tables2 %}
{% load i18n %}
{% if managers.data %}
<div class="card">
<div class="card-header position-relative" id="clubListHeading">
<a class="btn btn-link stretched-link font-weight-bold">
<i class="fa fa-users"></i> {% trans "Club managers" %}
</a>
</div>
{% render_table managers %}
</div>
<hr>
{% endif %}
{% if member_list.data %}
<div class="card">
<div class="card-header position-relative" id="clubListHeading">