archived note
This commit is contained in:
parent
00a7529c72
commit
4fc205d9b5
@ -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<IPropsClass, IState> {
|
||||
public constructor(props: IPropsClass) {
|
||||
@ -35,12 +37,14 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
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<IPropsClass, IState> {
|
||||
<div className={classes["modal-title"]}>
|
||||
<Typography typo={ITypo.P_16}>Souhaitez-vous vraiment archiver le dossier ?</Typography>
|
||||
</div>
|
||||
<InputField name="input field" fakeplaceholder="Description" textarea />
|
||||
<InputField name="archived_description" fakeplaceholder="Description" textarea onChange={this.onArchivedDescriptionInputChange}/>
|
||||
</Confirm>
|
||||
</div>
|
||||
) : (
|
||||
@ -148,9 +152,15 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
this.setState({ isArchivedModalOpen: false });
|
||||
}
|
||||
|
||||
private onArchivedDescriptionInputChange(e: ChangeEvent<HTMLInputElement>){
|
||||
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);
|
||||
}
|
||||
|
@ -119,7 +119,9 @@ class FolderInformationClass extends BasePage<IPropsClass, IState> {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user