Skip to content

Commit e094b8a

Browse files
Use dynamic data
1 parent 49f28cf commit e094b8a

File tree

7 files changed

+149
-109
lines changed

7 files changed

+149
-109
lines changed

app/data/organisations.js

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6002,5 +6002,81 @@ module.exports = [
60026002
type: 'Community Pharmacy',
60036003
status: 'Active',
60046004
"region": "Y61"
6005+
},
6006+
{
6007+
id: 'FA02S',
6008+
name: 'Addlestone Pharmacy',
6009+
address: {
6010+
line1: '92a Station Road',
6011+
town: 'Addlestone',
6012+
postcode: 'KT15 2AD'
6013+
},
6014+
type: 'Community Pharmacy',
6015+
status: 'Applied',
6016+
region: "Y61",
6017+
appliedOn: "2015-04-12",
6018+
application: {
6019+
firstName: "Francis",
6020+
lastName: "Blue",
6021+
6022+
phone: "01234 567890"
6023+
}
6024+
},
6025+
{
6026+
id: 'FVJ99',
6027+
name: 'Pharmacy 4U',
6028+
address: {
6029+
line1: '7 London Road',
6030+
town: 'Leeds',
6031+
postcode: 'LS17 9NP'
6032+
},
6033+
type: 'Community Pharmacy',
6034+
status: 'Applied',
6035+
region: "Y61",
6036+
appliedOn: "2015-04-15",
6037+
application: {
6038+
firstName: "James",
6039+
lastName: "Brown",
6040+
6041+
phone: "01234 567890"
6042+
}
6043+
},
6044+
{
6045+
id: 'PDL93',
6046+
name: 'Silverfields Chemists',
6047+
address: {
6048+
line1: '28 High Street',
6049+
town: 'Bradford',
6050+
postcode: 'B63 8PX'
6051+
},
6052+
type: 'Community Pharmacy',
6053+
status: 'Applied',
6054+
region: "Y61",
6055+
appliedOn: "2015-04-13",
6056+
application: {
6057+
firstName: "Jason",
6058+
lastName: "Green",
6059+
6060+
phone: "01234 567890"
6061+
}
6062+
},
6063+
{
6064+
id: 'JF93',
6065+
name: 'Village Chemist',
6066+
address: {
6067+
line1: 'The Parada',
6068+
town: 'Greenfield',
6069+
postcode: 'P35 8NS'
6070+
},
6071+
type: 'Community Pharmacy',
6072+
status: 'Applied',
6073+
region: "Y61",
6074+
appliedOn: "2015-04-02",
6075+
application: {
6076+
firstName: "Elizabeth",
6077+
lastName: "Black",
6078+
6079+
phone: "01234 567890"
6080+
}
60056081
}
60066082
]

app/routes/regions.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ module.exports = router => {
1212
})
1313
})
1414

15+
16+
router.get('/regions/awaiting-approval', (req, res) => {
17+
const data = req.session.data
18+
const organisations = data.organisations.filter((organisation) => (organisation.region === "Y61") && (organisation.status == "Applied"));
19+
20+
res.render('regions/awaiting-approval', {
21+
organisations
22+
})
23+
})
24+
1525
router.get('/regions/organisations/closed', (req, res) => {
1626
const data = req.session.data
1727
const organisations = data.organisations.filter((organisation) => (organisation.region === "Y61" && organisation.status == "Closed"))
@@ -21,6 +31,33 @@ module.exports = router => {
2131
})
2232
})
2333

