@@ -1,5 +1,6 @@
|
||||
import { usePreparationDirty } from '@/hooks/use-preparation-dirty';
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useRef } from 'react';
|
||||
import { FormErrors, PageTitle, Panel } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
@@ -69,23 +70,8 @@ export default function Dossier({
|
||||
file: null as File | null,
|
||||
},
|
||||
);
|
||||
const ref = useRef<HTMLFormElement>(null);
|
||||
const ref = usePreparationDirty(form.isDirty);
|
||||
const fileRef = useRef<HTMLInputElement>(null);
|
||||
useEffect(() => {
|
||||
const current = ref.current;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: current, dirty: form.isDirty },
|
||||
}),
|
||||
);
|
||||
return () => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: current, dirty: false },
|
||||
}),
|
||||
);
|
||||
};
|
||||
}, [form.isDirty]);
|
||||
const correction = (document: Document) => {
|
||||
form.setData({
|
||||
operation_key: crypto.randomUUID(),
|
||||
|
||||
Reference in New Issue
Block a user