2024-04-18 07:56:51 -04:00
|
|
|
<% content_for :sidebar do %>
|
|
|
|
<%= render "settings/nav" %>
|
|
|
|
<% end %>
|
|
|
|
<div class="space-y-4">
|
2024-04-25 07:54:56 -04:00
|
|
|
<h1 class="text-gray-900 text-xl font-medium mb-4"><%= t(".page_title") %></h1>
|
|
|
|
<div class="space-y-4">
|
|
|
|
<%= settings_section title: t(".profile_title"), subtitle: t(".profile_subtitle") do %>
|
2024-10-23 11:20:55 -04:00
|
|
|
<%= styled_form_with model: @user, class: "space-y-4" do |form| %>
|
|
|
|
<%= render "settings/user_avatar_field", form: form, user: @user %>
|
|
|
|
|
2024-04-30 18:38:33 +01:00
|
|
|
<div>
|
|
|
|
<div class="grid grid-cols-2 gap-4 mt-4">
|
2024-10-23 11:20:55 -04:00
|
|
|
<%= 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") %>
|
2024-04-25 07:54:56 -04:00
|
|
|
</div>
|
2024-04-30 18:38:33 +01:00
|
|
|
<div class="flex justify-end mt-4">
|
2024-06-24 12:49:08 +02:00
|
|
|
<%= form.submit t(".save"), class: "bg-gray-900 hover:bg-gray-700 cursor-pointer text-white rounded-lg px-3 py-2" %>
|
2024-04-25 07:54:56 -04:00
|
|
|
</div>
|
2024-04-30 18:38:33 +01:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2024-04-18 07:56:51 -04:00
|
|
|
<% end %>
|
2024-04-25 07:54:56 -04:00
|
|
|
<%= settings_section title: t(".household_title"), subtitle: t(".household_subtitle") do %>
|
|
|
|
<div class="space-y-4">
|
2024-10-23 11:20:55 -04:00
|
|
|
<%= 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" %>
|
2024-04-25 07:54:56 -04:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<div class="bg-gray-25 rounded-xl p-1">
|
|
|
|
<div class="px-4 py-2">
|
|
|
|
<p class="uppercase text-xs text-gray-500 font-medium"><%= Current.family.name %> · <%= Current.family.users.size %></p>
|
|
|
|
</div>
|
2024-11-01 10:23:27 -05:00
|
|
|
<% @users.each do |user| %>
|
|
|
|
<div class="flex gap-2 items-center bg-white p-4 border border-alpha-black-25 rounded-lg">
|
|
|
|
<div class="w-9 h-9 shrink-0">
|
|
|
|
<%= render "settings/user_avatar", user: user %>
|
|
|
|
</div>
|
|
|
|
<p class="text-gray-900 font-medium text-sm"><%= user.display_name %></p>
|
|
|
|
<div class="rounded-md bg-gray-100 px-1.5 py-0.5">
|
|
|
|
<p class="uppercase text-gray-500 font-medium text-xs"><%= user.role %></p>
|
|
|
|
</div>
|
2024-04-25 07:54:56 -04:00
|
|
|
</div>
|
2024-11-01 10:23:27 -05:00
|
|
|
<% end %>
|
|
|
|
<% if @pending_invitations.any? %>
|
|
|
|
<% @pending_invitations.each do |invitation| %>
|
|
|
|
<div class="flex gap-2 items-center justify-between bg-white p-4 border border-alpha-black-25 rounded-lg">
|
|
|
|
<div class="flex gap-2 items-center">
|
|
|
|
<div class="w-9 h-9 shrink-0">
|
|
|
|
<div class="text-white w-full h-full bg-gray-400 rounded-full flex items-center justify-center text-lg uppercase"><%= invitation.email[0] %></div>
|
|
|
|
</div>
|
|
|
|
<div class="flex">
|
|
|
|
<p class="text-gray-900 font-medium text-sm"><%= invitation.email %></p>
|
|
|
|
<div class="rounded-md bg-gray-100 px-1.5 py-0.5">
|
|
|
|
<p class="uppercase text-gray-500 font-medium text-xs"><%= t(".pending") %></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% if self_hosted? %>
|
|
|
|
<div class="flex items-center gap-2" data-controller="clipboard">
|
|
|
|
<p class="text-gray-500 text-sm"><%= t(".invitation_link") %></p>
|
|
|
|
<span data-clipboard-target="source" class="hidden"><%= accept_invitation_url(invitation.token) %></span>
|
2024-11-04 20:27:31 -05:00
|
|
|
<input type="text"
|
|
|
|
readonly
|
|
|
|
autocomplete="off"
|
|
|
|
value="<%= accept_invitation_url(invitation.token) %>"
|
2024-11-01 10:23:27 -05:00
|
|
|
class="text-sm bg-gray-50 px-2 py-1 rounded border border-gray-200 w-72">
|
|
|
|
<button data-action="clipboard#copy" class="text-gray-500 hover:text-gray-700">
|
|
|
|
<span data-clipboard-target="iconDefault">
|
|
|
|
<%= lucide_icon "copy", class: "w-5 h-5" %>
|
|
|
|
</span>
|
|
|
|
<span class="hidden" data-clipboard-target="iconSuccess">
|
|
|
|
<%= lucide_icon "check", class: "w-5 h-5" %>
|
|
|
|
</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% if Current.user.admin? %>
|
|
|
|
<%= link_to new_invitation_path,
|
|
|
|
class: "bg-gray-100 flex items-center justify-center gap-2 text-gray-500 mt-1 hover:bg-gray-200 rounded-lg px-4 py-2 w-full text-center",
|
|
|
|
data: { turbo_frame: :modal } do %>
|
|
|
|
<%= lucide_icon("plus", class: "w-5 h-5 text-gray-500") %>
|
|
|
|
<%= t(".invite_member") %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
2024-04-25 07:54:56 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<%= settings_section title: t(".danger_zone_title") do %>
|
|
|
|
<div class="flex items-center justify-between">
|
|
|
|
<div>
|
|
|
|
<h3 class="font-medium text-gray-900"><%= t(".delete_account") %></h3>
|
|
|
|
<p class="text-gray-500 text-sm"><%= t(".delete_account_warning") %></p>
|
|
|
|
</div>
|
2024-04-30 16:40:31 +01:00
|
|
|
<%=
|
2024-10-23 11:20:55 -04:00
|
|
|
button_to t(".delete_account"), user_path(@user), method: :delete,
|
2024-04-30 16:40:31 +01:00
|
|
|
class: "bg-red-500 text-white text-sm font-medium rounded-lg px-3 py-2",
|
|
|
|
data: { turbo_confirm: {
|
|
|
|
title: t(".confirm_delete.title"),
|
|
|
|
body: t(".confirm_delete.body"),
|
|
|
|
accept: t(".delete_account"),
|
|
|
|
acceptClass: "w-full bg-red-500 text-white rounded-xl text-center p-[10px] border mb-2"
|
|
|
|
}}
|
|
|
|
%>
|
2024-04-25 07:54:56 -04:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2024-08-27 17:10:31 -04:00
|
|
|
|
|
|
|
<%= settings_nav_footer %>
|
2024-04-18 07:56:51 -04:00
|
|
|
</div>
|