diff --git a/app/components/app_patient_navigation_component.rb b/app/components/app_patient_navigation_component.rb index 4b3cf4e52d..4e39e7a52e 100644 --- a/app/components/app_patient_navigation_component.rb +++ b/app/components/app_patient_navigation_component.rb @@ -16,6 +16,7 @@ def call text: "Child record", selected: active == :show ) + if Flipper.enabled?(:child_record_redesign) @programmes.flat_map do |programme| nav.with_item( @@ -25,11 +26,14 @@ def call ) end end - nav.with_item( - href: log_patient_path(patient), - text: "Activity log", - selected: active == :log - ) + + unless Flipper.enabled?(:child_record_redesign) + nav.with_item( + href: log_patient_path(patient), + text: "Activity log", + selected: active == :log + ) + end end end diff --git a/app/controllers/patients_controller.rb b/app/controllers/patients_controller.rb index 90a6378d59..bab635bda3 100644 --- a/app/controllers/patients_controller.rb +++ b/app/controllers/patients_controller.rb @@ -33,6 +33,9 @@ def show end def log + # This action and the corresponding view can be deleted when the + # `child_record_redesign` feature flag is removed. + render status: :not_found if Flipper.enabled?(:child_record_redesign) end def edit diff --git a/app/views/patients/programmes/show.html.erb b/app/views/patients/programmes/show.html.erb index 4496f3106c..1726e89b5d 100644 --- a/app/views/patients/programmes/show.html.erb +++ b/app/views/patients/programmes/show.html.erb @@ -20,3 +20,12 @@ <% card.with_heading { "Sessions" } %> <%= render AppPatientProgrammeSessionTableComponent.new(@patient, current_team:, programme_type: @programme.type) %> <% end %> + +<%= render AppCardComponent.new(section: true) do |card| %> + <% card.with_heading { "Programme activity" } %> + <%= render AppActivityLogComponent.new( + patient: @patient, + programme_type: @programme.type, + team: current_team, + ) %> +<% end %> diff --git a/spec/features/viewing_child_records_spec.rb b/spec/features/viewing_child_records_spec.rb index 14ecae2f7e..3ba4c73af9 100644 --- a/spec/features/viewing_child_records_spec.rb +++ b/spec/features/viewing_child_records_spec.rb @@ -22,11 +22,13 @@ then_i_see_the_childs_flu_vaccinations and_i_see_the_childs_flu_sessions and_the_flu_tab_is_selected + and_i_see_the_activity_log_for_flu when_i_click_on_the_hpv_tab then_i_see_the_childs_hpv_vaccinations and_i_see_the_childs_hpv_sessions and_the_hpv_tab_is_selected + and_i_see_the_activity_log_for_hpv end def given_that_the_child_record_redesign_feature_flag_is_enabled @@ -88,13 +90,14 @@ def and_patients_exist end def and_the_patient_is_vaccinated - create( - :vaccination_record, - outcome: :administered, - patient: @patient, - programme: @hpv, - session: @session - ) + @vaccination_record = + create( + :vaccination_record, + outcome: :administered, + patient: @patient, + programme: @hpv, + session: @session + ) end def when_i_click_on_children @@ -181,4 +184,20 @@ def and_i_see_the_childs_hpv_sessions expect(page).to have_content("Vaccinated") end end + + def and_i_see_the_activity_log_for_flu + within(".nhsuk-card", text: "Programme activity") do + expect(page).to have_content( + "Added to the session at #{@session.location.name}" + ) + end + end + + def and_i_see_the_activity_log_for_hpv + within(".nhsuk-card", text: "Programme activity") do + expect(page).to have_content( + "Vaccinated with #{@vaccination_record.vaccine.brand}" + ) + end + end end