diff --git a/src/utils/functionUtils.js b/src/utils/functionUtils.js index 464d9a4b..893f3624 100644 --- a/src/utils/functionUtils.js +++ b/src/utils/functionUtils.js @@ -13,6 +13,7 @@ export const handleClickLink = link => { }; export const detailsViewData = (type, detailData, dataType, changeColor) => { + console.log(detailData) //all detail view data if (type === 'data') { return ( @@ -60,6 +61,12 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { ); + } else if (detailData[dataType]?.changes[0] === '') { + return ( + <> + {detailData[dataType]?.original} + + ); } else { return ( @@ -102,10 +109,20 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { ) { //show new form data not changed staging detail view return ( - + {detailData && detailData[dataType] && detailData[dataType].original} ); + } else if ( + !detailData[dataType]?.changes[0] && + !detailData[dataType]?.original + ) { + //show new form data not changed staging detail view + return ( + + --- + + ); } else { // show formdata that has no changes or original return ---; @@ -129,9 +146,7 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { //show subform data that was kept and not deleted return ( <> - - {detailData[dataType]?.original} - + {detailData[dataType]?.original} ); } else if ( @@ -168,7 +183,9 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { //show subform original in staging view return ( - {detailData && detailData[dataType] && detailData[dataType].original} + {detailData && detailData[dataType] && detailData[dataType].original + ? detailData[dataType].original + : '0'} ); } @@ -217,8 +234,9 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { {detailData[dataType]?.changes[0] && detailData[dataType]?.original && ( - + @@ -273,8 +291,9 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { } else if (detailData[dataType]?.changes[0] === null) { // show deleted subform links return ( - + @@ -295,6 +314,7 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { !_.isEmpty(detailData[dataType]?.changes) && _.some(detailData[dataType]?.changes) ) { + //subform link changes return ( <> @@ -317,8 +337,9 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { {detailData[dataType]?.changes[0] && detailData[dataType]?.original && ( - + @@ -353,8 +374,21 @@ export const detailsViewData = (type, detailData, dataType, changeColor) => { ); - } else if (!_.some(detailData[dataType]?.changes)) { - return ---; + } else if ( + _.isEmpty(detailData[dataType]?.changes) && + detailData[dataType]?.original + ) { + return ( + + {detailData[dataType].original} + + ); + } else if ( + !detailData[dataType]?.changes[0] && + !detailData[dataType]?.original + ) { + //show new form data not changed staging detail view + return ---; } else { return (