34+
router.get('/regions/review/:id', (req, res) => {
35+
const data = req.session.data
36+
const organisation = data.organisations.find((org) => org.id === req.params.id)
37+
38+
res.render('regions/organisation-request', {
39+
organisation
40+
})
41+
})
42+
43+
router.get('/regions/accept/:id', (req, res) => {
44+
const data = req.session.data
45+
const organisation = data.organisations.find((org) => org.id === req.params.id)
46+
47+
res.render('regions/accept', {
48+
organisation
49+
})
50+
})
51+
52+
router.get('/regions/reject/:id', (req, res) => {
53+
const data = req.session.data
54+
const organisation = data.organisations.find((org) => org.id === req.params.id)
55+
56+
res.render('regions/reject', {
57+
organisation
58+
})
59+
})
60+
2461
// Inviting an organisation
2562
router.post('/regions/add', (req, res) => {
2663

app/views/regions/_email-reject.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="app-email-preview">
22

3-
<p>Dear {{ data.firstName }} {{ data.lastName }},</p>
3+
<p>Dear {{ organisation.application.firstName }} {{ organisation.application.lastName }},</p>
44
<p>Your NHS region has not approved your application to use the Record a vaccination service at Leeds Teaching Hospitals.</p>
55

66
<p>This may be due to:</p>

app/views/regions/accept.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
<div class="nhsuk-grid-row">
2222
<div class="nhsuk-grid-column-two-thirds">
2323

24-
<h1 class="nhsuk-heading-l">Approve Leeds Teaching Hospitals</h1>
24+
<h1 class="nhsuk-heading-l">Approve {{ organisation.name }}</h1>
2525

26-
<p>Confirm that Leeds Teaching Hospitals can use the Record a vaccination service.</p>
26+
<p>Confirm that {{ organisation.name }} can use the Record a vaccination service.</p>
2727

28-
<p>This email will be sent to [applicant's email] at Leeds Teaching Hospitals.</p>
28+
<p>This email will be sent to {{ organisation.application.email }} at {{ organisation.name }}.</p>
2929

3030
{% include "regions/_email-preview.html" %}
3131

app/views/regions/awaiting-approval.html

Lines changed: 18 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -53,92 +53,29 @@ <h1 class="nhsuk-heading-l">Awaiting approval</h1>
5353
</tr>
5454
</thead>
5555
<tbody class="nhsuk-table__body">
56-
<tr role="row" class="nhsuk-table__row">
57-
<td role="cell" class="nhsuk-table__cell">
58-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/organisation-request">Addlestone Pharmacy</a>
59-
</td>
60-
<td role="cell" class="nhsuk-table__cell">
61-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">ODS code </span>FAE02S
62-
</td>
63-
<td role="cell" class="nhsuk-table__cell">
64-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Type</span>NHS Trust
65-
</td>
66-
<td role="cell" class="nhsuk-table__cell">
67-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Date requested</span>4 April 2025
56+
57+
{% for organisation in organisations | sort(true, true, "appliedOn") %}
58+
<tr role="row" class="nhsuk-table__row">
59+
<td role="cell" class="nhsuk-table__cell">
60+
<a href="/regions/review/{{ organisation.id }}">{{ organisation.name }}</a>
6861
</td>
6962
<td role="cell" class="nhsuk-table__cell">
70-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/accept">Approve</a>
63+
{{ organisation.id }}
7164
</td>
7265
<td role="cell" class="nhsuk-table__cell">
73-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/reject">Reject</a>
66+
{{ organisation.type }}
7467
</td>
75-
76-
</tr>
77-
</thead>
78-
<tbody class="nhsuk-table__body">
79-
<tr role="row" class="nhsuk-table__row">
80-
<td role="cell" class="nhsuk-table__cell">
81-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/organisation-request">Leeds Teaching Hospitals </a>
82-
</td>
83-
<td role="cell" class="nhsuk-table__cell">
84-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">ODS code </span>RR8
85-
</td>
86-
<td role="cell" class="nhsuk-table__cell">
87-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Type</span>NHS Trust
88-
</td>
89-
<td role="cell" class="nhsuk-table__cell">
90-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Date requested</span>3 April 2025
91-
</td>
92-
<td role="cell" class="nhsuk-table__cell">
93-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/accept">Approve</a>
94-
</td>
95-
<td role="cell" class="nhsuk-table__cell">
96-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/reject">Reject</a>
97-
</td>
98-
99-
100-
101-
</tr>
102-
<tr role="row" class="nhsuk-table__row">
103-
<td role="cell" class="nhsuk-table__cell">
104-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/organisation-request/{{ organisation.id }}">Apex Prime Care</a>
105-
</td>
106-
<td role="cell" class="nhsuk-table__cell">
107-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">ODS code</span>VN0J3
108-
</td>
109-
<td role="cell" class="nhsuk-table__cell">
110-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Type</span>NHS Trust
111-
</td>
112-
<td role="cell" class="nhsuk-table__cell">
113-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Date requested</span>1 April 2025
114-
</td>
115-
<td role="cell" class="nhsuk-table__cell">
116-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/accept">Approve</a>
117-
</td>
118-
<td role="cell" class="nhsuk-table__cell">
119-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/reject">Reject</a>
120-
</td>
121-
</tr>
122-
<tr role="row" class="nhsuk-table__row">
123-
<td role="cell" class="nhsuk-table__cell">
124-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/organisations/{{ organisation.id }}">Oxford Road Pharmacy</a>
125-
</td>
126-
<td role="cell" class="nhsuk-table__cell">
127-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">ODS code</span>PP34
128-
</td>
129-
<td role="cell" class="nhsuk-table__cell">
130-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Type</span>Community Pharmacy
131-
</td>
132-
<td role="cell" class="nhsuk-table__cell">
133-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Date requested</span>28 March 2025
134-
</td>
135-
<td role="cell" class="nhsuk-table__cell">
136-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/accept">Approve</a>
137-
</td>
138-
<td role="cell" class="nhsuk-table__cell">
139-
<span class="nhsuk-table-responsive__heading" aria-hidden="true">Organisation </span><a href="/regions/reject">Reject</a>
140-
</td>
141-
68+
<td role="cell" class="nhsuk-table__cell">
69+
{{ organisation.appliedOn | govukDate }}
70+
</td>
71+
<td role="cell" class="nhsuk-table__cell">
72+
<a href="/regions/accept/{{ organisation.id }}">Approve</a>
73+
</td>
74+
<td role="cell" class="nhsuk-table__cell">
75+
<a href="/regions/reject/{{ organisation.id }}">Reject</a>
76+
</td>
77+
</tr>
78+
{% endfor %}
14279
</tbody>
14380
</table>
14481

app/views/regions/organisation-request.html

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,52 +15,42 @@
1515
}) }}
1616
{% endblock %}
1717

