create getDocument cloud function & minor UI changes

This commit is contained in:
prafull-opensignlabs
2023-11-20 10:42:20 +05:30
parent 776b1a7b43
commit ed6f44fd62
10 changed files with 131 additions and 104 deletions
@@ -209,6 +209,13 @@ const LoginFacebook = ({
/>
</div>
<div>
<button
type="button"
onClick={() => handleSubmitbtn()}
className="btn btn-info"
>
Sign up
</button>
<button
type="button"
className="btn btn-secondary"
@@ -217,13 +224,6 @@ const LoginFacebook = ({
>
Cancel
</button>
<button
type="button"
onClick={() => handleSubmitbtn()}
className="btn btn-info"
>
Sign up
</button>
</div>
</form>
</div>
+10 -10
View File
@@ -263,17 +263,17 @@ const GoogleSignInBtn = ({
</div>
<div className="form-group">
<label
htmlFor="Destination"
htmlFor="JobTitle"
style={{ display: "flex" }}
className="col-form-label"
>
Destination{" "}
Job Title{" "}
<span style={{ fontSize: 13, color: "red" }}>*</span>
</label>
<input
type="text"
className="form-control"
id="Destination"
id="JobTitle"
value={userDetails.Destination}
onChange={(e) =>
setUserDetails({
@@ -285,6 +285,13 @@ const GoogleSignInBtn = ({
/>
</div>
<div>
<button
type="button"
className="bg-[#17a2b8] p-2 text-white rounded"
onClick={() => handleSubmitbtn()}
>
Sign up
</button>
<button
type="button"
className="bg-[#6c757d] p-2 text-white rounded"
@@ -293,13 +300,6 @@ const GoogleSignInBtn = ({
>
Cancel
</button>
<button
type="button"
className="bg-[#17a2b8] p-2 text-white rounded"
onClick={() => handleSubmitbtn()}
>
Sign up
</button>
</div>
</form>
</div>
+1 -1
View File
@@ -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": [
+4 -3
View File
@@ -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) => {
) : (
<form id="signup" className="pgsignup-content" onSubmit={handleSubmit}>
<div className="pgsignup-container">
<h1 className="text-4xl font-bold">Choose Password</h1>
<h1 className="text-2xl md:text-3xl font-bold">Choose Password</h1>
<hr className="hrt" />
<label htmlFor="password">
<b>Password</b>
<b className="text-[13px]">Password</b>
</label>
<input
type="password"
@@ -454,7 +455,7 @@ const PgSignUp = (props) => {
/>
<label htmlFor="confirmPassword">
<b>Confirm Password</b>
<b className="text-[13px]">Confirm Password</b>
</label>
<input
type="password"
+19 -16
View File
@@ -2,14 +2,14 @@ import React, { useState, useEffect } from "react";
import { useNavigate } from "react-router";
import { NavLink } from "react-router-dom";
import checkmark from "../assets/images/checkmark.png";
import plansArr from '../json/plansArr.json'
import plansArr from "../json/plansArr.json";
import Title from "../components/Title";
const listItemStyle = {
paddingLeft: '20px', // Add padding to create space for the image
paddingLeft: "20px", // Add padding to create space for the image
backgroundImage: `url(${checkmark})`, // Set your image as the list style image
backgroundPosition: 'left',
backgroundRepeat: 'no-repeat',
backgroundSize: '16px 16px', // Adjust the size of the image
backgroundPosition: "left",
backgroundRepeat: "no-repeat",
backgroundSize: "16px 16px" // Adjust the size of the image
};
const PlanSubscriptions = () => {
@@ -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"} />
<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">
+18 -41
View File
@@ -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 });
}
}
}
})
+17 -17
View File
@@ -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>
)}
+29 -9
View File
@@ -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;
}
}
+3
View File
@@ -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);
@@ -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!' };
}
}