@@ -28,7 +28,7 @@ function PdfFileComponent({
28
28
const [ isOpenMoveModal , setIsOpenMoveModal ] = useState ( false ) ;
29
29
const [ selectDoc , setSelectDoc ] = useState ( ) ;
30
30
const [ isDeleteDoc , setIsDeleteDoc ] = useState ( false ) ;
31
- const contextMenu = [ "Download" , "Rename" , "Delete " , "Move " ] ;
31
+ const contextMenu = [ "Download" , "Rename" , "Move " , "Delete " ] ;
32
32
const navigate = useNavigate ( ) ;
33
33
34
34
//to focus input box on press rename to change doc name
@@ -113,56 +113,45 @@ function PdfFileComponent({
113
113
const signUrl = data . SignedUrl && data . SignedUrl ;
114
114
const isDecline = data . IsDeclined && data . IsDeclined ;
115
115
const isPlaceholder = data . Placeholders && data . Placeholders ;
116
- //checking and navigate to signyouself page
117
- const checkPlaceHolder = data . Placeholders ;
116
+
117
+ let isExpire = false ;
118
+ if ( currDate > expireUpdateDate ) {
119
+ isExpire = true ;
120
+ }
118
121
//checking if document has completed
119
- if ( data . IsCompleted && signerExist ) {
122
+ if ( data ? .IsCompleted && signerExist ?. length > 0 ) {
120
123
navigate ( `${ hostUrl } pdfRequestFiles/${ data . objectId } ` ) ;
121
124
122
125
// window.location.hash = `/pdfRequestFiles/${data.objectId}`;
123
- } else if ( data . IsCompleted && ! signerExist ) {
126
+ } else if ( data ? .IsCompleted && signerExist ?. length === 0 ) {
124
127
navigate ( `${ hostUrl } signaturePdf/${ data . objectId } ` ) ;
125
128
}
126
129
//checking if document has declined by someone
127
130
else if ( isDecline ) {
128
131
navigate ( `${ hostUrl } pdfRequestFiles/${ data . objectId } ` ) ;
129
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
130
- } else if ( currDate > expireUpdateDate && signerExist && ! isPlaceholder ) {
131
- // window.location.hash = `/placeHolderSign/${data.objectId}`;
132
- navigate ( `${ hostUrl } placeHolderSign/${ data . objectId } ` ) ;
132
+ //checking draft type document
133
133
} else if (
134
- currDate > expireUpdateDate &&
135
- ! signerExist &&
136
- ! isPlaceholder &&
134
+ isExpire &&
135
+ signerExist ?. length === 0 &&
136
+ isPlaceholder ?. length === 0 &&
137
137
! signUrl
138
138
) {
139
139
navigate ( `${ hostUrl } signaturePdf/${ data . objectId } ` ) ;
140
- // window.location.hash = `/signaturePdf/${data.objectId}`;
141
- }
142
- //checking if document has expired
143
- else if ( currDate > expireUpdateDate ) {
144
- navigate ( `${ hostUrl } pdfRequestFiles/${ data . objectId } ` ) ;
145
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
146
- } //checking if document is draft signers type and signers placeholder does not placed yet
147
- else if ( ! signUrl && signerExist ) {
148
- // window.location.hash = `/placeHolderSign/${data.objectId}`;
149
- navigate ( `${ hostUrl } placeHolderSign/${ data . objectId } ` ) ;
150
- }
151
- //checking if document is request type and signers placeholder exist and does not completed yet
152
- //then user can check progress of document and sign also
153
- else if (
154
- checkPlaceHolder &&
155
- checkPlaceHolder . length > 0 &&
156
- ! data . IsCompleted
140
+ } else if (
141
+ ( isExpire || ! isExpire ) &&
142
+ isPlaceholder ?. length > 0 &&
143
+ signerExist ?. length > 0
157
144
) {
158
145
navigate ( `${ hostUrl } pdfRequestFiles/${ data . objectId } ` ) ;
159
- // window.location.hash = `/pdfRequestFiles/${data.objectId}`;
146
+ } else if ( signerExist ?. length > 0 && isPlaceholder ?. length === 0 ) {
147
+ navigate ( `${ hostUrl } placeHolderSign/${ data . objectId } ` ) ;
148
+ //checking draft type document
149
+ } else if ( signerExist ?. length === 0 && isPlaceholder ?. length > 0 ) {
150
+ navigate ( `${ hostUrl } placeHolderSign/${ data . objectId } ` ) ;
160
151
}
161
152
//checking document is draft and signyourself type then user can sign document
162
153
else {
163
154
navigate ( `${ hostUrl } signaturePdf/${ data . objectId } ` ) ;
164
- // navigate(`/signaturePdf/${data.objectId}`);
165
- // window.location.hash = `/signaturePdf/${data.objectId}`;
166
155
}
167
156
} ;
168
157
@@ -189,6 +178,7 @@ function PdfFileComponent({
189
178
} ;
190
179
//function for delete document
191
180
const handleDeleteDocument = async ( docData ) => {
181
+ setIsDeleteDoc ( false ) ;
192
182
const docId = docData . objectId ;
193
183
const data = {
194
184
IsArchive : true
@@ -302,7 +292,6 @@ function PdfFileComponent({
302
292
status ,
303
293
isDecline ,
304
294
signerExist ,
305
- isExpire ,
306
295
isComplete ,
307
296
signUrl ,
308
297
isPlaceholder ;
@@ -317,36 +306,55 @@ function PdfFileComponent({
317
306
signUrl = data . SignedUrl && data . SignedUrl ;
318
307
const expireUpdateDate = new Date ( expireDate ) . getTime ( ) ;
319
308
const currDate = new Date ( ) . getTime ( ) ;
320
-
309
+ let isExpire = false ;
321
310
if ( currDate > expireUpdateDate ) {
322
311
isExpire = true ;
323
- } else {
324
- isExpire = false ;
325
312
}
313
+
326
314
if ( isComplete ) {
327
315
status = "Completed" ;
328
316
} else if ( isDecline ) {
329
317
status = "Declined" ;
330
- } else if ( isExpire && ! isPlaceholder && signerExist ) {
331
- // status = "Expired";
318
+ } else if (
319
+ ! isExpire &&
320
+ isPlaceholder ?. length === 0 &&
321
+ signerExist ?. length > 0
322
+ ) {
332
323
status = "Draft" ;
333
- } else if ( isExpire && ! isPlaceholder && ! signerExist && ! signUrl ) {
334
- // status = "Expired";
324
+ } else if (
325
+ ! isExpire &&
326
+ isPlaceholder ?. length > 0 &&
327
+ signerExist ?. length === 0
328
+ ) {
329
+ status = "Draft" ;
330
+ } else if (
331
+ ! isExpire &&
332
+ isPlaceholder ?. length === 0 &&
333
+ signerExist ?. length > 0 &&
334
+ ! signUrl
335
+ ) {
335
336
status = "Draft" ;
336
337
} else if ( isExpire ) {
337
338
status = "Expired" ;
338
339
} else if ( ! signUrl ) {
339
340
status = "Draft" ;
340
341
} else {
341
- status = "InComplete " ;
342
+ status = "In Progress " ;
342
343
}
343
344
}
344
345
345
346
const signersName = ( ) => {
346
347
const getSignersName = signerExist . map ( ( data ) => data . Name ) ;
347
348
const signerName = getSignersName . join ( "," ) ;
348
349
349
- return < span className = "statusSpan" > { signerName } </ span > ;
350
+ return (
351
+ < span
352
+ className = "statusSpan"
353
+ style = { { width : "90%" , wordWrap : "break-word" } }
354
+ >
355
+ { signerName } { " " }
356
+ </ span >
357
+ ) ;
350
358
} ;
351
359
return listType === "table" ? (
352
360
data . Type === "Folder" ? (
@@ -598,7 +606,7 @@ function PdfFileComponent({
598
606
< i className = "fa fa-file" > </ i >
599
607
</ div >
600
608
) : (
601
- status === "InComplete " && (
609
+ status === "In Progress " && (
602
610
< div className = "status-badge in-progress" >
603
611
< i className = "fa fa-paper-plane" > </ i >
604
612
</ div >
@@ -646,9 +654,11 @@ function PdfFileComponent({
646
654
{ signerExist && (
647
655
< >
648
656
< strong style = { { fontSize : "13px" } } > Signers: </ strong >
657
+ { /* <span className="statusSpan">kjefjjnejkfnkbjs bbfjkdsbjbfjkbjk kscbjkbjkb</span> */ }
649
658
{ signersName ( ) }
650
659
</ >
651
660
) }
661
+
652
662
< HoverCard . Arrow className = "HoverCardArrow" />
653
663
</ HoverCard . Content >
654
664
</ HoverCard . Portal >
@@ -732,22 +742,21 @@ function PdfFileComponent({
732
742
color : "white"
733
743
} }
734
744
type = "button"
735
- className = "docDeleteBtn "
745
+ className = "finishBtn "
736
746
>
737
- YES
747
+ Yes
738
748
</ button >
739
749
< button
740
750
onClick = { ( ) => {
741
751
setIsDeleteDoc ( false ) ;
742
752
} }
743
753
style = { {
744
- background : "rgb(24 138 226)" ,
745
- marginLeft : "10px"
754
+ color : "black"
746
755
} }
747
756
type = "button"
748
- className = "docDeleteBtn "
757
+ className = "finishBtn "
749
758
>
750
- NO
759
+ No
751
760
</ button >
752
761
</ div >
753
762
</ ModalUi >
0 commit comments