diff --git a/src/front/Components/DesignSystem/DragAndDrop/DocumentElement/classes.module.scss b/src/front/Components/DesignSystem/DragAndDrop/DocumentElement/classes.module.scss index cdba1ed0..2685612f 100644 --- a/src/front/Components/DesignSystem/DragAndDrop/DocumentElement/classes.module.scss +++ b/src/front/Components/DesignSystem/DragAndDrop/DocumentElement/classes.module.scss @@ -1,39 +1,38 @@ @import "@Themes/constants.scss"; .root { - display: flex; - max-width: 357px; - width: 100%; - gap: var(--spacing-sm, 8px); - justify-content: space-between; - align-items: center; + display: flex; + width: 100%; + gap: var(--spacing-sm, 8px); + justify-content: space-between; + align-items: center; - .content { - display: flex; - gap: var(--spacing-sm, 8px); - align-items: center; + .content { + display: flex; + gap: var(--spacing-sm, 8px); + align-items: center; - .file-name { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - max-width: 277px; - } - } + .file-name { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 277px; + } + } - svg { - min-width: var(--spacing-3, 24px); - min-height: var(--spacing-3, 24px); - width: var(--spacing-3, 24px); - height: var(--spacing-3, 24px); - stroke: var(--color-primary-500); - } + svg { + min-width: var(--spacing-3, 24px); + min-height: var(--spacing-3, 24px); + width: var(--spacing-3, 24px); + height: var(--spacing-3, 24px); + stroke: var(--color-primary-500); + } - .error{ + .error { min-width: var(--spacing-3, 24px); min-height: var(--spacing-3, 24px); width: var(--spacing-3, 24px); height: var(--spacing-3, 24px); stroke: var(--color-error-500); } -} \ No newline at end of file +} diff --git a/src/front/Components/DesignSystem/SearchBlockList/classes.module.scss b/src/front/Components/DesignSystem/SearchBlockList/classes.module.scss index cc668f67..68c4106d 100644 --- a/src/front/Components/DesignSystem/SearchBlockList/classes.module.scss +++ b/src/front/Components/DesignSystem/SearchBlockList/classes.module.scss @@ -75,4 +75,8 @@ display: block; } } + + &[data-fullwidth="true"] { + width: 100%; + } } diff --git a/src/front/Components/DesignSystem/SearchBlockList/index.tsx b/src/front/Components/DesignSystem/SearchBlockList/index.tsx index 0ca8fd77..93627bdd 100644 --- a/src/front/Components/DesignSystem/SearchBlockList/index.tsx +++ b/src/front/Components/DesignSystem/SearchBlockList/index.tsx @@ -14,9 +14,10 @@ export type ISearchBlockListProps = { text: string; link: string; }; + fullwidth?: boolean; }; export default function SearchBlockList(props: ISearchBlockListProps) { - const { blocks, onSelectedBlock, bottomButton } = props; + const { blocks, onSelectedBlock, bottomButton, fullwidth = false } = props; const [selectedBlock, setSelectedBlock] = useState(null); const router = useRouter(); @@ -69,7 +70,7 @@ export default function SearchBlockList(props: ISearchBlockListProps) { }, [blocks]); return ( -
+
{bottomButton && ( diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/DeleteAskedDocumentModal/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/DeleteAskedDocumentModal/index.tsx index 731bb4c9..87d2586a 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/DeleteAskedDocumentModal/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/DeleteAskedDocumentModal/index.tsx @@ -7,7 +7,6 @@ type IProps = { documentUid: string; isOpen: boolean; onClose?: () => void; - onDeleteSuccess: (uid: string) => void; }; diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/DeleteSentDocumentModal/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/DeleteSentDocumentModal/index.tsx new file mode 100644 index 00000000..f10fb594 --- /dev/null +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/DeleteSentDocumentModal/index.tsx @@ -0,0 +1,36 @@ +import Documents from "@Front/Api/LeCoffreApi/Notary/Documents/Documents"; +import Modal from "@Front/Components/DesignSystem/Modal"; +import Typography, { ETypo } from "@Front/Components/DesignSystem/Typography"; +import React, { useCallback } from "react"; + +type IProps = { + documentUid: string; + isOpen: boolean; + onClose?: () => void; + onDeleteSuccess: (uid: string) => void; +}; + +export default function DeleteSentDocumentModal(props: IProps) { + const { isOpen, onClose, documentUid, onDeleteSuccess } = props; + + const onDelete = useCallback( + () => + Documents.getInstance() + .delete(documentUid) + .then(() => onDeleteSuccess(documentUid)) + .then(onClose) + .catch((error) => console.warn(error)), + [documentUid, onClose, onDeleteSuccess], + ); + + return ( + + Cette action annulera l'envoi du document. + + ); +} diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/classes.module.scss b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/classes.module.scss index 1e85e972..c4b3c70e 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/classes.module.scss +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/classes.module.scss @@ -11,4 +11,10 @@ justify-content: space-between; align-items: center; } + + .actions { + display: flex; + align-items: center; + gap: var(--spacing-sm, 8px); + } } 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 8714f3dc..de516731 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientView/DocumentTables/index.tsx @@ -15,31 +15,13 @@ import { useCallback, useEffect, useMemo, useState } from "react"; import classes from "./classes.module.scss"; import DeleteAskedDocumentModal from "./DeleteAskedDocumentModal"; +import DeleteSentDocumentModal from "./DeleteSentDocumentModal"; type IProps = { documents: Document[]; folderUid: string; }; -const header: readonly IHead[] = [ - { - key: "document_type", - title: "Type de document", - }, - { - key: "document_status", - title: "Statut", - }, - { - key: "created_at", - title: "Demandé le", - }, - { - key: "actions", - title: "Actions", - }, -]; - const tradDocumentStatus: Record = { [EDocumentStatus.ASKED]: "Demandé", [EDocumentStatus.DEPOSITED]: "À valider", @@ -52,7 +34,8 @@ export default function DocumentTables(props: IProps) { const [documents, setDocuments] = useState(documentsProps); const [documentUid, setDocumentUid] = useState(null); - const deleteAskedOocumentModal = useOpenable(); + const deleteAskedDocumentModal = useOpenable(); + const deleteSentDocumentModal = useOpenable(); useEffect(() => { setDocuments(documentsProps); @@ -62,9 +45,18 @@ export default function DocumentTables(props: IProps) { (uid: string | undefined) => { if (!uid) return; setDocumentUid(uid); - deleteAskedOocumentModal.open(); + deleteAskedDocumentModal.open(); }, - [deleteAskedOocumentModal], + [deleteAskedDocumentModal], + ); + + const openDeleteSentDocumentModal = useCallback( + (uid: string | undefined) => { + if (!uid) return; + setDocumentUid(uid); + deleteSentDocumentModal.open(); + }, + [deleteSentDocumentModal], ); const onDownload = useCallback((doc: Document) => { @@ -99,7 +91,7 @@ export default function DocumentTables(props: IProps) { label={tradDocumentStatus[document.document_status].toUpperCase()} /> ), - created_at: document.created_at ? new Date(document.created_at).toLocaleDateString() : "_", + date: document.created_at ? new Date(document.created_at).toLocaleDateString() : "_", actions: openDeleteAskedDocumentModal(document.uid)} />} />, }; }) @@ -122,7 +114,7 @@ export default function DocumentTables(props: IProps) { label={tradDocumentStatus[document.document_status].toUpperCase()} /> ), - created_at: document.created_at ? new Date(document.created_at).toLocaleDateString() : "_", + date: document.updated_at ? new Date(document.updated_at).toLocaleDateString() : "_", actions: ( ), - created_at: document.created_at ? new Date(document.created_at).toLocaleDateString() : "_", + date: document.updated_at ? new Date(document.updated_at).toLocaleDateString() : "_", actions: (
), - created_at: document.created_at ? new Date(document.created_at).toLocaleDateString() : "_", + date: document.updated_at ? new Date(document.updated_at).toLocaleDateString() : "_", actions: "", }; }) @@ -195,6 +187,29 @@ export default function DocumentTables(props: IProps) { [documents], ); + //TODO: modify accordingly when the back will handle sent documents + const sentDocuments: IRowProps[] = useMemo( + () => + documents + .map((document) => { + if (document.document_status !== "sent") return null; + return { + key: document.uid, + document_type: document.document_type?.name ?? "_", + document_status: , + date: document.updated_at ? new Date(document.updated_at).toLocaleDateString() : "_", + actions: ( +
+ onDownload(document)} icon={} /> + openDeleteSentDocumentModal(document.uid)} />} /> +
+ ), + }; + }) + .filter((document) => document !== null) as IRowProps[], + [documents, onDownload, openDeleteSentDocumentModal], + ); + const progress = useMemo(() => { const total = askedDocuments.length + toValidateDocuments.length + validatedDocuments.length + refusedDocuments.length; if (total === 0) return 0; @@ -217,18 +232,48 @@ export default function DocumentTables(props: IProps) {
- {askedDocuments.length > 0 && } - {toValidateDocuments.length > 0 &&
} - {validatedDocuments.length > 0 &&
} - {refusedDocuments.length > 0 &&
} + {askedDocuments.length > 0 &&
} + {toValidateDocuments.length > 0 &&
} + {validatedDocuments.length > 0 &&
} + {refusedDocuments.length > 0 &&
} + {sentDocuments.length > 0 &&
} {documentUid && ( - + <> + + + )} ); } + +function getHeader(dateColumnTitle: string): IHead[] { + return [ + { + key: "document_type", + title: "Type de document", + }, + { + key: "document_status", + title: "Statut", + }, + { + key: "date", + title: dateColumnTitle, + }, + { + key: "actions", + title: "Action", + }, + ]; +} diff --git a/src/front/Components/Layouts/Folder/index.tsx b/src/front/Components/Layouts/Folder/index.tsx index fdcda8f0..ead04297 100644 --- a/src/front/Components/Layouts/Folder/index.tsx +++ b/src/front/Components/Layouts/Folder/index.tsx @@ -62,13 +62,13 @@ export default function Folder() { {activeUser && activeUser.contact && ( - + Bonjour {activeUser.contact.first_name}, bienvenue sur LeCoffre.io )} {!activeUser || (!activeUser.contact && ( - + Bonjour, bienvenue sur LeCoffre.io ))} diff --git a/src/front/Components/Layouts/SelectFolder/classes.module.scss b/src/front/Components/Layouts/SelectFolder/classes.module.scss index 6334c67f..48d62920 100644 --- a/src/front/Components/Layouts/SelectFolder/classes.module.scss +++ b/src/front/Components/Layouts/SelectFolder/classes.module.scss @@ -1,17 +1,22 @@ -.root { - position: relative; - .select-folder-container { - max-width: 530px; - padding: 80px 72px; +@import "@Themes/constants.scss"; +.root { + margin: 80px auto; + width: 472px; + + display: flex; + flex-direction: column; + gap: var(--spacing-xl, 32px); + + @media (max-width: $screen-s) { + width: 100%; + margin: 0; + padding: var(--spacing-md, 16px); + } + + .title-container { display: flex; flex-direction: column; - justify-content: center; - gap: 48px; - margin: auto; - background-color: white; - .title { - text-align: center; - } + gap: var(--spacing-sm, 8px); } } diff --git a/src/front/Components/Layouts/SelectFolder/index.tsx b/src/front/Components/Layouts/SelectFolder/index.tsx index 5d84f4bb..74999979 100644 --- a/src/front/Components/Layouts/SelectFolder/index.tsx +++ b/src/front/Components/Layouts/SelectFolder/index.tsx @@ -1,26 +1,28 @@ +import backgroundImage from "@Assets/images/background_refonte.svg"; +import LogoIcon from "@Assets/logo_small_blue.svg"; import Folders from "@Front/Api/LeCoffreApi/Customer/Folders/Folders"; -import Typography, { ETypo } from "@Front/Components/DesignSystem/Typography"; +import SearchBlockList from "@Front/Components/DesignSystem/SearchBlockList"; +import { IBlock } from "@Front/Components/DesignSystem/SearchBlockList/BlockList/Block"; +import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage"; import JwtService from "@Front/Services/JwtService/JwtService"; import { OfficeFolder } from "le-coffre-resources/dist/Customer"; +import Image from "next/image"; import { useRouter } from "next/router"; import { useCallback, useEffect, useState } from "react"; -import LandingImage from "../Login/landing-connect.jpeg"; import classes from "./classes.module.scss"; -import { IBlock } from "@Front/Components/DesignSystem/SearchBlockList/BlockList/Block"; -import BlockList from "@Front/Components/DesignSystem/SearchBlockList/BlockList"; export default function SelectFolder() { const [folders, setFolders] = useState([]); const router = useRouter(); useEffect(() => { - async function getFolders() { - const jwt = JwtService.getInstance().decodeCustomerJwt(); - if (!jwt) return; + const jwt = JwtService.getInstance().decodeCustomerJwt(); + if (!jwt) return; - const folders = await Folders.getInstance().get({ + Folders.getInstance() + .get({ q: { where: { customers: { @@ -40,11 +42,8 @@ export default function SelectFolder() { customers: true, }, }, - }); - setFolders(folders); - } - - getFolders(); + }) + .then((folders) => setFolders(folders)); }, []); const handleSelectBlock = useCallback( @@ -55,26 +54,35 @@ export default function SelectFolder() { ); return ( - +
-
-
- Vos dossiers -
-
- { - return { - id: folder.uid!, - primaryText: folder.name!, - selected: false, - }; - })} - /> -
+
+ + + Vos dossiers en cours + + + + Veuillez sélectionner le dossier pour lequel vous souhaitez déposer ou consulter des documents. +
+ + + Liste des dossiers disponibles : + + +
); } + +function getBlocks(folders: OfficeFolder[]): IBlock[] { + return folders.map((folder) => { + return { + id: folder.uid!, + primaryText: folder.name!, + secondaryText: folder.folder_number!, + }; + }); +}