Skip to content

Commit 6875135

Browse files
authored
Merge pull request #783 from OpenSignLabs/feat_bulksend
Fix: issues in quick send
2 parents f5e216f + 07933b5 commit 6875135

File tree

12 files changed

+748
-615
lines changed

12 files changed

+748
-615
lines changed

apps/OpenSign/src/components/BulkSendUi.js

Lines changed: 61 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -164,54 +164,72 @@ const BulkSendUi = (props) => {
164164
></div>
165165
</div>
166166
)}
167-
<form onSubmit={handleSubmit}>
168-
<div className=" min-h-max max-h-[250px] overflow-y-auto">
169-
{forms?.map((form, index) => (
170-
<div
171-
key={form.Id}
172-
className="p-3 rounded-xl border-[1px] border-gray-400 m-4 bg-white text-black grid grid-cols-1 md:grid-cols-2 gap-2 relative"
173-
>
174-
{form?.fields?.map((field, fieldIndex) => (
175-
<div className="flex flex-col " key={field.fieldId}>
176-
<label>{field.label}</label>
177-
<SuggestionInput
178-
required
179-
type="email"
180-
value={field.value}
181-
index={fieldIndex}
182-
onChange={(signer) =>
183-
handleInputChange(index, signer, fieldIndex)
184-
}
185-
/>
186-
</div>
187-
))}
188-
{index > 0 && (
167+
{props.Placeholders?.length > 0 ? (
168+
<>
169+
{props.Placeholders?.some((x) => !x.signerObjId) ? (
170+
<form onSubmit={handleSubmit}>
171+
<div className=" min-h-max max-h-[250px] overflow-y-auto">
172+
{forms?.map((form, index) => (
173+
<div
174+
key={form.Id}
175+
className="p-3 rounded-xl border-[1px] border-gray-400 m-4 bg-white text-black grid grid-cols-1 md:grid-cols-2 gap-2 relative"
176+
>
177+
{form?.fields?.map((field, fieldIndex) => (
178+
<div className="flex flex-col " key={field.fieldId}>
179+
<label>{field.label}</label>
180+
<SuggestionInput
181+
required
182+
type="email"
183+
value={field.value}
184+
index={fieldIndex}
185+
onChange={(signer) =>
186+
handleInputChange(index, signer, fieldIndex)
187+
}
188+
/>
189+
</div>
190+
))}
191+
{forms?.length > 1 && (
192+
<button
193+
onClick={() => handleRemoveForm(index)}
194+
className="absolute right-3 top-1 border border-gray-300 rounded-lg px-2 py-1"
195+
>
196+
<i className="fa-solid fa-trash"></i>
197+
</button>
198+
)}
199+
<div ref={formRef}></div>
200+
</div>
201+
))}
202+
</div>
203+
<div className="flex flex-col mx-4 mb-4 gap-3">
189204
<button
190-
onClick={() => handleRemoveForm(index)}
191-
className="absolute right-3 top-1 border border-gray-300 rounded-lg px-2 py-1"
205+
onClick={handleAddForm}
206+
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
192207
>
193-
<i className="fa-solid fa-trash"></i>
208+
<i className="fa-solid fa-plus"></i> <span>Add new</span>
194209
</button>
195-
)}
196-
<div ref={formRef}></div>
210+
<button
211+
type="submit"
212+
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
213+
>
214+
<i className="fa-solid fa-paper-plane"></i> <span>Send</span>
215+
</button>
216+
</div>
217+
</form>
218+
) : (
219+
<div className="text-black p-3 bg-white w-full text-sm md:text-base flex justify-center items-center">
220+
All roles in this document are currently linked to contacts. To
221+
&apos;quick send&apos; copies of this template to multiple
222+
signers, please ensure that at least one role is not linked to any
223+
contact.
197224
</div>
198-
))}
225+
)}
226+
</>
227+
) : (
228+
<div className="text-black p-3 bg-white w-full text-sm md:text-base flex justify-center items-center">
229+
Please add at least one role to this template in order to &apos;quick
230+
send&apos; copies of it to multiple signers.
199231
</div>
200-
<div className="flex flex-col mx-4 mb-4 gap-3">
201-
<button
202-
onClick={handleAddForm}
203-
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
204-
>
205-
<i className="fa-solid fa-plus"></i> <span>Add new</span>
206-
</button>
207-
<button
208-
type="submit"
209-
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
210-
>
211-
<i className="fa-solid fa-paper-plane"></i> <span>Send</span>
212-
</button>
213-
</div>
214-
</form>
232+
)}
215233
</>
216234
);
217235
};

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

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -211,27 +211,25 @@ function RenderPdf({
211211
setCurrentSigner(true);
212212
}
213213
const handleAllUserName = (Id, Role, type) => {
214-
return pdfDetails[0].Signers.map((signerData, key) => {
215-
return (
216-
signerData.objectId === data.signerObjId && (
217-
<React.Fragment key={key}>
218-
{signerData?.Name && (
219-
<div style={{ color: "black", fontSize: 8, fontWeight: "500" }}>
220-
{signerData.Name}
221-
</div>
222-
)}
223-
{type && (
224-
<div style={{ fontWeight: "700", fontSize: 11 }}>{type}</div>
225-
)}
226-
{Role && (
227-
<div style={{ color: "black", fontSize: 8, fontWeight: "500" }}>
228-
{`(${Role})`}
229-
</div>
230-
)}
231-
</React.Fragment>
232-
)
233-
);
234-
});
214+
return (
215+
<React.Fragment>
216+
<div style={{ color: "black", fontSize: 8, fontWeight: "500" }}>
217+
{
218+
pdfDetails[0].Signers?.find(
219+
(signer) => signer.objectId === data.signerObjId
220+
)?.Name
221+
}
222+
</div>
223+
{type && (
224+
<div style={{ fontWeight: "700", fontSize: 11 }}>{type}</div>
225+
)}
226+
{Role && (
227+
<div style={{ color: "black", fontSize: 8, fontWeight: "500" }}>
228+
{`(${Role})`}
229+
</div>
230+
)}
231+
</React.Fragment>
232+
);
235233
};
236234

237235
return (

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const SuggestionInput = (props) => {
6666
type={props?.type || "text"}
6767
value={inputValue}
6868
onChange={handleInputChange}
69-
placeholder="Enter text..."
69+
placeholder="Enter Email..."
7070
className="w-full border-[1px] border-gray-400 p-2 text-black rounded"
7171
required={props.required}
7272
/>

apps/OpenSign/src/json/ReportJson.js

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default function reportJson(id) {
33
const head = ["Sr.No", "Title", "Note", "Folder", "File", "Owner", "Signers"];
44
const contactbook = ["Sr.No", "Title", "Email", "Phone"];
55
const dashboardReportHead = ["Title", "File", "Owner", "Signers"];
6-
6+
const templateReport = ["Sr.No", "Title", "File", "Owner", "Signers"];
77
switch (id) {
88
// draft documents report
99
case "ByHuevtCFY":
@@ -326,7 +326,7 @@ export default function reportJson(id) {
326326
case "6TeaPr321t":
327327
return {
328328
reportName: "Templates",
329-
heading: head,
329+
heading: templateReport,
330330
actions: [
331331
{
332332
btnId: "2234",
@@ -341,6 +341,17 @@ export default function reportJson(id) {
341341
message:
342342
"Click the 'Use' button to create a new document from an existing template. "
343343
},
344+
{
345+
btnId: "1631",
346+
btnLabel: "Quick send",
347+
hoverLabel: "Quick send",
348+
btnIcon: "fa-solid fa-envelope",
349+
redirectUrl: "",
350+
action: "bulksend",
351+
selector: "tourbulksend",
352+
message:
353+
"To quickly create and send multiple documents using an existing template, click the 'Quick Send' button."
354+
},
344355
{
345356
btnId: "2234",
346357
hoverLabel: "option",
@@ -360,14 +371,6 @@ export default function reportJson(id) {
360371
redirectUrl: "template",
361372
action: "redirect"
362373
},
363-
{
364-
btnId: "1631",
365-
btnLabel: "Quick send",
366-
hoverLabel: "Quick send",
367-
btnIcon: "fa-solid fa-envelope",
368-
redirectUrl: "",
369-
action: "bulksend"
370-
},
371374
{
372375
btnId: "1834",
373376
btnLabel: "Delete",

apps/OpenSign/src/pages/GuestLogin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ function GuestLogin() {
169169
e.preventDefault();
170170
const params = { ...contact, docId: documentId };
171171
try {
172+
setLoading(true);
172173
const linkContactRes = await Parse.Cloud.run("linkcontacttodoc", params);
173174
// console.log("linkContactRes ", linkContactRes);
174175
setContactId(linkContactRes.contactId);
175-
setLoading(true);
176176
setEnterOtp(true);
177177
await SendOtp();
178178
} catch (err) {

0 commit comments

Comments
 (0)