1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

Add username column to the member list

This commit is contained in:
Guilherme Chaguri 2022-07-14 16:11:44 -03:00
parent 157774f525
commit d63b8d0dfa
10 changed files with 21 additions and 8 deletions

View File

@ -38,13 +38,14 @@
<thead> <thead>
<tr> <tr>
<th style="width:4%" class="hidden-xs" ng-if="enableUserValidationRequired"></th> <th style="width:4%" class="hidden-xs" ng-if="enableUserValidationRequired"></th>
<th style="width:15%"><a ng-click="setOrderMember('last_name')">{{ 'app.admin.members.surname' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='last_name', 'fa fa-sort-alpha-desc': member.order=='-last_name', 'fa fa-arrows-v': member.order }"></i></a></th> <th style="width:8%"><a ng-click="setOrderMember('username')">{{ 'app.admin.members.username' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='username', 'fa fa-sort-alpha-desc': member.order=='-username', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:15%"><a ng-click="setOrderMember('first_name')">{{ 'app.admin.members.first_name' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='first_name', 'fa fa-sort-alpha-desc': member.order=='-first_name', 'fa fa-arrows-v': member.order }"></i></a></th> <th style="width:14%"><a ng-click="setOrderMember('last_name')">{{ 'app.admin.members.surname' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='last_name', 'fa fa-sort-alpha-desc': member.order=='-last_name', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:15%" class="hidden-xs"><a ng-click="setOrderMember('email')">{{ 'app.admin.members.email' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='email', 'fa fa-sort-alpha-desc': member.order=='-email', 'fa fa-arrows-v': member.order }"></i></a></th> <th style="width:14%"><a ng-click="setOrderMember('first_name')">{{ 'app.admin.members.first_name' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='first_name', 'fa fa-sort-alpha-desc': member.order=='-first_name', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:9%" class="hidden-xs hidden-sm hidden-md"><a ng-click="setOrderMember('phone')">{{ 'app.admin.members.phone' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-numeric-asc': member.order=='phone', 'fa fa-sort-numeric-desc': member.order=='-phone', 'fa fa-arrows-v': member.order }"></i></a></th> <th style="width:14%" class="hidden-xs"><a ng-click="setOrderMember('email')">{{ 'app.admin.members.email' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='email', 'fa fa-sort-alpha-desc': member.order=='-email', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:14%" class="hidden-xs hidden-sm"><a ng-click="setOrderMember('group')">{{ 'app.admin.members.user_type' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='group', 'fa fa-sort-alpha-desc': member.order=='-group', 'fa fa-arrows-v': member.order }"></i></a></th> <th style="width:8%" class="hidden-xs hidden-sm hidden-md"><a ng-click="setOrderMember('phone')">{{ 'app.admin.members.phone' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-numeric-asc': member.order=='phone', 'fa fa-sort-numeric-desc': member.order=='-phone', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:14%" class="hidden-xs hidden-sm hidden-md"><a ng-click="setOrderMember('plan')">{{ 'app.admin.members.subscription' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='plan', 'fa fa-sort-alpha-desc': member.order=='-plan', 'fa fa-arrows-v': member.order }"></i></a></th> <th style="width:13%" class="hidden-xs hidden-sm"><a ng-click="setOrderMember('group')">{{ 'app.admin.members.user_type' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='group', 'fa fa-sort-alpha-desc': member.order=='-group', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:14%" class="buttons-col"></th> <th style="width:13%" class="hidden-xs hidden-sm hidden-md"><a ng-click="setOrderMember('plan')">{{ 'app.admin.members.subscription' | translate }} <i class="fa fa-arrows-v" ng-class="{'fa fa-sort-alpha-asc': member.order=='plan', 'fa fa-sort-alpha-desc': member.order=='-plan', 'fa fa-arrows-v': member.order }"></i></a></th>
<th style="width:12%" class="buttons-col"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -52,6 +53,7 @@
<td class="text-center" ng-if="enableUserValidationRequired"> <td class="text-center" ng-if="enableUserValidationRequired">
<span ng-class="{ 'text-success': !!m.validated_at }"><i class="fa fa-user-check"></i></span> <span ng-class="{ 'text-success': !!m.validated_at }"><i class="fa fa-user-check"></i></span>
</td> </td>
<td class="text-c">{{ m.username }}</td>
<td class="text-c">{{ m.profile.last_name }}</td> <td class="text-c">{{ m.profile.last_name }}</td>
<td class="text-c">{{ m.profile.first_name }}</td> <td class="text-c">{{ m.profile.first_name }}</td>
<td class="hidden-xs">{{ m.email }}</td> <td class="hidden-xs">{{ m.email }}</td>

View File

@ -26,7 +26,8 @@ class Members::ListService
# ILIKE => PostgreSQL case-insensitive LIKE # ILIKE => PostgreSQL case-insensitive LIKE
if params[:search].size.positive? if params[:search].size.positive?
@query = @query.where('profiles.first_name ILIKE :search OR ' \ @query = @query.where('username ILIKE :search OR ' \
'profiles.first_name ILIKE :search OR ' \
'profiles.last_name ILIKE :search OR ' \ 'profiles.last_name ILIKE :search OR ' \
'profiles.phone ILIKE :search OR ' \ 'profiles.phone ILIKE :search OR ' \
'email ILIKE :search OR ' \ 'email ILIKE :search OR ' \
@ -83,6 +84,8 @@ class Members::ListService
offset = ((params[:page]&.to_i || 1) - 1) * (params[:size]&.to_i || 1) offset = ((params[:page]&.to_i || 1) - 1) * (params[:size]&.to_i || 1)
order_key = case order_key order_key = case order_key
when 'username'
'username'
when 'last_name' when 'last_name'
'profiles.last_name' 'profiles.last_name'
when 'first_name' when 'first_name'

View File

@ -1,6 +1,7 @@
json.array!(@members) do |member| json.array!(@members) do |member|
json.maxMembers @max_members json.maxMembers @max_members
json.id member.id json.id member.id
json.username member.username
json.email member.email if current_user json.email member.email if current_user
json.profile do json.profile do
json.first_name member.profile.first_name json.first_name member.profile.first_name

View File

@ -823,6 +823,7 @@ de:
search_for_an_user: "Nach einem Benutzer suchen" search_for_an_user: "Nach einem Benutzer suchen"
add_a_new_member: "Neues Mitglied hinzufügen" add_a_new_member: "Neues Mitglied hinzufügen"
reservations: "Reservierungen" reservations: "Reservierungen"
username: "Username"
surname: "Nachname" surname: "Nachname"
first_name: "Vorname" first_name: "Vorname"
email: "E-Mail" email: "E-Mail"

View File

@ -823,6 +823,7 @@ en:
search_for_an_user: "Search for an user" search_for_an_user: "Search for an user"
add_a_new_member: "Add a new member" add_a_new_member: "Add a new member"
reservations: "Reservations" reservations: "Reservations"
username: "Username"
surname: "Last name" surname: "Last name"
first_name: "First name" first_name: "First name"
email: "Email" email: "Email"

View File

@ -823,6 +823,7 @@ es:
search_for_an_user: "Buscar un usuario" search_for_an_user: "Buscar un usuario"
add_a_new_member: "Añadir un nuevo miembro" add_a_new_member: "Añadir un nuevo miembro"
reservations: "Reservas" reservations: "Reservas"
username: "Username"
surname: "Last name" surname: "Last name"
first_name: "First name" first_name: "First name"
email: "Email" email: "Email"

View File

@ -823,6 +823,7 @@ fr:
search_for_an_user: "Recherchez un utilisateur" search_for_an_user: "Recherchez un utilisateur"
add_a_new_member: "Ajouter un nouveau membre" add_a_new_member: "Ajouter un nouveau membre"
reservations: "Réservations" reservations: "Réservations"
username: "Username"
surname: "Nom" surname: "Nom"
first_name: "Prénom" first_name: "Prénom"
email: "Courriel" email: "Courriel"

View File

@ -823,6 +823,7 @@
search_for_an_user: "Søk etter bruker" search_for_an_user: "Søk etter bruker"
add_a_new_member: "Legge til nytt medlem" add_a_new_member: "Legge til nytt medlem"
reservations: "Reservasjoner" reservations: "Reservasjoner"
username: "Username"
surname: "Etternavn" surname: "Etternavn"
first_name: "Fornavn" first_name: "Fornavn"
email: "E-post" email: "E-post"

View File

@ -823,6 +823,7 @@ pt:
search_for_an_user: "Buscar por usuário" search_for_an_user: "Buscar por usuário"
add_a_new_member: "Adicionar novo membro" add_a_new_member: "Adicionar novo membro"
reservations: "Reservas" reservations: "Reservas"
username: "Username"
surname: "Sobrenome" surname: "Sobrenome"
first_name: "Primeiro nome" first_name: "Primeiro nome"
email: "Email" email: "Email"

View File

@ -823,6 +823,7 @@ zu:
search_for_an_user: "crwdns7741:0crwdne7741:0" search_for_an_user: "crwdns7741:0crwdne7741:0"
add_a_new_member: "crwdns7743:0crwdne7743:0" add_a_new_member: "crwdns7743:0crwdne7743:0"
reservations: "crwdns7745:0crwdne7745:0" reservations: "crwdns7745:0crwdne7745:0"
username: "Username"
surname: "crwdns7747:0crwdne7747:0" surname: "crwdns7747:0crwdne7747:0"
first_name: "crwdns7749:0crwdne7749:0" first_name: "crwdns7749:0crwdne7749:0"
email: "crwdns7751:0crwdne7751:0" email: "crwdns7751:0crwdne7751:0"