diff --git a/src/components/FormField/components/Table/index.js b/src/components/FormField/components/Table/index.js index d02badb..5d80b09 100644 --- a/src/components/FormField/components/Table/index.js +++ b/src/components/FormField/components/Table/index.js @@ -136,7 +136,8 @@ const Table = ({ return ( <> {rows ? : null} {!isEmpty(columns) && !shouldDisableNewRows diff --git a/src/helpers/renderHtmlContent.js b/src/helpers/renderHtmlContent.js index 8a59d21..672546a 100644 --- a/src/helpers/renderHtmlContent.js +++ b/src/helpers/renderHtmlContent.js @@ -1,5 +1,6 @@ import parse from 'html-react-parser'; +import { isNil } from 'ramda'; -const renderHtmlContent = (content) => parse(content); +const renderHtmlContent = (content = '') => !isNil(content) ? parse(content) : ''; export default renderHtmlContent; \ No newline at end of file diff --git a/src/helpers/validators.js b/src/helpers/validators.js index e4f9aff..3a05435 100644 --- a/src/helpers/validators.js +++ b/src/helpers/validators.js @@ -68,7 +68,6 @@ export const maxChecks = (v, num) => { } export const nonEmptyTables = (v = [], tableCfg = []) => { - //console.log('nonEmptyTables',v) const colsCfg = pathOr([], ['stateFieldData'], tableCfg); const nonPredefinedCells = colsCfg .filter(o => !o.predefined) @@ -76,22 +75,24 @@ export const nonEmptyTables = (v = [], tableCfg = []) => { let isTableValid = true; let atLeastOneCellFilled = false - // eslint-disable-next-line array-callback-return - v.map((row) => { - if (isEmpty(row)) { - isTableValid = false; - } else { - // eslint-disable-next-line array-callback-return - nonPredefinedCells.map((k) => { - if (isNil(row[k]) || isEmpty(row[k])) { - isTableValid = atLeastOneCellFilled; - } else { - atLeastOneCellFilled = true; - isTableValid = true; - } - }); - } - }); + if (is(Array, v)) { + // eslint-disable-next-line array-callback-return + v.map((row) => { + if (isEmpty(row)) { + isTableValid = false; + } else { + // eslint-disable-next-line array-callback-return + nonPredefinedCells.map((k) => { + if (isNil(row[k]) || isEmpty(row[k])) { + isTableValid = atLeastOneCellFilled; + } else { + atLeastOneCellFilled = true; + isTableValid = true; + } + }); + } + }); + } return is(Array, v) ? v.length >= 1 && isTableValid : false; } \ No newline at end of file diff --git a/src/pages/BandoApplication/index.js b/src/pages/BandoApplication/index.js index 9272991..5b3d9a5 100644 --- a/src/pages/BandoApplication/index.js +++ b/src/pages/BandoApplication/index.js @@ -96,7 +96,7 @@ const BandoApplication = () => { const submitApplicationCallback = (data) => { if (data.status === 'SUCCESS') { - if (data.data.applicationStatus) { + if (data.data.status) { setApplicationStatus(data.data.status); // ask why not 'applicationStatus'? } } @@ -275,7 +275,7 @@ const BandoApplication = () => { acc[cur.fieldId] = cur.fieldValue; return acc; }, {}); - + reset(); setFormInitialData(formDataInitial); } } @@ -394,7 +394,7 @@ const BandoApplication = () => { useEffect(() => { if (formInitialData) { - reset(); + //reset(); Object.keys(formInitialData).map(k => setValue(k, formInitialData[k])) } }, [formInitialData]); @@ -483,6 +483,7 @@ const BandoApplication = () => { return acc; }, {}); + //console.log('validations', validations, o.name) return ['paragraph'].includes(o.name) && text ?
{renderHtmlContent(text.value)}
diff --git a/src/pages/BandoView/index.js b/src/pages/BandoView/index.js index 3e78d30..2132270 100644 --- a/src/pages/BandoView/index.js +++ b/src/pages/BandoView/index.js @@ -176,7 +176,9 @@ const BandoView = () => {

{__('Allegati', 'gepafin')}

diff --git a/src/pages/BandoViewBeneficiario/index.js b/src/pages/BandoViewBeneficiario/index.js index 0ddec79..34d728f 100644 --- a/src/pages/BandoViewBeneficiario/index.js +++ b/src/pages/BandoViewBeneficiario/index.js @@ -324,7 +324,9 @@ const BandoViewBeneficiario = () => {

{__('Allegati', 'gepafin')}

    - {data.docs.map((o, i) =>
  • + {data.docs + .filter(o => o.source === 'CALL') + .map((o, i) =>
  • {o.name}
  • )}