Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@hapi/boom": "^9.1.1",
"@hapi/hapi": "^20.0.1",
"@hapi/inert": "^6.0.3",
"@opencrvs/toolkit": "1.8.1-rc.a5eecfe",
"@opencrvs/toolkit": "1.8.1-rc.4958667",
"@types/chalk": "^2.2.0",
"@types/csv2json": "^1.4.0",
"@types/fhir": "^0.0.30",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/api/notification/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,13 +297,13 @@ const RequestDeathDeclarationAction = {
createdByRole: 'LOCAL_REGISTRAR',
createdAtLocation: '9e069dda-0d83-4f67-a4f2-9adbf5658e2e' as unknown as UUID,
declaration: {
'spouse.age': '41',
'spouse.age': { age: '41', asOfDate: '2025-08-19' },
'spouse.name': {
firstname: 'Toki',
surname: 'Kozuki',
middlename: ''
},
'deceased.age': '31',
'deceased.age': { age: '31', asOfDate: '2025-08-19' },
'deceased.name': {
firstname: 'Oden',
surname: 'Kozuki',
Expand Down Expand Up @@ -353,13 +353,13 @@ const DeathDeclarationAction = {
createdByRole: 'LOCAL_REGISTRAR',
createdAtLocation: '9e069dda-0d83-4f67-a4f2-9adbf5658e2e' as unknown as UUID,
declaration: {
'spouse.age': '41',
'spouse.age': { age: '41', asOfDate: '2025-08-19' },
'spouse.name': {
firstname: 'Toki',
surname: 'Kozuki',
middlename: ''
},
'deceased.age': '31',
'deceased.age': { age: '31', asOfDate: '2025-08-19' },
'deceased.name': {
firstname: 'Oden',
surname: 'Kozuki',
Expand Down
13 changes: 12 additions & 1 deletion src/form/v2/birth/forms/pages/father.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,15 @@ export const father = defineFormPage({
},
{
id: 'father.age',
type: FieldType.TEXT,
type: FieldType.AGE,
required: true,
label: {
defaultMessage: 'Age of father',
description: 'This is the label for the field',
id: 'event.birth.action.declare.form.section.father.field.age.label'
},
configuration: {
asOfDate: field('child.dob'),
postfix: {
defaultMessage: 'years',
description: 'This is the postfix for age field',
Expand All @@ -209,6 +210,16 @@ export const father = defineFormPage({
requireFatherDetails
)
}
],
validation: [
{
validator: field('father.age').asAge().isBetween(12, 120),
message: {
defaultMessage: 'Age must be between 12 and 120',
description: 'Error message for invalid age',
id: 'event.action.declare.form.section.person.field.age.error'
}
}
]
},
{
Expand Down
13 changes: 12 additions & 1 deletion src/form/v2/birth/forms/pages/informant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,15 @@ export const informant = defineFormPage({
},
{
id: 'informant.age',
type: FieldType.TEXT,
type: FieldType.AGE,
required: true,
label: {
defaultMessage: 'Age of informant',
description: 'This is the label for the field',
id: 'event.birth.action.declare.form.section.informant.field.age.label'
},
configuration: {
asOfDate: field('child.dob'),
postfix: {
defaultMessage: 'years',
description: 'This is the postfix for age field',
Expand All @@ -248,6 +249,16 @@ export const informant = defineFormPage({
)
}
],
validation: [
{
validator: field('informant.age').asAge().isBetween(12, 120),
message: {
defaultMessage: 'Age must be between 12 and 120',
description: 'Error message for invalid age',
id: 'event.action.declare.form.section.person.field.age.error'
}
}
],
parent: field('informant.relation')
},
{
Expand Down
13 changes: 12 additions & 1 deletion src/form/v2/birth/forms/pages/mother.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,15 @@ export const mother = defineFormPage({
},
{
id: 'mother.age',
type: FieldType.TEXT,
type: FieldType.AGE,
required: true,
label: {
defaultMessage: 'Age of mother',
description: 'This is the label for the field',
id: 'event.birth.action.declare.form.section.mother.field.age.label'
},
configuration: {
asOfDate: field('child.dob'),
postfix: {
defaultMessage: 'years',
description: 'This is the postfix for age field',
Expand All @@ -206,6 +207,16 @@ export const mother = defineFormPage({
requireMotherDetails
)
}
],
validation: [
{
validator: field('mother.age').asAge().isBetween(12, 120),
message: {
defaultMessage: 'Age must be between 12 and 120',
description: 'Error message for invalid age',
id: 'event.action.declare.form.section.person.field.age.error'
}
}
]
},
{
Expand Down
13 changes: 12 additions & 1 deletion src/form/v2/death/forms/pages/deceased.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,15 @@ export const deceased = defineFormPage({
},
{
id: `deceased.age`,
type: FieldType.TEXT,
type: FieldType.AGE,
required: true,
label: {
defaultMessage: `Age of deceased`,
description: 'This is the label for the field',
id: 'event.death.action.declare.form.section.deceased.field.age.label'
},
configuration: {
asOfDate: field('eventDetails.date'),
postfix: {
defaultMessage: 'years',
description: 'This is the postfix for age field',
Expand All @@ -170,6 +171,16 @@ export const deceased = defineFormPage({
type: ConditionalType.SHOW,
conditional: field(`deceased.dobUnknown`).isEqualTo(true)
}
],
validation: [
{
validator: field('deceased.age').asAge().isBetween(0, 120),
message: {
defaultMessage: 'Age must be between 0 and 120',
description: 'Error message for invalid age',
id: 'event.death.action.declare.form.section.deceased.field.age.error'
}
}
]
},
{
Expand Down
13 changes: 12 additions & 1 deletion src/form/v2/death/forms/pages/informant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,15 @@ export const informant = defineFormPage({
},
{
id: 'informant.age',
type: FieldType.TEXT,
type: FieldType.AGE,
required: true,
label: {
defaultMessage: 'Age of informant',
description: 'This is the label for the field',
id: 'event.death.action.declare.form.section.informant.field.age.label'
},
configuration: {
asOfDate: field('eventDetails.date'),
postfix: {
defaultMessage: 'years',
description: 'This is the postfix for age field',
Expand All @@ -250,6 +251,16 @@ export const informant = defineFormPage({
)
}
],
validation: [
{
validator: field('informant.age').asAge().isBetween(12, 120),
message: {
defaultMessage: 'Age must be between 12 and 120',
description: 'Error message for invalid age',
id: 'event.action.declare.form.section.person.field.age.error'
}
}
],
parent: field('informant.relation')
},
{
Expand Down
13 changes: 12 additions & 1 deletion src/form/v2/death/forms/pages/spouse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,15 @@ export const spouse = defineFormPage({
},
{
id: 'spouse.age',
type: FieldType.TEXT,
type: FieldType.AGE,
required: true,
label: {
defaultMessage: 'Age of spouse',
description: 'This is the label for the field',
id: 'event.death.action.declare.form.section.spouse.field.age.label'
},
configuration: {
asOfDate: field('eventDetails.date'),
postfix: {
defaultMessage: 'years',
description: 'This is the postfix for age field',
Expand All @@ -196,6 +197,16 @@ export const spouse = defineFormPage({
requireSpouseDetails
)
}
],
validation: [
{
validator: field('spouse.age').asAge().isBetween(12, 120),
message: {
defaultMessage: 'Age must be between 12 and 120',
description: 'Error message for invalid age',
id: 'event.action.declare.form.section.person.field.age.error'
}
}
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/translations/client.csv
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ error.userListError,Error message when user list loads fails,Failed to load user
error.weAreTryingToFixThisError,Error description,This page could not be found,"Ce n'est pas vous, c'est nous. C'est notre faute."
errors.notAssigned,User not assigned error toast message,You've been unassigned from the event,Vous avez été désassigné de l'événement
errors.somethingWentWrong,Error toast message for general errors,Something went wrong. Please try again,Une erreur s'est produite. Veuillez réessayer
event.action.declare.form.section.person.field.age.error,Error message for invalid age,Age must be between 12 and 120,L'auteur doit avoir entre 12 et 120 ans
event.action.notAvailableForEvent,Shown when user tries to perform an action that is not available for the event,The action you're trying to perform is not available for this event anymore,L'action que vous essayez d'effectuer n'est plus disponible pour cet événement
event.action.outbox-retry.label,Label for retry button for outbox,Retry,Réessayer
event.action.review-correction.label,Label for review correction button in dropdown menu,Review,Revoir
Expand Down Expand Up @@ -939,6 +940,7 @@ event.death.action.declare.form.review.title,Title of the form to show in review
event.death.action.declare.form.section.deceased.field.address.label,This is the label for the field,Usual place of residence,Lieu de résidence habituel
event.death.action.declare.form.section.deceased.field.addressHelper.label,This is the label for the field,Usual place of residence,Lieu de résidence habituel
event.death.action.declare.form.section.deceased.field.age.checkbox.label,This is the label for the field,Exact date of birth unknown,Date exacte de naissance inconnue
event.death.action.declare.form.section.deceased.field.age.error,Error message for invalid age,Age must be between 0 and 120,L'auteur doit avoir entre 0 et 120 ans
event.death.action.declare.form.section.deceased.field.age.label,This is the label for the field,Age of deceased,Âge du défunt
event.death.action.declare.form.section.deceased.field.age.postfix,This is the postfix for age field,years,ans
event.death.action.declare.form.section.deceased.field.deathLocation.label,This is the label for the field,Health Institution,Établissement de santé
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -834,10 +834,10 @@
dependencies:
"@octokit/openapi-types" "^18.0.0"

"@opencrvs/[email protected].a5eecfe":
version "1.8.1-rc.a5eecfe"
resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.8.1-rc.a5eecfe.tgz#0aa5f0655c0ed5da8a1be6e0ccb8e3f4eac10e41"
integrity sha512-fynKGOtPmFWPtUcU65IaGrJzzL5i8nOWrli5MTHgRaTyMTZa0xD8sR+J5Ot1R4Ak1V+oMTd5eEPz8sJVx0VplQ==
"@opencrvs/[email protected].4958667":
version "1.8.1-rc.4958667"
resolved "https://registry.yarnpkg.com/@opencrvs/toolkit/-/toolkit-1.8.1-rc.4958667.tgz#a97384f813b2f05c6def224380a507f2336b84a7"
integrity sha512-OZpSEquSi1p5P06iCVHik+uZQbZqcAXMz3s8qVGSMAN1/NAL9B7d3irTeqi7jf1GBMxhXYZzqYP73mfnksVlnQ==
dependencies:
"@trpc/client" "11.4.3"
"@trpc/server" "11.4.3"
Expand Down
Loading