@@ -480,13 +480,13 @@ function SignYourSelf() {
480
480
Width : widgetTypeExist
481
481
? calculateInitialWidthHeight ( dragTypeValue , widgetValue ) . getWidth
482
482
: dragTypeValue === "initials"
483
- ? defaultWidthHeight ( dragTypeValue ) . width
484
- : "" ,
483
+ ? defaultWidthHeight ( dragTypeValue ) . width
484
+ : "" ,
485
485
Height : widgetTypeExist
486
486
? calculateInitialWidthHeight ( dragTypeValue , widgetValue ) . getHeight
487
487
: dragTypeValue === "initials"
488
- ? defaultWidthHeight ( dragTypeValue ) . height
489
- : "" ,
488
+ ? defaultWidthHeight ( dragTypeValue ) . height
489
+ : "" ,
490
490
options : addWidgetOptions ( dragTypeValue )
491
491
} ;
492
492
@@ -603,7 +603,8 @@ function SignYourSelf() {
603
603
} ;
604
604
//function for send placeholder's co-ordinate(x,y) position embed signature url or stamp url
605
605
async function embedWidgetsData ( ) {
606
- let showAlert = false ;
606
+ let showAlert = false ,
607
+ isSignatureExist = false ;
607
608
try {
608
609
for ( let i = 0 ; i < xyPostion ?. length ; i ++ ) {
609
610
const requiredWidgets = xyPostion [ i ] . pos . filter (
@@ -627,17 +628,26 @@ function SignYourSelf() {
627
628
}
628
629
}
629
630
}
631
+ //condition to check exist signature widget or not
632
+ if ( ! isSignatureExist ) {
633
+ isSignatureExist = xyPostion [ i ] . pos . some (
634
+ ( data ) => data ?. type === "signature"
635
+ ) ;
636
+ }
630
637
}
631
- if ( xyPostion . length === 0 ) {
638
+ if ( xyPostion . length === 0 || ! isSignatureExist ) {
632
639
setIsAlert ( {
640
+ header : "Fields required" ,
633
641
isShow : true ,
634
- alertMessage : "Please complete your signature!"
642
+ alertMessage :
643
+ "Please ensure there's at least one signature widget added"
635
644
} ) ;
636
645
return ;
637
646
} else if ( showAlert ) {
638
647
setIsAlert ( {
639
648
isShow : true ,
640
- alertMessage : "Please complete your signature!"
649
+ alertMessage :
650
+ "Please ensure all field is accurately filled and meets all requirements."
641
651
} ) ;
642
652
return ;
643
653
} else {
@@ -713,13 +723,13 @@ function SignYourSelf() {
713
723
// for adding it in completion certificate
714
724
let getSignature ;
715
725
for ( let item of xyPostion ) {
716
- const typeExist = item . pos . some ( ( data ) => data ?. type ) ;
717
- if ( typeExist ) {
718
- getSignature = item . pos . find ( ( data ) => data ?. type === "signature" ) ;
719
- break ;
720
- } else {
721
- getSignature = item . pos . find ( ( data ) => ! data . isStamp ) ;
722
- break ;
726
+ if ( ! getSignature ) {
727
+ const typeExist = item . pos . some ( ( data ) => data ?. type ) ;
728
+ if ( typeExist ) {
729
+ getSignature = item . pos . find ( ( data ) => data ?. type === "signature" ) ;
730
+ } else {
731
+ getSignature = item . pos . find ( ( data ) => ! data . isStamp ) ;
732
+ }
723
733
}
724
734
}
725
735
let base64Sign = getSignature . SignUrl ;
@@ -1161,7 +1171,7 @@ function SignYourSelf() {
1161
1171
< ModalUi
1162
1172
headerColor = { "#dc3545" }
1163
1173
isOpen = { isAlert . isShow }
1164
- title = { "Alert" }
1174
+ title = { isAlert ?. header || "Alert" }
1165
1175
handleClose = { ( ) => {
1166
1176
setIsAlert ( {
1167
1177
isShow : false ,
@@ -1171,28 +1181,6 @@ function SignYourSelf() {
1171
1181
>
1172
1182
< div style = { { height : "100%" , padding : 20 } } >
1173
1183
< p > { isAlert . alertMessage } </ p >
1174
-
1175
- < div
1176
- style = { {
1177
- height : "1px" ,
1178
- backgroundColor : "#9f9f9f" ,
1179
- width : "100%" ,
1180
- marginTop : "15px" ,
1181
- marginBottom : "15px"
1182
- } }
1183
- > </ div >
1184
- < button
1185
- onClick = { ( ) => {
1186
- setIsAlert ( {
1187
- isShow : false ,
1188
- alertMessage : ""
1189
- } ) ;
1190
- } }
1191
- type = "button"
1192
- className = "finishBtn cancelBtn"
1193
- >
1194
- Ok
1195
- </ button >
1196
1184
</ div >
1197
1185
</ ModalUi >
1198
1186
0 commit comments