@@ -9,7 +9,23 @@ const BulkSendUi = (props) => {
9
9
const [ scrollOnNextUpdate , setScrollOnNextUpdate ] = useState ( false ) ;
10
10
const [ isSubmit , setIsSubmit ] = useState ( false ) ;
11
11
const [ allowedForm , setAllowedForm ] = useState ( 0 ) ;
12
+ const [ isSignatureExist , setIsSignatureExist ] = useState ( ) ;
12
13
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
+ } ;
13
29
useEffect ( ( ) => {
14
30
if ( scrollOnNextUpdate && formRef . current ) {
15
31
formRef . current . scrollIntoView ( {
@@ -165,65 +181,73 @@ const BulkSendUi = (props) => {
165
181
</ div >
166
182
) }
167
183
{ 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"
176
224
>
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
+ 'quick send' copies of this template to multiple
240
+ signers, please ensure that at least one role is not linked to
241
+ any contact.
216
242
</ 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
- 'quick send' 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's at least one signature widget added for
248
+ all recipients.
249
+ </ div >
250
+ )
227
251
) : (
228
252
< div className = "text-black p-3 bg-white w-full text-sm md:text-base flex justify-center items-center" >
229
253
Please add at least one role to this template in order to 'quick
0 commit comments