Skip to content

Commit 4391da6

Browse files
Update first page of Lists (#388)
This updates the first page of the Lists feature with 2 states: * an empty state containing no lists and a How it works section * where there are 2 lists, and "How it works" is collapsed into a Details component ## Screenshots ### Empty state ![Screenshot 2025-07-07 at 13 03 10](https://github.com/user-attachments/assets/6a4e267b-e391-45d0-8e81-68dc2942fff6) ### State with some lists ![Screenshot 2025-07-07 at 13 03 47](https://github.com/user-attachments/assets/37821e77-e978-4702-b5fc-21e77d07f137)
1 parent e8c9884 commit 4391da6

File tree

3 files changed

+51
-14
lines changed

3 files changed

+51
-14
lines changed

app/routes/lists.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
module.exports = router => {
22

33

4+
router.get('/lists', (req, res) => {
5+
6+
const currentOrganisation = res.locals.currentOrganisation;
7+
const lists = currentOrganisation.lists || []
8+
9+
res.render('lists/index', {
10+
lists
11+
})
12+
13+
})
14+
15+
router.post('/lists/add-numbers', (req, res) => {
16+
17+
const currentOrganisation = res.locals.currentOrganisation;
18+
currentOrganisation.lists ||= []
19+
20+
// This bit isn’t working yet so faked for now.
21+
currentOrganisation.lists.push({
22+
siteCode: "TODO"
23+
})
24+
25+
res.redirect('/lists/list')
26+
27+
})
428

529
}

app/views/lists/add-nhs-numbers.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
}) }}
2020
{% endif %}
2121

22+
<form action="/lists/add-numbers" method="post" novalidate>
23+
2224
<h1 class="nhsuk-heading-l">Add a list of NHS numbers</h1>
2325

2426
<p class="nhsuk-body-m">Copy and paste NHS numbers from a spreadsheet or another source.</p>
@@ -43,10 +45,9 @@ <h1 class="nhsuk-heading-l">Add a list of NHS numbers</h1>
4345

4446

4547
{{ button({
46-
text: "Confirm",
47-
href: "/lists/list"
48+
text: "Confirm"
4849
}) }}
49-
50+
</form>
5051

5152
{% endblock %}
5253

app/views/lists/index.html

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,34 @@ <h1 class="nhsuk-heading-l">Lists</h1>
1717

1818
<p class="nhsuk-body-m">To save time when you record vaccinations, you can add a list of NHS numbers.</p>
1919

20-
<h2 class="nhsuk-heading-m">How it works</h2>
21-
22-
<p>Add a list of NHS numbers and we will match them to patient details.</p>
23-
<p>This means you will not have to input each patient's NHS number when you record vaccinations.</p>
24-
{{ button({
25-
text: "Add a list",
26-
href: "/lists/team"
20+
{% set howItWorksHtml %}
21+
<p>Add a list of NHS numbers and we will match them to patient details.</p>
22+
<p>This means you will not have to input each patient's NHS number when you record vaccinations.</p>
23+
{% endset %}
24+
25+
{% if (lists | length) > 0 %}
26+
{{ details({
27+
text: "How it works",
28+
html: howItWorksHtml
2729
}) }}
2830

29-
<br><br>
31+
<ul class="nhsuk-list xnhsuk-u-margin-top-6 nhsuk-u-margin-bottom-6">
32+
<li><a href="/lists/team-lists">Anne Ward Maternity Unit</a></li>
33+
<li><a href="/lists/team-lists">St Mary’s Hospital </a></li>
34+
</ul>
35+
36+
{% else %}
37+
<h2 class="nhsuk-heading-m">How it works</h2>
38+
39+
{{ howItWorksHtml | safe }}
3040

31-
<h2 class="nhsuk-heading-m">Sites or teams</h2>
41+
{% endif %}
3242

33-
<p class="nhsuk-body-m"><a href="/lists/team-lists">Anne Ward Maternity Unit</a></p>
3443

35-
<p class="nhsuk-body-m"><a href="/lists/team-lists">St Mary’s Hospital</a></p>
44+
{{ button({
45+
text: "Add a list",
46+
href: "/lists/team"
47+
}) }}
3648

3749
</div>
3850
</div>

0 commit comments

Comments
 (0)