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