diff --git a/src/front/Components/LayoutTemplates/DefaultCustomerDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultCustomerDashboard/index.tsx index 1b8d7b96..d539fb3b 100644 --- a/src/front/Components/LayoutTemplates/DefaultCustomerDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultCustomerDashboard/index.tsx @@ -1,4 +1,3 @@ -import Folders from "@Front/Api/LeCoffreApi/Customer/Folders/Folders"; import { IBlock } from "@Front/Components/DesignSystem/SearchBlockList/BlockList/Block"; import Module from "@Front/Config/Module"; import JwtService from "@Front/Services/JwtService/JwtService"; diff --git a/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx b/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx index a967c7c3..3f9ae3e6 100644 --- a/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/DepositDocumentComponent/index.tsx @@ -110,7 +110,8 @@ export default function DepositDocumentComponent(props: IProps) { ); const onOpenModal = useCallback(async () => { - const refused_reason = document.document_history?.find((history: any) => history.document_status === "REFUSED")?.refused_reason; + if (document.document_status !== "REFUSED") return; + const refused_reason = document.refused_reason; if (!refused_reason) return; setRefusedReason(refused_reason); setIsModalOpen(true); diff --git a/src/front/Components/Layouts/ClientDashboard/index.tsx b/src/front/Components/Layouts/ClientDashboard/index.tsx index 4b9eb1cc..c02202dd 100644 --- a/src/front/Components/Layouts/ClientDashboard/index.tsx +++ b/src/front/Components/Layouts/ClientDashboard/index.tsx @@ -1,5 +1,4 @@ "use client"; -import Documents, { IGetDocumentsparams } from "@Front/Api/LeCoffreApi/Customer/Documents/Documents"; import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; @@ -23,6 +22,9 @@ import ContactBox from "./ContactBox"; import { EDocumentNotaryStatus } from "le-coffre-resources/dist/Notary/DocumentNotary"; import DepositOtherDocument from "@Front/Components/DesignSystem/DepositOtherDocument"; +import Modal from "@Front/Components/DesignSystem/Modal"; +import TextField from "@Front/Components/DesignSystem/Form/TextField"; + import AuthModal from "src/sdk/AuthModal"; import FolderService from "src/common/Api/LeCoffreApi/sdk/FolderService"; @@ -45,6 +47,30 @@ export default function ClientDashboard(props: IProps) { const [isAddDocumentModalVisible, setIsAddDocumentModalVisible] = useState(false); const [isAuthModalOpen, setIsAuthModalOpen] = useState(false); + const [isSmsModalOpen, setIsSmsModalOpen] = useState(false); + const [smsCode, setSmsCode] = useState(""); + const [smsError, setSmsError] = useState(""); + + const verifySmsCode = useCallback(() => { + if (smsCode === "1234") { + setIsSmsModalOpen(false); + } else { + setSmsError("Code incorrect. Le code valide est 1234."); + } + }, [smsCode]); + + useEffect(() => { + const handleKeyPress = (e: KeyboardEvent) => { + if (e.key === "Enter" && isSmsModalOpen) { + verifySmsCode(); + } + }; + + window.addEventListener("keypress", handleKeyPress); + return () => { + window.removeEventListener("keypress", handleKeyPress); + }; + }, [isSmsModalOpen, smsCode, verifySmsCode]); const fetchFolderAndCustomer = useCallback(async () => { let jwt: ICustomerJwtPayload | undefined; @@ -311,8 +337,52 @@ export default function ClientDashboard(props: IProps) { isOpen={isAuthModalOpen} onClose={() => { setIsAuthModalOpen(false); + setIsSmsModalOpen(true); }} />} + + {isSmsModalOpen && ( + setIsSmsModalOpen(false)} + title="Vérification SMS" + > +
+ + Veuillez saisir le code à 4 chiffres que vous avez reçu par SMS + + + { + const value = e.target.value; + // Only allow digits + if (value === "" || /^\d+$/.test(value)) { + setSmsCode(value); + setSmsError(""); + } + }} + /> + + {smsError && ( + + {smsError} + + )} + +
+ +
+
+
+ )} ); diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx index 09b95b55..fd44a797 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/ClientBox/index.tsx @@ -43,8 +43,8 @@ export default function ClientBox(props: IProps) { if (processes.length > 0) { let documents: any[] = processes.map((process: any) => process.processData); - // FilterBy depositor_uid & folder_uid - documents = documents.filter((document: any) => document.depositor.uid === customerUid && document.folder.uid === folderUid); + // FilterBy folder.uid & depositor.uid + documents = documents.filter((document: any) => document.folder.uid === folderUid && document.depositor && document.depositor.uid === customerUid); if (documents && documents.length > 0) { closeDeleteModal(); diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/index.tsx index a639767d..9f99eb02 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/index.tsx @@ -328,9 +328,13 @@ export default function DocumentTables(props: IProps) { ), }, date: { - sx: { width: 107 }, + sx: { width: 120 }, content: document.updated_at ? new Date(document.updated_at).toLocaleDateString() : "_", }, + file: { + sx: { width: 120 }, + content: document.files?.[0]?.file_name ?? "_", + }, actions: { sx: { width: 76 }, content: "" }, }; })