Skip to content

Commit f25fd0b

Browse files
Fix medical history bugs and prevent medical information editing outside of workflow (#183)
* Fix medical history bugs and prevent medical information editing by non clinicians or outside of workflow * Clean up review page * Fix sticky workflow nav * Don't show resume link for completed appointments * Show extra contact details on modal
1 parent b530529 commit f25fd0b

File tree

22 files changed

+236
-141
lines changed

22 files changed

+236
-141
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,7 @@ coverage
7575

7676
# ESlint cache
7777
.cache
78+
79+
# LLM instructions
80+
.github
81+
CLAUDE.md

app/assets/sass/_workflow.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@
1414
@include nhsuk-width-container(1200px);
1515
}
1616

17-
.app-workflow-container .nhsuk-grid-column-one-quarter {
18-
align-self: flex-start;
17+
@include nhsuk-media-query($from: desktop) {
18+
.app-workflow-side-nav-wrapper {
19+
position: relative;
20+
min-height: 100vh; // Ensures it's tall enough for sticky to work
21+
}
1922
}
2023

21-
// Side navigation
2224
.app-workflow-side-nav {
2325
position: sticky;
2426
top: nhsuk-spacing(4);
25-
align-self: flex-start; // Important for sticky in grid/flex
27+
align-self: flex-start;
2628
padding-bottom: 15px;
2729
}
2830

app/data/session-data-defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const defaultSettings = {
6262
darkMode: 'false',
6363
screening: {
6464
confirmIdentityOnCheckIn: 'true',
65-
manualImageCollection: 'false',
65+
manualImageCollection: 'true',
6666
showParticipantSection: 'false'
6767
},
6868
reading: {

app/lib/utils/status.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const STATUS_GROUPS = {
1717
'event_attended_not_screened',
1818
'event_cancelled'
1919
],
20-
active: ['event_scheduled', 'event_checked_in'],
20+
active: ['event_scheduled', 'event_checked_in', 'event_in_progress'],
2121
eligible_for_reading: ['event_complete', 'event_partially_screened']
2222
}
2323

@@ -119,7 +119,12 @@ const isAppointmentWorkflow = function (event, currentUser) {
119119
currentUser = currentUser || this?.ctx?.data?.currentUser
120120

121121
const startedBy = event?.sessionDetails?.startedBy
122-
if (!currentUser || !startedBy) return false
122+
if (!currentUser || !startedBy) {
123+
console.log(
124+
`User or event not found: currentuser: ${currentUser}, startedBy: ${startedBy}`
125+
)
126+
return false
127+
}
123128

124129
// Extract user ID whether currentUser is object or string
125130
const currentUserId =

app/routes/events.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ module.exports = (router) => {
171171
const currentUser = data.currentUser
172172
const returnTo = req.query.returnTo // Used by /index so we can 'start' an appointment but then go to a different page.
173173

174+
console.log(
175+
`Starting appointment for event ${req.params.eventId} by user ${currentUser.id}`
176+
)
177+
174178
if (event?.status !== 'event_in_progress') {
175179
// Update status
176180
updateEventStatus(data, req.params.eventId, 'event_in_progress')

app/views/_components/summary-list/summary-list-row-template.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ true unless told otherwise #}
1515
{%- set anyRowHasActions = row.anyRowHasActions | default(true) %}
1616

1717
{% if row %}
18-
<div class="nhsuk-summary-list__row {%- if anyRowHasActions and not row.actions.items %} nhsuk-summary-list__row--no-actions{% endif %} {%- if row.classes %} {{ row.classes }}{% endif %}">
18+
<div class="nhsuk-summary-list__row {%- if not anyRowHasActions and not row.actions.items %} nhsuk-summary-list__row--no-actions{% endif %} {%- if row.classes %} {{ row.classes }}{% endif %}">
1919
<dt class="nhsuk-summary-list__key {%- if row.key.classes %} {{ row.key.classes }}{% endif %}">
2020
{{ row.key.html | safe if row.key.html else row.key.text }}
2121
</dt>

app/views/_includes/confirm-identity-modal.njk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
{% call summaryList() %}
1919
{% include "_includes/summary-lists/rows/full-name.njk" %}
2020
{% include "_includes/summary-lists/rows/date-of-birth.njk" %}
21-
{% set noBorder = true %}
21+
2222
{% include "_includes/summary-lists/rows/address.njk" %}
23+
{% include "_includes/summary-lists/rows/phone-numbers.njk" %}
24+
{% set noBorder = true %}
25+
{% include "_includes/summary-lists/rows/email.njk" %}
2326
{% endcall %}
2427
{% endset %}
2528

app/views/_includes/medical-information/breast-features.njk

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@
4040
{% endset %}
4141

4242
{% if allowEdits %}
43-
<p>
43+
{# <p>
4444
<a href="{{ linkHref | safe }}" class="nhsuk-link--no-visited-state">{{ "Add a feature" if not hasBreastFeatures else "View or edit breast features" }}</a>
45-
</p>
46-
{% endif %}
45+
</p> #}
46+
47+
<div class="nhsuk-form-group">
48+
{{ button({
49+
text: "Add a feature" if not hasBreastFeatures else "View or edit breast features",
50+
href: "./medical-information/record-breast-features" | urlWithReferrer(currentUrl, scrollTo),
51+
classes: "nhsuk-button--secondary app-button--small"
52+
}) }}
53+
</div>
54+
{% endif %}

app/views/_includes/medical-information/index.njk

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
{# Calling template sets variable `displayFormat` to one of card / expander / flat #}
44

5-
{% set allowEdits = true if currentUser | isClinician else false %}
5+
{% set allowEdits = true if (isAppointmentWorkflow and currentUser | isClinician) else false %}
66

77
{# Explicitly set referrer chain to the current url #}
88
{% set referrerChain = currentUrl %}
@@ -96,17 +96,20 @@
9696
<a href="{{ linkHref }}" class="nhsuk-link">{{ "Add another symptom" if hasSymptoms else "Add a symptom" }}</a>
9797
</p> #}
9898

99-
<h4>Add symptoms</h4>
100-
101-
<div class="nhsuk-button-group app-button-group--small">
102-
{% for symptomType in data.symptomTypes %}
103-
{{ button({
104-
text: symptomType.name | sentenceCase,
105-
href: ("./medical-information/symptoms/add?symptomType=" + symptomType.slug) | urlWithReferrer(currentUrl, scrollTo),
106-
classes: "nhsuk-button--secondary app-button--small"
107-
}) }}
108-
{% endfor %}
109-
</div>
99+
{% if allowEdits %}
100+
<h4>Add symptoms</h4>
101+
102+
<div class="nhsuk-button-group app-button-group--small">
103+
{% for symptomType in data.symptomTypes %}
104+
{{ button({
105+
text: symptomType.name | sentenceCase,
106+
href: ("./medical-information/symptoms/add?symptomType=" + symptomType.slug) | urlWithReferrer(currentUrl, scrollTo),
107+
classes: "nhsuk-button--secondary app-button--small"
108+
}) }}
109+
{% endfor %}
110+
</div>
111+
{% endif %}
112+
110113
{% endset %}
111114

112115
{% switch displayFormat %}

app/views/_includes/medical-information/medical-history/additional-details.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{# app/views/_includes/medical-information/medical-history/additonal-details.njk #}
1+
{# app/views/_includes/medical-information/medical-history/additional-details.njk #}
22

33
{{ textarea({
44
name: "event[medicalHistoryTemp][additionalDetails]",

0 commit comments

Comments
 (0)