diff --git a/apps/OpenSign/src/components/pdf/RecipientList.js b/apps/OpenSign/src/components/pdf/RecipientList.js index b31c907d4..b7c3b69d8 100644 --- a/apps/OpenSign/src/components/pdf/RecipientList.js +++ b/apps/OpenSign/src/components/pdf/RecipientList.js @@ -61,15 +61,27 @@ const RecipientList = (props) => { ); //splice method is used to replace or add new value in array at specific index remainingItems.splice(index, 0, ...draggedItem); - //set current draggable recipient details,objectId,index,contract_className ... after replace recipient list - props.setSignersData(remainingItems); - props.setSignerObjId(remainingItems[index]?.objectId || ""); - props.setIsSelectId(index); - props.setContractName(remainingItems[index]?.className || ""); - props.setUniqueId(remainingItems[index]?.Id); - props.setRoleName(remainingItems[index]?.Role); - props.setBlockColor(remainingItems[index]?.blockColor); + props?.setSignersData(remainingItems); + props?.setSignerObjId(remainingItems[index]?.objectId || ""); + props?.setIsSelectId(index); + props?.setContractName(remainingItems[index]?.className || ""); + props?.setUniqueId(remainingItems[index]?.Id); + props?.setRoleName(remainingItems[index]?.Role); + props?.setBlockColor(remainingItems[index]?.blockColor); + + //change order of placeholder's list using sorting method + //`remainingItems` is correct order of signers after change order + const changeOrderSignerList = props?.signerPos.sort((a, b) => { + //`indexA` and `indexB` is to get element position using index in correct order array + const indexA = remainingItems.findIndex((item) => item.Id === a.Id); + const indexB = remainingItems.findIndex((item) => item.Id === b.Id); + //and then compare `indexA - indexB` value + //if positive it means indexB element comes before indexA then need to sorting + //if negative it means indexA element is on correct position do not need to sorting + return indexA - indexB; + }); + props?.setSignerPos(changeOrderSignerList); }; return ( <> diff --git a/apps/OpenSign/src/components/pdf/TextFontSetting.js b/apps/OpenSign/src/components/pdf/TextFontSetting.js index 1687513b6..13d5cc5de 100644 --- a/apps/OpenSign/src/components/pdf/TextFontSetting.js +++ b/apps/OpenSign/src/components/pdf/TextFontSetting.js @@ -19,7 +19,9 @@ function TextFontSetting(props) { props.setFontColor(e.target.value)} className="ml-[7px] op-select op-select-bordered op-select-sm focus:outline-none hover:border-base-content text-xs" diff --git a/apps/OpenSign/src/components/pdf/WidgetComponent.js b/apps/OpenSign/src/components/pdf/WidgetComponent.js index 6b812bbcc..88f9f9818 100644 --- a/apps/OpenSign/src/components/pdf/WidgetComponent.js +++ b/apps/OpenSign/src/components/pdf/WidgetComponent.js @@ -37,11 +37,10 @@ function WidgetComponent({ sendInOrder, isTemplateFlow, setBlockColor, - blockColor, - setIsAddSigner + setIsAddSigner, + blockColor }) { const [isSignersModal, setIsSignersModal] = useState(false); - const [, dropdown] = useDrag({ type: "BOX", item: { @@ -187,7 +186,6 @@ function WidgetComponent({ const isMobile = window.innerWidth < 767; const scrollContainerRef = useRef(null); const [widget, setWidget] = useState([]); - const color = [ "#93a3db", "#e6c3db", @@ -245,86 +243,68 @@ function WidgetComponent({ ? textWidgetData : widget; + const handleSelectRecipient = () => { + if ( + signersdata[isSelectListId]?.Email || + signersdata[isSelectListId]?.Role + ) { + const userData = + signersdata[isSelectListId]?.Name || signersdata[isSelectListId]?.Role; + const name = + userData?.length > 20 ? `${userData.slice(0, 20)}...` : userData; + return name; + } + }; + return ( <> {isMobile ? ( !isMailSend && ( -