Skip to content

Commit a90e679

Browse files
Merge pull request #813 from OpenSignLabs/raktima-opensignlabs-patch-9
fix: display the list of unsigned signers in the 'Yet to Sign' panel using the QuickSend flow.
2 parents 302f38d + 90b5e3c commit a90e679

File tree

10 files changed

+423
-323
lines changed

10 files changed

+423
-323
lines changed

apps/OpenSign/src/components/BulkSendUi.js

Lines changed: 81 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,23 @@ const BulkSendUi = (props) => {
99
const [scrollOnNextUpdate, setScrollOnNextUpdate] = useState(false);
1010
const [isSubmit, setIsSubmit] = useState(false);
1111
const [allowedForm, setAllowedForm] = useState(0);
12+
const [isSignatureExist, setIsSignatureExist] = useState();
1213
const allowedSigners = 50;
14+
useEffect(() => {
15+
signatureExist();
16+
// eslint-disable-next-line react-hooks/exhaustive-deps
17+
}, []);
18+
19+
//function to check atleast one signature field exist
20+
const signatureExist = () => {
21+
const getPlaceholder = props.item?.Placeholders;
22+
const checkIsSignatureExistt = getPlaceholder?.every((placeholderObj) =>
23+
placeholderObj?.placeHolder?.some((holder) =>
24+
holder?.pos?.some((posItem) => posItem?.type === "signature")
25+
)
26+
);
27+
setIsSignatureExist(checkIsSignatureExistt);
28+
};
1329
useEffect(() => {
1430
if (scrollOnNextUpdate && formRef.current) {
1531
formRef.current.scrollIntoView({
@@ -165,65 +181,73 @@ const BulkSendUi = (props) => {
165181
</div>
166182
)}
167183
{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"
184+
isSignatureExist ? (
185+
<>
186+
{props.Placeholders?.some((x) => !x.signerObjId) ? (
187+
<form onSubmit={handleSubmit}>
188+
<div className=" min-h-max max-h-[250px] overflow-y-auto">
189+
{forms?.map((form, index) => (
190+
<div
191+
key={form.Id}
192+
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"
193+
>
194+
{form?.fields?.map((field, fieldIndex) => (
195+
<div className="flex flex-col " key={field.fieldId}>
196+
<label>{field.label}</label>
197+
<SuggestionInput
198+
required
199+
type="email"
200+
value={field.value}
201+
index={fieldIndex}
202+
onChange={(signer) =>
203+
handleInputChange(index, signer, fieldIndex)
204+
}
205+
/>
206+
</div>
207+
))}
208+
{forms?.length > 1 && (
209+
<button
210+
onClick={() => handleRemoveForm(index)}
211+
className="absolute right-3 top-1 border border-gray-300 rounded-lg px-2 py-1"
212+
>
213+
<i className="fa-solid fa-trash"></i>
214+
</button>
215+
)}
216+
<div ref={formRef}></div>
217+
</div>
218+
))}
219+
</div>
220+
<div className="flex flex-col mx-4 mb-4 gap-3">
221+
<button
222+
onClick={handleAddForm}
223+
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
176224
>
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">
204-
<button
205-
onClick={handleAddForm}
206-
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
207-
>
208-
<i className="fa-solid fa-plus"></i> <span>Add new</span>
209-
</button>
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>
225+
<i className="fa-solid fa-plus"></i> <span>Add new</span>
226+
</button>
227+
<button
228+
type="submit"
229+
className="bg-[#32a3ac] p-2 text-white w-full rounded-full focus:outline-none"
230+
>
231+
<i className="fa-solid fa-paper-plane"></i>{" "}
232+
<span>Send</span>
233+
</button>
234+
</div>
235+
</form>
236+
) : (
237+
<div className="text-black p-3 bg-white w-full text-sm md:text-base flex justify-center items-center">
238+
All roles in this document are currently linked to contacts. To
239+
&apos;quick send&apos; copies of this template to multiple
240+
signers, please ensure that at least one role is not linked to
241+
any contact.
216242
</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.
224-
</div>
225-
)}
226-
</>
243+
)}
244+
</>
245+
) : (
246+
<div className="text-black p-3 bg-white w-full text-sm md:text-base flex justify-center items-center">
247+
Please ensure there&#39;s at least one signature widget added for
248+
all recipients.
249+
</div>
250+
)
227251
) : (
228252
<div className="text-black p-3 bg-white w-full text-sm md:text-base flex justify-center items-center">
229253
Please add at least one role to this template in order to &apos;quick

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ function RenderPdf({
204204
};
205205
//function for render placeholder block over pdf document
206206
const checkSignedSignes = (data) => {
207-
const checkSign = signedSigners.filter(
208-
(sign) => sign.objectId === data.signerObjId
207+
let checkSign = [];
208+
//condition to handle quick send flow and using normal request sign flow
209+
checkSign = signedSigners.filter(
210+
(sign) => sign?.Id === data?.Id || sign?.objectId === data?.signerObjId
209211
);
210212
if (data.signerObjId === signerObjectId) {
211213
setCurrentSigner(true);

apps/OpenSign/src/constant/Utils.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ export const createDocument = async (template, placeholders, signerData) => {
669669
Name: Doc.Name,
670670
URL: Doc.URL,
671671
SignedUrl: Doc.SignedUrl,
672+
SentToOthers: Doc.SentToOthers,
672673
Description: Doc.Description,
673674
Note: Doc.Note,
674675
Placeholders: placeholdersArr,

0 commit comments

Comments
 (0)