Skip to content

Commit b8fb626

Browse files
fix: drattemplate ui changes, signers not visible in list, alert message
1 parent 50d7982 commit b8fb626

File tree

7 files changed

+43
-33
lines changed

7 files changed

+43
-33
lines changed

apps/OpenSign/src/components/pdf/EditTemplate.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ import { isEnableSubscription } from "../../constant/const";
55
import { useTranslation } from "react-i18next";
66
import { Tooltip } from "react-tooltip";
77

8-
// import SelectFolder from "../../premitives/SelectFolder";
9-
10-
const EditTemplate = ({ template, onSuccess }) => {
8+
const EditTemplate = ({ template, onSuccess, jwttoken }) => {
119
const { t } = useTranslation();
12-
// const [folder, setFolder] = useState({ ObjectId: "", Name: "" });
1310
const [formData, setFormData] = useState({
1411
Name: template?.Name || "",
1512
Note: template?.Note || "",
@@ -29,17 +26,13 @@ const EditTemplate = ({ template, onSuccess }) => {
2926
}, []);
3027
const fetchSubscription = async () => {
3128
if (isEnableSubscription) {
32-
const subscribe = await checkIsSubscribed();
29+
const subscribe = await checkIsSubscribed(jwttoken);
3330
setIsSubscribe(subscribe.isValid);
3431
}
3532
};
3633
const handleStrInput = (e) => {
3734
setFormData({ ...formData, [e.target.name]: e.target.value });
3835
};
39-
// const handleFolder = (data) => {
40-
// console.log("handleFolder ", data)
41-
// setFolder(data);
42-
// };
4336

4437
// Define a function to handle form submission
4538
const handleSubmit = async (e) => {
@@ -85,7 +78,7 @@ const EditTemplate = ({ template, onSuccess }) => {
8578
</div>
8679
<div className="mb-[0.35rem]">
8780
<label htmlFor="name" className="text-[13px]">
88-
{t("name")}
81+
{t("Title")}
8982
<span className="text-[13px] text-[red]"> *</span>
9083
</label>
9184
<input
@@ -158,7 +151,6 @@ const EditTemplate = ({ template, onSuccess }) => {
158151
}
159152
>
160153
{t("auto-reminder")}
161-
{" "}
162154
{!isSubscribe && isEnableSubscription && <Upgrade />}
163155
</span>
164156
<label

apps/OpenSign/src/components/pdf/PdfHeader.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ function Header({
4040
handleRotationFun,
4141
isDisableRotate,
4242
templateId,
43-
setIsDownloadModal
43+
setIsDownloadModal,
44+
disabledBackBtn
4445
}) {
4546
const { t } = useTranslation();
4647
const filterPrefill =
4748
signerPos && signerPos?.filter((data) => data.Role !== "prefill");
4849
const isMobile = window.innerWidth < 767;
4950
const [isDownloading, setIsDownloading] = useState("");
5051
const isGuestSigner = localStorage.getItem("isGuestSigner");
52+
const enabledBackBtn = disabledBackBtn === true ? false : true;
5153

5254
//function for show decline alert
5355
const handleDeclinePdfAlert = async () => {
@@ -332,13 +334,15 @@ function Header({
332334
<i className="fa-light fa-gear fa-lg"></i>
333335
</button>
334336
)}
335-
<button
336-
onClick={() => window.history.go(-2)}
337-
type="button"
338-
className="op-btn op-btn-ghost op-btn-sm mr-[3px]"
339-
>
340-
{t("back")}
341-
</button>
337+
{enabledBackBtn && (
338+
<button
339+
onClick={() => window.history.go(-2)}
340+
type="button"
341+
className="op-btn op-btn-ghost op-btn-sm mr-[3px]"
342+
>
343+
{t("back")}
344+
</button>
345+
)}
342346
<button
343347
disabled={isMailSend && true}
344348
data-tut="headerArea"

apps/OpenSign/src/components/shared/fields/SelectSigners.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ const SelectSigners = (props) => {
3333
try {
3434
const baseURL = localStorage.getItem("baseUrl");
3535
const url = `${baseURL}functions/getsigners`;
36-
const token = props?.jwttoken
37-
? { jwttoken: props?.jwttoken }
36+
const token = props.jwttoken
37+
? { jwttoken: props.jwttoken }
3838
: { "X-Parse-Session-Token": localStorage.getItem("accesstoken") };
3939
const headers = {
4040
"Content-Type": "application/json",
4141
"X-Parse-Application-Id": localStorage.getItem("parseAppId"),
4242
...token
4343
};
44-
const search = inputValue;
45-
const axiosRes = await axios.post(url, { search }, { headers });
44+
const searchEmail = inputValue;
45+
const axiosRes = await axios.post(url, { searchEmail }, { headers });
4646
const contactRes = axiosRes?.data?.result || [];
4747
if (contactRes) {
4848
const res = JSON.parse(JSON.stringify(contactRes));

apps/OpenSign/src/constant/Utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ export async function fetchSubscriptionInfo() {
126126
}
127127
}
128128
//function to get subcripition details from subscription class
129-
export async function checkIsSubscribed() {
129+
export async function checkIsSubscribed(jwttoken) {
130130
try {
131-
const res = await fetchSubscription();
131+
const res = await fetchSubscription("", "", false, false, jwttoken);
132132
if (res.plan === "freeplan") {
133133
return { plan: res.plan, isValid: false, adminId: res?.adminId };
134134
} else if (res.billingDate) {

apps/OpenSign/src/pages/DraftTemplate.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ const DraftTemplate = () => {
732732
} else {
733733
// setIsPublicError(true);
734734
alert(
735-
"Only one signer without a role is allowed, and it should be at the first index."
735+
"To make your template public, it must either contain a single role, or, if it includes multiple roles, all additional roles must already be assigned to signers. The unassigned public role should remain empty and must be placed in the first position. \nVisit below link to know more - \nhttps://docs.opensignlabs.com/docs/help/Templates/make-template-public"
736736
);
737737
}
738738
} else {
@@ -1302,7 +1302,7 @@ const DraftTemplate = () => {
13021302
} else {
13031303
// setIsPublicError(true);
13041304
alert(
1305-
"Only one signer without a role is allowed, and it should be at the first index."
1305+
"To make your template public, it must either contain a single role, or, if it includes multiple roles, all additional roles must already be assigned to signers. The unassigned public role should remain empty and must be placed in the first position. \nVisit below link to know more - \nhttps://docs.opensignlabs.com/docs/help/Templates/make-template-public"
13061306
);
13071307
}
13081308
};
@@ -1614,6 +1614,7 @@ const DraftTemplate = () => {
16141614
{/* pdf header which contain funish back button */}
16151615
<Header
16161616
completeBtnTitle={t("send")}
1617+
disabledBackBtn={true}
16171618
isPlaceholder={true}
16181619
pageNumber={pageNumber}
16191620
allPages={allPages}
@@ -1800,6 +1801,7 @@ const DraftTemplate = () => {
18001801
<EditTemplate
18011802
template={pdfDetails?.[0]}
18021803
onSuccess={handleEditTemplateForm}
1804+
jwttoken={jwttoken}
18031805
/>
18041806
</ModalUi>
18051807
<WidgetNameModal

apps/OpenSignServer/Utils.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,12 @@ export const updateMailCount = async (extUserId, plan, monthchange) => {
127127
};
128128

129129
export function formatWidgetOptions(type, options) {
130+
const colorsArr = ['red', 'black', 'blue', 'yellow'];
130131
const status = options?.required === true ? 'required' : 'optional' || 'required';
131132
const defaultValue = options?.default || '';
132133
const values = options?.values || [];
134+
const color = options?.color ? options.color : 'black';
135+
const fontColor = colorsArr.includes(color) ? color : 'black';
133136
switch (type) {
134137
case 'signature':
135138
return { name: 'signature', status: 'required' };
@@ -140,13 +143,18 @@ export function formatWidgetOptions(type, options) {
140143
case 'image':
141144
return { status: status, name: options.name || 'image' };
142145
case 'email':
143-
return { status: status, name: options.name || 'email', validation: { type: 'email' } };
146+
return {
147+
status: status,
148+
name: options.name || 'email',
149+
validation: { type: 'email' },
150+
fontColor: fontColor,
151+
};
144152
case 'name':
145-
return { status: status, name: options.name || 'name' };
153+
return { status: status, name: options.name || 'name', fontColor: fontColor };
146154
case 'job title':
147-
return { status: status, name: options.name || 'job title' };
155+
return { status: status, name: options.name || 'job title', fontColor: fontColor };
148156
case 'company':
149-
return { status: status, name: options.name || 'company' };
157+
return { status: status, name: options.name || 'company', fontColor: fontColor };
150158
case 'date': {
151159
let today = new Date();
152160
let dd = String(today.getDate()).padStart(2, '0');
@@ -160,6 +168,7 @@ export function formatWidgetOptions(type, options) {
160168
name: options.name || 'date',
161169
response: defaultValue || today,
162170
validation: { format: dateFormat || 'dd-MM-yyyy', type: 'date-format' },
171+
fontColor: fontColor,
163172
};
164173
}
165174
case 'textbox':
@@ -169,6 +178,7 @@ export function formatWidgetOptions(type, options) {
169178
defaultValue: defaultValue,
170179
hint: options.hint,
171180
validation: { type: 'regex', pattern: options?.regularexpression || '/^[a-zA-Z0-9s]+$/' },
181+
fontColor: fontColor,
172182
};
173183
case 'checkbox': {
174184
const arr = options?.values;
@@ -188,6 +198,7 @@ export function formatWidgetOptions(type, options) {
188198
maxRequiredCount: options?.validation?.maxselections || 0,
189199
},
190200
defaultValue: selectedvalues || [],
201+
fontColor: fontColor,
191202
};
192203
}
193204
case 'radio button': {
@@ -198,6 +209,7 @@ export function formatWidgetOptions(type, options) {
198209
isReadOnly: options?.readonly || false,
199210
isHideLabel: options?.hidelabel || false,
200211
defaultValue: defaultValue,
212+
fontColor: fontColor,
201213
};
202214
}
203215
case 'dropdown':
@@ -206,6 +218,7 @@ export function formatWidgetOptions(type, options) {
206218
name: options.name || 'dropdown',
207219
values: values,
208220
defaultValue: defaultValue,
221+
fontColor: fontColor,
209222
};
210223
default:
211224
break;

apps/OpenSignServer/cloud/parsefunction/getSigners.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ export default async function getSigners(request) {
1313
className: '_User',
1414
objectId: request?.user?.id,
1515
});
16-
1716
if (search) {
1817
contactbook.matches('Name', new RegExp(search, 'i'));
1918
} else if (searchEmail) {
2019
contactbook.matches('Email', new RegExp(searchEmail, 'i'));
2120
}
2221
contactbook.notEqualTo('IsDeleted', true);
23-
const contactRes = await contactbook.find();
22+
const contactRes = await contactbook.find({ sessionToken: request.user.getSessionToken() });
2423
const _contactRes = JSON.parse(JSON.stringify(contactRes));
2524
return _contactRes;
2625
} else if (jwttoken) {

0 commit comments

Comments
 (0)