Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
4.9 KiB

<% content_for :title, current_user == @user ? "Your account" : "#{@user.name.presence || @user.email}’s account" %>
1 year ago
<% if current_user.support? %>
<% content_for :breadcrumbs, govuk_breadcrumbs(breadcrumbs: {
"Users (#{@user.organisation.name})" => users_organisation_path(@user.organisation),
content_for(:title) => "",
}) %>
<% else %>
<% content_for :before_content do %>
<%= govuk_back_link(href: users_path) %>
<% end %>
<% end %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<h1 class="govuk-heading-l">
<%= content_for(:title) %>
</h1>
<h2 class="govuk-heading-m">
Personal details
</h2>
<%= govuk_summary_list do |summary_list| %>
<%= summary_list.with_row do |row|
row.with_key { "Name" }
row.with_value { @user.name }
if UserPolicy.new(current_user, @user).edit_names?
row.with_action(visually_hidden_text: "name", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-name" })
else
row.with_action
end
end %>
<%= summary_list.with_row do |row|
row.with_key { "Email address" }
row.with_value { @user.email }
if UserPolicy.new(current_user, @user).edit_emails?
row.with_action(visually_hidden_text: "email address", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-email-address" })
else
row.with_action
end
end %>
<%= summary_list.with_row do |row|
row.with_key { "Telephone number" }
row.with_value { @user.phone }
if UserPolicy.new(current_user, @user).edit_telephone_numbers?
row.with_action(visually_hidden_text: "telephone number", href: aliased_user_edit(@user, current_user), html_attributes: { "data-qa": "change-telephone-number" })
else
row.with_action
end
end %>
<%= summary_list.with_row do |row|
row.with_key { "Password" }
row.with_value { "••••••••" }
if UserPolicy.new(current_user, @user).edit_password?
row.with_action(
visually_hidden_text: "password",
href: edit_password_account_path,
html_attributes: { "data-qa": "change-password" },
)
else
row.with_action
end
end %>
<%= summary_list.with_row do |row|
row.with_key { "Organisation" }
row.with_value { @user.organisation.name }
row.with_action
end %>
<%= summary_list.with_row do |row|
row.with_key { "Role" }
row.with_value { @user.role&.humanize }
if UserPolicy.new(current_user, @user).edit_roles?
row.with_action(
visually_hidden_text: "role",
href: aliased_user_edit(@user, current_user),
html_attributes: { "data-qa": "change-role" },
)
else
row.with_action
end
end %>
<%= summary_list.with_row do |row|
row.with_key { "Data protection officer" }
row.with_value { @user.is_data_protection_officer? ? "Yes" : "No" }
if UserPolicy.new(current_user, @user).edit_dpo?
row.with_action(
visually_hidden_text: "if data protection officer",
href: user_edit_dpo_path(@user),
html_attributes: { "data-qa": "change-data-protection-officer" },
)
else
row.with_action
end
end %>
<%= summary_list.with_row do |row|
row.with_key { "Key contact" }
row.with_value { @user.is_key_contact? ? "Yes" : "No" }
if UserPolicy.new(current_user, @user).edit_key_contact?
row.with_action(
visually_hidden_text: "if a key contact",
href: user_edit_key_contact_path(@user),
html_attributes: { "data-qa": "change-key-contact" },
)
else
row.with_action
end
end %>
<% end %>
<div class="govuk-button-group">
<% if current_user.can_toggle_active?(@user) %>
<% if @user.active? %>
<%= govuk_button_link_to "Deactivate user", deactivate_user_path(@user), warning: true %>
<% if current_user.support? && @user.last_sign_in_at.nil? %>
<%= govuk_button_to "Resend invite link", resend_invite_user_path(@user), secondary: true %>
<% end %>
<% else %>
<span class="app-!-colour-muted govuk-!-margin-right-2">
This user has been deactivated. <%= govuk_button_link_to "Reactivate user", reactivate_user_path(@user) %>
</span>
<% end %>
<% end %>
</div>
</div>
</div>