def call
govuk_summary_list(actions: @change_links.present?) do |summary_list|
summary_list.with_row do |row|
row.with_key { "Child" }
row.with_value { @patient.full_name }
end
summary_list.with_row do |row|
row.with_key { "Outcome" }
row.with_value { outcome_value }
if (href = @change_links[:outcome])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "outcome"
)
end
end
summary_list.with_row do |row|
row.with_key { "Programme" }
row.with_value { programme_value }
end
if @vaccination_record.administered? &&
!@vaccination_record.sourced_from_manual_report?
summary_list.with_row do |row|
row.with_key { "Vaccine" }
if @vaccine
row.with_value { vaccine_value }
if @current_user.selected_team.has_national_reporting_access?
row.with_action(
text: "Change",
href: @change_links[:batch],
visually_hidden_text: "vaccine"
)
elsif (href = @change_links[:vaccine])
row.with_action(
text: "Change",
visually_hidden_text: "vaccine",
href:
)
end
elsif (href = @change_links[:vaccine])
row.with_value { link_to "Add vaccine", href }
else
row.with_value { "Not provided" }
end
end
summary_list.with_row do |row|
row.with_key { "Batch number" }
if @vaccination_record.batch_number
row.with_value(classes: ["app-u-code"]) { batch_number_value }
if (href = @change_links[:batch])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "batch"
)
end
elsif (href = @change_links[:batch])
row.with_value { link_to "Add batch", href }
else
row.with_value { "Not provided" }
end
end
if @vaccination_record.batch_number && @vaccination_record.batch_expiry
summary_list.with_row do |row|
row.with_key { "Batch expiry date" }
row.with_value { batch_expiry_value }
if @current_user.selected_team.has_national_reporting_access?
row.with_action(
text: "Change",
href: @change_links[:batch],
visually_hidden_text: "batch expiry date"
)
end
end
end
summary_list.with_row do |row|
row.with_key { "Method" }
if @vaccination_record.delivery_method.present?
row.with_value { delivery_method_value }
if (href = @change_links[:delivery_method])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "method"
)
end
elsif (href = @change_links[:delivery_method])
row.with_value { link_to "Add method", href }
else
row.with_value { "Not provided" }
end
end
summary_list.with_row do |row|
row.with_key { "Site" }
if @vaccination_record.delivery_site.present?
row.with_value { delivery_site_value }
if (href = @change_links[:delivery_site])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "site"
)
end
elsif (href = @change_links[:delivery_site])
row.with_value { link_to "Add site", href }
else
row.with_value { "Not provided" }
end
end
end
if @vaccination_record.administered? || @vaccination_record.already_had?
if @vaccination_record.vaccine.present? &&
!@vaccination_record.sourced_from_national_reporting?
summary_list.with_row do |row|
row.with_key { "Dose volume" }
row.with_value { dose_volume_value }
if (href = @change_links[:dose_volume])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "dose volume"
)
end
end
end
summary_list.with_row do |row|
row.with_key { "Dose number" }
row.with_value { dose_number_value }
if (href = @change_links[:dose_sequence])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "dose number"
)
end
end
end
if @identity_check
summary_list.with_row do |row|
row.with_key { "Child identified by" }
row.with_value { identity_check_label(@identity_check) }
if (href = @change_links[:identity])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "child identified by"
)
end
end
end
summary_list.with_row do |row|
row.with_key { "Location" }
row.with_value { location_value }
if (href = @change_links[:location])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "location"
)
end
end
summary_list.with_row do |row|
row.with_key { "Date" }
row.with_value { date_value }
if (href = @change_links[:performed_at])
row.with_action(text: "Change", visually_hidden_text: "date", href:)
end
end
summary_list.with_row do |row|
row.with_key { "Time" }
row.with_value { time_value }
if (href = @change_links[:performed_at])
row.with_action(text: "Change", visually_hidden_text: "time", href:)
end
end
if @vaccination_record.supplied_by.present?
summary_list.with_row do |row|
row.with_key { "Supplier" }
row.with_value { supplier_value }
if (href = @change_links[:supplier])
row.with_action(
text: "Change",
visually_hidden_text: "supplier",
href:
)
end
end
end
summary_list.with_row do |row|
row.with_key { "Vaccinator" }
row.with_value { vaccinator_value }
if (href = @change_links[:vaccinator])
row.with_action(
text: "Change",
visually_hidden_text: "vaccinator",
href:
)
end
end
if @vaccination_record.protocol.present? &&
!@vaccination_record.sourced_from_national_reporting?
summary_list.with_row do |row|
row.with_key { "Protocol" }
row.with_value { protocol_value }
end
end
if @show_notes && !@vaccination_record.sourced_from_national_reporting?
summary_list.with_row do |row|
row.with_key { "Notes" }
if @vaccination_record.notes.present?
row.with_value { notes_value }
if (href = @change_links[:notes])
row.with_action(
text: "Change",
href:,
visually_hidden_text: "notes"
)
end
elsif (href = @change_links[:notes])
row.with_value { link_to "Add notes", href }
else
row.with_value { "Not provided" }
end
end
end
if @vaccination_record.respond_to?(:discarded_at) &&
@vaccination_record.discarded_at.present?
summary_list.with_row do |row|
row.with_key { "Archived" }
row.with_value { discarded_value }
end
end
if @vaccination_record.respond_to?(:source)
summary_list.with_row do |row|
row.with_key { "Source" }
row.with_value { source_value }
end
end
if @vaccination_record.reported_by.present?
summary_list.with_row do |row|
row.with_key { "Reported by" }
row.with_value { @vaccination_record.reported_by&.full_name }
end
end
if historical_vaccination_event?
summary_list.with_row do |row|
row.with_key { "Reported on" }
row.with_value { @vaccination_record.created_at.to_fs(:long) }
end
end
correct_feature_flags_enabled =
Programme.all_as_variants.any? do
Flipper.enabled?(:imms_api_sync_job, it)
end && Flipper.enabled?(:imms_api_integration)
if @vaccination_record.respond_to?(:sync_status) &&
correct_feature_flags_enabled &&
@vaccination_record.correct_source_for_nhs_immunisations_api? &&
!@comparing
summary_list.with_row do |row|
row.with_key { "Synced with NHS England?" }
row.with_value do
render AppVaccinationRecordAPISyncStatusComponent.new(
@vaccination_record
)
end
end
end
end
end