Skip to content

Commit

Permalink
Condition gear on board validation to control check in mission form
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Jul 13, 2023
1 parent 15096f7 commit 5e8068f
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ const actionDatetimeUtcValidator = string()
})

export const GearOnboardSchema = object({
declaredMesh: number().required('Veuillez indiquer le maillage déclaré.'),
controlledMesh: number().when('hasUncontrolledMesh', {
is: false,
then: number().required('Veuillez indiquer le maillage mesuré.'),
otherwise: number()
declaredMesh: number().when('gearWasControlled', {
is: true,
then: number().required('Veuillez indiquer le maillage déclaré.')
}),
controlledMesh: number().when(['hasUncontrolledMesh', 'gearWasControlled'], {
is: (hasUncontrolledMesh: boolean, gearWasControlled: boolean) => !hasUncontrolledMesh && gearWasControlled,
then: number().required('Veuillez indiquer le maillage mesuré.')
}),
gearWasControlled: boolean().required("Veuillez indiquer si l'engin a été contrôlé.")
})
Expand Down

0 comments on commit 5e8068f

Please sign in to comment.