From c07d4d2502fdab1c844156c0144079f33e7de32e Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Tue, 31 Oct 2023 14:18:55 +0530 Subject: [PATCH] fix: add signer form not working properly for overlap contacts --- .../src/components/AppendFormInForm.js | 44 ++++++++++--------- .../src/components/fields/MultiSelectField.js | 6 +-- apps/OpenSign/src/routes/Login.js | 43 +++++++++++++++++- 3 files changed, 68 insertions(+), 25 deletions(-) diff --git a/apps/OpenSign/src/components/AppendFormInForm.js b/apps/OpenSign/src/components/AppendFormInForm.js index 31c8415dd..494936742 100644 --- a/apps/OpenSign/src/components/AppendFormInForm.js +++ b/apps/OpenSign/src/components/AppendFormInForm.js @@ -667,7 +667,15 @@ class AppendFormInForm extends Component { form.setACL(new Parse.ACL(ACL)); } form.save(RowData).then( - () => { + (formd) => { + const parseData = JSON.parse(JSON.stringify(formd)); + this.props.details({ + value: parseData[this.props.valueKey], + label: parseData[this.props.displayKey] + }); + if (this.props.closePopup) { + this.props.closePopup(); + } let filtered = {}; if (this.state.redirect_type === "clearData") { if ( @@ -686,25 +694,21 @@ class AppendFormInForm extends Component { } else { RowData = {}; } - this.setState( - { - formData: filtered, - active: true, - loading: false, - toastColor: "#5cb85c", - toastDescription: this.state.successMassage - }, - () => { - this.props.removeState(); - this.props.removeLevel2State(); - this.props.removeLevel3State(); - var x = document.getElementById("snackbar"); - x.className = "show"; - setTimeout(function () { - x.className = x.className.replace("show", ""); - }, 2000); - } - ); + this.setState({ + formData: filtered, + active: true, + loading: false, + toastColor: "#5cb85c", + toastDescription: "Record inserted successfully." + }); + // this.props.removeState(); + // this.props.removeLevel2State(); + // this.props.removeLevel3State(); + // var x = document.getElementById("snackbar"); + // x.className = "show"; + // setTimeout(function () { + // x.className = x.className.replace("show", ""); + // }, 2000); }, (error) => { this.setState({ diff --git a/apps/OpenSign/src/components/fields/MultiSelectField.js b/apps/OpenSign/src/components/fields/MultiSelectField.js index 7ccba7c73..48aaef090 100644 --- a/apps/OpenSign/src/components/fields/MultiSelectField.js +++ b/apps/OpenSign/src/components/fields/MultiSelectField.js @@ -494,9 +494,9 @@ const MultiSelectField = (props) => { const handleNewDetails = (data) => { setState({ [`${props.name}_DD`]: [...state[`${props.name}_DD`], data] }); if (selected.length > 0) { - setSelected([data]); - } else { setSelected([...selected, data]); + } else { + setSelected([data]); } }; if (props.schema.uiLayout === "MultiDropdownList") { @@ -656,7 +656,7 @@ const MultiSelectField = (props) => { right: 0, bottom: 0, backgroundColor: "rgba(255, 255, 255, 0.75)", - zIndex: 10 + zIndex: 50 } }} > diff --git a/apps/OpenSign/src/routes/Login.js b/apps/OpenSign/src/routes/Login.js index a29895bd0..41effaab1 100644 --- a/apps/OpenSign/src/routes/Login.js +++ b/apps/OpenSign/src/routes/Login.js @@ -125,7 +125,26 @@ function Login(props) { ) { _currentRole = userRoles[1]; } else { - _currentRole = userRoles[0]; + const rolesfiltered = userRoles.filter( + (x) => x !== "contracts_Guest" + ); + if (rolesfiltered.length > 0) { + _currentRole = rolesfiltered[0]; + } else { + setThirdpartyLoader(false); + setState({ + ...state, + loading: false, + toastColor: "#d9534f", + toastDescription: `Does not have permissions to access this application.` + }); + const x = document.getElementById("snackbar"); + x.className = "show"; + setTimeout(function () { + x.className = x.className.replace("show", ""); + }, 2000); + } + // _currentRole = userRoles[0]; } } else { _currentRole = userRoles[0]; @@ -725,6 +744,7 @@ function Login(props) { }; const GetLoginData = async () => { + setState({...state, loading: true}) try { Parse.serverURL = localStorage.getItem("baseUrl"); Parse.initialize(localStorage.getItem("parseAppId")); @@ -769,7 +789,26 @@ function Login(props) { ) { _currentRole = userRoles[1]; } else { - _currentRole = userRoles[0]; + const rolesfiltered = userRoles.filter( + (x) => x !== "contracts_Guest" + ); + if (rolesfiltered.length > 0) { + _currentRole = rolesfiltered[0]; + } else { + setThirdpartyLoader(false); + setState({ + ...state, + loading: false, + toastColor: "#d9534f", + toastDescription: `Does not have permissions to access this application.` + }); + const x = document.getElementById("snackbar"); + x.className = "show"; + setTimeout(function () { + x.className = x.className.replace("show", ""); + }, 2000); + } + // _currentRole = userRoles[0]; } } else { _currentRole = userRoles[0];