<h1><%%= dgettext("mandarin.<%= schema.context_underscore %>", "Settings") %></h1>

<h3><%%= dgettext("mandarin.<%= schema.context_underscore %>", "Change email") %></h3>

<.form let={f} for={@email_changeset} action={Routes.<%= schema.route_helper %>_settings_path(@conn, :update)} id="update_email">
  <%%= if @email_changeset.action do %>
    <div class="alert alert-danger">
      <p><%%= dgettext("mandarin.<%= schema.context_underscore %>", "Oops, something went wrong! Please check the errors below.") %></p>
    </div>
  <%% end %>

  <%%= hidden_input f, :action, name: "action", value: "update_email" %>

  <%%= forage_form_group(f, :email,
          dgettext("mandarin.<%= schema.context_underscore %>", "Email"), [],
          &forage_text_input/3) %>

  <%%= forage_form_group(f, :current_password,
          dgettext("mandarin.<%= schema.context_underscore %>", "Current password for email"), [],
          &forage_password_input/3) %>

  <div class="py-4">
    <%%= forage_submit dgettext("mandarin.<%= schema.context_underscore %>", "Change email") %>
  </div>
</.form>

<h3><%%= dgettext("mandarin.<%= schema.context_underscore %>", "Change password") %></h3>

<.form let={f} for={@password_changeset} action={Routes.<%= schema.route_helper %>_settings_path(@conn, :update)} id="update_password">
  <%%= if @password_changeset.action do %>
    <div class="alert alert-danger">
      <p>Oops, something went wrong! Please check the errors below.</p>
    </div>
  <%% end %>

  <%%= hidden_input f, :action, name: "action", value: "update_password" %>

  <%%= forage_form_group(f, :password,
          dgettext("mandarin.<%= schema.context_underscore %>", "New password"), [],
          &forage_password_input/3) %>

  <%%= forage_form_group(f, :password_confirmation,
          dgettext("mandarin.<%= schema.context_underscore %>", "Confirm new password"), [],
          &forage_password_input/3) %>
          
  <%%= forage_form_group(f, :password_confirmation,
          dgettext("mandarin.<%= schema.context_underscore %>", "Current password"), [],
          &forage_password_input/3) %>

  <div class="py-4">
    <%%= forage_submit dgettext("mandarin.<%= schema.context_underscore %>", "Change password") %>
  </div>
</.form>
