add visible field to form

This commit is contained in:
Julien Aldon
2026-02-23 15:38:29 +01:00
parent 85a70da07d
commit 124b0700da
19 changed files with 119 additions and 15 deletions

View File

@@ -330,6 +330,15 @@ export function useGetForms(filters?: URLSearchParams): UseQueryResult<Form[], E
});
}
export function useGetReferentForms(filters?: URLSearchParams): UseQueryResult<Form[], Error> {
const queryString = filters?.toString();
return useQuery<Form[]>({
queryKey: ["forms", queryString],
queryFn: () =>
fetchWithAuth(`${Config.backend_uri}/forms/referents${filters ? `?${queryString}` : ""}`).then((res) => res.json()),
});
}
export function useCreateForm() {
const queryClient = useQueryClient();
@@ -711,7 +720,6 @@ export function useGetContractFile() {
});
}
export function useGetContractFileTemplate() {
return useMutation({
mutationFn: async (form_id: number) => {

View File

@@ -12,6 +12,7 @@ export type Form = {
referer: User;
shipments: Shipment[];
minimum_shipment_value: number | null;
visible: boolean;
};
export type FormCreate = {
@@ -22,6 +23,7 @@ export type FormCreate = {
productor_id: number;
referer_id: number;
minimum_shipment_value: number | null;
visible: boolean;
};
export type FormEdit = {
@@ -32,6 +34,7 @@ export type FormEdit = {
productor_id?: number | null;
referer_id?: number | null;
minimum_shipment_value: number | null;
visible: boolean;
};
export type FormEditPayload = {
@@ -47,4 +50,5 @@ export type FormInputs = {
productor_id: string;
referer_id: string;
minimum_shipment_value: number | string | null;
visible: boolean;
};