feat: add groups to member detail view #374
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon 2026-02-17 14:15:43 +01:00
parent 46f9094e1f
commit b1a9eb8b1d
Signed by: simon
GPG key ID: 40E7A58C4AA1EDB2
6 changed files with 45 additions and 12 deletions

View file

@ -12,6 +12,8 @@ defmodule MvWeb.MemberLive.Show do
## Sections
- Personal Data: Name, address, contact information, membership dates, notes
- Custom Fields: Dynamic fields in uniform grid layout (sorted by name)
- Groups: Group links (buttons) in Personal Data section, below Linked User
- Payment Data: Membership fee type and cycle status
- Membership Fees: Tab showing all membership fee cycles with status management (via MembershipFeesComponent)
## Navigation
@ -146,6 +148,28 @@ defmodule MvWeb.MemberLive.Show do
</div>
<% end %>
<%!-- Groups (in Personal Data, below Linked User) --%>
<div>
<.data_field label={gettext("Groups")}>
<%= if Enum.any?(@member.groups || []) do %>
<div class="flex flex-wrap gap-2">
<%= for group <- (@member.groups || []) do %>
<.link
navigate={~p"/groups/#{group.slug}"}
class="btn btn-xs btn-outline btn-primary"
role="status"
aria-label={gettext("Member of group %{name}", name: group.name)}
>
{group.name}
</.link>
<% end %>
</div>
<% else %>
<span class="text-base-content/70 italic">{gettext("No groups")}</span>
<% end %>
</.data_field>
</div>
<%!-- Notes --%>
<%= if @member.notes && String.trim(@member.notes) != "" do %>
<div>
@ -262,7 +286,8 @@ defmodule MvWeb.MemberLive.Show do
:user,
:membership_fee_type,
custom_field_values: [:custom_field],
membership_fee_cycles: [:membership_fee_type]
membership_fee_cycles: [:membership_fee_type],
groups: [:id, :name, :slug]
])
member = Ash.read_one!(query, actor: actor)