Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6cc4164
Add `sessions configure` command
thomasleese Aug 21, 2025
0d22cc2
Refactor session edit routes
thomasleese Aug 21, 2025
0bfd19c
Merge pull request #4403 from nhsuk/cli-session-configuration
thomasleese Aug 27, 2025
03f08c0
Restrict who can edit session details
thomasleese Aug 27, 2025
1ba204e
Add ability to edit session registration
thomasleese Aug 21, 2025
2a8ede5
Add ability for users to enable/disable delgation
thomasleese Aug 21, 2025
ee39713
Add `is_prescriber?`
thomasleese Aug 21, 2025
e54e213
Merge pull request #4370 from nhsuk/edit-session-protocols
thomasleese Aug 27, 2025
d6a264c
Merge pull request #4363 from nhsuk/prescriber-permission
thomasleese Aug 27, 2025
5fefcb8
Update policies for healthcare assistances
thomasleese Aug 22, 2025
26b9bbb
Add `Session#vaccine_methods_for`
thomasleese Aug 25, 2025
75a35ae
Don't render vaccination section heading
thomasleese Aug 25, 2025
63df0c8
Refactor recording already vaccinated
thomasleese Aug 25, 2025
9087543
Pass VaccinationRecord instance to policy
thomasleese Aug 25, 2025
6e4bc0f
Restrict patients by user
thomasleese Aug 25, 2025
cbc21e7
Add supplier user to vaccination records
thomasleese Aug 25, 2025
8ea3982
Remove column PatientSpecificDirection#full_dose
jhenderson Aug 27, 2025
031c32b
Add new policy PatientSpecificDirectionPolicy
jhenderson Aug 20, 2025
0274a91
Change patient_specific_direction factory to use nasal
jhenderson Aug 20, 2025
51e9dfb
Allow HCAs to administer nasal flu
thomasleese Aug 26, 2025
8634a32
Basic functionality to add PSD to a triaged patient
jhenderson Aug 20, 2025
b006ad7
Merge pull request #4393 from nhsuk/healthcare-assistant-nasal-flu-pgd
thomasleese Aug 27, 2025
abc8da0
Refactor AppRegisterStatusTagComponent to be reusable
jhenderson Aug 26, 2025
141701e
Prescribers can create PSD instructions in bulk
jhenderson Aug 22, 2025
5280902
Merge pull request #4347 from nhsuk/prescribers-can-create-psd-instru…
jhenderson Aug 27, 2025
ef2ebe2
Merge pull request #4384 from nhsuk/prescribers-can-create-psd-instru…
jhenderson Aug 27, 2025
90cb4d4
Small code improvements to PSD functionality
thomasleese Aug 27, 2025
0776664
Rename `bulk_add` action
thomasleese Aug 28, 2025
d8c0783
Use layout in PSD controller
thomasleese Aug 28, 2025
e944c0a
Don't create PSDs in bulk for patients who need triage
thomasleese Aug 28, 2025
95a417f
Attach PSDs to approriate vaccines
thomasleese Aug 28, 2025
96c6cda
Add PSD filters to PSDs tab page
jhenderson Aug 28, 2025
6ffdb26
Refactor PSD controller
thomasleese Aug 28, 2025
460252c
Merge pull request #4435 from nhsuk/add-filters-to-psds-page
jhenderson Aug 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions app/assets/stylesheets/components/_action-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,59 @@
margin-right: 0;
padding-right: 0;
}

.nhsuk-action-link {
@include nhsuk-responsive-margin(6, "bottom");
}

.nhsuk-action-link__link {
display: inline-block; // [1]
padding-left: 38px; // [2]
position: relative; // [3]
text-decoration: none; // [4]

@include nhsuk-font(22, $weight: bold);

&:not(:focus):hover {
.nhsuk-action-link__text {
text-decoration: underline; // [6]
}
}

@include nhsuk-media-query($until: tablet) {
padding-left: 26px; // [2]
}

@include nhsuk-media-query($media-type: print) {
color: $nhsuk-print-text-color;

&:visited {
color: $nhsuk-print-text-color;
}
}

.nhsuk-icon__arrow-right-circle {
// stylelint-disable-next-line declaration-no-important
fill: $color_nhsuk-green !important;
height: 36px;
left: -3px;
position: absolute;
top: -3px;
width: 36px;

@include nhsuk-print-color($nhsuk-print-text-color);

@include nhsuk-media-query($until: tablet) {
height: 24px;
left: -2px;
margin-bottom: 0;
top: 1px;
width: 24px;
}
}

&:focus .nhsuk-icon__arrow-right-circle {
// stylelint-disable-next-line declaration-no-important
fill: $color_nhsuk-black !important;
}
}
16 changes: 16 additions & 0 deletions app/components/app_patient_search_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ class AppPatientSearchFormComponent < ViewComponent::Base
<% end %>
<% end %>
<% end %>

