Browse Source
* Mark log as impacted by deactivation when location is deactivated * Display affected logs in the table * Route affected logs to tenancy start date question * Update routes to get the tenancy start date page from form * update next_page_redirect_path * rename column * Fix tests * Add next_unresolved_page_id to pages * Update unresulved when the log is corrected * Mark logs as unresolved when scheme gets deactivated * display correct content when there are no unresolved logs * mark logs resolved after the user leaves check answers page * Display link in success banner and reset banner when the link is clicked * display inset hint text for unresolved log questions * Display unresolved logs banner * update banner message * Persist the link in the banner * update inset text * Update success banner text * Add unresolved and created_by scopes * rename method * add unresolved_log_redirect_page_id to form + typo and route * Add UnresolvedLogHelper and extract flack notice message * pluralize and return early * remove flash[:notice] = nil * to keep it consistent for sales log * Extract unresolved path and fix a link * extract resolve method and fix attribute nme * update path * typopull/1057/head
kosiakkatrina
2 years ago
committed by
GitHub
32 changed files with 285 additions and 11 deletions
@ -0,0 +1,7 @@ |
|||||||
|
module UnresolvedLogHelper |
||||||
|
def flash_notice_for_resolved_logs(count) |
||||||
|
notice_message = "You’ve updated all the fields affected by the scheme change.</br>" |
||||||
|
notice_message << " <a href=\"/lettings-logs/update-logs\">Update #{count} more #{'log'.pluralize(count)}</a>" if count.positive? |
||||||
|
notice_message |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,46 @@ |
|||||||
|
<% item_label = format_label(@pagy.count, "logs") %> |
||||||
|
<% title = "Update logs" %> |
||||||
|
|
||||||
|
<% content_for :title, title %> |
||||||
|
|
||||||
|
<% if @total_count < 1 %> |
||||||
|
<%= render partial: "organisations/headings", locals: { main: "There are no more logs that need updating", sub: "" } %> |
||||||
|
<p class="govuk-body"> |
||||||
|
You’ve completed all the logs that were affected by scheme changes. |
||||||
|
</p> |
||||||
|
<div> |
||||||
|
<%= govuk_button_link_to "Back to all logs", lettings_logs_path %> |
||||||
|
</div> |
||||||
|
<% else %> |
||||||
|
<%= render partial: "organisations/headings", locals: { main: "You need to update #{@total_count} logs", sub: "" } %> |
||||||
|
|
||||||
|
<%= govuk_table do |table| %> |
||||||
|
<% table.head do |head| %> |
||||||
|
<% head.row do |row| %> |
||||||
|
<% row.cell(header: true, text: "Log ID") %> |
||||||
|
<% row.cell(header: true, text: "Tenancy code") %> |
||||||
|
<% row.cell(header: true, text: "Property reference") %> |
||||||
|
<% row.cell(header: true, text: "Status") %> |
||||||
|
<% row.cell(header: true, text: "") %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% @logs.each do |log| %> |
||||||
|
<% table.body do |body| %> |
||||||
|
<% body.row do |row| %> |
||||||
|
<% row.cell(text: log.id) %> |
||||||
|
<% row.cell(text: log.tenancycode) %> |
||||||
|
<% row.cell(text: log.propcode) %> |
||||||
|
<% row.cell(text: status_tag(log.status)) %> |
||||||
|
<% row.cell(html_attributes: { |
||||||
|
scope: "row", |
||||||
|
class: "govuk-!-text-align-right", |
||||||
|
}) do %> |
||||||
|
<%= govuk_link_to("Update now", send(log.form.unresolved_log_path, log)) %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
<% end %> |
||||||
|
|
||||||
|
<%= render partial: "pagy/nav", locals: { pagy: @pagy, item_name: "logs" } %> |
@ -0,0 +1,7 @@ |
|||||||
|
class AddImpactedByDeactivationColumn < ActiveRecord::Migration[7.0] |
||||||
|
def change |
||||||
|
change_table :lettings_logs, bulk: true do |t| |
||||||
|
t.column :unresolved, :boolean |
||||||
|
end |
||||||
|
end |
||||||
|
end |
|
Loading…
Reference in new issue