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.

172 lines
6.8 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: {
"Home" => root_path,
1 year ago
"Users (#{@user.organisation.name})" => users_organisation_path(@user.organisation),
}) %>
<% else %>
<% content_for :before_content do %>
<%= govuk_back_link(href: users_path) %>
<% end %>
<% end %>
<% if display_pending_email_change_banner?(@user) %>
<%= govuk_notification_banner(title_text: "Important") do %>
<p class="govuk-notification-banner__heading govuk-!-width-full" style="max-width: fit-content">
<%= pending_email_change_title_text(current_user, @user) %>
</p>
<%= pending_email_change_banner_text(current_user) %>
<% 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" }
CLDC-3740: Replace you didn't answer text with link to question (#2836) * Different versions of details_html * One version of details_html * Replace you didnt answer with link * Fix lint * Update some tests * Update some tests * Add question marks to yes no questions - test * Improve formatting helper * Improve formatting helper * Improve prompt message * Revert "Add question marks to yes no questions - test" This reverts commit 40bee289 * Rename question method * Add check answer prompt method to question model and translation key * Add translation key to soft validations * Lettings custom prompts * Update to handle new helpdesk ticket logic * Update copy * Update copy * Update method names * Add check answer prompt to soft validations * Change copy * Do not put error objects into cookies * Hide change link for inferred or derived values not yet answered * Revert "Hide change link for inferred or derived values not yet answered" This reverts commit ec1fd1c9aa7db852c0250600ce39335335344f65. * Update lettings related check answer prompts * Update some sales related check answer prompts * Update some sales related check answer prompts * Bug fix * More sales prompts * Replace text for bulk upload * Update uprn known test with specific error message already used * Translation file to CSV * Revert "Translation file to CSV" This reverts commit 0565fea7172ba9fe78af806ee19afdac255a60bc. * Add a red link to show questions that still must be answered (after bulk upload) * Lint * Update feature tests * Update component tests * Update helper tests * Update requests tests * Update request test * Refactor improvements * Refactor improvements 0.2 * Lint * Stay consistent with date question message * Rename variable * Add tests * Improvements * Refactor details table helper * Remove action link not just hide * Revert "Remove action link not just hide" This reverts commit 59ecac5cf3a2c8f1453d7f5ad6c6a1a2ef891578. * Users - remove action link * Organisations - remove action link * Merge requests - remove action link * Revert "Refactor details table helper" This reverts commit b74fd830f13ff0179efeff77421a3d7e43e76d83. * Schemes - remove action link * Location - remove action link * Logs - remove action link * Lint * Refactor V2 details table helper * Allow respond_to? to see private methods * Remove .presence duplication of logic * Change "Answer if" to "Tell us if" * Add missing CAP * Update age questions sales and lettings * Update postcode and la questions * Update wording * Updates and improvements * Another update * Fix bug * typo * typo * update relat to buyer/lead prompts * Update test * Additional copy * Additional copy * Update copy "housing-related" to "housing related" --------- Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
2 weeks ago
row.with_value { user_details_html(@user, current_user, "phone") }
if UserPolicy.new(current_user, @user).edit_telephone_numbers? && @user.phone.present?
row.with_action(
text: user_action_text(@user, "phone"),
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 { current_user.support? ? govuk_link_to(@user.organisation.name, lettings_logs_organisation_path(@user.organisation)) : @user.organisation.name }
if UserPolicy.new(current_user, @user).edit_organisation?
row.with_action(
visually_hidden_text: "organisation",
href: aliased_user_edit(@user, current_user),
html_attributes: { "data-qa": "change-organisation" },
)
else
row.with_action
end
end %>
<%= summary_list.with_row do |row|
row.with_key { "Role" }
CLDC-3740: Replace you didn't answer text with link to question (#2836) * Different versions of details_html * One version of details_html * Replace you didnt answer with link * Fix lint * Update some tests * Update some tests * Add question marks to yes no questions - test * Improve formatting helper * Improve formatting helper * Improve prompt message * Revert "Add question marks to yes no questions - test" This reverts commit 40bee289 * Rename question method * Add check answer prompt method to question model and translation key * Add translation key to soft validations * Lettings custom prompts * Update to handle new helpdesk ticket logic * Update copy * Update copy * Update method names * Add check answer prompt to soft validations * Change copy * Do not put error objects into cookies * Hide change link for inferred or derived values not yet answered * Revert "Hide change link for inferred or derived values not yet answered" This reverts commit ec1fd1c9aa7db852c0250600ce39335335344f65. * Update lettings related check answer prompts * Update some sales related check answer prompts * Update some sales related check answer prompts * Bug fix * More sales prompts * Replace text for bulk upload * Update uprn known test with specific error message already used * Translation file to CSV * Revert "Translation file to CSV" This reverts commit 0565fea7172ba9fe78af806ee19afdac255a60bc. * Add a red link to show questions that still must be answered (after bulk upload) * Lint * Update feature tests * Update component tests * Update helper tests * Update requests tests * Update request test * Refactor improvements * Refactor improvements 0.2 * Lint * Stay consistent with date question message * Rename variable * Add tests * Improvements * Refactor details table helper * Remove action link not just hide * Revert "Remove action link not just hide" This reverts commit 59ecac5cf3a2c8f1453d7f5ad6c6a1a2ef891578. * Users - remove action link * Organisations - remove action link * Merge requests - remove action link * Revert "Refactor details table helper" This reverts commit b74fd830f13ff0179efeff77421a3d7e43e76d83. * Schemes - remove action link * Location - remove action link * Logs - remove action link * Lint * Refactor V2 details table helper * Allow respond_to? to see private methods * Remove .presence duplication of logic * Change "Answer if" to "Tell us if" * Add missing CAP * Update age questions sales and lettings * Update postcode and la questions * Update wording * Updates and improvements * Another update * Fix bug * typo * typo * update relat to buyer/lead prompts * Update test * Additional copy * Additional copy * Update copy "housing-related" to "housing related" --------- Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
2 weeks ago
row.with_value { user_details_html(@user, current_user, "role") }
if UserPolicy.new(current_user, @user).edit_roles? && @user.role
row.with_action(
CLDC-3740: Replace you didn't answer text with link to question (#2836) * Different versions of details_html * One version of details_html * Replace you didnt answer with link * Fix lint * Update some tests * Update some tests * Add question marks to yes no questions - test * Improve formatting helper * Improve formatting helper * Improve prompt message * Revert "Add question marks to yes no questions - test" This reverts commit 40bee289 * Rename question method * Add check answer prompt method to question model and translation key * Add translation key to soft validations * Lettings custom prompts * Update to handle new helpdesk ticket logic * Update copy * Update copy * Update method names * Add check answer prompt to soft validations * Change copy * Do not put error objects into cookies * Hide change link for inferred or derived values not yet answered * Revert "Hide change link for inferred or derived values not yet answered" This reverts commit ec1fd1c9aa7db852c0250600ce39335335344f65. * Update lettings related check answer prompts * Update some sales related check answer prompts * Update some sales related check answer prompts * Bug fix * More sales prompts * Replace text for bulk upload * Update uprn known test with specific error message already used * Translation file to CSV * Revert "Translation file to CSV" This reverts commit 0565fea7172ba9fe78af806ee19afdac255a60bc. * Add a red link to show questions that still must be answered (after bulk upload) * Lint * Update feature tests * Update component tests * Update helper tests * Update requests tests * Update request test * Refactor improvements * Refactor improvements 0.2 * Lint * Stay consistent with date question message * Rename variable * Add tests * Improvements * Refactor details table helper * Remove action link not just hide * Revert "Remove action link not just hide" This reverts commit 59ecac5cf3a2c8f1453d7f5ad6c6a1a2ef891578. * Users - remove action link * Organisations - remove action link * Merge requests - remove action link * Revert "Refactor details table helper" This reverts commit b74fd830f13ff0179efeff77421a3d7e43e76d83. * Schemes - remove action link * Location - remove action link * Logs - remove action link * Lint * Refactor V2 details table helper * Allow respond_to? to see private methods * Remove .presence duplication of logic * Change "Answer if" to "Tell us if" * Add missing CAP * Update age questions sales and lettings * Update postcode and la questions * Update wording * Updates and improvements * Another update * Fix bug * typo * typo * update relat to buyer/lead prompts * Update test * Additional copy * Additional copy * Update copy "housing-related" to "housing related" --------- Co-authored-by: Kat <54268893+kosiakkatrina@users.noreply.github.com>
2 weeks ago
text: user_action_text(@user, "role"),
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 %>
<%= summary_list.with_row do |row| %>
<% row.with_key { "Status" } %>
<% row.with_value do %>
<%= details_html({ name: "Status", value: status_tag(@user.status), id: "status" }) %>
<% if @user.status == :deactivated && current_user.support? && !UserPolicy.new(current_user, @user).delete? %>
<span class="app-!-colour-muted">This user was active in an open or editable collection year, and cannot be deleted.</span>
<% end %>
<% end %>
<% end %>
<%= summary_list.with_row do |row|
row.with_key { "Last logged in" }
row.with_value { @user.last_sign_in_at&.to_formatted_s(:govuk_date) }
end %>
<% end %>
<% if @user.organisation.active? && current_user.can_toggle_active?(@user) %>
<div class="govuk-button-group">
<% 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">
<%= govuk_button_link_to "Reactivate user", reactivate_user_path(@user) %>
</span>
<% end %>
<% end %>
<% if UserPolicy.new(current_user, @user).delete? %>
<%= delete_user_link(@user) %>
<% end %>
</div>
</div>
</div>