diff --git a/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx b/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx index 66374d71..768ab0a0 100644 --- a/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx +++ b/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx @@ -16,6 +16,7 @@ type IProps = { document_type: Document["document_type"]; document_status: Document["document_status"]; folder: Document["folder"]; + files?: Document["files"]; }; openDeletionModal?: (uid: Document["uid"]) => void; }; @@ -37,13 +38,31 @@ class DocumentNotaryClass extends React.Component {
{this.props.document?.document_type?.name} - Aucun document déposé + {this.getDocumentsTitle()}
{this.renderIcon()}
); } + private getDocumentsTitle(){ + const documentFiles = this.props.document.files; + if(documentFiles){ + if(documentFiles.length === 1){ + const fileName = documentFiles[0]?.file_path?.split("/").pop(); + if(fileName && fileName.length > 20){ + return `${fileName.substr(0, 7)}...${fileName.substr(fileName.length - 7, fileName.length)}`; + }else{ + return fileName; + } + }else{ + return `${documentFiles.length} documents déposés`; + } + }else{ + return "Aucun document déposé"; + } + } + private onClick() { if (this.props.document.document_status !== "VALIDATED" && this.props.document.document_status !== "PENDING") return; this.props.router.push(`/folders/${this.props.document.folder.uid}/documents/${this.props.document.uid}`);