%= content_for :page_title, t(".page_title") %>
<%= settings_section title: t(".profile_title"), subtitle: t(".profile_subtitle", product_name: product_name) do %>
<%= styled_form_with model: @user, url: user_path(@user), class: "space-y-4" do |form| %>
<%= render "settings/user_avatar_field", form: form, user: @user %>
<%= form.email_field :email, placeholder: t(".email"), label: t(".email") %>
<% if @user.unconfirmed_email.present? %>
You have requested to change your email to <%= @user.unconfirmed_email %>. Please go to your email and confirm for the change to take effect. If you haven't received the email, please check your spam folder, or <%= link_to "request a new confirmation email", resend_confirmation_email_user_path(@user), class: "hover:underline text-secondary" %>.
<% end %>
<%= form.text_field :first_name, placeholder: t(".first_name"), label: t(".first_name") %>
<%= form.text_field :last_name, placeholder: t(".last_name"), label: t(".last_name") %>
<%= render DS::Button.new(text: t(".save"), class: "md:w-auto w-full justify-center") %>
<% end %>
<% end %>
<%= settings_section title: t(".household_title"), subtitle: t(".household_subtitle") do %>
<%= styled_form_with model: Current.user, class: "space-y-4", data: { controller: "auto-submit-form" } do |form| %>
<%= form.fields_for :family do |family_fields| %>
<%= family_fields.text_field :name,
placeholder: t(".household_form_input_placeholder"),
label: t(".household_form_label"),
disabled: !Current.user.admin?,
"data-auto-submit-form-target": "auto" %>
<% end %>
<% end %>
<%= Current.family.name %> · <%= Current.family.users.size %>
<% @users.each do |user| %>
<%= render "settings/user_avatar", avatar_url: user.profile_image&.variant(:small)&.url, initials: user.initials %>
<%= user.display_name %>
<% if Current.user.admin? && user != Current.user %>
<%= render DS::Button.new(
variant: "icon",
icon: "x",
href: settings_profile_path(user_id: user),
method: :delete,
confirm: CustomConfirm.for_resource_deletion(user.display_name, high_severity: true)
) %>
<% end %>
<% end %>
<% if @pending_invitations.any? %>
<% @pending_invitations.each do |invitation| %>
<%= invitation.email[0] %>
<% if self_hosted? %>
<% end %>
<% if Current.user.admin? %>
<%= render DS::Button.new(
variant: "icon",
icon: "x",
href: invitation_path(invitation),
method: :delete,
confirm: CustomConfirm.for_resource_deletion(invitation.email, high_severity: true)
) %>
<% end %>
<% end %>
<% end %>
<% if Current.user.admin? %>
<%= link_to new_invitation_path,
class: "bg-container-inset flex items-center justify-center gap-2 text-secondary mt-1 hover:bg-container-inset-hover rounded-lg px-4 py-2 w-full text-center",
data: { turbo_frame: :modal } do %>
<%= icon("plus") %>
<%= t(".invite_member") %>
<% end %>
<% end %>
<% end %>
<%= settings_section title: t(".danger_zone_title") do %>
<% if Current.user.admin? %>
<%= t(".reset_account") %>
<%= t(".reset_account_warning") %>
<%= render DS::Button.new(
text: t(".reset_account"),
variant: "destructive",
href: reset_user_path(@user),
method: :delete,
confirm: CustomConfirm.new(
title: t(".confirm_reset.title"),
body: t(".confirm_reset.body"),
btn_text: t(".reset_account"),
destructive: true,
high_severity: true
)
) %>
<%= t(".reset_account_with_sample_data") %>
<%= t(".reset_account_with_sample_data_warning") %>
<%= render DS::Button.new(
text: t(".reset_account_with_sample_data"),
variant: "destructive",
href: reset_with_sample_data_user_path(@user),
method: :delete,
confirm: CustomConfirm.new(
title: t(".confirm_reset_with_sample_data.title"),
body: t(".confirm_reset_with_sample_data.body"),
btn_text: t(".reset_account_with_sample_data"),
destructive: true,
high_severity: true
)
) %>
<% end %>
<%= t(".delete_account") %>
<%= t(".delete_account_warning") %>
<%= render DS::Button.new(
text: t(".delete_account"),
variant: "destructive",
href: user_path(@user),
method: :delete,
confirm: CustomConfirm.for_resource_deletion("your account", high_severity: true)
) %>
<% end %>