From 889e14a451bc085739f83bccaf18b340a90d97bc Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:00:40 +0200 Subject: [PATCH 01/31] :bug: Anchoring popup disappear after 2 gifs occurence --- .../Layouts/Folder/ViewDocuments/index.tsx | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx index 94a0545c..e113b581 100644 --- a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx @@ -1,4 +1,5 @@ import "reflect-metadata"; + import LeftArrowIcon from "@Assets/Icons/left-arrow.svg"; import RightArrowIcon from "@Assets/Icons/right-arrow.svg"; import ValidateAnchoringGif from "@Front/Assets/images/validate_anchoring.gif"; @@ -18,7 +19,6 @@ import React from "react"; import BasePage from "../../Base"; import classes from "./classes.module.scss"; - type IProps = {}; type IPropsClass = { documentsList: Document[]; @@ -74,7 +74,10 @@ class ViewDocumentsClass extends BasePage {
{this.props.documentsList.length > 1 && ( -
+
left arrow
)} @@ -84,7 +87,10 @@ class ViewDocumentsClass extends BasePage { ))}
{this.props.documentsList.length > 1 && ( -
+
right arrow
)} @@ -202,6 +208,19 @@ class ViewDocumentsClass extends BasePage { this.setState({ hasValidateAnchoring: true, }); + + const timeoutDelay = 9800; + setTimeout(() => { + this.setState({ + isValidateModalVisible: false, + }); + }, timeoutDelay); + + setTimeout(() => { + this.setState({ + hasValidateAnchoring: false, + }); + }, timeoutDelay + 1000); } private onRefuseTextChange(e: React.ChangeEvent) { From 235a3c607cb0845b83863c86af5a1511e00964df Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:11:20 +0200 Subject: [PATCH 02/31] :bug: File name when validated or pending --- .../Document/DocumentNotary/index.tsx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx b/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx index 66374d71..768ab0a0 100644 --- a/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx +++ b/src/front/Components/DesignSystem/Document/DocumentNotary/index.tsx @@ -16,6 +16,7 @@ type IProps = { document_type: Document["document_type"]; document_status: Document["document_status"]; folder: Document["folder"]; + files?: Document["files"]; }; openDeletionModal?: (uid: Document["uid"]) => void; }; @@ -37,13 +38,31 @@ class DocumentNotaryClass extends React.Component {
{this.props.document?.document_type?.name} - Aucun document déposé + {this.getDocumentsTitle()}
{this.renderIcon()}
); } + private getDocumentsTitle(){ + const documentFiles = this.props.document.files; + if(documentFiles){ + if(documentFiles.length === 1){ + const fileName = documentFiles[0]?.file_path?.split("/").pop(); + if(fileName && fileName.length > 20){ + return `${fileName.substr(0, 7)}...${fileName.substr(fileName.length - 7, fileName.length)}`; + }else{ + return fileName; + } + }else{ + return `${documentFiles.length} documents déposés`; + } + }else{ + return "Aucun document déposé"; + } + } + private onClick() { if (this.props.document.document_status !== "VALIDATED" && this.props.document.document_status !== "PENDING") return; this.props.router.push(`/folders/${this.props.document.folder.uid}/documents/${this.props.document.uid}`); From a5ea0b1e3ce4b1aa7a51acc8864bda1e090ae4bc Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:20:37 +0200 Subject: [PATCH 03/31] :bug: Retour aux dossiers missing in folder information + wrong css --- .../classes.module.scss | 6 ++-- .../DefaultNotaryDashboard/index.tsx | 30 +++++++++---------- .../Folder/FolderInformation/index.tsx | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/classes.module.scss b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/classes.module.scss index 7bd278e7..c701b96b 100644 --- a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/classes.module.scss +++ b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/classes.module.scss @@ -88,12 +88,13 @@ min-width: calc(100vw - 389px); padding: 64px 48px; overflow-y: auto; - + @media (max-width: ($screen-m - 1px)) { min-width: calc(100vw - 56px); } - + @media(max-width: $screen-s){ + padding: 40px 16px 64px 16px; flex: 1; min-width: unset; } @@ -102,6 +103,7 @@ display: none; @media (max-width: $screen-s) { display: block; + margin-bottom: 24px; } } diff --git a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx index 1b20db23..b8e17182 100644 --- a/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx +++ b/src/front/Components/LayoutTemplates/DefaultNotaryDashboard/index.tsx @@ -84,21 +84,21 @@ export default class DefaultNotaryDashboard extends React.Component {this.props.hasBackArrow && ( - <> -
- -
-
- -
- +
+ +
+ )} + {this.props.mobileBackText && ( +
+ +
)} {this.props.children}
diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index bc2ef367..ccd9eb62 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -46,7 +46,7 @@ class FolderInformationClass extends BasePage { .get() .modules.pages.Folder.pages.EditCollaborators.props.path.replace("[folderUid]", this.props.selectedFolderUid); return ( - +
{this.state.selectedFolder ? (
From 1db13b6cfe92754f8fb7300f38001fb58a217396 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:24:31 +0200 Subject: [PATCH 04/31] :bug: Folder list on default folder --- src/front/Components/Layouts/Folder/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/front/Components/Layouts/Folder/index.tsx b/src/front/Components/Layouts/Folder/index.tsx index bfd2968a..0b012370 100644 --- a/src/front/Components/Layouts/Folder/index.tsx +++ b/src/front/Components/Layouts/Folder/index.tsx @@ -22,7 +22,7 @@ export default class Folder extends BasePage { // TODO: Message if the user has not created any folder yet public override render(): JSX.Element { return ( - +
Informations du dossier From 370ade12aef29f0e1f1109e1b00b5e4cfff93564 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:27:39 +0200 Subject: [PATCH 05/31] :bug: Replacing folder URL with config --- src/front/Components/DesignSystem/Header/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/front/Components/DesignSystem/Header/index.tsx b/src/front/Components/DesignSystem/Header/index.tsx index 23e4ca3f..b4bffcd4 100644 --- a/src/front/Components/DesignSystem/Header/index.tsx +++ b/src/front/Components/DesignSystem/Header/index.tsx @@ -8,6 +8,7 @@ import Notifications from "./Notifications"; import Profile from "./Profile"; import BurgerMenu from "./BurgerMenu"; import WindowStore from "@Front/Stores/WindowStore"; +import Module from "@Front/Config/Module"; enum EHeaderOpeningState { OPEN = "open", @@ -49,7 +50,7 @@ export default class Header extends React.Component { return (
- + logo
From 941d8387a420de4cf74aa32b1306cabd8e588a9e Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:29:05 +0200 Subject: [PATCH 06/31] :bug: Can refuse document without a motive --- src/front/Components/Layouts/Folder/ViewDocuments/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx index e113b581..db4ffe72 100644 --- a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx @@ -139,7 +139,7 @@ class ViewDocumentsClass extends BasePage { header={"Refuser le document ?"} cancelText={"Annuler"} confirmText={"Refuser"} - canConfirm={this.state.refuseText !== ""}> + >
Veuillez indiquer au client le motif du refus de son document afin qu'il puisse vous renvoyer une bonne From e53118cfe3dc93fff1f9bfba0e15f48af33588d0 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:31:14 +0200 Subject: [PATCH 07/31] :bug: Wrong color radio button --- .../Components/DesignSystem/RadioBox/classes.module.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/front/Components/DesignSystem/RadioBox/classes.module.scss b/src/front/Components/DesignSystem/RadioBox/classes.module.scss index 2790b0ab..da7efcac 100644 --- a/src/front/Components/DesignSystem/RadioBox/classes.module.scss +++ b/src/front/Components/DesignSystem/RadioBox/classes.module.scss @@ -11,7 +11,7 @@ background-color: transparent; width: 16px; height: 16px; - border: 1px solid $green-flash; + border: 1px solid $turquoise-flash; border-radius: 100px; margin-right: 16px; display: grid; @@ -24,7 +24,7 @@ content: ""; width: 10px; height: 10px; - background-color: $green-flash; + background-color: $turquoise-flash; border-radius: 100px; transform: scale(0); } From 70e1e4a7a472d22d00977f04d9b14061ff78491c Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:33:46 +0200 Subject: [PATCH 08/31] :bug: 404 Rework --- .../Components/DesignSystem/Header/index.tsx | 2 +- .../Layouts/PageNotFound/classes.module.scss | 9 +++++++++ .../Components/Layouts/PageNotFound/index.tsx | 17 ++++++++++------- src/front/Config/Module/development.json | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/front/Components/DesignSystem/Header/index.tsx b/src/front/Components/DesignSystem/Header/index.tsx index b4bffcd4..e5c496ce 100644 --- a/src/front/Components/DesignSystem/Header/index.tsx +++ b/src/front/Components/DesignSystem/Header/index.tsx @@ -50,7 +50,7 @@ export default class Header extends React.Component { return (
- + logo
diff --git a/src/front/Components/Layouts/PageNotFound/classes.module.scss b/src/front/Components/Layouts/PageNotFound/classes.module.scss index d044e590..30a6f4b3 100644 --- a/src/front/Components/Layouts/PageNotFound/classes.module.scss +++ b/src/front/Components/Layouts/PageNotFound/classes.module.scss @@ -6,4 +6,13 @@ align-items: center; justify-content: center; flex-direction: column; + text-align: center; + + .buttons-container{ + margin-top: 32px; + } + + @media(max-width: $screen-s){ + margin-top: 32px; + } } \ No newline at end of file diff --git a/src/front/Components/Layouts/PageNotFound/index.tsx b/src/front/Components/Layouts/PageNotFound/index.tsx index c8baf7d3..d7592019 100644 --- a/src/front/Components/Layouts/PageNotFound/index.tsx +++ b/src/front/Components/Layouts/PageNotFound/index.tsx @@ -1,20 +1,23 @@ +import Button from "@Front/Components/DesignSystem/Button"; +import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; import DefaultTemplate from "@Front/Components/LayoutTemplates/DefaultTemplate"; +import Module from "@Front/Config/Module"; import Link from "next/link"; + import BasePage from "../Base"; import classes from "./classes.module.scss"; -import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; -import Button from "@Front/Components/DesignSystem/Button"; -import Module from "@Front/Config/Module"; export default class PageNotFound extends BasePage { public override render(): JSX.Element { return (
- Il n'y a rien ici, la page que vous avez demandé n'existe pas - - - + Il n'y a rien ici, la page que vous avez demandée n'existe pas +
+ + + +
); diff --git a/src/front/Config/Module/development.json b/src/front/Config/Module/development.json index b449fef6..1702ebb5 100644 --- a/src/front/Config/Module/development.json +++ b/src/front/Config/Module/development.json @@ -6,7 +6,7 @@ "Home": { "enabled": true, "props": { - "path": "/", + "path": "/folders", "labelKey": "homepage" } }, From e0f985e8170138215b1c68a2b636d8f8f7f75ad9 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 11:38:47 +0200 Subject: [PATCH 09/31] :bug: Wrong path and wrong color view documents --- .../Layouts/Folder/UpdateFolderCollaborators/index.tsx | 4 +++- src/front/Components/Layouts/Folder/ViewDocuments/index.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/front/Components/Layouts/Folder/UpdateFolderCollaborators/index.tsx b/src/front/Components/Layouts/Folder/UpdateFolderCollaborators/index.tsx index 7defa139..ac758fc2 100644 --- a/src/front/Components/Layouts/Folder/UpdateFolderCollaborators/index.tsx +++ b/src/front/Components/Layouts/Folder/UpdateFolderCollaborators/index.tsx @@ -10,6 +10,7 @@ import Link from "next/link"; import { useRouter } from "next/router"; import RadioBox from "@Front/Components/DesignSystem/RadioBox"; import MultiSelect from "@Front/Components/DesignSystem/MultiSelect"; +import Module from "@Front/Config/Module"; type IPropsClass = { selectedFolderUid: string; @@ -35,7 +36,8 @@ class UpdateFolderCollaboratorsClass extends BasePage { this.onSelectedOptionSpecific = this.onSelectedOptionSpecific.bind(this); } public override render(): JSX.Element { - const backwardPath = "/folder/".concat(this.props.selectedFolderUid); + const foldersInformationPath = Module.getInstance().get().modules.pages.Folder.pages.FolderInformation.props.path; + const backwardPath = foldersInformationPath.replace("[folderUid]", this.props.selectedFolderUid); const selectOptions = [ { value: "adazzdsqaad", label: "John Doe" }, { value: "azdzafzad", label: "Jahn Doe" }, diff --git a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx index db4ffe72..6a2dd5e3 100644 --- a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx @@ -69,7 +69,7 @@ class ViewDocumentsClass extends BasePage { App 23 rue Torus Toulon - + {this.state.selectedDocument.document_type.name}
From e2ede3a5bea79a7c7861cdce2fcab33859d0c27e Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 12:08:52 +0200 Subject: [PATCH 10/31] :bug: Carousel between files and not documents + download when validated --- .../Layouts/DesignSystem/dummyData.ts | 2 +- .../Layouts/Folder/ViewDocuments/index.tsx | 104 +++++++++--------- 2 files changed, 56 insertions(+), 50 deletions(-) diff --git a/src/front/Components/Layouts/DesignSystem/dummyData.ts b/src/front/Components/Layouts/DesignSystem/dummyData.ts index 0bef5a44..252c615b 100644 --- a/src/front/Components/Layouts/DesignSystem/dummyData.ts +++ b/src/front/Components/Layouts/DesignSystem/dummyData.ts @@ -131,7 +131,7 @@ export const documentPending: Document = { document_type: docType, updated_at: new Date(), created_at: new Date(), - files: [fileMock2], + files: [fileMock,fileMock2], }; export const documentDeposited: Document = { diff --git a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx index 6a2dd5e3..bcc68904 100644 --- a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx @@ -11,7 +11,7 @@ import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; import { folders } from "@Front/Components/Layouts/DesignSystem/dummyData"; import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; -import { Document } from "le-coffre-resources/dist/Customer"; +import { Document, File } from "le-coffre-resources/dist/Customer"; import Image from "next/image"; import { NextRouter, useRouter } from "next/router"; import React from "react"; @@ -19,9 +19,9 @@ import React from "react"; import BasePage from "../../Base"; import classes from "./classes.module.scss"; + type IProps = {}; type IPropsClass = { - documentsList: Document[]; selectedDocument: Document | null; router: NextRouter; folderUid: string; @@ -32,8 +32,8 @@ type IState = { isValidateModalVisible: boolean; refuseText: string; hasValidateAnchoring: boolean; - selectedDocument: Document | null; - selectedDocumentIndex: number; + selectedFileIndex: number; + selectedFile: File | null; }; class ViewDocumentsClass extends BasePage { @@ -45,8 +45,8 @@ class ViewDocumentsClass extends BasePage { isRefuseModalVisible: false, refuseText: "", hasValidateAnchoring: false, - selectedDocument: null, - selectedDocumentIndex: -1, + selectedFileIndex: 0, + selectedFile: null, }; this.closeModals = this.closeModals.bind(this); @@ -59,21 +59,23 @@ class ViewDocumentsClass extends BasePage { this.hasPrevious = this.hasPrevious.bind(this); this.hasNext = this.hasNext.bind(this); + + this.downloadFile = this.downloadFile.bind(this); } public override render(): JSX.Element | null { return ( - {this.state.selectedDocument && ( + {this.props.selectedDocument && this.props.selectedDocument.files && this.state.selectedFile && (
App 23 rue Torus Toulon - {this.state.selectedDocument.document_type.name} + {this.props.selectedDocument.document_type.name}
- {this.props.documentsList.length > 1 && ( + {this.props.selectedDocument.files.length > 1 && (
{
)}
- {this.state.selectedDocument.files?.map((file) => ( - - ))} +
- {this.props.documentsList.length > 1 && ( + {this.props.selectedDocument.files.length > 1 && (
{ )}
- - - + {this.props.selectedDocument?.document_status === "PENDING" && ( + <> + + + + + )} + {this.props.selectedDocument?.document_status === "VALIDATED" && ( + <> + + + )}
{ closeBtn header={"Refuser le document ?"} cancelText={"Annuler"} - confirmText={"Refuser"} - > + confirmText={"Refuser"}>
Veuillez indiquer au client le motif du refus de son document afin qu'il puisse vous renvoyer une bonne @@ -150,7 +158,7 @@ class ViewDocumentsClass extends BasePage {
)} - {!this.state.selectedDocument && ( + {(!this.state.selectedFile || !this.props.selectedDocument) && (
Document non trouvé @@ -162,46 +170,52 @@ class ViewDocumentsClass extends BasePage { } override componentDidMount(): void { - if (!this.props.selectedDocument) return; + if (!this.props.selectedDocument || !this.props.selectedDocument.files || !this.props.selectedDocument.files[0]) return; this.setState({ - selectedDocument: this.props.selectedDocument, - selectedDocumentIndex: this.props.documentsList.findIndex((doc) => doc.uid === this.props.selectedDocument!.uid), + selectedFile: this.props.selectedDocument.files[0], + selectedFileIndex: 0, }); } - override componentDidUpdate(prevProps: Readonly, prevState: Readonly, snapshot?: any): void { - if (prevProps.selectedDocument !== this.props.selectedDocument) { - this.setState({ - selectedDocument: this.props.selectedDocument, - selectedDocumentIndex: this.props.documentsList.findIndex((doc) => doc.uid === this.props.selectedDocument!.uid), - }); - } + private downloadFile() { + var link = document.createElement("a"); + // If you don't know the name or want to use + // the webserver default set name = '' + link.setAttribute("download", "super_nom.pdf"); + link.href = "/"; + document.body.appendChild(link); + link.click(); + link.remove(); } private goToPrevious() { + const index = this.state.selectedFileIndex - 1; if (this.hasPrevious()) { - this.props.router.push( - `/folders/${this.props.folderUid}/documents/${this.props.documentsList[this.state.selectedDocumentIndex - 1]!.uid}`, - ); + this.setState({ + selectedFile: this.props.selectedDocument!.files![index]!, + selectedFileIndex: index, + }); } } private goToNext() { if (this.hasNext()) { - this.props.router.push( - `/folders/${this.props.folderUid}/documents/${this.props.documentsList[this.state.selectedDocumentIndex + 1]!.uid}`, - ); + const index = this.state.selectedFileIndex + 1; + this.setState({ + selectedFile: this.props.selectedDocument!.files![index]!, + selectedFileIndex: index, + }); } } private hasPrevious() { - const index = this.state.selectedDocumentIndex - 1; + const index = this.state.selectedFileIndex - 1; return index >= 0; } private hasNext() { - const index = this.state.selectedDocumentIndex + 1; - return index < this.props.documentsList.length; + const index = this.state.selectedFileIndex + 1; + return index < this.props.selectedDocument!.files!.length; } private validateAnchoring() { @@ -256,13 +270,5 @@ export default function ViewDocuments(props: IProps) { const folder = folders[0]!; const documents = folder.documents!.filter((document) => document.document_status !== "ASKED"); const selectedDocument = documents.find((document) => document.uid === documentUid) ?? null; - return ( - - ); + return ; } From cd93d5c34020b1af75328c0ba22e6885c8e81878 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Wed, 26 Apr 2023 12:09:00 +0200 Subject: [PATCH 11/31] :bug: Carousel between files and not documents + download when validated --- .../Layouts/Folder/ViewDocuments/index.tsx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx index bcc68904..39d10a74 100644 --- a/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/ViewDocuments/index.tsx @@ -59,8 +59,6 @@ class ViewDocumentsClass extends BasePage { this.hasPrevious = this.hasPrevious.bind(this); this.hasNext = this.hasNext.bind(this); - - this.downloadFile = this.downloadFile.bind(this); } public override render(): JSX.Element | null { @@ -106,9 +104,9 @@ class ViewDocumentsClass extends BasePage { )} {this.props.selectedDocument?.document_status === "VALIDATED" && ( - <> - - + + + )}
{ }); } - private downloadFile() { - var link = document.createElement("a"); - // If you don't know the name or want to use - // the webserver default set name = '' - link.setAttribute("download", "super_nom.pdf"); - link.href = "/"; - document.body.appendChild(link); - link.click(); - link.remove(); - } - private goToPrevious() { const index = this.state.selectedFileIndex - 1; if (this.hasPrevious()) { From 39cba4981f2bbd1a5ccf0cfd0c03d248ef959577 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 27 Apr 2023 10:42:30 +0200 Subject: [PATCH 12/31] :sparkles: Fixing active link in header --- .../DesignSystem/Header/HeaderLink/index.tsx | 20 ++++++++++--------- .../DesignSystem/Header/Navigation/index.tsx | 9 +++++++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/front/Components/DesignSystem/Header/HeaderLink/index.tsx b/src/front/Components/DesignSystem/Header/HeaderLink/index.tsx index a2af0095..d8db1a7e 100644 --- a/src/front/Components/DesignSystem/Header/HeaderLink/index.tsx +++ b/src/front/Components/DesignSystem/Header/HeaderLink/index.tsx @@ -6,12 +6,15 @@ import React from "react"; import Typography, { ITypo } from "../../Typography"; import classes from "./classes.module.scss"; -type IPropsClass = { +type IProps = { text: string | JSX.Element; - path?: string; + path: string; isActive?: boolean; + routesActive: string[]; }; +type IPropsClass = IProps; + type IStateClass = {}; class HeaderLinkClass extends React.Component { @@ -37,14 +40,13 @@ class HeaderLinkClass extends React.Component { } } -export default function HeaderLink(props: IPropsClass) { - /** - * TODO: We need to fix the check and include subPathName - * BUT - * `/folder/archived` and `/folder/xxx` should be differenciated - */ +export default function HeaderLink(props: IProps) { const router = useRouter(); const { pathname } = router; - const isActive = pathname === props.path; + let isActive = props.path === pathname; + for (const routeActive of props.routesActive) { + if (isActive) break; + isActive = pathname.includes(routeActive); + } return ; } diff --git a/src/front/Components/DesignSystem/Header/Navigation/index.tsx b/src/front/Components/DesignSystem/Header/Navigation/index.tsx index 0319b1a3..0a1427a5 100644 --- a/src/front/Components/DesignSystem/Header/Navigation/index.tsx +++ b/src/front/Components/DesignSystem/Header/Navigation/index.tsx @@ -1,8 +1,8 @@ +import Module from "@Front/Config/Module"; import React from "react"; import HeaderLink from "../HeaderLink"; import classes from "./classes.module.scss"; -import Module from "@Front/Config/Module"; type IProps = {}; type IState = {}; @@ -11,10 +11,15 @@ export default class Navigation extends React.Component { public override render(): JSX.Element { return (
- +
); From 10f7f081214d268bc0d796214bdf19e6f2f5ebf9 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 27 Apr 2023 10:46:52 +0200 Subject: [PATCH 13/31] :bug: Removing act type choose in ask documents --- .../Layouts/Folder/AskDocuments/index.tsx | 71 ++++++------------- 1 file changed, 22 insertions(+), 49 deletions(-) diff --git a/src/front/Components/Layouts/Folder/AskDocuments/index.tsx b/src/front/Components/Layouts/Folder/AskDocuments/index.tsx index 46ab0cb5..7e93a30b 100644 --- a/src/front/Components/Layouts/Folder/AskDocuments/index.tsx +++ b/src/front/Components/Layouts/Folder/AskDocuments/index.tsx @@ -4,7 +4,7 @@ import CheckBox from "@Front/Components/DesignSystem/CheckBox"; import Form, { IApiFormErrors } from "@Front/Components/DesignSystem/Form"; import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"; import Confirm from "@Front/Components/DesignSystem/Modal/Confirm"; -import Select, { IOption } from "@Front/Components/DesignSystem/Select"; +import { IOption } from "@Front/Components/DesignSystem/Select"; import Typography, { ITypo, ITypoColor } from "@Front/Components/DesignSystem/Typography"; import BackArrow from "@Front/Components/Elements/BackArrow"; import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; @@ -15,19 +15,12 @@ import classes from "./classes.module.scss"; type IProps = {}; type IState = { - actType: IOption | null; isCreateDocumentModalVisible: boolean; documentName: string; visibleDescription: string; }; export default class AskDocuments extends BasePage { - private actsOptions: IOption[] = [ - { label: "Divorce", value: "divorce" }, - { label: "Succession", value: "succession" }, - { label: "Vente immobilière", value: "vente_immobiliere" }, - ]; - private documentsType: IOption[] = [ { label: "Carte d'identité", value: "carte_identite" }, { label: "Diagnostic État Risques et Pollution", value: "diagnostic_erep" }, @@ -46,13 +39,11 @@ export default class AskDocuments extends BasePage { super(props); this.state = { - actType: null, isCreateDocumentModalVisible: false, documentName: "", visibleDescription: "", }; - this.onActTypeChange = this.onActTypeChange.bind(this); this.onFormSubmit = this.onFormSubmit.bind(this); this.closeModal = this.closeModal.bind(this); this.openModal = this.openModal.bind(this); @@ -73,38 +64,27 @@ export default class AskDocuments extends BasePage {
- {!this.state.actType && ( - - +
@@ -70,6 +71,15 @@ class UpdateFolderMetadataClass extends BasePage { ); } + public override componentDidMount(): void { + this.setState({ + selectedOption: { + label: this.props.folder?.deed.deed_type?.name ?? "", + value: this.props.folder?.deed.deed_type?.uid ?? "", + }, + }); + } + private onSelectedOption(option: IOption) { this.setState({ selectedOption: option, @@ -85,5 +95,15 @@ export default function UpdateFolderMetadata() { const router = useRouter(); let { folderUid } = router.query; folderUid = folderUid as string; - return ; + const folder = folders.find((folder) => folder.uid === folderUid) ?? null; + return ; +} + +function formatDate(date: Date | null): string { + if (!date) return "..."; + return date.toLocaleDateString("fr-FR", { + year: "numeric", + month: "long", + day: "numeric", + }); } From d81edc352583641bb0b85bc86d14b9f3c0fb72e6 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Thu, 27 Apr 2023 12:31:03 +0200 Subject: [PATCH 24/31] :bug: Autofill folder description update --- .../Form/Elements/InputField/index.tsx | 1 + .../Folder/UpdateFolderDescription/index.tsx | 14 +++++----- .../Folder/UpdateFolderMetadata/index.tsx | 26 ++++++++++++------- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/front/Components/DesignSystem/Form/Elements/InputField/index.tsx b/src/front/Components/DesignSystem/Form/Elements/InputField/index.tsx index d30dac43..4511802a 100644 --- a/src/front/Components/DesignSystem/Form/Elements/InputField/index.tsx +++ b/src/front/Components/DesignSystem/Form/Elements/InputField/index.tsx @@ -46,6 +46,7 @@ export default class InputField extends BaseField { className={ this.props.className ? [classes["textarea"], classes[this.props.className]].join(" ") : classes["textarea"] } + value={value} />
{this.props.fakeplaceholder}
diff --git a/src/front/Components/Layouts/Folder/UpdateFolderDescription/index.tsx b/src/front/Components/Layouts/Folder/UpdateFolderDescription/index.tsx index 3416e816..54568d25 100644 --- a/src/front/Components/Layouts/Folder/UpdateFolderDescription/index.tsx +++ b/src/front/Components/Layouts/Folder/UpdateFolderDescription/index.tsx @@ -3,16 +3,17 @@ import Form from "@Front/Components/DesignSystem/Form"; import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField"; import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; import BackArrow from "@Front/Components/Elements/BackArrow"; +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 Link from "next/link"; -import Module from "@Front/Config/Module"; type IProps = { - selectedFolderUid: string; + folder: IDashBoardFolder | null; }; type IState = { selectedFolder: IDashBoardFolder | null; @@ -28,7 +29,7 @@ class UpdateFolderDescriptionClass extends BasePage { public override render(): JSX.Element { const backwardPath = Module.getInstance() .get() - .modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.selectedFolderUid); + .modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", this.props.folder?.uid ?? ""); return (
@@ -39,7 +40,7 @@ class UpdateFolderDescriptionClass extends BasePage {
- +
@@ -63,5 +64,6 @@ export default function UpdateFolderDescription() { const router = useRouter(); let { folderUid } = router.query; folderUid = folderUid as string; - return ; + const folder = folders.find((folder) => folder.uid === folderUid) ?? null; + return ; } diff --git a/src/front/Components/Layouts/Folder/UpdateFolderMetadata/index.tsx b/src/front/Components/Layouts/Folder/UpdateFolderMetadata/index.tsx index a3f15ebb..f1ac54ad 100644 --- a/src/front/Components/Layouts/Folder/UpdateFolderMetadata/index.tsx +++ b/src/front/Components/Layouts/Folder/UpdateFolderMetadata/index.tsx @@ -4,17 +4,17 @@ import InputField from "@Front/Components/DesignSystem/Form/Elements/InputField" import Select, { IOption } from "@Front/Components/DesignSystem/Select"; import Typography, { ITypo } from "@Front/Components/DesignSystem/Typography"; import BackArrow from "@Front/Components/Elements/BackArrow"; -import DefaultNotaryDashboard, { IDashBoardFolder } from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; -import { useRouter } from "next/router"; 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 Link from "next/link"; -import Module from "@Front/Config/Module"; -import { OfficeFolder } from "le-coffre-resources/dist/Notary"; type IProps = { - folder: OfficeFolder | null; + folder: IDashBoardFolder | null; }; type IState = { selectedFolder: IDashBoardFolder | null; @@ -48,15 +48,23 @@ class UpdateFolderMetadataClass extends BasePage {
- - + +