Skip to content

Commit 7cf6e56

Browse files
authored
Merge pull request #1112 from IFRCGo/fix/validation-update-local-unit-form
Update validation for number input in local unit form
2 parents ee704e7 + 480c3e1 commit 7cf6e56

File tree

1 file changed

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

1 file changed

+70
-14
lines changed

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

Lines changed: 70 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import {
1010
} from '@togglecorp/toggle-form';
1111

1212
import { type components } from '#generated/types';
13-
import { getNumberInBetweenCondition } from '#utils/form';
13+
import {
14+
getNumberInBetweenCondition,
15+
positiveIntegerCondition,
16+
} from '#utils/form';
1417
import {
1518
type GoApiBody,
1619
type GoApiResponse,
@@ -164,21 +167,74 @@ const schema: LocalUnitsFormSchema = {
164167
speciality: {
165168
validations: [lengthSmallerThanCondition(200)],
166169
},
167-
maximum_capacity: {},
168-
number_of_isolation_rooms: {},
170+
maximum_capacity: {
171+
validations: [
172+
positiveIntegerCondition,
173+
],
174+
},
175+
number_of_isolation_rooms: {
176+
validations: [
177+
positiveIntegerCondition,
178+
],
179+
},
169180
is_warehousing: {},
170181
is_cold_chain: {},
171-
ambulance_type_a: {},
172-
ambulance_type_b: {},
173-
ambulance_type_c: {},
174-
total_number_of_human_resource: { required: true },
175-
general_practitioner: {},
176-
specialist: {},
177-
residents_doctor: {},
178-
nurse: {},
179-
dentist: {},
180-
nursing_aid: {},
181-
midwife: {},
182+
ambulance_type_a: {
183+
validations: [
184+
positiveIntegerCondition,
185+
],
186+
},
187+
ambulance_type_b: {
188+
validations: [
189+
positiveIntegerCondition,
190+
],
191+
},
192+
ambulance_type_c: {
193+
validations: [
194+
positiveIntegerCondition,
195+
],
196+
},
197+
total_number_of_human_resource: {
198+
validations: [
199+
positiveIntegerCondition,
200+
],
201+
required: true,
202+
},
203+
general_practitioner: {
204+
validations: [
205+
positiveIntegerCondition,
206+
],
207+
},
208+
specialist: {
209+
validations: [
210+
positiveIntegerCondition,
211+
],
212+
},
213+
residents_doctor: {
214+
validations: [
215+
positiveIntegerCondition,
216+
],
217+
},
218+
nurse: {
219+
validations: [
220+
positiveIntegerCondition,
221+
],
222+
},
223+
dentist: {
224+
validations: [
225+
positiveIntegerCondition,
226+
],
227+
},
228+
nursing_aid: {
229+
validations: [
230+
positiveIntegerCondition,
231+
],
232+
},
233+
midwife: {
234+
validations: [
235+
positiveIntegerCondition,
236+
],
237+
},
182238
other_medical_heal: {},
183239
other_profiles: {
184240
validations: [lengthSmallerThanCondition(200)],

0 commit comments

Comments
 (0)