Skip to content

Commit f3278cf

Browse files
Add imaging views and bits of medical information
1 parent e70f2df commit f3278cf

File tree

10 files changed

+471
-89
lines changed

10 files changed

+471
-89
lines changed

app/assets/sass/_utils.scss

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
.app-nowrap {
22
white-space: nowrap;
33
}
4+
5+
.app-hidden {
6+
display: none;
7+
opacity: 0;
8+
}
9+
10+
11+
.app-image-card {
12+
opacity: 1;
13+
transition: opacity 0.5s ease-in;
14+
}

app/filters/nunjucks.js

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

33

44

5-
const log = (a, description=false) => {
5+
const log = (a, description=null) => {
66

77
if (description){
88
description = `console.log("${description}:");`
99
}
10-
return `<script>${description}console.log(${JSON.stringify(a, null, '\t')});</script>`
10+
return `<script>${description ? description : ""}console.log(${JSON.stringify(a, null, '\t')});</script>`
1111
}
1212

1313
module.exports = {

app/views/_includes/event-header.njk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@
99

1010
<p class="app-text-grey"><span>NHS Number: {{ participant.medicalInformation.nhsNumber | formatNhsNumber }}</span><span class="nhsuk-u-margin-left-4">SX Number: {{ participant.sxNumber }}</span></p>
1111

12-
<p class="nhsuk-u-margin-bottom-4"><a href="/participants/{{ participant.id }}">View participant record</a></p>
12+
{# <p class="nhsuk-u-margin-bottom-4"><a href="/participants/{{ participant.id }}">View participant record</a></p> #}
13+
14+
<p class="nhsuk-u-margin-bottom-4"><a href="#">View participant record</a></p>

app/views/_templates/layout-app.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
current: true if navActive == "clinics"
4545
},
4646
{
47-
url: "/participants",
47+
url: "#",
4848
label: "Participants",
4949
current: true if navActive == "participants"
5050
},

app/views/dashboard.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ <h1>
3838
heading: "Participants",
3939
headingClasses: "nhsuk-heading-m",
4040
href: "/participants",
41+
href: "#",
4142
descriptionHtml: participantCardDescriptionHtml
4243
}) }}
4344
</li>

app/views/events/mammography/attended-not-screened-reason.html

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
{% extends 'layout-app.html' %}
33

44

5-
{% set pageHeading = "Attended not screened reason" %}
5+
{% set pageHeading = "Screening suspended" %}
66

