-
Notifications
You must be signed in to change notification settings - Fork 9
TimelineRecords UI #3559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TimelineRecords UI #3559
Changes from all commits
8d1fcad
61d7942
31e2417
f48593e
d2b3867
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
<%= render AppCardComponent.new(filters: true) do |card| %> | ||
<% card.with_heading { "Customise timeline" } %> | ||
<%= form_with url: @url, | ||
method: :get, | ||
data: { module: "autosubmit", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like we've removed Stimulus from Mavis, probably since this was originally written (see b66c0f4). Not a show-stopper, but it would be nice to see if we can get this functionality back, although I suspect NHSUK won't support it directly so we'll have to bring Stimulus back. |
||
turbo: "true", | ||
turbo_action: "replace" }, | ||
builder: GOVUKDesignSystemFormBuilder::FormBuilder do |f| %> | ||
<%= f.govuk_fieldset legend: { text: "Events to display:", size: "s" } do %> | ||
<% event_options.keys.each do |value| %> | ||
<%= f.govuk_check_boxes_fieldset :event_names, legend: { hidden: true } do %> | ||
<%= f.govuk_check_box :event_names, | ||
value, | ||
label: { text: value.to_s.humanize }, | ||
checked: value.to_s.in?(params[:event_names] || event_options.keys.map(&:to_s)), | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
|
||
<% available_fields = timeline_fields[value.to_sym] || [] %> | ||
<% if available_fields.any? && value.to_s.in?(params[:event_names]) %> | ||
<div class="nhsuk-checkboxes__conditional nhsuk-u-margin-bottom-2"> | ||
<% available_fields.each do |field| %> | ||
<%= f.govuk_check_box "detail_config[#{value}]", | ||
field, | ||
small: true, | ||
label: { text: field }, | ||
checked: field.to_s.in?(params.dig("detail_config", value) || []), | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= f.govuk_check_boxes_fieldset :audit_config, legend: { hidden: true } do %> | ||
<%= f.govuk_check_box :event_names, "audits", | ||
label: { text: "Audits" }, | ||
checked: "audits".in?(params[:event_names]), | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
<% if "audits".in?(params[:event_names]) %> | ||
<div class="nhsuk-checkboxes__conditional nhsuk-u-margin-bottom-2"> | ||
<%= f.govuk_check_box "audit_config[include_associated_audits]", true, false, | ||
multiple: false, | ||
label: { text: "include associated audits" }, | ||
checked: params.dig(:audit_config, :include_associated_audits) == "true", | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
|
||
<%= f.govuk_check_box "audit_config[include_filtered_audit_changes]", true, false, | ||
multiple: false, | ||
label: { text: "include filtered audit changes" }, | ||
murugapl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
checked: params.dig(:audit_config, :include_filtered_audit_changes) == "true", | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= f.govuk_check_box :event_names, "org_cohort_imports", | ||
label: { text: "Cohort Imports for Team #{@teams.join(",")} excluding patient" }, | ||
checked: "org_cohort_imports".in?(params[:event_names]), | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
|
||
<% (@additional_class_imports).each do |location_id, import_ids| %> | ||
<%= f.govuk_check_box :event_names, "add_class_imports_#{location_id}", | ||
label: { text: "Class Imports for Location-#{location_id} excluding Patient" }, | ||
checked: "add_class_imports_#{location_id}".in?(params[:event_names]), | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
<% end %> | ||
|
||
|
||
<%= f.govuk_radio_buttons_fieldset :compare_option, legend: { text: "Compare with another patient:", size: "s" } do %> | ||
<%= f.govuk_radio_button :compare_option, | ||
nil, | ||
label: { text: "Do not compare" }, | ||
checked: params[:compare_option].blank?, | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
|
||
<% if class_imports.present? %> | ||
<%= f.govuk_radio_button :compare_option, | ||
"class_import", | ||
label: { text: "From a Class Import" }, | ||
checked: params[:compare_option] == "class_import", | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" do %> | ||
<% class_imports.each do |import| %> | ||
<%= f.govuk_radio_button :compare_option_class_import, | ||
import, | ||
label: { text: "ClassImport-#{import}" }, | ||
checked: params[:compare_option_class_import].to_s == import.to_s, | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% if cohort_imports.present? %> | ||
<%= f.govuk_radio_button :compare_option, | ||
"cohort_import", | ||
label: { text: "From a Cohort Import" }, | ||
checked: params[:compare_option] == "cohort_import", | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" do %> | ||
<% cohort_imports.each do |import| %> | ||
<%= f.govuk_radio_button :compare_option_cohort_import, | ||
import, | ||
label: { text: "CohortImport-#{import}" }, | ||
checked: params[:compare_option_cohort_import].to_s == import.to_s, | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<% if sessions.present? %> | ||
<%= f.govuk_radio_button :compare_option, | ||
"session", | ||
label: { text: "In a Session" }, | ||
checked: params[:compare_option] == "session" do %> | ||
<% sessions.each do |session| %> | ||
<%= f.govuk_radio_button :compare_option_session, | ||
session, | ||
label: { text: "Session-#{session}" }, | ||
checked: params[:compare_option_session].to_s == session.to_s && params[:compare_option] == "session", | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
|
||
<%= f.govuk_radio_button :compare_option, | ||
"manual_entry", | ||
label: { text: "With a specific Patient ID" }, | ||
checked: params[:compare_option] == "manual_entry" do %> | ||
<%= f.govuk_number_field :manual_patient_id, | ||
label: { hidden: true }, | ||
width: 10, | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
<% end %> | ||
<% end %> | ||
|
||
<div class="nhsuk-u-margin-bottom-4"> | ||
<%= f.govuk_check_box :show_pii, true, | ||
label: { text: "Show PII" }, | ||
checked: @show_pii, | ||
"data-autosubmit-target": "field", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
</div> | ||
|
||
<%= helpers.govuk_button_link_to "Reset filters", | ||
@reset_url, | ||
class: "govuk-button govuk-button--secondary nhsuk-u-display-block app-button--small", | ||
secondary: true, | ||
"data-autosubmit-target": "reset", | ||
"data-action": "autosubmit#submit", | ||
"data-turbo-permanent": "true" %> | ||
<%= f.govuk_submit "Filter" %> | ||
<% end %> | ||
<% end %> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
class AppTimelineFilterComponent < ViewComponent::Base | ||
def initialize( | ||
url:, | ||
patient:, | ||
teams:, | ||
event_options:, | ||
timeline_fields:, | ||
additional_class_imports:, | ||
class_imports:, | ||
cohort_imports:, | ||
sessions:, | ||
reset_url:, | ||
show_pii: | ||
) | ||
@url = url | ||
@patient = patient | ||
@teams = teams.map(&:id) | ||
@event_options = event_options | ||
@timeline_fields = timeline_fields | ||
@additional_class_imports = additional_class_imports | ||
@class_imports = class_imports | ||
@cohort_imports = cohort_imports | ||
@sessions = sessions | ||
@reset_url = reset_url | ||
@show_pii = show_pii | ||
end | ||
|
||
attr_reader :url, | ||
:patient, | ||
:event_options, | ||
:timeline_fields, | ||
:additional_class_imports, | ||
:class_imports, | ||
:cohort_imports, | ||
:sessions, | ||
:reset_url, | ||
:show_pii | ||
end |
Uh oh!
There was an error while loading. Please reload this page.