diff --git a/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx b/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx index 198c4ec7..66374d71 100644 --- a/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx +++ b/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx @@ -15,6 +15,7 @@ type IProps = { uid: Document["uid"]; document_type: Document["document_type"]; document_status: Document["document_status"]; + folder: Document["folder"]; }; openDeletionModal?: (uid: Document["uid"]) => void; }; @@ -45,7 +46,7 @@ class DocumentNotaryClass extends React.Component { private onClick() { if (this.props.document.document_status !== "VALIDATED" && this.props.document.document_status !== "PENDING") return; - this.props.router.push(`/folder/${this.props.document.folder.uid}/document/${this.props.document.uid}`); + this.props.router.push(`/folders/${this.props.document.folder.uid}/documents/${this.props.document.uid}`); } private renderIcon(): JSX.Element { diff --git a/src/front/Components/DesignSystem/FolderBoxInformation/classes.module.scss b/src/front/Components/DesignSystem/FolderBoxInformation/classes.module.scss index 323dc0d5..c22fa8de 100644 --- a/src/front/Components/DesignSystem/FolderBoxInformation/classes.module.scss +++ b/src/front/Components/DesignSystem/FolderBoxInformation/classes.module.scss @@ -33,7 +33,7 @@ grid-template-columns: 1fr; } - &.isSignleDescription { + &.single-information { grid-template-columns: 1fr; } } diff --git a/src/front/Components/DesignSystem/FolderBoxInformation/index.tsx b/src/front/Components/DesignSystem/FolderBoxInformation/index.tsx index 16df26a8..de2e85d5 100644 --- a/src/front/Components/DesignSystem/FolderBoxInformation/index.tsx +++ b/src/front/Components/DesignSystem/FolderBoxInformation/index.tsx @@ -1,20 +1,28 @@ -import React from "react"; -import classes from "./classes.module.scss"; -import classNames from "classnames"; -import Image from "next/image"; import PenICon from "@Assets/Icons/pen.svg"; import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; -import Typography, { ITypo } from "../Typography"; -import Link from "next/link"; import Module from "@Front/Config/Module"; +import classNames from "classnames"; +import Image from "next/image"; +import Link from "next/link"; +import React from "react"; + +import Typography, { ITypo } from "../Typography"; +import classes from "./classes.module.scss"; type IProps = { folder: IDashBoardFolder; - isDescription?: boolean; + type: EFolderBoxInformationType; + isArchived?: boolean; }; +export enum EFolderBoxInformationType { + INFORMATIONS = "informations", + DESCRIPTION = "description", + ARCHIVED_DESCRIPTION = "archivedDescription", +} + export default function FolderBoxInformation(props: IProps) { - const { isDescription = false } = props; + const { isArchived = false, type } = props; const editDescriptionPath = Module.getInstance() .get() .modules.pages.Folder.pages.EditDescription.props.path.replace("[folderUid]", props.folder.uid); @@ -22,44 +30,57 @@ export default function FolderBoxInformation(props: IProps) { .get() .modules.pages.Folder.pages.EditDescription.props.path.replace("[folderUid]", props.folder.uid); - const path = isDescription ? editDescriptionPath : editInformationsPath; - + const path = type === EFolderBoxInformationType.DESCRIPTION ? editDescriptionPath : editInformationsPath; return ( -
-
- {isDescription ? ( - <> -
- Note dossier - {props.folder.description ?? "..."} -
- - ) : ( +
+
{renderContentByType(props.folder, type)}
+ {!isArchived && ( + + edit informations + + )} +
+ ); + + function renderContentByType(folder: IDashBoardFolder, type: EFolderBoxInformationType) { + switch (type) { + case EFolderBoxInformationType.DESCRIPTION: + return ( +
+ Note dossier + {folder.description ?? ""} +
+ ); + case EFolderBoxInformationType.ARCHIVED_DESCRIPTION: + return ( +
+ Note archive + {folder.archived_description ?? ""} +
+ ); + case EFolderBoxInformationType.INFORMATIONS: + return ( <>
Intitulé du dossier - {props.folder.name ?? "..."} + {folder.name ?? ""}
Numéro de dossier - {props.folder.folder_number ?? "..."} + {folder.folder_number ?? ""}
Type d’acte - {props.folder.deed.deed_type.name ?? "..."} + {folder.deed.deed_type.name ?? ""}
Ouverture du dossier - {formatDate(props.folder.created_at)} + {formatDate(folder.created_at)}
- )} -
- - edit informations - -
- ); + ); + } + } } function formatDate(date: Date | null): string { diff --git a/src/front/Components/DesignSystem/UserFolder/DocumentList/index.tsx b/src/front/Components/DesignSystem/UserFolder/DocumentList/index.tsx index 210f8f86..77129633 100644 --- a/src/front/Components/DesignSystem/UserFolder/DocumentList/index.tsx +++ b/src/front/Components/DesignSystem/UserFolder/DocumentList/index.tsx @@ -12,6 +12,7 @@ type IProps = { uid: Document["uid"]; document_type: Document["document_type"]; document_status: Document["document_status"]; + folder: Document["folder"]; }[] | null; openDeletionModal: (uid: Document["uid"]) => void; diff --git a/src/front/Components/DesignSystem/UserFolder/UserFolderHeader/index.tsx b/src/front/Components/DesignSystem/UserFolder/UserFolderHeader/index.tsx index 02b683d0..3ffe5317 100644 --- a/src/front/Components/DesignSystem/UserFolder/UserFolderHeader/index.tsx +++ b/src/front/Components/DesignSystem/UserFolder/UserFolderHeader/index.tsx @@ -18,10 +18,14 @@ type IProps = { email: Contact["email"]; }; selectedFolderUid: string; + isArchived?: boolean; }; type IState = {}; -export default class UserFolderHeaderClass extends React.Component { +export default class UserFolderHeader extends React.Component { + static defaultProps = { + isArchived: false, + }; public override render(): JSX.Element { const redirectPath = Module.getInstance() .get() @@ -53,12 +57,14 @@ export default class UserFolderHeaderClass extends React.Component{this.props.contact.email} -
- - - edit - -
+ {!this.props.isArchived && ( +
+ + + edit + +
+ )} ); } diff --git a/src/front/Components/DesignSystem/UserFolder/index.tsx b/src/front/Components/DesignSystem/UserFolder/index.tsx index 4d56f190..e0fc1d82 100644 --- a/src/front/Components/DesignSystem/UserFolder/index.tsx +++ b/src/front/Components/DesignSystem/UserFolder/index.tsx @@ -1,6 +1,7 @@ import ChevronIcon from "@Assets/Icons/chevron.svg"; import PlusIcon from "@Assets/Icons/plus.svg"; import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; +import Module from "@Front/Config/Module"; import classNames from "classnames"; import Customer, { Document } from "le-coffre-resources/dist/Customer"; import Image from "next/image"; @@ -13,12 +14,12 @@ import QuantityProgressBar from "../QuantityProgressBar"; import classes from "./classes.module.scss"; import DocumentList from "./DocumentList"; import UserFolderHeader from "./UserFolderHeader"; -import Module from "@Front/Config/Module"; type IProps = { customer: Customer; animationDelay?: number; folder: IDashBoardFolder; + isArchived?: boolean; }; type IState = { isOpen: boolean; @@ -29,6 +30,7 @@ type IState = { export default class UserFolder extends React.Component { static defaultProps = { animationDelay: 300, + isArchived: false, }; public rootRefElement = React.createRef(); @@ -64,7 +66,11 @@ export default class UserFolder extends React.Component {
- + chevron open close { openDeletionModal={this.openDeletionModal} />
-
- - - - {} -
+ {!this.props.isArchived && ( +
+ + + + {} +
+ )} )} diff --git a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx index 3133c29a..1b20db23 100644 --- a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx @@ -41,7 +41,9 @@ export type IDashBoardFolder = { deed: OfficeFolder["deed"]; created_at: OfficeFolder["created_at"]; office_folder_has_customers?: OfficeFolder["office_folder_has_customers"]; + archived_description: OfficeFolder["archived_description"]; }; + export default class DefaultNotaryDashboard extends React.Component { private onWindowResize = () => {}; public static defaultProps: Partial = { diff --git a/src/front/Components/LayoutTemplates/DefaultTemplate/index.tsx b/src/front/Components/LayoutTemplates/DefaultTemplate/index.tsx index c31fafc6..c4c6edcf 100644 --- a/src/front/Components/LayoutTemplates/DefaultTemplate/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultTemplate/index.tsx @@ -1,8 +1,9 @@ +import "reflect-metadata"; + import React, { ReactNode } from "react"; import classes from "./classes.module.scss"; import Header from "@Front/Components/DesignSystem/Header"; import Version from "@Front/Components/DesignSystem/Version"; -import "reflect-metadata"; type IProps = { title: string; diff --git a/src/front/Components/Layouts/DesignSystem/dummyData.ts b/src/front/Components/Layouts/DesignSystem/dummyData.ts index 95da8113..0bef5a44 100644 --- a/src/front/Components/Layouts/DesignSystem/dummyData.ts +++ b/src/front/Components/Layouts/DesignSystem/dummyData.ts @@ -247,6 +247,7 @@ export const folderWithPendingDocumentArchived1: OfficeFolder = { description: "Description", archived_description: "Archived description", documents: [documentDeposited], + office_folder_has_customers: [officeFolderHasCustomer1, officeFolderHasCustomer2], }; export const folderWithPendingDocumentArchived2: OfficeFolder = { uid: "adzefdazdaazzrtgtr", diff --git a/src/front/Components/Layouts/DesignSystem/index.tsx b/src/front/Components/Layouts/DesignSystem/index.tsx index f1e0742d..18310c61 100644 --- a/src/front/Components/Layouts/DesignSystem/index.tsx +++ b/src/front/Components/Layouts/DesignSystem/index.tsx @@ -1,3 +1,5 @@ +import "reflect-metadata"; + import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; import CheckBox from "@Front/Components/DesignSystem/CheckBox"; import DocumentNotary from "@Front/Components/DesignSystem/Document/DocumentNotary"; @@ -22,7 +24,6 @@ import Toasts, { IToast } from "@Front/Stores/Toasts"; import classes from "./classes.module.scss"; import { customer2, document, documentDeposited, documentPending, folder, folders, folderWithPendingDocument } from "./dummyData"; -import "reflect-metadata"; type IState = { isModalDisplayed: boolean; diff --git a/src/front/Components/Layouts/Folder/FolderInformation/ClientSection/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/ClientSection/index.tsx index 2acba430..b0d4b830 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/ClientSection/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/ClientSection/index.tsx @@ -51,11 +51,7 @@ export default class ClientSection extends React.Component { const output = this.props.folder.office_folder_has_customers?.map((folderHasCustomer, key) => { if (!folderHasCustomer.customer) return null; // TODO : Les documents ASKED fonctionne mais les autres documents ne doivcent etre seulement ceux qui correspondent au folder - return ( - //
- - //
- ); + return ; }); return output ?? null; } diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index f88e1d9d..bc2ef367 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -2,27 +2,25 @@ import "reflect-metadata"; import ChevronIcon from "@Assets/Icons/chevron.svg"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; -import FolderBoxInformation from "@Front/Components/DesignSystem/FolderBoxInformation"; +import FolderBoxInformation, { EFolderBoxInformationType } from "@Front/Components/DesignSystem/FolderBoxInformation"; import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"; import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; import { folders } from "@Front/Components/Layouts/DesignSystem/dummyData"; import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; +import Module from "@Front/Config/Module"; +import Link from "next/link"; import { useRouter } from "next/router"; - import BasePage from "../../Base"; import classes from "./classes.module.scss"; import ClientSection from "./ClientSection"; -import Link from "next/link"; -import { useEffect, useState } from "react"; -import Module from "@Front/Config/Module"; + type IProps = {}; type IPropsClass = IProps & { selectedFolderUid: string; - isArchivedFolders: boolean; }; type IState = { @@ -48,7 +46,7 @@ class FolderInformationClass extends BasePage { .get() .modules.pages.Folder.pages.EditCollaborators.props.path.replace("[folderUid]", this.props.selectedFolderUid); return ( - +
{this.state.selectedFolder ? (
@@ -63,9 +61,9 @@ class FolderInformationClass extends BasePage {
- +
- +
@@ -142,8 +140,5 @@ export default function FolderInformation(props: IProps) { const router = useRouter(); let { folderUid } = router.query; folderUid = folderUid as string; - const [url, setUrl] = useState(""); - useEffect(() => setUrl(router?.asPath), []); - const isArchivedFolders = url.includes("archived"); - return ; + return ; } diff --git a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx index 9cb8ed2a..94a0545c 100644 --- a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx @@ -175,7 +175,7 @@ class ViewDocumentsClass extends BasePage { private goToPrevious() { if (this.hasPrevious()) { this.props.router.push( - `/folder/${this.props.folderUid}/document/${this.props.documentsList[this.state.selectedDocumentIndex - 1]!.uid}`, + `/folders/${this.props.folderUid}/documents/${this.props.documentsList[this.state.selectedDocumentIndex - 1]!.uid}`, ); } } @@ -183,7 +183,7 @@ class ViewDocumentsClass extends BasePage { private goToNext() { if (this.hasNext()) { this.props.router.push( - `/folder/${this.props.folderUid}/document/${this.props.documentsList[this.state.selectedDocumentIndex + 1]!.uid}`, + `/folders/${this.props.folderUid}/documents/${this.props.documentsList[this.state.selectedDocumentIndex + 1]!.uid}`, ); } } diff --git a/src/front/Components/Layouts/FolderArchived/FolderInformation/ClientSection/index.tsx b/src/front/Components/Layouts/FolderArchived/FolderInformation/ClientSection/index.tsx index 2acba430..15924744 100644 --- a/src/front/Components/Layouts/FolderArchived/FolderInformation/ClientSection/index.tsx +++ b/src/front/Components/Layouts/FolderArchived/FolderInformation/ClientSection/index.tsx @@ -2,11 +2,7 @@ import React from "react"; import classes from "./classes.module.scss"; import { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; -import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; -import PlusIcon from "@Assets/Icons/plus.svg"; import UserFolder from "@Front/Components/DesignSystem/UserFolder"; -import Link from "next/link"; -import Module from "@Front/Config/Module"; type IProps = { folder: IDashBoardFolder; @@ -15,32 +11,17 @@ type IState = {}; export default class ClientSection extends React.Component { public override render(): JSX.Element { - const navigatePath = Module.getInstance() - .get() - .modules.pages.Folder.pages.AddClient.props.path.replace("[folderUid]", this.props.folder.uid); return (
{this.doesFolderHaveCustomer() ? ( <>
{this.renderCustomerFolders()}
- - - ) : (
-
- - Aucun client n’est associé au dossier. - -
- - - + + Aucun client dans ce dossier +
)}
@@ -51,11 +32,7 @@ export default class ClientSection extends React.Component { const output = this.props.folder.office_folder_has_customers?.map((folderHasCustomer, key) => { if (!folderHasCustomer.customer) return null; // TODO : Les documents ASKED fonctionne mais les autres documents ne doivcent etre seulement ceux qui correspondent au folder - return ( - //
- - //
- ); + return ; }); return output ?? null; } diff --git a/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx b/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx index 25ee7d73..1e249bfb 100644 --- a/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx @@ -2,9 +2,7 @@ import "reflect-metadata"; import ChevronIcon from "@Assets/Icons/chevron.svg"; import Button, { EButtonVariant } from "@Front/Components/DesignSystem/Button"; -import FolderBoxInformation from "@Front/Components/DesignSystem/FolderBoxInformation"; -import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"; -import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; +import FolderBoxInformation, { EFolderBoxInformationType } from "@Front/Components/DesignSystem/FolderBoxInformation"; import QuantityProgressBar from "@Front/Components/DesignSystem/QuantityProgressBar"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; import { folders } from "@Front/Components/Layouts/DesignSystem/dummyData"; @@ -14,13 +12,11 @@ import { useRouter } from "next/router"; import BasePage from "../../Base"; import classes from "./classes.module.scss"; import ClientSection from "./ClientSection"; -import { useEffect, useState } from "react"; type IProps = {}; type IPropsClass = IProps & { selectedFolderUid: string; - isArchivedFolders: boolean; }; type IState = { @@ -43,7 +39,7 @@ class FolderInformationClass extends BasePage { // TODO: get the selected folder from the api in componentDidMount public override render(): JSX.Element { return ( - +
{this.state.selectedFolder ? (
@@ -56,10 +52,26 @@ class FolderInformationClass extends BasePage { Modifier les collaborateurs
- +
- +
+
+ +
+
@@ -69,27 +81,10 @@ class FolderInformationClass extends BasePage { {!this.doesFolderHaveCustomer() && }
- - {!this.doesFolderHaveCustomer() && ( - - - - )}
- -
- Souhaitez-vous vraiment archiver le dossier ? -
- -
) : (
@@ -106,6 +101,7 @@ class FolderInformationClass extends BasePage { ); } public override async componentDidMount() { + // TODO : GET Current folder from the api for (const folder of folders) { if (folder.uid === this.props.selectedFolderUid) { this.setState({ selectedFolder: folder }); @@ -122,6 +118,8 @@ class FolderInformationClass extends BasePage { this.setState({ selectedFolder: folder }); } + private restoreFolder() {} + // should call the api to restore the folder private openArchivedModal(): void { this.setState({ isArchivedModalOpen: true }); } @@ -135,9 +133,5 @@ export default function FolderInformation(props: IProps) { const router = useRouter(); let { folderUid } = router.query; folderUid = folderUid as string; - const [url, setUrl] = useState(""); - useEffect(() => setUrl(router?.asPath), []); - const isArchivedFolders = url.includes("archived"); - console.log("isArchivedFolders >> ", isArchivedFolders); - return ; + return ; } diff --git a/src/front/Config/Module/preprod.json b/src/front/Config/Module/preprod.json index b5d6f276..b449fef6 100644 --- a/src/front/Config/Module/preprod.json +++ b/src/front/Config/Module/preprod.json @@ -48,7 +48,7 @@ "AddClient": { "enabled": true, "props": { - "path": "/folders/add/client", + "path": "/folders/add/clients", "labelKey": "add_client_to_folder" } }, @@ -80,6 +80,13 @@ "labelKey": "edit_informations" } }, + "EditCollaborators": { + "enabled": true, + "props": { + "path": "/folders/[folderUid]/edit/collaborators", + "labelKey": "edit_collaborators" + } + }, "FolderArchived": { "enabled": true, "props": { diff --git a/src/front/Config/Module/production.json b/src/front/Config/Module/production.json index b5d6f276..b449fef6 100644 --- a/src/front/Config/Module/production.json +++ b/src/front/Config/Module/production.json @@ -48,7 +48,7 @@ "AddClient": { "enabled": true, "props": { - "path": "/folders/add/client", + "path": "/folders/add/clients", "labelKey": "add_client_to_folder" } }, @@ -80,6 +80,13 @@ "labelKey": "edit_informations" } }, + "EditCollaborators": { + "enabled": true, + "props": { + "path": "/folders/[folderUid]/edit/collaborators", + "labelKey": "edit_collaborators" + } + }, "FolderArchived": { "enabled": true, "props": { diff --git a/src/front/Config/Module/staging.json b/src/front/Config/Module/staging.json index b5d6f276..b449fef6 100644 --- a/src/front/Config/Module/staging.json +++ b/src/front/Config/Module/staging.json @@ -48,7 +48,7 @@ "AddClient": { "enabled": true, "props": { - "path": "/folders/add/client", + "path": "/folders/add/clients", "labelKey": "add_client_to_folder" } }, @@ -80,6 +80,13 @@ "labelKey": "edit_informations" } }, + "EditCollaborators": { + "enabled": true, + "props": { + "path": "/folders/[folderUid]/edit/collaborators", + "labelKey": "edit_collaborators" + } + }, "FolderArchived": { "enabled": true, "props": { diff --git a/src/pages/folder/[folderUid]/document/[documentUid]/index.tsx b/src/pages/folders/[folderUid]/documents/[documentUid]/index.tsx similarity index 100% rename from src/pages/folder/[folderUid]/document/[documentUid]/index.tsx rename to src/pages/folders/[folderUid]/documents/[documentUid]/index.tsx diff --git a/src/pages/folders/archived/[folderUid]/index.tsx b/src/pages/folders/archived/[folderUid]/index.tsx index 2b6680d9..d3a8ef97 100644 --- a/src/pages/folders/archived/[folderUid]/index.tsx +++ b/src/pages/folders/archived/[folderUid]/index.tsx @@ -1,4 +1,4 @@ -import FolderInformation from "@Front/Components/Layouts/Folder/FolderInformation"; +import FolderInformation from "@Front/Components/Layouts/FolderArchived/FolderInformation"; export default function Route() { return ;