commit compras1 2911
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-29 05:28:30 +02:00
parent 1ddabbbdcc
commit 448948a487
137 changed files with 9481 additions and 1926 deletions
+4 -20
View File
@@ -1,5 +1,5 @@
import { usePreparationDirty } from '@/hooks/use-preparation-dirty';
import { Head, Link, useForm } from '@inertiajs/react';
import { useEffect, useRef } from 'react';
import { Button } from '@/components/ui/button';
import {
FormErrors,
@@ -64,23 +64,6 @@ type Props = {
tenantId: number;
};
function useGuard(dirty: boolean) {
const ref = useRef<HTMLFormElement>(null);
useEffect(() => {
const form = ref.current;
window.dispatchEvent(
new CustomEvent('sgc:context-dirty', { detail: { form, dirty } }),
);
return () => {
window.dispatchEvent(
new CustomEvent('sgc:context-dirty', {
detail: { form, dirty: false },
}),
);
};
}, [dirty]);
return ref;
}
function Pagination({ page }: { page: Page<unknown> }) {
return (
<nav className="my-3 flex flex-wrap gap-4" aria-label="Páginas">
@@ -123,7 +106,7 @@ function ItemForm({
'',
reason: '',
});
const ref = useGuard(form.isDirty);
const ref = usePreparationDirty(form.isDirty);
const submit = (action: string) => {
form.transform((data) => ({
...data,
@@ -291,7 +274,7 @@ function MasterForm({
reason: '',
},
);
const ref = useGuard(form.isDirty);
const ref = usePreparationDirty(form.isDirty);
return (
<details className="rounded border p-3">
<summary>
@@ -386,6 +369,7 @@ export default function ImportTariffs(props: Props) {
)}
<Panel title="Localizar material ou código">
<form
data-query-form="true"
method="get"
action={url}
className="flex flex-wrap gap-3"