import Button, { EButtonstyletype, EButtonVariant } from "@Front/Components/DesignSystem/Button"; import Form from "@Front/Components/DesignSystem/Form"; import TextAreaField from "@Front/Components/DesignSystem/Form/TextareaField"; import Typography, { ETypo } from "@Front/Components/DesignSystem/Typography"; import BackArrow from "@Front/Components/Elements/BackArrow"; import DefaultNotaryDashboard from "@Front/Components/LayoutTemplates/DefaultNotaryDashboard"; import Module from "@Front/Config/Module"; import Link from "next/link"; import { NextRouter, useRouter } from "next/router"; import BasePage from "../../Base"; import classes from "./classes.module.scss"; import Note from "le-coffre-resources/dist/Customer/Note"; import NoteService from "src/common/Api/LeCoffreApi/sdk/NoteService"; import LoaderService from "src/common/Api/LeCoffreApi/sdk/Loader/LoaderService"; type IProps = {}; type IPropsClass = IProps & { noteUid: string; router: NextRouter; }; type IState = { note: Note | null; backwardPath: string; }; class UpdateCustomerNoteClass extends BasePage { constructor(props: IPropsClass) { super(props); this.state = { note: null, backwardPath: "", }; this.onFormSubmit = this.onFormSubmit.bind(this); } public override render(): JSX.Element { return (
Modifier la note du client
); } public override async componentDidMount() { LoaderService.getInstance().show(); NoteService.getNoteByUid(this.props.noteUid).then((process: any) => { if (process) { const note: any = process.processData; // const folder = await Folders.getInstance().getByUid(this.props.folderUid, { note: true }); //get the note of the folder that has customer_uid = this.props.customer.uid // const folderNote = folder.notes?.find((note) => note.customer?.uid === this.props.customerUid); this.setState({ note, backwardPath: Module.getInstance() .get() .modules.pages.Folder.pages.FolderInformation.props.path.replace("[folderUid]", note.folder?.uid!), }); LoaderService.getInstance().hide(); } }); } private async onFormSubmit(e: React.FormEvent | null, values: { [key: string]: string }) { try { LoaderService.getInstance().show(); NoteService.getNoteByUid(this.props.noteUid).then((process: any) => { if (process) { NoteService.updateNote(process, { content: values["content"] }).then(() => { this.props.router.push(this.state.backwardPath); }); } }); } catch (error) { console.error(error); } } } export default function UpdateCustomerNote(props: IProps) { const router = useRouter(); let { noteUid } = router.query; noteUid = noteUid as string; return ; }