@@ -102,7 +102,6 @@ const TemplatePlaceholder = () => {
102
102
} ) ;
103
103
const [ { isDragSign } , dragSignature ] = useDrag ( {
104
104
type : "BOX" ,
105
-
106
105
item : {
107
106
type : "BOX" ,
108
107
id : 1 ,
@@ -127,7 +126,6 @@ const TemplatePlaceholder = () => {
127
126
128
127
const [ { isDragSignatureSS } , dragSignatureSS ] = useDrag ( {
129
128
type : "BOX" ,
130
-
131
129
item : {
132
130
type : "BOX" ,
133
131
id : 3 ,
@@ -140,7 +138,6 @@ const TemplatePlaceholder = () => {
140
138
141
139
const [ { isDragStampSS } , dragStampSS ] = useDrag ( {
142
140
type : "BOX" ,
143
-
144
141
item : {
145
142
type : "BOX" ,
146
143
id : 4 ,
@@ -405,15 +402,14 @@ const TemplatePlaceholder = () => {
405
402
406
403
xyPosArr . push ( xyPos ) ;
407
404
}
408
-
409
- //add signers objId first inseretion
405
+ const { blockColor , Role } = signersdata . find ( ( x ) => x . Id === uniqueId ) ;
406
+ //adding placholder in existing signer pos array (placaholder)
410
407
if ( filterSignerPos . length > 0 ) {
411
408
// const colorIndex = signerPos
412
409
// .map((e) => e.signerObjId)
413
410
// .indexOf(signerObjId);
414
411
415
412
const colorIndex = signerPos . map ( ( e ) => e . Id ) . indexOf ( uniqueId ) ;
416
- const blockColor = signersdata . find ( ( x ) => x . Id === uniqueId ) ?. blockColor ;
417
413
const getPlaceHolder = filterSignerPos [ 0 ] . placeHolder ;
418
414
const updatePlace = getPlaceHolder . filter (
419
415
( data ) => data . pageNumber !== pageNumber
@@ -442,7 +438,7 @@ const TemplatePlaceholder = () => {
442
438
className : `${ contractName } ` ,
443
439
objectId : signerObjId
444
440
} ,
445
- Role : roleName ,
441
+ Role : Role ? Role : roleName ,
446
442
Id : uniqueId
447
443
} ;
448
444
} else {
@@ -451,7 +447,7 @@ const TemplatePlaceholder = () => {
451
447
signerObjId : "" ,
452
448
placeHolder : updatePlace ,
453
449
signerPtr : { } ,
454
- Role : roleName ,
450
+ Role : Role ? Role : roleName ,
455
451
Id : uniqueId
456
452
} ;
457
453
}
@@ -476,7 +472,7 @@ const TemplatePlaceholder = () => {
476
472
className : `${ contractName } ` ,
477
473
objectId : signerObjId
478
474
} ,
479
- Role : roleName ,
475
+ Role : Role ? Role : roleName ,
480
476
Id : uniqueId
481
477
} ;
482
478
} else {
@@ -485,12 +481,11 @@ const TemplatePlaceholder = () => {
485
481
signerObjId : "" ,
486
482
placeHolder : newSignPoss ,
487
483
signerPtr : { } ,
488
- Role : roleName ,
484
+ Role : Role ? Role : roleName ,
489
485
Id : uniqueId
490
486
} ;
491
487
}
492
488
493
- // signerPos.splice(colorIndex, 1, placeHolderPos);
494
489
const newArry = [ placeHolderPos ] ;
495
490
const newArray = [
496
491
...signerPos . slice ( 0 , colorIndex ) ,
@@ -501,7 +496,7 @@ const TemplatePlaceholder = () => {
501
496
setSignerPos ( newArray ) ;
502
497
}
503
498
} else {
504
- const blockColor = signersdata . find ( ( x ) => x . Id === uniqueId ) ?. blockColor ;
499
+ //adding new placeholder for selected signer in pos array (placeholder)
505
500
let placeHolderPos ;
506
501
if ( contractName ) {
507
502
placeHolderPos = {
@@ -513,7 +508,7 @@ const TemplatePlaceholder = () => {
513
508
signerObjId : signerObjId ,
514
509
blockColor : blockColor ? blockColor : color [ isSelectListId ] ,
515
510
placeHolder : xyPosArr ,
516
- Role : roleName ,
511
+ Role : Role ? Role : roleName ,
517
512
Id : uniqueId
518
513
} ;
519
514
} else {
@@ -522,7 +517,7 @@ const TemplatePlaceholder = () => {
522
517
signerObjId : "" ,
523
518
blockColor : blockColor ? blockColor : color [ isSelectListId ] ,
524
519
placeHolder : xyPosArr ,
525
- Role : roleName ,
520
+ Role : Role ? Role : roleName ,
526
521
Id : uniqueId
527
522
} ;
528
523
}
@@ -871,14 +866,17 @@ const TemplatePlaceholder = () => {
871
866
e . preventDefault ( ) ;
872
867
const count = signersdata . length > 0 ? signersdata . length + 1 : 1 ;
873
868
const Id = randomId ( ) ;
869
+ const index = signersdata ?. length || 0 ;
874
870
const obj = {
875
871
Role : roleName || "User " + count ,
876
- Id : Id
872
+ Id : Id ,
873
+ blockColor : color [ index ]
877
874
} ;
878
875
setSignersData ( ( prevArr ) => [ ...prevArr , obj ] ) ;
879
876
setIsModalRole ( false ) ;
880
877
setRoleName ( "" ) ;
881
878
setUniqueId ( Id ) ;
879
+ setIsSelectId ( index ) ;
882
880
setIsMailSend ( false ) ;
883
881
} ;
884
882
// `handleDeleteUser` function is used to delete record and placeholder when user click on delete which is place next user name in recipients list
0 commit comments