diff --git a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx index e0e54532..09e9cc72 100644 --- a/src/front/Components/Layouts/Folder/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/Folder/FolderInformation/index.tsx @@ -17,6 +17,7 @@ import ClientSection from "./ClientSection"; import { EDocumentStatus } from "le-coffre-resources/dist/Notary/Document"; import Folders from "@Front/Api/LeCoffreApi/SuperAdmin/Folders/Folders"; import { OfficeFolder } from "le-coffre-resources/dist/Customer"; +import { ChangeEvent } from "react"; type IProps = {}; @@ -28,6 +29,7 @@ type IPropsClass = IProps & { type IState = { selectedFolder: IDashBoardFolder | null; isArchivedModalOpen: boolean; + inputArchivedDescripton: string; }; class FolderInformationClass extends BasePage { public constructor(props: IPropsClass) { @@ -35,12 +37,14 @@ class FolderInformationClass extends BasePage { this.state = { selectedFolder: null, isArchivedModalOpen: false, + inputArchivedDescripton: "", }; this.onSelectedFolder = this.onSelectedFolder.bind(this); this.openArchivedModal = this.openArchivedModal.bind(this); this.closeArchivedModal = this.closeArchivedModal.bind(this); this.onArchivedModalAccepted = this.onArchivedModalAccepted.bind(this); this.getCompletionNumber = this.getCompletionNumber.bind(this); + this.onArchivedDescriptionInputChange = this.onArchivedDescriptionInputChange.bind(this); } // TODO: Message if the user has not created any folder yet @@ -98,7 +102,7 @@ class FolderInformationClass extends BasePage {
Souhaitez-vous vraiment archiver le dossier ?
- + ) : ( @@ -148,9 +152,15 @@ class FolderInformationClass extends BasePage { this.setState({ isArchivedModalOpen: false }); } + private onArchivedDescriptionInputChange(e: ChangeEvent){ + this.setState({inputArchivedDescripton: e.target.value}) + } + private async onArchivedModalAccepted() { if (!this.state.selectedFolder) return; - await Folders.getInstance().archive(this.state.selectedFolder.uid ?? "", this.state.selectedFolder); + const folder = this.state.selectedFolder; + folder.archived_description = this.state.inputArchivedDescripton; + await Folders.getInstance().archive(this.state.selectedFolder.uid ?? "", folder); this.closeArchivedModal(); this.props.router.push(Module.getInstance().get().modules.pages.Folder.props.path); } diff --git a/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx b/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx index 6aacc80e..26f512d0 100644 --- a/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx +++ b/src/front/Components/Layouts/FolderArchived/FolderInformation/index.tsx @@ -119,7 +119,9 @@ class FolderInformationClass extends BasePage { private async restoreFolder() { if (!this.state.selectedFolder) return; - await Folders.getInstance().restore(this.state.selectedFolder.uid ?? "", this.state.selectedFolder); + const folder = this.state.selectedFolder; + folder.archived_description = null; + await Folders.getInstance().restore(this.state.selectedFolder.uid ?? "", folder); this.props.router.push(Module.getInstance().get().modules.pages.Folder.pages.FolderArchived.props.path); }