diff --git a/app/components/candidate_interface/application_dashboard_course_choices_component.rb b/app/components/candidate_interface/application_dashboard_course_choices_component.rb index 9363734f04c..59a50d09173 100644 --- a/app/components/candidate_interface/application_dashboard_course_choices_component.rb +++ b/app/components/candidate_interface/application_dashboard_course_choices_component.rb @@ -149,7 +149,12 @@ def status_row(application_choice) if @show_status { key: 'Status', - value: render(ApplicationStatusTagComponent.new(application_choice:)), + value: render( + ApplicationStatusTagComponent.new( + application_choice:, + supplementary_statuses: supplementary_statuses_for(application_choice:), + ), + ), } end end 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..476308c861d 100644 --- a/app/components/candidate_interface/application_status_tag_component.rb +++ b/app/components/candidate_interface/application_status_tag_component.rb @@ -2,9 +2,10 @@ module CandidateInterface class ApplicationStatusTagComponent < ViewComponent::Base delegate :status, to: :application_choice - def initialize(application_choice:, display_info_text: true) + def initialize(application_choice:, display_info_text: true, supplementary_statuses: []) @application_choice = application_choice @display_info_text = display_info_text + @supplementary_statuses = 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..950294c9777 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,13 @@ 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, + supplementary_statuses: supplementary_statuses_for(application_choice:), + ), + ), } end diff --git a/app/components/candidate_interface/continuous_applications/application_summary_component.rb b/app/components/candidate_interface/continuous_applications/application_summary_component.rb index 01b71a7d36a..a13969fc681 100644 --- a/app/components/candidate_interface/continuous_applications/application_summary_component.rb +++ b/app/components/candidate_interface/continuous_applications/application_summary_component.rb @@ -70,7 +70,12 @@ def course_details def application_choice_status_row { key: 'Status', - value: render(ContinuousApplications::ApplicationStatusTagComponent.new(application_choice:)), + value: render( + ContinuousApplications::ApplicationStatusTagComponent.new( + application_choice:, + supplementary_statuses: supplementary_statuses_for(application_choice:), + ), + ), } end end diff --git a/app/components/candidate_interface/course_choices_review_component.rb b/app/components/candidate_interface/course_choices_review_component.rb index 7de57c5c913..63ab2c69cb3 100644 --- a/app/components/candidate_interface/course_choices_review_component.rb +++ b/app/components/candidate_interface/course_choices_review_component.rb @@ -270,7 +270,12 @@ def status_row(application_choice) if @show_status { key: 'Status', - value: render(ApplicationStatusTagComponent.new(application_choice:)), + value: render( + ApplicationStatusTagComponent.new( + application_choice:, + supplementary_statuses: supplementary_statuses_for(application_choice:), + ), + ), } end 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..adc4d383661 100644 --- a/app/components/candidate_interface/previous_applications_component.html.erb +++ b/app/components/candidate_interface/previous_applications_component.html.erb @@ -22,7 +22,12 @@ <% end %> - <%= render CandidateInterface::ApplicationStatusTagComponent.new(application_choice: application_choice) %> + <%= + render CandidateInterface::ApplicationStatusTagComponent.new( + application_choice: application_choice, + supplementary_statuses: supplementary_statuses_for(application_choice:), + ) + %> <% end %> diff --git a/app/components/candidate_interface/rejection_reasons_component.rb b/app/components/candidate_interface/rejection_reasons_component.rb index 51220bb4b20..6285fad73a7 100644 --- a/app/components/candidate_interface/rejection_reasons_component.rb +++ b/app/components/candidate_interface/rejection_reasons_component.rb @@ -40,7 +40,12 @@ def course_details_row_value(application_choice) def status_row(application_choice) { key: 'Status', - value: render(ApplicationStatusTagComponent.new(application_choice:)), + value: render( + ApplicationStatusTagComponent.new( + application_choice:, + supplementary_statuses: supplementary_statuses_for(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..053ad4d0a6b 100644 --- a/app/components/provider_interface/application_card_component.html.erb +++ b/app/components/provider_interface/application_card_component.html.erb @@ -6,7 +6,14 @@ <%= application_choice.id %> - <%= render ProviderInterface::ApplicationStatusTagComponent.new(application_choice: application_choice) %> + + <%= render( + ProviderInterface::ApplicationStatusTagComponent.new( + application_choice: application_choice, + supplementary_statuses: supplementary_statuses_for(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..0d0fdc29579 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,13 @@

<%= application_choice.application_form.full_name %> - <%= render(ProviderInterface::ApplicationStatusTagComponent.new(application_choice: application_choice)) %> + + <%= render( + ProviderInterface::ApplicationStatusTagComponent.new( + application_choice: application_choice, + supplementary_statuses: supplementary_statuses_for(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..101131f70b0 100644 --- a/app/components/provider_interface/application_status_tag_component.rb +++ b/app/components/provider_interface/application_status_tag_component.rb @@ -2,8 +2,9 @@ module ProviderInterface class ApplicationStatusTagComponent < ViewComponent::Base delegate :status, to: :application_choice - def initialize(application_choice:) + def initialize(application_choice:, supplementary_statuses: []) @application_choice = application_choice + @supplementary_statuses = 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..bc5e2249834 100644 --- a/app/components/support_interface/application_card_component.html.erb +++ b/app/components/support_interface/application_card_component.html.erb @@ -11,7 +11,14 @@