Merge pull request #1788 from RafaelTaranto/fix/receipt-configuration
LAM-1292 fix: proper validation on boolen table schema
This commit is contained in:
commit
55d7d42c8f
1 changed files with 8 additions and 3 deletions
|
|
@ -27,11 +27,16 @@ const BooleanCell = ({ name }) => {
|
|||
const BooleanPropertiesTable = memo(
|
||||
({ title, disabled, data, elements, save, forcedEditing = false }) => {
|
||||
const initialValues = R.fromPairs(
|
||||
elements.map(it => [it.name, data[it.name]?.toString() ?? null])
|
||||
elements.map(it => [it.name, data[it.name]?.toString() ?? 'false'])
|
||||
)
|
||||
|
||||
const validationSchema = R.fromPairs(
|
||||
elements.map(it => [it.name, Yup.boolean().required()])
|
||||
const validationSchema = Yup.object().shape(
|
||||
R.fromPairs(
|
||||
elements.map(it => [
|
||||
it.name,
|
||||
Yup.mixed().oneOf(['true', 'false', true, false]).required()
|
||||
])
|
||||
)
|
||||
)
|
||||
|
||||
const [editing, setEditing] = useState(forcedEditing)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue