diff --git a/app/controllers/form_controller.rb b/app/controllers/form_controller.rb index 799a68146..a56ba3dca 100644 --- a/app/controllers/form_controller.rb +++ b/app/controllers/form_controller.rb @@ -50,8 +50,8 @@ class FormController < ApplicationController @interruption_page_id = URI.parse(request.headers["HTTP_REFERER"]).path.split("/").last.underscore @interruption_page_referrer_type = referrer_from_query end - if DuplicateLogService.is_log_duplicate?(@log) - redirect_to + if @log.duplicate_logs? + redirect_to end if @log page_id = request.path.split("/")[-1].underscore diff --git a/app/services/duplicate_log_service.rb b/app/services/duplicate_log_service.rb deleted file mode 100644 index a2171bd3d..000000000 --- a/app/services/duplicate_log_service.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DuplicateLogService - def is_log_duplicate? (log) - return true if log.id == 3 - end -end diff --git a/app/views/duplicate_logs/_banner.html.erb b/app/views/duplicate_logs/_banner.html.erb new file mode 100644 index 000000000..14a89b770 --- /dev/null +++ b/app/views/duplicate_logs/_banner.html.erb @@ -0,0 +1,13 @@ +<% if question.page.routed_to?(@log, current_user) %> + <%= govuk_panel( + classes: "app-panel--interruption", + ) do %> +

<%= display_title_text(title_text, lettings_log) %>

+ <% if informative_text.present? %> +

<%= display_informative_text(informative_text, lettings_log) %>

+ <% end %> + <% if question.hint_text.present? %> +

<%= question.hint_text&.html_safe %>

+ <% end %> + <% end %> +<% end %> diff --git a/app/views/duplicate_logs/_check_answers_summary_list.html.erb b/app/views/duplicate_logs/_check_answers_summary_list.html.erb new file mode 100644 index 000000000..4d1bbd8a4 --- /dev/null +++ b/app/views/duplicate_logs/_check_answers_summary_list.html.erb @@ -0,0 +1,37 @@ +<%= govuk_summary_list do |summary_list| %> + <% questions.each do |question| %> + <% summary_list.row do |row| %> + <% row.key { get_question_label(question) } %> + + <% row.value do %> + <%= simple_format( + get_answer_label(question, @log), + wrapper_tag: "span", + class: "govuk-!-margin-right-4", + ) %> + + <% extra_value = question.get_extra_check_answer_value(@log) %> + + <% if extra_value && question.answer_label(@log, current_user).present? %> + <%= simple_format( + extra_value, + wrapper_tag: "span", + class: "govuk-!-font-weight-regular app-!-colour-muted", + ) %> + <% end %> + + <% question.get_inferred_answers(@log).each do |inferred_answer| %> + <%= inferred_answer %> + <% end %> + <% end %> + + <% if @log.collection_period_open_for_editing? %> + <% row.action( + text: question.action_text(@log), + href: action_href(@log, question.page.id, referrer), + visually_hidden_text: question.check_answer_label.to_s.downcase, + ) %> + <% end %> + <% end %> + <% end %> +<% end %> diff --git a/db/schema.rb b/db/schema.rb index 3a47ae8aa..2d8f5b358 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -186,14 +186,14 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.integer "hb" t.integer "hbrentshortfall" t.integer "property_relet" - t.datetime "mrcdate", precision: nil + t.datetime "mrcdate" t.integer "incref" - t.datetime "startdate", precision: nil + t.datetime "startdate" t.integer "armedforces" t.integer "first_time_property_let_as_social_housing" t.integer "unitletas" t.integer "builtype" - t.datetime "voiddate", precision: nil + t.datetime "voiddate" t.bigint "owning_organisation_id" t.bigint "managing_organisation_id" t.integer "renttype" @@ -341,7 +341,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.string "old_id" t.string "old_visible_id" t.string "mobility_type" - t.datetime "startdate", precision: nil + t.datetime "startdate" t.string "location_admin_district" t.boolean "confirmed" t.index ["old_id"], name: "index_locations_on_old_id", unique: true @@ -512,7 +512,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.integer "stairbought" t.integer "stairowned" t.decimal "mrent", precision: 10, scale: 2 - t.datetime "exdate", precision: nil + t.datetime "exdate" t.integer "exday" t.integer "exmonth" t.integer "exyear" @@ -548,7 +548,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.integer "wchair" t.integer "income2_value_check" t.integer "armedforcesspouse" - t.datetime "hodate", precision: nil + t.datetime "hodate" t.integer "hoday" t.integer "homonth" t.integer "hoyear" @@ -601,9 +601,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.integer "discounted_sale_value_check" t.integer "student_not_child_value_check" t.integer "percentage_discount_value_check" + t.integer "combined_income_value_check" t.integer "buyer_livein_value_check" t.integer "status_cache", default: 0, null: false - t.integer "combined_income_value_check" t.datetime "discarded_at" t.integer "stairowned_value_check" t.integer "creation_method", default: 1 @@ -656,8 +656,8 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.string "name" t.bigint "organisation_id" t.integer "sign_in_count", default: 0, null: false - t.datetime "current_sign_in_at", precision: nil - t.datetime "last_sign_in_at", precision: nil + t.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.integer "role" @@ -665,7 +665,7 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.string "phone" t.integer "failed_attempts", default: 0 t.string "unlock_token" - t.datetime "locked_at", precision: nil + t.datetime "locked_at" t.boolean "is_dpo", default: false t.boolean "is_key_contact", default: false t.integer "second_factor_attempts_count", default: 0 @@ -673,12 +673,12 @@ ActiveRecord::Schema[7.0].define(version: 2023_06_29_125541) do t.string "encrypted_otp_secret_key_iv" t.string "encrypted_otp_secret_key_salt" t.string "direct_otp" - t.datetime "direct_otp_sent_at", precision: nil + t.datetime "direct_otp_sent_at" t.datetime "totp_timestamp", precision: nil t.boolean "active", default: true t.string "confirmation_token" - t.datetime "confirmed_at", precision: nil - t.datetime "confirmation_sent_at", precision: nil + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" t.string "unconfirmed_email" t.boolean "initial_confirmation_sent" t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true