Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added example values for form filler tool #767

Closed
wants to merge 9 commits into from
Closed
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
11 changes: 10 additions & 1 deletion src/form/addresses/address-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export function getAddressLocationSelect({
required: true,
initialValue: '',
validator: [],
exampleValues: ['Sulaka', 'Ilanga'],
placeholder: {
defaultMessage: 'Select',
description: 'Placeholder text for a select',
Expand All @@ -129,7 +130,7 @@ export function getAddressLocationSelect({
useCase,
fieldName,
fhirLineArrayPosition,
isLowestAdministrativeLevel
isLowestAdministrativeLevel
})
}
}
Expand Down Expand Up @@ -281,6 +282,7 @@ export function getAddressFields(
options: {
resource: 'countries'
},
exampleValues: ['Farajaland'],
conditionals: isUseCaseForPlaceOfEvent(useCase)
? getPlaceOfEventConditionals(section, 'country', useCase)
: getAddressConditionals(section, 'country', useCase),
Expand Down Expand Up @@ -311,6 +313,7 @@ export function getAddressFields(
? useCase
: `${useCase}Address`,
validator: [],
exampleValues: ['Rural'],
conditionals: isUseCaseForPlaceOfEvent(useCase)
? getPlaceOfEventConditionals(section, 'ruralOrUrban', useCase)
: getAddressConditionals(section, 'ruralOrUrban', useCase),
Expand All @@ -337,6 +340,7 @@ export function getAddressFields(
required: false,
initialValue: '',
validator: [],
exampleValues: ['Afue'],
dependency: `district${sentenceCase(useCase)}${sentenceCase(section)}`,
conditionals: isUseCaseForPlaceOfEvent(useCase)
? getPlaceOfEventConditionals(section, 'urban', useCase)
Expand Down Expand Up @@ -365,6 +369,7 @@ export function getAddressFields(
required: false,
initialValue: '',
validator: [],
exampleValues: ['Sulaka'],
dependency: `district${sentenceCase(useCase)}${sentenceCase(section)}`,
conditionals: isUseCaseForPlaceOfEvent(useCase)
? getPlaceOfEventConditionals(section, 'urban', useCase)
Expand Down Expand Up @@ -396,6 +401,7 @@ export function getAddressFields(
required: false,
initialValue: '',
validator: [],
exampleValues: ['Afue street 12'],
dependency: `district${sentenceCase(useCase)}${sentenceCase(section)}`,
conditionals: isUseCaseForPlaceOfEvent(useCase)
? getPlaceOfEventConditionals(section, 'urban', useCase)
Expand Down Expand Up @@ -427,6 +433,7 @@ export function getAddressFields(
required: false,
initialValue: '',
validator: [],
exampleValues: ['123456789'],
dependency: `district${sentenceCase(useCase)}${sentenceCase(section)}`,
conditionals: isUseCaseForPlaceOfEvent(useCase)
? getPlaceOfEventConditionals(section, 'urban', useCase)
Expand Down Expand Up @@ -456,6 +463,7 @@ export function getAddressFields(
required: false,
initialValue: '',
validator: [],
exampleValues: ['00450'],
dependency: `district${sentenceCase(useCase)}${sentenceCase(section)}`,
conditionals: isUseCaseForPlaceOfEvent(useCase)
? getPlaceOfEventConditionals(section, 'urban', useCase)
Expand Down Expand Up @@ -484,6 +492,7 @@ export function getAddressFields(
required: false,
initialValue: '',
validator: [],
exampleValues: ['Afue'],
dependency: `district${sentenceCase(useCase)}${sentenceCase(section)}`,
conditionals: isUseCaseForPlaceOfEvent(useCase)
? getPlaceOfEventConditionals(section, 'rural', useCase)
Expand Down
10 changes: 7 additions & 3 deletions src/form/birth/optional-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export const attendantAtBirth: SerializedFormField = {
mapping: getFieldMapping(
'attendantAtBirth',
certificateHandlebars.attendantAtBirth
)
),
exampleValues: ['Nurse']
}

export const birthType: SerializedFormField = {
Expand All @@ -45,7 +46,8 @@ export const birthType: SerializedFormField = {
validator: [],
placeholder: formMessageDescriptors.formSelectPlaceholder,
options: typeOfBirthOptions,
mapping: getFieldMapping('birthType', certificateHandlebars.birthType)
mapping: getFieldMapping('birthType', certificateHandlebars.birthType),
exampleValues: ['Single']
}

export const weightAtBirth: SerializedFormField = {
Expand All @@ -62,6 +64,7 @@ export const weightAtBirth: SerializedFormField = {
}
],
postfix: 'Kg',
exampleValues: ['3'],
mapping: getFieldMapping(
'weightAtBirth',
certificateHandlebars.weightAtBirth
Expand Down Expand Up @@ -98,5 +101,6 @@ export const multipleBirth: SerializedFormField = {
'multipleBirth',
certificateHandlebars.multipleBirth
),
inputFieldWidth: '64px'
inputFieldWidth: '64px',
exampleValues: ['10']
}
17 changes: 8 additions & 9 deletions src/form/birth/required-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
*/

import { MessageDescriptor } from 'react-intl'
import {
formMessageDescriptors,
informantMessageDescriptors
} from '../common/messages'
import { Conditional, SerializedFormField } from '../types/types'
import { formMessageDescriptors } from '../common/messages'
import { SerializedFormField } from '../types/types'
import { divider } from '../common/common-optional-fields'
import {
birthInformantTypeOptions,
Expand All @@ -37,7 +33,8 @@ export const informantType: SerializedFormField = {
'informantType',
certificateHandlebars.informantType
),
options: birthInformantTypeOptions
options: birthInformantTypeOptions,
exampleValues: ['Mother']
}

export const getPlaceOfBirthFields = (): SerializedFormField[] => [
Expand All @@ -53,7 +50,8 @@ export const getPlaceOfBirthFields = (): SerializedFormField[] => [
validator: [],
placeholder: formMessageDescriptors.formSelectPlaceholder,
options: placeOfBirthOptions,
mapping: getEventLocationSelectionMapping('placeOfBirth')
mapping: getEventLocationSelectionMapping('placeOfBirth'),
exampleValues: ['Other']
},
{
name: 'birthLocation',
Expand Down Expand Up @@ -81,6 +79,7 @@ export const getPlaceOfBirthFields = (): SerializedFormField[] => [
mapping: getEventLocationSelectionMapping(
'birthLocation',
certificateHandlebars.placeOfBirth
)
),
exampleValues: ['Shifwankula Health Post']
}
]
15 changes: 11 additions & 4 deletions src/form/common/common-optional-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from './select-options'
import { certificateHandlebars } from '../birth/certificate-handlebars'
import { getFieldMapping } from '@countryconfig/utils/mapping/field-mapping-utils'
import { Validator } from '../types/validators'

const exactDobConditional: Conditional[] = [
{
Expand Down Expand Up @@ -48,7 +49,8 @@ export const exactDateOfBirthUnknown = (
mutation: {
operation: 'ignoreFieldTransformer'
}
}
},
exampleValues: ['true']
})

export const getAgeOfIndividualInYears = (
Expand Down Expand Up @@ -76,7 +78,8 @@ export const getAgeOfIndividualInYears = (
],
conditionals,
postfix: 'years',
inputFieldWidth: '78px'
inputFieldWidth: '78px',
exampleValues: ['27']
})

export const getMaritalStatus = (
Expand All @@ -96,7 +99,8 @@ export const getMaritalStatus = (
placeholder: formMessageDescriptors.formSelectPlaceholder,
mapping: getFieldMapping('maritalStatus', certificateHandlebar),
conditionals,
options: maritalStatusOptions
options: maritalStatusOptions,
exampleValues: ['Single']
})

export const registrationEmail: SerializedFormField = {
Expand All @@ -114,7 +118,8 @@ export const registrationEmail: SerializedFormField = {
mapping: getFieldMapping(
'registrationEmail',
certificateHandlebars.contactEmail
)
),
exampleValues: ['[email protected]']
}

export const registrationPhone: SerializedFormField = {
Expand All @@ -123,6 +128,7 @@ export const registrationPhone: SerializedFormField = {
label: formMessageDescriptors.phoneNumber,
required: false,
initialValue: '',
exampleValues: ['0912345678'],
validator: [
{
operation: 'phoneNumberFormat'
Expand Down Expand Up @@ -170,6 +176,7 @@ export const getNIDVerificationButton = (
labelForUnverified: formMessageDescriptors.nidNotVerified,
labelForOffline: formMessageDescriptors.nidOffline
})

export const getOccupation = (
certificateHandlebar: string
): SerializedFormField => ({
Expand Down
13 changes: 10 additions & 3 deletions src/form/common/common-required-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export const getBirthDate = (
conditionals,
initialValue: '',
validator,
mapping: getFieldMapping('birthDate', certificateHandlebar)
mapping: getFieldMapping('birthDate', certificateHandlebar),
exampleValues: ['03-04-2023', '02-01-1995']
})

export const getGender = (certificateHandlebar: string) =>
Expand All @@ -42,7 +43,8 @@ export const getGender = (certificateHandlebar: string) =>
validator: [],
placeholder: formMessageDescriptors.formSelectPlaceholder,
mapping: getFieldMapping('gender', certificateHandlebar),
options: genderOptions
options: genderOptions,
exampleValues: ['Male']
} satisfies SerializedFormField)

export const getFamilyNameField = (
Expand All @@ -64,6 +66,7 @@ export const getFamilyNameField = (
operation: 'englishOnlyNameFormat'
}
],
exampleValues: ['Mweene'],
mapping: getFieldMapping('familyName', certificateHandlebar)
} satisfies SerializedFormField)

Expand All @@ -85,6 +88,7 @@ export const getFirstNameField = (
maxLength: 32,
required: true,
initialValue: '',
exampleValues: ['Kennedy'],
validator: [
{
operation: 'englishOnlyNameFormat'
Expand All @@ -105,6 +109,7 @@ export const getNationality = (
initialValue: 'FAR',
validator: [],
placeholder: formMessageDescriptors.formSelectPlaceholder,
exampleValues: ['Farajaland'],
options: {
resource: 'countries'
},
Expand All @@ -125,6 +130,7 @@ export const otherInformantType = (event: Event) =>
placeholder: formMessageDescriptors.relationshipPlaceHolder,
required: true,
initialValue: '',
exampleValues: ['Other Information'],
validator: [
{
operation: 'englishOnlyNameFormat'
Expand Down Expand Up @@ -153,7 +159,8 @@ export const getNationalID = (
initialValue: '',
validator,
conditionals,
mapping: getFieldMapping('nationalId', certificateHandlebar)
mapping: getFieldMapping('nationalId', certificateHandlebar),
exampleValues: ['4185417204']
} satisfies SerializedFormField)

export const getDetailsExist = (
Expand Down
25 changes: 18 additions & 7 deletions src/form/death/required-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const getDeathDate = (
conditionals,
initialValue: '',
validator,
exampleValues: ['05-04-2023'],
mapping: getFieldMapping('deathDate', certificateHandlebars.eventDate)
})

Expand All @@ -54,7 +55,8 @@ export const deathInformantType: SerializedFormField = {
'informantType',
certificateHandlebars.informantType
),
options: deathInformantTypeOptions
options: deathInformantTypeOptions,
exampleValues: ['Son']
}

export const getMannerOfDeath: SerializedFormField = {
Expand All @@ -66,7 +68,11 @@ export const getMannerOfDeath: SerializedFormField = {
validator: [],
placeholder: formMessageDescriptors.formSelectPlaceholder,
options: mannerOfDeathOptions,
mapping: getFieldMapping('mannerOfDeath', certificateHandlebars.mannerOfDeath)
mapping: getFieldMapping(
'mannerOfDeath',
certificateHandlebars.mannerOfDeath
),
exampleValues: ['Natural causes']
}

export const getCauseOfDeath: SerializedFormField = {
Expand All @@ -82,7 +88,8 @@ export const getCauseOfDeath: SerializedFormField = {
mapping: getFieldMapping(
'causeOfDeathEstablished',
certificateHandlebars.causeOfDeathEstablished
)
),
exampleValues: ['true']
}

export const getCauseOfDeathMethod: SerializedFormField = {
Expand All @@ -103,7 +110,8 @@ export const getCauseOfDeathMethod: SerializedFormField = {
mapping: getFieldMapping(
'causeOfDeathMethod',
certificateHandlebars.causeOfDeathMethod
)
),
exampleValues: ['Natural causes']
}

export const getDeathDescription: SerializedFormField = {
Expand All @@ -124,7 +132,8 @@ export const getDeathDescription: SerializedFormField = {
mapping: getFieldMapping(
'deathDescription',
certificateHandlebars.deathDescription
)
),
exampleValues: ['He got heart attack in the middle of the night.']
}

export const getPlaceOfDeathFields = () =>
Expand All @@ -150,7 +159,8 @@ export const getPlaceOfDeathFields = () =>
validator: [],
placeholder: formMessageDescriptors.formSelectPlaceholder,
options: placeOfDeathOptions,
mapping: getEventLocationSelectionMapping('placeOfDeath')
mapping: getEventLocationSelectionMapping('placeOfDeath'),
exampleValues: ['Other']
},
{
name: 'deathLocation',
Expand Down Expand Up @@ -178,6 +188,7 @@ export const getPlaceOfDeathFields = () =>
mapping: getEventLocationSelectionMapping(
'deathLocation',
certificateHandlebars.placeOfDeath
)
),
exampleValues: ['Sekelela Health Post']
}
] satisfies SerializedFormField[]
6 changes: 4 additions & 2 deletions src/form/marriage/optional-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const getMarriedLastName = (
operation: 'englishOnlyNameFormat'
}
],
mapping: getFieldMapping('marriedLastName', certificateHandlebar)
mapping: getFieldMapping('marriedLastName', certificateHandlebar),
exampleValues: ['Campbell']
})

export const getTypeOfMarriage: SerializedFormField = {
Expand All @@ -45,7 +46,8 @@ export const getTypeOfMarriage: SerializedFormField = {
mapping: getFieldMapping(
'typeOfMarriage',
certificateHandlebars.typeOfMarriage
)
),
exampleValues: ['Monogamous']
}

export const placeOfMarriageSubsection: SerializedFormField = {
Expand Down
Loading
Loading