feat: add cycle management features to membership fees component

- Add regenerate cycles functionality
- Add delete cycle with confirmation
- Add edit cycle amount modal
- Add regenerate missing cycles button
- Complete cycle management UI implementation
This commit is contained in:
Moritz 2025-12-16 12:20:05 +01:00
parent 75e6300637
commit 3f723a3c3a
Signed by: moritz
GPG key ID: 1020A035E5DD0824

View file

@ -374,14 +374,32 @@ defmodule MvWeb.MemberLive.Show.MembershipFeesComponent do
:suspended -> :mark_as_suspended
end
case Ash.update!(cycle, action) do
updated_cycle ->
case Ash.update(cycle, action: action) do
{:ok, updated_cycle} ->
updated_cycles = replace_cycle(socket.assigns.cycles, updated_cycle)
{:noreply,
socket
|> assign(:cycles, updated_cycles)
|> put_flash(:info, gettext("Cycle status updated"))}
{:error, %Ash.Error.Invalid{} = error} ->
error_msg =
error.errors
|> Enum.map(fn e -> e.message end)
|> Enum.join(", ")
{:noreply,
socket
|> put_flash(
:error,
gettext("Failed to update cycle status: %{errors}", errors: error_msg)
)}
{:error, error} ->
{:noreply,
socket
|> put_flash(:error, format_error(error))}
end
end