diff --git a/app/components/candidate_interface/application_status_tag_component.html.erb b/app/components/candidate_interface/application_status_tag_component.html.erb index 2e41a6804bd..56812839b3b 100644 --- a/app/components/candidate_interface/application_status_tag_component.html.erb +++ b/app/components/candidate_interface/application_status_tag_component.html.erb @@ -1,4 +1,7 @@ <%= govuk_tag(text: text, colour: colour) %> +<% supplementary_tags do |supplementary_tag_text, supplementary_tag_colour| %> + <%= govuk_tag(text: supplementary_tag_text, colour: supplementary_tag_colour) %> +<% end %> <% if @display_info_text %> <% if @application_choice.application_not_sent? %> diff --git a/app/components/candidate_interface/application_status_tag_component.rb b/app/components/candidate_interface/application_status_tag_component.rb index c04880ca3e3..e984bc65735 100644 --- a/app/components/candidate_interface/application_status_tag_component.rb +++ b/app/components/candidate_interface/application_status_tag_component.rb @@ -5,6 +5,7 @@ class ApplicationStatusTagComponent < ViewComponent::Base def initialize(application_choice:, display_info_text: true) @application_choice = application_choice @display_info_text = display_info_text + @supplementary_statuses = application_choice.respond_to?(:supplementary_statuses) ? application_choice.supplementary_statuses : [] end def text @@ -36,8 +37,27 @@ def colour end end + def supplementary_tags + @supplementary_statuses.each do |supplementary_status| + yield supplementary_tag_text(supplementary_status), supplementary_tag_colour(supplementary_status) + end + end + private + def supplementary_tag_text(supplementary_status) + I18n.t!("supplementary_application_states.#{supplementary_status}.name") + end + + def supplementary_tag_colour(supplementary_status) + case supplementary_status.to_s + when 'ske_pending_conditions' + 'blue' + else + raise "You need to define a colour for the #{supplementary_status} supplementary state" + end + end + attr_reader :application_choice end end diff --git a/app/components/candidate_interface/continuous_applications/application_review_component.rb b/app/components/candidate_interface/continuous_applications/application_review_component.rb index e812ee77ec2..4b94cfa36ff 100644 --- a/app/components/candidate_interface/continuous_applications/application_review_component.rb +++ b/app/components/candidate_interface/continuous_applications/application_review_component.rb @@ -27,7 +27,9 @@ def status_row { key: 'Status', - value: render(ApplicationStatusTagComponent.new(application_choice:, display_info_text: false)), + value: render( + ApplicationStatusTagComponent.new(application_choice:, display_info_text: false), + ), } end diff --git a/app/components/candidate_interface/previous_applications_component.html.erb b/app/components/candidate_interface/previous_applications_component.html.erb index 1e543c31d78..b64937873a2 100644 --- a/app/components/candidate_interface/previous_applications_component.html.erb +++ b/app/components/candidate_interface/previous_applications_component.html.erb @@ -22,7 +22,7 @@ <% end %> - <%= render CandidateInterface::ApplicationStatusTagComponent.new(application_choice: application_choice) %> + <%= render CandidateInterface::ApplicationStatusTagComponent.new(application_choice:) %> <% end %> diff --git a/app/components/provider_interface/application_card_component.html.erb b/app/components/provider_interface/application_card_component.html.erb index 7e7018b8e6d..2c7e7276fb6 100644 --- a/app/components/provider_interface/application_card_component.html.erb +++ b/app/components/provider_interface/application_card_component.html.erb @@ -6,7 +6,9 @@ <%= application_choice.id %> - <%= render ProviderInterface::ApplicationStatusTagComponent.new(application_choice: application_choice) %> + + <%= render(ProviderInterface::ApplicationStatusTagComponent.new(application_choice:)) %> +
diff --git a/app/components/provider_interface/application_choice_header_component.html.erb b/app/components/provider_interface/application_choice_header_component.html.erb index a279053fca6..6e91df1135a 100644 --- a/app/components/provider_interface/application_choice_header_component.html.erb +++ b/app/components/provider_interface/application_choice_header_component.html.erb @@ -1,6 +1,8 @@

<%= application_choice.application_form.full_name %> - <%= render(ProviderInterface::ApplicationStatusTagComponent.new(application_choice: application_choice)) %> + + <%= render(ProviderInterface::ApplicationStatusTagComponent.new(application_choice:)) %> +

<% if show_inset_text? -%> diff --git a/app/components/provider_interface/application_status_tag_component.html.erb b/app/components/provider_interface/application_status_tag_component.html.erb index a32d93128a1..9d581972d8c 100644 --- a/app/components/provider_interface/application_status_tag_component.html.erb +++ b/app/components/provider_interface/application_status_tag_component.html.erb @@ -1 +1,4 @@ <%= govuk_tag(text: text, colour: colour) %> +<% supplementary_tags do |supplementary_tag_text, supplementary_tag_colour| %> + <%= govuk_tag(text: supplementary_tag_text, colour: supplementary_tag_colour) %> +<% end %> diff --git a/app/components/provider_interface/application_status_tag_component.rb b/app/components/provider_interface/application_status_tag_component.rb index c29429d9f6b..86583f38434 100644 --- a/app/components/provider_interface/application_status_tag_component.rb +++ b/app/components/provider_interface/application_status_tag_component.rb @@ -4,6 +4,7 @@ class ApplicationStatusTagComponent < ViewComponent::Base def initialize(application_choice:) @application_choice = application_choice + @supplementary_statuses = application_choice.respond_to?(:supplementary_statuses) ? application_choice.supplementary_statuses : [] end def text @@ -33,8 +34,27 @@ def colour end end + def supplementary_tags + @supplementary_statuses.each do |supplementary_status| + yield supplementary_tag_text(supplementary_status), supplementary_tag_colour(supplementary_status) + end + end + private + def supplementary_tag_text(supplementary_status) + I18n.t!("supplementary_application_states.#{supplementary_status}.name") + end + + def supplementary_tag_colour(supplementary_status) + case supplementary_status.to_s + when 'ske_pending_conditions' + 'blue' + else + raise "You need to define a colour for the #{supplementary_status} supplementary state" + end + end + attr_reader :application_choice end end diff --git a/app/components/support_interface/application_card_component.html.erb b/app/components/support_interface/application_card_component.html.erb index 2302cc86685..0ec2f914fa5 100644 --- a/app/components/support_interface/application_card_component.html.erb +++ b/app/components/support_interface/application_card_component.html.erb @@ -11,7 +11,7 @@