From d1bb681e7425b64a558082850ee764cbbaf98593 Mon Sep 17 00:00:00 2001 From: Maxime Lalo Date: Mon, 18 Sep 2023 15:45:22 +0200 Subject: [PATCH] :sparkles: Anchor and certify on folder page --- .../FolderInformation/classes.module.scss | 10 +++ .../Folder/FolderInformation/index.tsx | 83 ++++++++++++++++++- 2 files changed, 90 insertions(+), 3 deletions(-) diff --git a/src/front/Components/Layouts/Folder/FolderInformation/classes.module.scss b/src/front/Components/Layouts/Folder/FolderInformation/classes.module.scss index e4477922..8d16dc82 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/classes.module.scss +++ b/src/front/Components/Layouts/Folder/FolderInformation/classes.module.scss @@ -88,3 +88,13 @@ margin-bottom: 24px; } } + +.validate-document-container { + .document-validating-container { + .validate-gif { + width: 100%; + height: 100%; + object-fit: contain; + } + } +} diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index 8bd2e922..f58687e3 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -13,10 +13,13 @@ import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document"; import Link from "next/link"; import { NextRouter, useRouter } from "next/router"; import { ChangeEvent } from "react"; +import Image from "next/image"; +import ValidateAnchoringGif from "@Front/Assets/images/validate_anchoring.gif"; import BasePage from "../../Base"; import classes from "./classes.module.scss"; import ClientSection from "./ClientSection"; +import CheckBox from "@Front/Components/DesignSystem/CheckBox"; type IProps = {}; @@ -29,6 +32,8 @@ type IState = { selectedFolder: OfficeFolder | null; isArchivedModalOpen: boolean; inputArchivedDescripton: string; + isValidateModalVisible: boolean; + hasValidateAnchoring: boolean; }; class FolderInformationClass extends BasePage { public constructor(props: IPropsClass) { @@ -37,6 +42,8 @@ class FolderInformationClass extends BasePage { selectedFolder: null, isArchivedModalOpen: false, inputArchivedDescripton: "", + isValidateModalVisible: false, + hasValidateAnchoring: false, }; this.onSelectedFolder = this.onSelectedFolder.bind(this); this.openArchivedModal = this.openArchivedModal.bind(this); @@ -45,7 +52,9 @@ class FolderInformationClass extends BasePage { this.getCompletionNumber = this.getCompletionNumber.bind(this); this.onArchivedDescriptionInputChange = this.onArchivedDescriptionInputChange.bind(this); this.deleteFolder = this.deleteFolder.bind(this); - this.anchorFolder = this.anchorFolder.bind(this); + this.closeModal = this.closeModal.bind(this); + this.validateAnchoring = this.validateAnchoring.bind(this); + this.openValidateModal = this.openValidateModal.bind(this); } // TODO: Message if the user has not created any folder yet @@ -95,7 +104,7 @@ class FolderInformationClass extends BasePage { Archiver le dossier {this.everyDocumentValidated() && ( - )} @@ -134,6 +143,41 @@ class FolderInformationClass extends BasePage { )} + +
+ {!this.state.hasValidateAnchoring && ( + + Afin de certifier les documents associés au dossier, cliquez sur “Ancrez et certifier” et les documents + seront certifiés sur la blockchain. + + )} + {this.state.hasValidateAnchoring && ( +
+ + Vous pouvez désormais télécharger les feuilles d'ancrage et les mettre dans la GED de votre logiciel de + rédaction d'acte. + + Anchoring animation +
+ +
+
+ )} +
+
); } @@ -143,7 +187,40 @@ class FolderInformationClass extends BasePage { }); } - private anchorFolder() {} + private closeModal() { + this.setState({ + isValidateModalVisible: false, + }); + } + + private openValidateModal() { + this.setState({ + isValidateModalVisible: true, + }); + } + + private async validateAnchoring() { + this.setState({ + hasValidateAnchoring: true, + }); + + try { + const timeoutDelay = 9800; + setTimeout(() => { + this.setState({ + isValidateModalVisible: false, + }); + }, timeoutDelay); + + setTimeout(() => { + this.setState({ + hasValidateAnchoring: false, + }); + }, timeoutDelay + 1000); + } catch (e) { + console.error(e); + } + } private everyDocumentValidated(): boolean { if (!this.state.selectedFolder?.documents) return false;