7-
{% set gridColumn = "nhsuk-grid-column-full" %}
7+
{# {% set gridColumn = "nhsuk-grid-column-full" %} #}
88

99
{% set formAction = './attended-not-screened-answer' %}
1010

@@ -28,6 +28,40 @@ <h1 class="nhsuk-heading-l">
2828
{{ pageHeading }}
2929
</h1>
3030

31+
{{ textarea({
32+
name: "example",
33+
id: "example",
34+
label: {
35+
text: "Details of why screening cannot proceed"
36+
}
37+
}) }}
38+
39+
{{ radios({
40+
idPrefix: "example",
41+
name: "example",
42+
fieldset: {
43+
legend: {
44+
text: "Follow-up action",
45+
classes: "nhsuk-fieldset__legend--s",
46+
isPageHeading: false
47+
}
48+
},
49+
items: [
50+
{
51+
value: "yes",
52+
text: "Reschedule appointment"
53+
},
54+
{
55+
value: "no",
56+
text: "Review with clinician"
57+
},
58+
{
59+
value: "no",
60+
text: "Other"
61+
}
62+
]
63+
}) }}
64+
3165

3266
{{ button({
3367
text: "Save"

app/views/events/mammography/imaging.html

Lines changed: 111 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,41 @@
88

99
{% set formAction = './complete' %}
1010

11+
{% set images = [
12+
{
13+
view: "Cranio-caudal",
14+
side: "Right"
15+
},
16+
{
17+
view: "Dutch oblique",
18+
side: "Right"
19+
},
20+
{
21+
view: "Cranio-caudal",
22+
side: "Left"
23+
},
24+
{
25+
view: "Dutch oblique",
26+
side: "Left"
27+
}
28+
] %}
29+
1130
{# {% set back = {
1231
href: "/clinics/" + clinicId,
1332
text: "Back to clinic"
1433
} %}
1534
#}
35+
{# Loading state macro #}
36+
{% macro loadingSpinner() %}
37+
<div id="loading-spinner" class="">
38+
<div class="nhsuk-loader">
39+
<span class="nhsuk-u-visually-hidden">Loading images...</span>
40+
</div>
41+
<p class="nhsuk-u-margin-top-3 nhsuk-u-secondary-text-color">Waiting for mammogram images...</p>
42+
</div>
43+
{% endmacro %}
44+
45+
1646
{% macro makeImage(params) %}
1747

1848
{% set summaryListHtml %}
@@ -106,7 +136,7 @@
106136
heading: "Image " + params.index,
107137
headingLevel: "3",
108138
descriptionHtml: summaryListHtml,
109-
classes: "nhsuk-u-margin-bottom-3"
139+
classes: "nhsuk-u-margin-bottom-3 app-image-card app-hidden"
110140
}) }}
111141

112142
{% endmacro %}
@@ -124,24 +154,8 @@ <h1 class="nhsuk-heading-l">
124154
{{ pageHeading }}
125155
</h1>
126156

127-
{% set images = [
128-
{
129-
view: "Cranio-caudal",
130-
side: "Right"
131-
},
132-
{
133-
view: "Dutch oblique",
134-
side: "Right"
135-
},
136-
{
137-
view: "Cranio-caudal",
138-
side: "Left"
139-
},
140-
{
141-
view: "Dutch oblique",
142-
side: "Left"
143-
}
144-
] %}
157+
{# Show loading spinner initially #}
158+
{{ loadingSpinner() }}
145159

146160
<div class="nhsuk-u-margin-bottom-4">
147161
{% for image in images %}
@@ -154,46 +168,88 @@ <h1 class="nhsuk-heading-l">
154168
{% endfor %}
155169
</div>
156170

157-
<div class="nhsuk-grid-row">
158-
<div class="nhsuk-grid-column-two-thirds">
159-
{% set reasonHtml %}
160-
{{ textarea({
161-
name: "partialMammographyReason",
162-
id: "partialMammographyReason",
163-
label: {
164-
text: "Reason for partial mammography"
165-
}
166-
}) }}
167-
{% endset %}
168-
169-
{{ checkboxes({
170-
idPrefix: "partialMammography",
171-
name: "partialMammography",
172-
classes: "nhsuk-u-margin-bottom-5",
173-
_fieldset: {
174-
legend: {
175-
text: "How would you like to be contacted?",
176-
classes: "nhsuk-fieldset__legend--l",
177-
isPageHeading: true
178-
}
179-
},
180-
items: [
181-
{
182-
value: "partial",
183-
text: "Partial mammography only",
184-
185-
conditional: {
186-
html: reasonHtml
171+
<div class='app-hidden' id="imaging-form">
172+
<div class="nhsuk-grid-row">
173+
<div class="nhsuk-grid-column-two-thirds">
174+
{% set reasonHtml %}
175+
{{ textarea({
176+
name: "partialMammographyReason",
177+
id: "partialMammographyReason",
178+
label: {
179+
text: "Reason for partial mammography"
187180
}
188-
}
189-
]
190-
}) }}
181+
}) }}
182+
{% endset %}
183+
184+
{{ checkboxes({
185+
idPrefix: "partialMammography",
186+
name: "partialMammography",
187+
classes: "nhsuk-u-margin-bottom-5",
188+
_fieldset: {
189+
legend: {
190+
text: "How would you like to be contacted?",
191+
classes: "nhsuk-fieldset__legend--l",
192+
isPageHeading: true
193+
}
194+
},
195+
items: [
196+
{
197+
value: "partial",
198+
text: "Partial mammography only",
199+
200+
conditional: {
201+
html: reasonHtml
202+
}
203+
}
204+
]
205+
}) }}
191206

192-
{{ button({
193-
text: "Confirm all images and complete imaging"
194-
}) }}
207+
{{ button({
208+
text: "Confirm all images and complete imaging"
209+
}) }}
210+
</div>
195211
</div>
196212
</div>
197213

214+
<p><a href="./attended-not-screened-reason">Screening cannot proceed</a></p>
215+
198216
{% endblock %}
199217

218+
{% block pageScripts %}
219+
<script>
220+
document.addEventListener('DOMContentLoaded', () => {
221+
const loadingSpinner = document.getElementById('loading-spinner')
222+
const imageCards = document.querySelectorAll('.app-image-card')
223+
const imagingForm = document.getElementById('imaging-form')
224+
let lastLoadTime = 0
225+
226+
// Hide spinner after initial delay
227+
setTimeout(() => {
228+
loadingSpinner.classList.add('app-hidden')
229+
230+
// Show each image sequentially
231+
imageCards.forEach((card, index) => {
232+
const loadTime = 1000 + (index * 1600)
233+
234+
setTimeout(() => {
235+
card.classList.remove('app-hidden')
236+
// Add fade-in effect
237+
card.style.opacity = 0
238+
card.style.transition = 'opacity 0.5s ease-in'
239+
setTimeout(() => card.style.opacity = 1, 50)
240+
241+
// Show form after first image is loaded
242+
if (index === 0) {
243+
setTimeout(() => {
244+
imagingForm.classList.remove('app-hidden')
245+
imagingForm.style.opacity = 0
246+
imagingForm.style.transition = 'opacity 0.5s ease-in'
247+
setTimeout(() => imagingForm.style.opacity = 1, 50)
248+
}, 400) // Show form slightly after first image
249+
}
250+
}, loadTime)
251+
})
252+
}, 2000)
253+
})
254+
</script>
255+
{% endblock %}

0 commit comments

Comments
 (0)