<% if patient_specific_direction_statuses.any? %>
<%= f.govuk_radio_buttons_fieldset :patient_specific_direction_status, legend: { text: "PSD status", size: "s" } do %>
<%= f.govuk_radio_button :patient_specific_direction_status, "", checked: form.patient_specific_direction_status.blank?, label: { text: "Any" } %>

<% patient_specific_direction_statuses.each do |status| %>
<%= f.govuk_radio_button :patient_specific_direction_status,
status,
checked: form.patient_specific_direction_status == status,
label: { text: t(status, scope: %i[status patient_specific_direction label]) } %>
<% end %>
<% end %>
<% end %>

<% if vaccine_methods.any? %>
<%= f.govuk_radio_buttons_fieldset :vaccine_method, legend: { text: "Vaccination method", size: "s" } do %>
Expand Down Expand Up @@ -182,6 +195,7 @@ def initialize(
register_statuses: [],
triage_statuses: [],
vaccination_statuses: [],
patient_specific_direction_statuses: [],
vaccine_methods: [],
year_groups: [],
heading_level: 3,
Expand All @@ -197,6 +211,7 @@ def initialize(
@register_statuses = register_statuses
@triage_statuses = triage_statuses
@vaccination_statuses = vaccination_statuses
@patient_specific_direction_statuses = patient_specific_direction_statuses
@vaccine_methods = vaccine_methods
@year_groups = year_groups
@heading_level = heading_level
Expand All @@ -212,6 +227,7 @@ def initialize(
:register_statuses,
:triage_statuses,
:vaccination_statuses,
:patient_specific_direction_statuses,
:vaccine_methods,
:year_groups,
:heading_level,
Expand Down
15 changes: 10 additions & 5 deletions app/components/app_patient_session_record_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

class AppPatientSessionRecordComponent < ViewComponent::Base
erb_template <<-ERB
<h3 class="nhsuk-heading-m"><%= heading %></h3>

<% if helpers.policy(VaccinationRecord).new? %>
<% if helpers.policy(vaccination_record).new? %>
<h3 class="nhsuk-heading-m"><%= heading %></h3>
<%= render AppVaccinateFormComponent.new(vaccinate_form) %>
<% end %>
ERB

def initialize(patient_session, programme:, vaccinate_form: nil)
def initialize(patient_session, programme:, current_user:, vaccinate_form:)
super

@patient_session = patient_session
@programme = programme
@current_user = current_user
@vaccinate_form = vaccinate_form || default_vaccinate_form
end

Expand All @@ -28,16 +28,21 @@ def render?

private

attr_reader :patient_session, :programme, :vaccinate_form
attr_reader :patient_session, :current_user, :programme, :vaccinate_form

delegate :patient, :session, to: :patient_session
delegate :academic_year, to: :session

def vaccination_record
VaccinationRecord.new(patient:, session:, programme:)
end

def default_vaccinate_form
pre_screening_confirmed = patient.pre_screenings.today.exists?(programme:)
session_date = session.session_dates.today.first

VaccinateForm.new(
current_user:,
patient:,
session_date:,
programme:,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AppPatientSessionSearchResultCardComponent < ViewComponent::Base
end
end

if (note = patient_session.latest_note)
if context != :patient_specific_direction && (note = patient_session.latest_note)
summary_list.with_row do |row|
row.with_key { "Notes" }
row.with_value { render note_to_log_event(note) }
Expand All @@ -57,7 +57,16 @@ class AppPatientSessionSearchResultCardComponent < ViewComponent::Base
def initialize(patient_session, context:, programmes: [])
super

unless context.in?(%i[patients consent triage register record])
unless context.in?(
%i[
patients
consent
triage
register
record
patient_specific_direction
]
)
raise "Unknown context: #{context}"
end

Expand Down Expand Up @@ -157,6 +166,8 @@ def status_tags
[consent_status_tag]
when :triage
[triage_status_tag]
when :patient_specific_direction
[patient_specific_direction_status_tag]
else
[vaccination_status_tag]
end
Expand Down Expand Up @@ -203,8 +214,9 @@ def register_status_tag
key: :register,
value:
render(
AppRegisterStatusTagComponent.new(
patient_session.registration_status&.status || "unknown"
AppStatusTagComponent.new(
patient_session.registration_status&.status || "unknown",
context: :register
)
)
}
Expand Down Expand Up @@ -240,6 +252,19 @@ def triage_status_value(triage_status, programme)
{ status: status }
end

def patient_specific_direction_status_tag
{
key: :patient_specific_direction,
value:
render(
AppStatusTagComponent.new(
psd_exists?(programmes.first) ? :added : :not_added,
context: :patient_specific_direction
)
)
}
end

def note_to_log_event(note)
truncated_body = note.body.truncate_words(80, omission: "…")

Expand All @@ -260,4 +285,10 @@ def note_to_log_event(note)

AppLogEventComponent.new(body:, at: note.created_at, by: note.created_by)
end

def psd_exists?(programme)
patient.patient_specific_directions.any? do
it.programme_id == programme.id && it.academic_year == academic_year
end
end
end
21 changes: 0 additions & 21 deletions app/components/app_register_status_tag_component.rb

This file was deleted.

7 changes: 4 additions & 3 deletions app/components/app_search_results_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class AppSearchResultsComponent < ViewComponent::Base
erb_template <<-ERB
<h3 class="nhsuk-heading-m nhsuk-u-margin-bottom-2">Search results</h3>
<h3 class="nhsuk-heading-m nhsuk-u-margin-bottom-2"><%= heading %></h3>

<p class="nhsuk-caption-m nhsuk-u-margin-bottom-4">
<% if has_results? %>
Expand All @@ -19,16 +19,17 @@ class AppSearchResultsComponent < ViewComponent::Base
<% end %>
ERB

def initialize(pagy, label:)
def initialize(pagy, label:, heading: "Search results")
super

@pagy = pagy
@label = label
@heading = heading
end

private

attr_reader :pagy, :label
attr_reader :pagy, :label, :heading

def has_results? = pagy.count.positive?
end
22 changes: 22 additions & 0 deletions app/components/app_status_tag_component.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

class AppStatusTagComponent < ViewComponent::Base
def initialize(status, context:)
super

@status = status
@context = context
end

def call = tag.strong(text, class: ["nhsuk-tag nhsuk-tag--#{colour}"])

private

def text
I18n.t(@status, scope: [:status, @context, :label])
end

def colour
I18n.t(@status, scope: [:status, @context, :colour])
end
end
10 changes: 9 additions & 1 deletion app/components/app_triage_form_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@

<%= f.govuk_radio_buttons_fieldset :status_and_vaccine_method, **fieldset_options do %>
<% triage_form.safe_to_vaccinate_options.each do |option| %>
<%= f.govuk_radio_button :status_and_vaccine_method, option %>
<%= f.govuk_radio_button :status_and_vaccine_method, option do %>
<% if show_psd_options?(option) %>
<%= f.govuk_radio_buttons_fieldset :psd_action,
legend: { text: "Do you want to add a PSD?", size: "s" } do %>
<%= f.govuk_radio_button :add_psd, "true", label: { text: "Yes" } %>
<%= f.govuk_radio_button :add_psd, "false", label: { text: "No" } %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= f.govuk_radio_divider %>
<% triage_form.other_options.each do |option| %>
Expand Down
6 changes: 6 additions & 0 deletions app/components/app_triage_form_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def initialize(

def builder = GOVUKDesignSystemFormBuilder::FormBuilder

def show_psd_options?(option)
patient_session.session.psd_enabled? &&
option == "safe_to_vaccinate_nasal" &&
helpers.policy(PatientSpecificDirection).create?
end

def fieldset_options
text = "Is it safe to vaccinate #{patient.given_name}?"
hint =
Expand Down
16 changes: 15 additions & 1 deletion app/components/app_vaccinate_form_component.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= form_with(
model: vaccinate_form,
model: form,
url:,
method: :post,
class: "nhsuk-card",
Expand Down Expand Up @@ -54,6 +54,20 @@
<% end %>

<%= f.govuk_text_area :pre_screening_notes, label: { text: "Pre-screening notes (optional)" }, rows: 3 %>

<% if form.requires_supplied_by_user_id? %>
<%= f.govuk_select :supplied_by_user_id,
label: { text: "Which nurse identified and pre-screened the child and supplied the vaccine?" },
data: { module: "autocomplete" } do %>
<%= tag.option "", value: "" %>
<% form.supplied_by_users.each do |user| %>
<%= tag.option user.full_name,
value: user.id,
selected: user.id == form.supplied_by_user_id,
data: { hint: user.email } %>
<% end %>
<% end %>
<% end %>
</section>

<hr class="nhsuk-section-break nhsuk-section-break--visible nhsuk-section-break--l">
Expand Down
8 changes: 4 additions & 4 deletions app/components/app_vaccinate_form_component.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# frozen_string_literal: true

class AppVaccinateFormComponent < ViewComponent::Base
def initialize(vaccinate_form)
def initialize(form)
super

@vaccinate_form = vaccinate_form
@form = form
end

private

attr_reader :vaccinate_form
attr_reader :form

delegate :patient, :session, :programme, to: :vaccinate_form
delegate :patient, :session, :programme, to: :form
delegate :academic_year, to: :session

def url
Expand Down
Loading