Skip to content

Commit fc41868

Browse files
authored
Merge pull request #1153 from opencrvs/sync-far-14-11
fix: farajaland name config
2 parents 1d72fd7 + 6615756 commit fc41868

File tree

12 files changed

+38
-30
lines changed

12 files changed

+38
-30
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"@hapi/boom": "^9.1.1",
7070
"@hapi/hapi": "^20.0.1",
7171
"@hapi/inert": "^6.0.3",
72-
"@opencrvs/toolkit": "1.9.0-rc.a9cc5f2",
72+
"@opencrvs/toolkit": "1.9.0-rc.79b0f42",
7373
"@types/chalk": "^2.2.0",
7474
"@types/csv2json": "^1.4.0",
7575
"@types/fhir": "^0.0.30",

src/form/v2/birth/forms/pages/child.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ import { applicationConfig } from '@countryconfig/api/application/application-co
2727

2828
import { createSelectOptions, emptyMessage } from '@countryconfig/form/v2/utils'
2929
import {
30-
invalidNameValidator,
31-
MAX_NAME_LENGTH
30+
farajalandNameConfig,
31+
invalidNameValidator
3232
} from '@countryconfig/form/v2/birth/validators'
3333
import {
3434
defaultStreetAddressConfiguration,
@@ -197,7 +197,7 @@ export const child = defineFormPage({
197197
id: 'child.name',
198198
type: FieldType.NAME,
199199
required: true,
200-
configuration: { maxLength: MAX_NAME_LENGTH },
200+
configuration: farajalandNameConfig,
201201
hideLabel: true,
202202
label: {
203203
defaultMessage: "Child's name",

src/form/v2/birth/forms/pages/father.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import {
2222
import { or, not } from '@opencrvs/toolkit/conditionals'
2323
import { emptyMessage } from '@countryconfig/form/v2/utils'
2424
import {
25+
farajalandNameConfig,
2526
invalidNameValidator,
26-
MAX_NAME_LENGTH,
2727
nationalIdValidator
2828
} from '@countryconfig/form/v2/birth/validators'
2929
import { InformantType } from './informant'
@@ -111,7 +111,7 @@ export const father = defineFormPage({
111111
id: 'father.name',
112112
type: FieldType.NAME,
113113
required: true,
114-
configuration: { maxLength: MAX_NAME_LENGTH },
114+
configuration: farajalandNameConfig,
115115
hideLabel: true,
116116
label: {
117117
defaultMessage: "Father's name",

src/form/v2/birth/forms/pages/informant.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import {
2424
import { not } from '@opencrvs/toolkit/conditionals'
2525
import { createSelectOptions, emptyMessage } from '../../../utils'
2626
import {
27+
farajalandNameConfig,
2728
invalidNameValidator,
28-
MAX_NAME_LENGTH,
2929
nationalIdValidator
3030
} from '@countryconfig/form/v2/birth/validators'
3131
import { IdType, idTypeOptions } from '../../../person'
@@ -148,7 +148,7 @@ export const informant = defineFormPage({
148148
id: 'informant.name',
149149
type: FieldType.NAME,
150150
required: true,
151-
configuration: { maxLength: MAX_NAME_LENGTH },
151+
configuration: farajalandNameConfig,
152152
hideLabel: true,
153153
label: {
154154
defaultMessage: "Informant's name",

src/form/v2/birth/forms/pages/mother.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { emptyMessage } from '@countryconfig/form/v2/utils'
2424
import {
2525
invalidNameValidator,
2626
nationalIdValidator,
27-
MAX_NAME_LENGTH
27+
farajalandNameConfig
2828
} from '@countryconfig/form/v2/birth/validators'
2929
import { InformantType } from './informant'
3030
import { IdType, idTypeOptions } from '../../../person'
@@ -108,7 +108,7 @@ export const mother = defineFormPage({
108108
id: 'mother.name',
109109
type: FieldType.NAME,
110110
required: true,
111-
configuration: { maxLength: MAX_NAME_LENGTH },
111+
configuration: farajalandNameConfig,
112112
hideLabel: true,
113113
label: {
114114
defaultMessage: "Mother's name",

src/form/v2/birth/forms/printForm/collector-other.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {
1616
FieldType
1717
} from '@opencrvs/toolkit/events'
1818
import {
19+
farajalandNameConfig,
1920
invalidNameValidator,
20-
MAX_NAME_LENGTH,
2121
nationalIdValidator
2222
} from '../../validators'
2323

@@ -275,7 +275,7 @@ export const printCertificateCollectorOther: FieldConfig[] = [
275275
id: 'collector.OTHER.name',
276276
type: FieldType.NAME,
277277
required: true,
278-
configuration: { maxLength: MAX_NAME_LENGTH },
278+
configuration: farajalandNameConfig,
279279
hideLabel: true,
280280
label: {
281281
defaultMessage: "Collector's name",

src/form/v2/birth/validators.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
1010
*/
1111
import { defineFormConditional } from '@opencrvs/toolkit/conditionals'
12-
import { field } from '@opencrvs/toolkit/events'
12+
import { and, field } from '@opencrvs/toolkit/events'
1313

1414
export const MAX_NAME_LENGTH = 32
1515

@@ -20,11 +20,11 @@ export const invalidNameValidator = (fieldName: string) => ({
2020
description: 'This is the error message for invalid name',
2121
id: 'error.invalidName'
2222
},
23-
validator: field(fieldName).object({
24-
firstname: field('firstname').isValidEnglishName(),
25-
middlename: field('middlename').isValidEnglishName(),
26-
surname: field('surname').isValidEnglishName()
27-
})
23+
validator: and(
24+
field(fieldName).get('firstname').isValidEnglishName(),
25+
field(fieldName).get('middlename').isValidEnglishName(),
26+
field(fieldName).get('surname').isValidEnglishName()
27+
)
2828
})
2929

3030
export const nationalIdValidator = (fieldId: string) => ({
@@ -45,3 +45,11 @@ export const nationalIdValidator = (fieldId: string) => ({
4545
}
4646
})
4747
})
48+
49+
export const farajalandNameConfig = {
50+
name: {
51+
firstname: { required: true },
52+
surname: { required: true }
53+
},
54+
maxLength: MAX_NAME_LENGTH
55+
}

src/form/v2/death/forms/pages/deceased.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import { not, never } from '@opencrvs/toolkit/conditionals'
2424

2525
import { createSelectOptions, emptyMessage } from '@countryconfig/form/v2/utils'
2626
import {
27+
farajalandNameConfig,
2728
invalidNameValidator,
28-
MAX_NAME_LENGTH,
2929
nationalIdValidator
3030
} from '@countryconfig/form/v2/birth/validators'
3131
import {
@@ -76,7 +76,7 @@ export const deceased = defineFormPage({
7676
{
7777
id: 'deceased.name',
7878
type: FieldType.NAME,
79-
configuration: { maxLength: MAX_NAME_LENGTH },
79+
configuration: farajalandNameConfig,
8080
required: true,
8181
hideLabel: true,
8282
label: {

src/form/v2/death/forms/pages/informant.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import {
2424
import { not } from '@opencrvs/toolkit/conditionals'
2525
import { createSelectOptions, emptyMessage } from '../../../utils'
2626
import {
27+
farajalandNameConfig,
2728
invalidNameValidator,
28-
MAX_NAME_LENGTH,
2929
nationalIdValidator
3030
} from '@countryconfig/form/v2/birth/validators'
3131
import {
@@ -157,7 +157,7 @@ export const informant = defineFormPage({
157157
},
158158
{
159159
id: 'informant.name',
160-
configuration: { maxLength: MAX_NAME_LENGTH },
160+
configuration: farajalandNameConfig,
161161
type: FieldType.NAME,
162162
required: true,
163163
hideLabel: true,

src/form/v2/death/forms/pages/spouse.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ import {
2323
import { not } from '@opencrvs/toolkit/conditionals'
2424
import { emptyMessage } from '../../../utils'
2525
import {
26+
farajalandNameConfig,
2627
invalidNameValidator,
27-
MAX_NAME_LENGTH,
2828
nationalIdValidator
2929
} from '@countryconfig/form/v2/birth/validators'
3030
import {
@@ -107,7 +107,7 @@ export const spouse = defineFormPage({
107107
},
108108
{
109109
id: 'spouse.name',
110-
configuration: { maxLength: MAX_NAME_LENGTH },
110+
configuration: farajalandNameConfig,
111111
type: FieldType.NAME,
112112
required: true,
113113
hideLabel: true,

0 commit comments

Comments
 (0)