Skip to content

Commit 2af91a3

Browse files
committed
Fix local unit form schema condition for focal person
1 parent b2df6a1 commit 2af91a3

File tree

2 files changed

+6
-6
lines changed
  • app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm

2 files changed

+6
-6
lines changed

app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
DateOutput,
1313
MultiSelectInput,
1414
NumberInput,
15-
PageContainer,
1615
Portal,
1716
SelectInput,
1817
TextArea,

app/src/views/CountryNsOverviewContextAndStructure/NationalSocietyLocalUnits/LocalUnitsFormModal/LocalUnitsForm/schema.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ const schema: LocalUnitsFormSchema = {
7171
focal_person_en: {
7272
validations: [lengthSmallerThanCondition(200)],
7373
},
74-
focal_person_loc: {
75-
validations: [lengthSmallerThanCondition(200)],
76-
required: true,
77-
},
7874
date_of_data: { required: true },
7975
source_loc: {},
8076
source_en: {},
@@ -124,10 +120,11 @@ const schema: LocalUnitsFormSchema = {
124120
formFields,
125121
formValue,
126122
['type'],
127-
['health'],
123+
['health', 'focal_person_loc'],
128124
(val) => {
129125
if (val?.type === TYPE_HEALTH_CARE) {
130126
return {
127+
focal_person_loc: { forceValue: nullValue },
131128
health: {
132129
fields: (): LocalUnitsHealthFormSchemaFields => ({
133130
affiliation: { required: true },
@@ -247,6 +244,10 @@ const schema: LocalUnitsFormSchema = {
247244
};
248245
}
249246
return {
247+
focal_person_loc: {
248+
validations: [lengthSmallerThanCondition(200)],
249+
required: true,
250+
},
250251
health: { forceValue: nullValue },
251252
};
252253
},

0 commit comments

Comments
 (0)