18-
19-
20-
{% set organisationSettings = currentUser.organisations | findById(currentOrganisation.id) %}
21-
2218
{% block content %}
2319
<div class="nhsuk-grid-row">
2420
<div class="nhsuk-grid-column-two-thirds">
25-
<h1 class="nhsuk-heading-xl"> Addlestone Pharmacy</h1>
21+
<h1 class="nhsuk-heading-l">{{ organisation.name }}</h1>
2622
<dl class="nhsuk-summary-list">
2723

2824
<div class="nhsuk-summary-list__row">
2925
<dt class="nhsuk-summary-list__key">
3026
ODS code
3127
</dt>
3228
<dd class="nhsuk-summary-list__value">
33-
FAE02S
29+
{{ organisation.id }}
3430
</dd>
3531
</div>
36-
37-
38-
39-
40-
41-
4232
<div class="nhsuk-summary-list__row">
4333
<dt class="nhsuk-summary-list__key">
4434
Address
4535
</dt>
4636
<dd class="nhsuk-summary-list__value">
47-
92a station Road<br>Addlestone<br>Kent<br> KT15 2AD
37+
{{ organisation.address.line1 }}, {{ organisation.address.town }}, {{ organisation.address.postcode }}
4838
</dd>
49-
39+
5040
<dd class="nhsuk-summary-list__actions">
51-
41+
5242
</dd>
53-
43+
5444
</div>
55-
45+
5646

5747

5848
<div class="nhsuk-summary-list__row">
5949
<dt class="nhsuk-summary-list__key">
6050
Email
6151
</dt>
6252
<dd class="nhsuk-summary-list__value">
63-
53+
{{ organisation.application.email }}
6454
</dd>
6555
</div>
6656

@@ -69,7 +59,7 @@ <h1 class="nhsuk-heading-xl"> Addlestone Pharmacy</h1>
6959
Phone
7060
</dt>
7161
<dd class="nhsuk-summary-list__value">
72-
07712 348902
62+
{{ organisation.application.phone }}
7363
</dd>
7464
</div>
7565

@@ -78,10 +68,10 @@ <h1 class="nhsuk-heading-xl"> Addlestone Pharmacy</h1>
7868
Date requested
7969
</dt>
8070
<dd class="nhsuk-summary-list__value">
81-
4 April 2025
71+
{{ organisation.appliedOn | govukDate }}
8272
</dd>
8373
</div>
84-
74+
8575

8676
</div>
8777
</div>

app/views/regions/reject.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
<div class="nhsuk-grid-row">
2020
<div class="nhsuk-grid-column-two-thirds">
2121

22-
<h1 class="nhsuk-heading-l">Reject Leeds Teaching Hospitals</h1>
22+
<h1 class="nhsuk-heading-l">Reject {{ organisation.name }}</h1>
2323

24-
<p>Confirm that you have not approved Leeds Teaching Hospitals to use the Record a vaccination service.</p>
24+
<p>Confirm that you have not approved {{ organisation.name }} to use the Record a vaccination service.</p>
2525

26-
<p>This email will be sent to [applicant's email] at Leeds Teaching Hospitals.</p>
26+
<p>This email will be sent to {{ organisation.application.email }} at Leeds Teaching Hospitals.</p>
2727

2828

2929
{% include "regions/_email-reject.html" %}

0 commit comments

Comments
 (0)