This commit is contained in:
VincentAlamelle 2025-01-23 10:47:19 +01:00 committed by GitHub
commit 5a7f251df7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 43 additions and 60 deletions

View File

@ -65,6 +65,18 @@ const mimeTypesAccepted: { [key: string]: IMimeTypes } = {
extension: "xls",
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 = {

View File

@ -20,7 +20,7 @@ export default function ContactBox(props: IProps) {
const notaryContact = useMemo(
() =>
folder?.stakeholders!.find((stakeholder) => stakeholder.office_role?.name === "Collaborateur")?.contact ??
folder?.stakeholders!.find((stakeholder) => stakeholder.office_role?.name === "Notaire")?.contact ??
folder?.stakeholders![0]!.contact,
[folder],
);

View File

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

View File

@ -12,6 +12,7 @@ import { useCallback } from "react";
import { AnchorStatus } from "../..";
import classes from "./classes.module.scss";
import DeleteCustomerModal from "./DeleteCustomerModal";
import Documents from "@Front/Api/LeCoffreApi/Notary/Documents/Documents";
type IProps = {
customer: Customer;
@ -28,8 +29,12 @@ export default function ClientBox(props: IProps) {
const { isOpen: isErrorModalOpen, open: openErrorModal, close: closeErrorModal } = useOpenable();
const handleDelete = useCallback(
(customerUid: string) => {
if (customer.documents && customer.documents.length > 0) {
async (customerUid: string) => {
console.log(customer);
const documents = await Documents.getInstance().get({ where: { depositor_uid: customerUid, folder_uid: folderUid } });
console.log(documents);
if (documents && documents.length > 0) {
closeDeleteModal();
openErrorModal();
return;

View File

@ -189,7 +189,7 @@ export default function SendDocuments() {
<DragAndDrop
name="files"
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}
/>

View File

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