Skip to content

Commit d02ecf5

Browse files
Add fullNameAndRelationship to parent model
1 parent 2a75ac2 commit d02ecf5

6 files changed

Lines changed: 16 additions & 9 deletions

File tree

app/locales/en.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,8 +1217,7 @@ export const en = {
12171217
},
12181218
invite: {
12191219
label: 'Send consent request',
1220-
success:
1221-
'Consent request sent to {{parent.formatted.fullNameAndRelationship}}'
1220+
success: 'Consent request sent to {{parent.fullNameAndRelationship}}'
12221221
},
12231222
replies: {
12241223
pending: 'Consent requests',
@@ -1390,7 +1389,7 @@ export const en = {
13901389
label: 'Parent',
13911390
title: {
13921391
new: 'Details for parent or guardian',
1393-
edit: 'Details for {{parent.formatted.fullNameAndRelationship}}'
1392+
edit: 'Details for {{parent.fullNameAndRelationship}}'
13941393
},
13951394
notify: {
13961395
title:

app/models/consent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class Consent extends Reply {
2525
return {
2626
summary: formatLinkWithSecondaryText(
2727
this.uri,
28-
this.parent.formatted.fullNameAndRelationship,
28+
this.parent.fullNameAndRelationship,
2929
`for ${this.child.fullName}`
3030
)
3131
}

app/models/parent.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ export class Parent {
4747
}
4848
}
4949

50+
/**
51+
* Get full name and relationship to child
52+
*
53+
* @returns {string} Full name and relationship
54+
*/
55+
get fullNameAndRelationship() {
56+
return formatParent(this, false)
57+
}
58+
5059
/**
5160
* Get formatted values
5261
*
@@ -57,7 +66,6 @@ export class Parent {
5766
contactPreference:
5867
this.contactPreferenceDetails || this.contactPreference,
5968
fullName: this.fullName || 'Name unknown',
60-
fullNameAndRelationship: formatParent(this, false),
6169
relationship: formatOther(this.relationshipOther, this.relationship)
6270
}
6371
}

app/models/patient-session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ export class PatientSession {
213213
return this.responses
214214
.filter((reply) => !reply.invalid)
215215
.filter((reply) => reply.declined)
216-
.flatMap((reply) => reply.parent.formatted.fullNameAndRelationship)
216+
.flatMap((reply) => reply.parent.fullNameAndRelationship)
217217
}
218218

219219
/**

app/views/patient-session/_consent.njk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
{{ summaryList({
5252
card: {
5353
classes: "app-card--compact app-card--offset",
54-
heading: reply.formatted.fullNameAndRelationship,
54+
heading: reply.fullNameAndRelationship,
5555
headingLevel: 5,
5656
href: reply.uri if reply.delivered,
5757
clickable: true if reply.delivered
@@ -83,7 +83,7 @@
8383
{{ summaryList({
8484
card: {
8585
classes: "app-card--compact app-card--offset",
86-
heading: parent.formatted.fullNameAndRelationship,
86+
heading: parent.fullNameAndRelationship,
8787
headingLevel: 5
8888
},
8989
rows: summaryRows(parent, {

app/views/reply/form/follow-up.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
html: summaryList({
1414
rows: summaryRows(reply, {
1515
parent: {
16-
value: reply.parent.formatted.fullNameAndRelationship
16+
value: reply.parent.fullNameAndRelationship
1717
},
1818
email: {
1919
label: __("parent.email.label"),

0 commit comments

Comments
 (0)