From ed6f44fd6247c3840da9058d0fc0419694263183 Mon Sep 17 00:00:00 2001 From: prafull-opensignlabs Date: Mon, 20 Nov 2023 10:42:20 +0530 Subject: [PATCH] create getDocument cloud function & minor UI changes --- apps/OpenSign/src/components/LoginFacebook.js | 14 ++--- apps/OpenSign/src/components/LoginGoogle.js | 20 +++---- apps/OpenSign/src/json/plansArr.json | 2 +- apps/OpenSign/src/routes/Pgsignup.js | 7 ++- apps/OpenSign/src/routes/PlanSubscriptions.js | 35 ++++++----- apps/OpenSign/src/routes/Signup.js | 59 ++++++------------- apps/OpenSign/src/routes/UserProfile.js | 34 +++++------ apps/OpenSign/src/styles/pgsignup.css | 38 +++++++++--- apps/OpenSignServer/cloud/main.js | 3 + .../cloud/parsefunction/getDocument.js | 23 ++++++++ 10 files changed, 131 insertions(+), 104 deletions(-) create mode 100644 apps/OpenSignServer/cloud/parsefunction/getDocument.js diff --git a/apps/OpenSign/src/components/LoginFacebook.js b/apps/OpenSign/src/components/LoginFacebook.js index 442fcb3e7..1aeef2c73 100644 --- a/apps/OpenSign/src/components/LoginFacebook.js +++ b/apps/OpenSign/src/components/LoginFacebook.js @@ -209,6 +209,13 @@ const LoginFacebook = ({ />
+ -
diff --git a/apps/OpenSign/src/components/LoginGoogle.js b/apps/OpenSign/src/components/LoginGoogle.js index 7e00b8e8c..1038b21bb 100644 --- a/apps/OpenSign/src/components/LoginGoogle.js +++ b/apps/OpenSign/src/components/LoginGoogle.js @@ -263,17 +263,17 @@ const GoogleSignInBtn = ({
setUserDetails({ @@ -285,6 +285,13 @@ const GoogleSignInBtn = ({ />
+ -
diff --git a/apps/OpenSign/src/json/plansArr.json b/apps/OpenSign/src/json/plansArr.json index 57439a344..ed75ffcb9 100644 --- a/apps/OpenSign/src/json/plansArr.json +++ b/apps/OpenSign/src/json/plansArr.json @@ -26,7 +26,7 @@ "planName": "THANKS PLAN", "currency": "$", "price": "29.99", - "subtitle": "Use code 'FREEBETA' to get this for free(First 100 users)", + "subtitle": "Use code 'FREEBETA' to get this for free(First 1000 users)", "btnText": "Subscribe", "url": "https://subscriptions.zoho.in/subscribe/ef798486e6a0a11ea65f2bae8f2af901dbadf3175d495584fd25b9af5d2f2b9e/thanks", "benefits": [ diff --git a/apps/OpenSign/src/routes/Pgsignup.js b/apps/OpenSign/src/routes/Pgsignup.js index 75a34c253..79f033a6c 100644 --- a/apps/OpenSign/src/routes/Pgsignup.js +++ b/apps/OpenSign/src/routes/Pgsignup.js @@ -151,6 +151,7 @@ const PgSignUp = (props) => { if (res) { const params = { userDetails: { + jobTitle: zohoRes.data.result.jobTitle, company: zohoRes.data.result.company, name: zohoRes.data.result.name, email: zohoRes.data.result.email, @@ -438,10 +439,10 @@ const PgSignUp = (props) => { ) : (
-

Choose Password

+

Choose Password


{ /> { @@ -28,7 +28,12 @@ const PlanSubscriptions = () => { : ""; const phone = userDetails && userDetails.phone ? "&mobile=" + userDetails.phone : ""; - const details = "?shipping_country_code=US&" + name + email + company + phone; + const details = + "?shipping_country_code=US&billing_country_code=US&billing_state_code=CA&" + + name + + email + + company + + phone; useEffect(() => { if (localStorage.getItem("accesstoken")) { setIsLoader(false); @@ -41,7 +46,7 @@ const PlanSubscriptions = () => { return ( <> - + <Title title={"Subscriptions"} /> {isLoader ? ( <div style={{ @@ -131,15 +136,13 @@ const PlanSubscriptions = () => { <p>{item.subtitle}</p> </div> </div> - <div className="bg-[#002862] w-full text-white py-2 rounded"> - <NavLink - to={item.url + details} - className="rounded uppercase hover:no-underline hover:text-white" - target="_self" - > - {item.btnText} - </NavLink> - </div> + <NavLink + to={item.url + details} + className="bg-[#002862] w-full text-white py-2 rounded uppercase hover:no-underline hover:text-white" + target="_self" + > + {item.btnText} + </NavLink> </div> <hr className="w-full bg-gray-300 p-[.5px]" /> <ul className="mx-1 p-3 text-left break-words text-sm list-none"> diff --git a/apps/OpenSign/src/routes/Signup.js b/apps/OpenSign/src/routes/Signup.js index 3ae28e34c..8c7332a16 100644 --- a/apps/OpenSign/src/routes/Signup.js +++ b/apps/OpenSign/src/routes/Signup.js @@ -52,50 +52,27 @@ const Signup = (props) => { res .then(async (r) => { if (r) { - let roleurl = `${parseBaseUrl}functions/AddUserToRole`; - const headers = { - "Content-Type": "application/json", - "X-Parse-Application-Id": parseAppId, - sessionToken: - r.getSessionToken() || localStorage.getItem("accesstoken") - }; - let body = { - appName: props.appInfo.appname, - roleName: props.appInfo.defaultRole, - userId: r.id - }; - await axios.post(roleurl, body, { headers: headers }); - let roleData = props.appInfo.settings; if (roleData && roleData.length > 0) { - roleData.forEach((rld) => { - if (rld.role === props.appInfo.defaultRole) { - const extCls = Parse.Object.extend(rld.extended_class); - const newObj = new extCls(); - newObj.set("UserId", { - __type: "Pointer", - className: "_User", - objectId: r.id - }); - newObj.set("UserRole", props.appInfo.defaultRole); - newObj.set("Email", email); - newObj.set("Name", name); - newObj.set("Phone", phone); - newObj.set("Company", company); - newObj.set("JobTitle", jobTitle); - newObj - .save() - .then((ex) => { - if (ex) { - handleNavigation(r.getSessionToken()); - } - }) - .catch((err) => { - alert(err.message); - setState({ loading: false }); - }); + const params = { + userDetails: { + jobTitle: jobTitle, + company: company, + name: name, + email: email, + phone: phone, + role: props.appInfo.defaultRole } - }); + }; + try { + const usersignup = await Parse.Cloud.run("usersignup", params); + if (usersignup) { + handleNavigation(r.getSessionToken()); + } + } catch (err) { + alert(err.message); + setState({ loading: false }); + } } } }) diff --git a/apps/OpenSign/src/routes/UserProfile.js b/apps/OpenSign/src/routes/UserProfile.js index ae86ca1ba..f252f3644 100644 --- a/apps/OpenSign/src/routes/UserProfile.js +++ b/apps/OpenSign/src/routes/UserProfile.js @@ -214,26 +214,11 @@ function UserProfile() { </li> </ul> <div className="flex justify-center pb-4"> - <button - type="button" - onClick={() => { - if (editmode) { - setEditMode(false); - } else { - navigate("/changepassword"); - } - }} - className={`rounded shadow text-white bg-[#3598dc] mr-4 ${ - editmode ? "px-4 py-2 " : "p-2" - }`} - > - {editmode ? "Cancel" : "Change Password"} - </button> {editmode ? ( <button type="button" onClick={handleSubmit} - className="rounded bg-white border-[1px] border-[#15b4e9] text-[#15b4e9] px-4 py-2" + className="rounded bg-white border-[1px] border-[#15b4e9] text-[#15b4e9] px-4 py-2 mr-4" > Save </button> @@ -243,11 +228,26 @@ function UserProfile() { onClick={() => { setEditMode(true); }} - className="rounded shadow text-white bg-[#e7505a] px-4 py-2" + className="rounded shadow text-white bg-[#e7505a] px-4 py-2 mr-4" > Edit </button> )} + <button + type="button" + onClick={() => { + if (editmode) { + setEditMode(false); + } else { + navigate("/changepassword"); + } + }} + className={`rounded shadow text-white bg-[#3598dc] ${ + editmode ? "px-4 py-2 " : "p-2" + }`} + > + {editmode ? "Cancel" : "Change Password"} + </button> </div> </div> )} diff --git a/apps/OpenSign/src/styles/pgsignup.css b/apps/OpenSign/src/styles/pgsignup.css index fab477b35..102a878de 100644 --- a/apps/OpenSign/src/styles/pgsignup.css +++ b/apps/OpenSign/src/styles/pgsignup.css @@ -1,12 +1,14 @@ /* Full-width input fields */ .inputt { width: 100%; - padding: 15px; - margin: 5px 0 22px 0; + padding: 8px; + margin-bottom: 10px; + /* margin: 5px 0 14px 0; */ display: inline-block; border: none; background: #f1f1f1; color: black; + font-size: 12px; } /* Add a background color when the inputs get focus */ @@ -18,11 +20,12 @@ .confirmInputt { width: 100%; - padding: 15px; - margin: 5px 0 1px 0; + padding: 8px; + /* margin: 5px 0 14px 0; */ display: inline-block; background: #f1f1f1; color: black; + font-size: 12px; } .inputt::placeholder, @@ -42,11 +45,10 @@ .signupbtn { background-color: #15b4e9; color: white; - padding: 14px 20px; + padding: 12px 12px; margin: 8px 0; border: none; cursor: pointer; - width: 100%; opacity: 0.9; float: left; width: 50%; @@ -87,7 +89,7 @@ margin: 5% auto 15% auto; /* 5% from the top, 15% from the bottom and centered */ border: 1px solid #888; - width: 80%; + width: 50%; /* Could be more or less, depending on screen size */ } @@ -111,8 +113,26 @@ } /* Change styles for cancel button and signup button on extra small screens */ -@media screen and (max-width: 300px) { +@media screen and (max-width: 768px) { + + /* pgsignup Content/Box */ + .pgsignup-content { + background-color: #fefefe; + margin: 5% auto 15% auto; + /* 5% from the top, 15% from the bottom and centered */ + border: 1px solid #888; + width: 90%; + /* Could be more or less, depending on screen size */ + } + .signupbtn { width: 100%; + font-size: 16px; } -} + + /* Style the horizontal ruler */ + .hrt { + border: 1px solid #f1f1f1; + margin-bottom: 16px; + } +} \ No newline at end of file diff --git a/apps/OpenSignServer/cloud/main.js b/apps/OpenSignServer/cloud/main.js index 2facd600c..634677ed7 100644 --- a/apps/OpenSignServer/cloud/main.js +++ b/apps/OpenSignServer/cloud/main.js @@ -14,6 +14,8 @@ import SendMailv1 from './parsefunction/SendMailv1.js'; import AuthLoginAsMail from './parsefunction/AuthLoginAsMail.js'; import getUserId from './parsefunction/getUserId.js'; import getUserDetails from './parsefunction/getUserDetails.js'; +import getDocument from './parsefunction/getDocument.js'; +import getInProgressReport from './parsefunction/getInProgressReport.js'; Parse.Cloud.define('AddUserToRole', addUserToGroups); Parse.Cloud.define('UserGroups', getUserGroups); @@ -31,3 +33,4 @@ Parse.Cloud.define('sendmail', SendMailv1); Parse.Cloud.define('AuthLoginAsMail', AuthLoginAsMail); Parse.Cloud.define('getUserId', getUserId); Parse.Cloud.define('getUserDetails', getUserDetails); +Parse.Cloud.define('getDocument', getDocument); diff --git a/apps/OpenSignServer/cloud/parsefunction/getDocument.js b/apps/OpenSignServer/cloud/parsefunction/getDocument.js new file mode 100644 index 000000000..e2e1d514c --- /dev/null +++ b/apps/OpenSignServer/cloud/parsefunction/getDocument.js @@ -0,0 +1,23 @@ +export default async function getDocument(request) { + const docId = request.params.docId; + const userId = request.params.userId; + if (docId && userId) { + try { + const query = new Parse.Query('contracts_Document'); + query.equalTo('objectId', docId); + query.equalTo('ACL', new Parse.ACL(userId)); + query.include('ExtUserPtr'); + query.include('CreatedBy'); + query.include('Signers'); + query.include('AuditTrail.UserPtr'); + query.include('Placeholders'); + const res = await query.first({ useMasterKey: true }); + return res; + } catch (err) { + console.log('err', err); + return err; + } + } else { + return { error: 'Please pass required parameters!' }; + } +}