From 2aa356e4179c24ef7083a561088cc813b53b82bb Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Wed, 9 Nov 2022 12:06:57 +0000 Subject: [PATCH] feat: wip toggle active page --- app/helpers/schemes_helper.rb | 10 +++++++++- app/views/schemes/toggle_active.html.erb | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/app/helpers/schemes_helper.rb b/app/helpers/schemes_helper.rb index 3bd188343..444a3b936 100644 --- a/app/helpers/schemes_helper.rb +++ b/app/helpers/schemes_helper.rb @@ -14,7 +14,7 @@ module SchemesHelper { name: "Secondary client group", value: scheme.secondary_client_group }, { name: "Level of support given", value: scheme.support_type }, { name: "Intended length of stay", value: scheme.intended_stay }, - { name: "Availability", value: "Available from #{scheme.available_from.to_formatted_s(:govuk_date)} \nDeactivation date #{scheme.deactivation_date.to_formatted_s(:govuk_date)}" }, + { name: "Availability", value: availability_text(scheme)}, { name: "Status", value: status_tag(scheme_status(scheme)) }, ] @@ -24,6 +24,14 @@ module SchemesHelper base_attributes end + def availability_text(scheme) + base_text = "Available from #{scheme.available_from.to_formatted_s(:govuk_date)}" + if scheme.deactivation_date.present? + base_text += "\nDeactivation date #{scheme.deactivation_date.to_formatted_s(:govuk_date)}" + end + base_text + end + def scheme_status(scheme) now = Time.zone.now if scheme.deactivation_date.nil? diff --git a/app/views/schemes/toggle_active.html.erb b/app/views/schemes/toggle_active.html.erb index e69de29bb..7d0738cf1 100644 --- a/app/views/schemes/toggle_active.html.erb +++ b/app/views/schemes/toggle_active.html.erb @@ -0,0 +1,20 @@ +<%= form_with url: scheme_details_path(@scheme), method: "get", local: true do |f| %> + <% content_for :before_content do %> + <%= govuk_back_link(href: :back) %> + <% end %> +

+ <%= @scheme.service_name %> + <%= "When should this change apply?" %> +

+ <%= govuk_warning_text text: "It will not be possible to add logs with this scheme if their tenancy start date is on or after the date you enter. Any existing logs may be affected." %> +
+ If the date is before 5 April 2022, select 'From the start of the current collection period' because the previous period has now closed. +
+ <% selection = [OpenStruct.new(date: Time.zone.now, name: "From the start of the current collection period (5 April 2022)"), OpenStruct.new(date: Time.zone.now, name: "For tenancies starting after a certain date")] %> + <%= f.govuk_collection_radio_buttons :deactivation_date, + selection, + :date, + :name, + legend: nil %> + <%= f.govuk_submit "Continue" %> +<% end %>