A couple of questions about a simple_form inside a core modal component

I put a simple_form inside a core modal component.

  1. Is it possible to submit the form using the modal :confirm slot?
  2. When the form is submitted a record is created, how can I close the modal when the opration is successful?

Here is the code execute when the form is submitted:

@impl true
def handle_event("save", %{"user" => params}, socket) do
  case Accounts.create_user_with_roles(params, []) do
    {:ok, _} ->
       |> put_flash(:success, dgettext("admin", "User created succesfully"))
       |> ... here I would like to just close the modal and show the flash ...

    {:error, changeset} ->
      {:noreply, assign(socket, form: to_form(changeset))}