New file formats

This commit is contained in:
Vins 2024-12-09 10:43:50 +01:00
parent 0a89712489
commit ee95fed48b
4 changed files with 35 additions and 57 deletions

View File

@ -65,6 +65,18 @@ const mimeTypesAccepted: { [key: string]: IMimeTypes } = {
extension: "xls", extension: "xls",
size: 104857600, // 100MB size: 104857600, // 100MB
}, },
"application/msword": {
extension: "doc",
size: 104857600, // 100MB
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
extension: "docx",
size: 104857600, // 100MB
},
"text/plain": {
extension: "txt",
size: 104857600, // 100MB
},
}; };
type IDocumentFileBase = { type IDocumentFileBase = {

View File

@ -71,33 +71,17 @@ class ViewDocumentsNotaryClass extends BasePage<IPropsClass, IState> {
</div> </div>
)} )}
<div className={classes["file-container"]}> <div className={classes["file-container"]}>
{this.state.selectedFile.mimetype !== "text/csv" && {this.state.selectedFile.mimetype === "application/pdf" ||
this.state.selectedFile.mimetype !== this.state.selectedFile.mimetype === "image/jpeg" ||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" && this.state.selectedFile.mimetype === "image/png" ||
this.state.selectedFile.mimetype !== "application/vnd.ms-excel" && ( this.state.selectedFile.mimetype === "image/jpg" ? (
<FilePreview <FilePreview
href={this.state.fileBlob ? URL.createObjectURL(this.state.fileBlob) : ""} href={this.state.fileBlob ? URL.createObjectURL(this.state.fileBlob) : ""}
fileName={this.state.selectedFile.file_name} fileName={this.state.selectedFile.file_name}
key={this.state.selectedFile.uid} key={this.state.selectedFile.uid}
/> />
)} ) : (
{this.state.selectedFile.mimetype === "text/csv" && ( <div className={classes["unsupported-format"]}>
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté.
</Typography>
</div>
)}
{this.state.selectedFile.mimetype ===
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" && (
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté.
</Typography>
</div>
)}
{this.state.selectedFile.mimetype === "application/vnd.ms-excel" && (
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}> <Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté. L'affichage de ce format de fichier n'est pas supporté.
</Typography> </Typography>
@ -144,8 +128,6 @@ class ViewDocumentsNotaryClass extends BasePage<IPropsClass, IState> {
folder: true, folder: true,
depositor: true, depositor: true,
}); });
console.log(documentNotary);
this.setState( this.setState(
{ {
documentNotary, documentNotary,

View File

@ -189,7 +189,7 @@ export default function SendDocuments() {
<DragAndDrop <DragAndDrop
name="files" name="files"
title="Glisser ou déposer ou" title="Glisser ou déposer ou"
description="Formats acceptés : PDF, JPG, PNG, CSV, XLSX Taille maximale : 100 Mo" description="Formats acceptés : PDF, JPG, PNG, CSV, XLSX, doc, dox, txt Taille maximale : 100 Mo"
onChange={handleFileChange} onChange={handleFileChange}
/> />

View File

@ -89,33 +89,17 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
</div> </div>
)} )}
<div className={classes["file-container"]}> <div className={classes["file-container"]}>
{this.state.selectedFile.mimetype !== "text/csv" && {this.state.selectedFile.mimetype === "application/pdf" ||
this.state.selectedFile.mimetype !== this.state.selectedFile.mimetype === "image/jpeg" ||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" && this.state.selectedFile.mimetype === "image/png" ||
this.state.selectedFile.mimetype !== "application/vnd.ms-excel" && ( this.state.selectedFile.mimetype === "image/jpg" ? (
<FilePreview <FilePreview
href={this.state.fileBlob ? URL.createObjectURL(this.state.fileBlob) : ""} href={this.state.fileBlob ? URL.createObjectURL(this.state.fileBlob) : ""}
fileName={this.state.selectedFile.file_name} fileName={this.state.selectedFile.file_name}
key={this.state.selectedFile.uid} key={this.state.selectedFile.uid}
/> />
)} ) : (
{this.state.selectedFile.mimetype === "text/csv" && ( <div className={classes["unsupported-format"]}>
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté.
</Typography>
</div>
)}
{this.state.selectedFile.mimetype ===
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" && (
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté.
</Typography>
</div>
)}
{this.state.selectedFile.mimetype === "application/vnd.ms-excel" && (
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}> <Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté. L'affichage de ce format de fichier n'est pas supporté.
</Typography> </Typography>