diff --git a/src/front/Components/Layouts/Folder/FolderInformation/InformationSection/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/InformationSection/index.tsx index c7c6722b..7e2e3067 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/InformationSection/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/InformationSection/index.tsx @@ -1,16 +1,17 @@ import CircleProgress from "@Front/Components/DesignSystem/CircleProgress"; import IconButton, { EIconButtonVariant } from "@Front/Components/DesignSystem/IconButton"; +import Menu from "@Front/Components/DesignSystem/Menu"; +import { IItem } from "@Front/Components/DesignSystem/Menu/MenuItem"; import Tag, { ETagColor } from "@Front/Components/DesignSystem/Tag"; import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; import Module from "@Front/Config/Module"; -import { ArchiveBoxIcon, EllipsisHorizontalIcon, PencilSquareIcon, UsersIcon } from "@heroicons/react/24/outline"; +import { ArchiveBoxIcon, EllipsisHorizontalIcon, PaperAirplaneIcon, PencilSquareIcon, UsersIcon } from "@heroicons/react/24/outline"; import { OfficeFolder } from "le-coffre-resources/dist/Notary"; -import { useCallback } from "react"; +import { useMemo } from "react"; import { AnchorStatus } from ".."; import classes from "./classes.module.scss"; -import { IItem } from "@Front/Components/DesignSystem/Menu/MenuItem"; -import Menu from "@Front/Components/DesignSystem/Menu"; +import Link from "next/link"; type IProps = { folder: OfficeFolder | null; @@ -23,7 +24,7 @@ type IProps = { export default function InformationSection(props: IProps) { const { folder, progress, onArchive, anchorStatus, isArchived } = props; - const getSubMenuElement = useCallback(() => { + const menuItems = useMemo(() => { let elements: IItem[] = []; // Creating the three elements and adding them conditionnally @@ -41,31 +42,18 @@ export default function InformationSection(props: IProps) { link: Module.getInstance() .get() .modules.pages.Folder.pages.EditInformations.props.path.replace("[folderUid]", folder?.uid ?? ""), - hasSeparator: true, - }; - - const archiveElement = { - icon: , - text: "Archiver le dossier", - onClick: onArchive, - color: ETypoColor.ERROR_WEAK_CONTRAST, + hasSeparator: false, }; // If the folder is not anchored, we can modify the collaborators and the informations if (anchorStatus === AnchorStatus.NOT_ANCHORED) { elements.push(modifyCollaboratorsElement); - // Remove the separator if it's the last item (if the folder is not archived) - if (isArchived) modifyInformationsElement.hasSeparator = false; elements.push(modifyInformationsElement); } - // If the folder is not archived, we can archive it - if (!isArchived) { - elements.push(archiveElement); - } return elements; - }, [anchorStatus, folder?.uid, isArchived, onArchive]); + }, [anchorStatus, folder?.uid]); return (
@@ -88,9 +76,17 @@ export default function InformationSection(props: IProps) {
- + + } variant={EIconButtonVariant.NEUTRAL} /> + + } variant={EIconButtonVariant.NEUTRAL} /> + {!isArchived && } variant={EIconButtonVariant.ERROR} />}
diff --git a/src/front/Components/Layouts/Folder/SendDocuments/classes.module.scss b/src/front/Components/Layouts/Folder/SendDocuments/classes.module.scss new file mode 100644 index 00000000..613b5a8d --- /dev/null +++ b/src/front/Components/Layouts/Folder/SendDocuments/classes.module.scss @@ -0,0 +1,36 @@ +@import "@Themes/constants.scss"; + +.root { + display: flex; + flex-direction: column; + gap: var(--spacing-xl, 32px); + + margin: 24px auto; + width: 566px; + + @media (max-width: $screen-m) { + width: 474px; + } + + @media (max-width: $screen-s) { + width: 100%; + padding: var(--spacing-md, 16px); + } + + .radioboxes { + display: flex; + flex-direction: column; + gap: var(--Radius-lg, 16px); + } + + .form { + display: flex; + flex-direction: column; + gap: var(--spacing-xl, 32px); + + .buttons-container { + display: flex; + gap: var(--spacing-md, 16px); + } + } +} diff --git a/src/front/Components/Layouts/Folder/SendDocuments/index.tsx b/src/front/Components/Layouts/Folder/SendDocuments/index.tsx new file mode 100644 index 00000000..96f094a7 --- /dev/null +++ b/src/front/Components/Layouts/Folder/SendDocuments/index.tsx @@ -0,0 +1,123 @@ +import backgroundImage from "@Assets/images/background_refonte.svg"; +import Folders from "@Front/Api/LeCoffreApi/Notary/Folders/Folders"; +import AutocompleteMultiSelect from "@Front/Components/DesignSystem/AutocompleteMultiSelect"; +import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button"; +import DragAndDrop from "@Front/Components/DesignSystem/DragAndDrop"; +import Form from "@Front/Components/DesignSystem/Form"; +import RadioBox from "@Front/Components/DesignSystem/RadioBox"; +import Typography, { ETypo, ETypoColor } from "@Front/Components/DesignSystem/Typography"; +import BackArrow from "@Front/Components/Elements/BackArrow"; +import DefaultDoubleSidePage from "@Front/Components/LayoutTemplates/DefaultDoubleSidePage"; +import Module from "@Front/Config/Module"; +import { PaperAirplaneIcon } from "@heroicons/react/24/outline"; +import { OfficeFolder } from "le-coffre-resources/dist/Notary"; +import { useRouter } from "next/router"; +import React, { useCallback, useEffect, useMemo, useState } from "react"; + +import classes from "./classes.module.scss"; + +enum EClientSelection { + ALL_CLIENTS = "all_clients", + SELECTED_CLIENTS = "selected_clients", +} + +export default function SendDocuments() { + const router = useRouter(); + let { folderUid } = router.query; + const [folder, setFolder] = useState(null); + const [clientSelection, setClientSelection] = useState(null); + + const onFormSubmit = useCallback( + async ( + _e: React.FormEvent | null, + _values: { + [key: string]: any; + }, + //TODO: when back is done + ) => {}, + [], + ); + + const fetchFolder = useCallback(async () => { + Folders.getInstance() + .getByUid(folderUid as string, { + q: { + customers: { + include: { + contact: true, + }, + }, + }, + }) + .then((folder) => setFolder(folder)) + .catch((e) => console.warn(e)); + }, [folderUid]); + + const onClientSelectionChange = useCallback((e: React.ChangeEvent) => { + setClientSelection(e.target.value as EClientSelection); + console.log(e.target.value); + }, []); + + useEffect(() => { + fetchFolder(); + }, [fetchFolder]); + + const backUrl = useMemo( + () => + Module.getInstance() + .get() + .modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", folderUid as string), + [folderUid], + ); + + const clientsOptions = useMemo(() => { + if (!folder?.customers) return []; + return folder.customers.map((customer) => ({ + id: customer.uid ?? "", + label: `${customer.contact?.first_name} ${customer.contact?.last_name}`, + })); + }, [folder]); + + return ( + +
+ + + Envoyer des documents, sélectionnez les destinataires : + +
+ + +
+ +
+ {clientSelection === EClientSelection.SELECTED_CLIENTS && ( + + )} + + +
+ + + + +
+ +
+
+ ); +} diff --git a/src/front/Config/Module/development.json b/src/front/Config/Module/development.json index 253742bf..09587298 100644 --- a/src/front/Config/Module/development.json +++ b/src/front/Config/Module/development.json @@ -59,6 +59,13 @@ "labelKey": "add_client_to_folder" } }, + "SendDocuments": { + "enabled": true, + "props": { + "path": "/folders/[folderUid]/send-documents", + "labelKey": "send_documents" + } + }, "AskDocument": { "enabled": true, "props": { diff --git a/src/front/Config/Module/preprod.json b/src/front/Config/Module/preprod.json index 253742bf..09587298 100644 --- a/src/front/Config/Module/preprod.json +++ b/src/front/Config/Module/preprod.json @@ -59,6 +59,13 @@ "labelKey": "add_client_to_folder" } }, + "SendDocuments": { + "enabled": true, + "props": { + "path": "/folders/[folderUid]/send-documents", + "labelKey": "send_documents" + } + }, "AskDocument": { "enabled": true, "props": { diff --git a/src/front/Config/Module/production.json b/src/front/Config/Module/production.json index 253742bf..09587298 100644 --- a/src/front/Config/Module/production.json +++ b/src/front/Config/Module/production.json @@ -59,6 +59,13 @@ "labelKey": "add_client_to_folder" } }, + "SendDocuments": { + "enabled": true, + "props": { + "path": "/folders/[folderUid]/send-documents", + "labelKey": "send_documents" + } + }, "AskDocument": { "enabled": true, "props": { diff --git a/src/front/Config/Module/staging.json b/src/front/Config/Module/staging.json index 253742bf..09587298 100644 --- a/src/front/Config/Module/staging.json +++ b/src/front/Config/Module/staging.json @@ -59,6 +59,13 @@ "labelKey": "add_client_to_folder" } }, + "SendDocuments": { + "enabled": true, + "props": { + "path": "/folders/[folderUid]/send-documents", + "labelKey": "send_documents" + } + }, "AskDocument": { "enabled": true, "props": { diff --git a/src/pages/folders/[folderUid]/send-documents/index.tsx b/src/pages/folders/[folderUid]/send-documents/index.tsx new file mode 100644 index 00000000..06bf18b7 --- /dev/null +++ b/src/pages/folders/[folderUid]/send-documents/index.tsx @@ -0,0 +1,5 @@ +import SendDocuments from "@Front/Components/Layouts/Folder/SendDocuments"; + +export default function Route() { + return ; +}