feat(WIP): filtering, exporting and more reports

This commit is contained in:
Nathnael
2026-08-19 13:51:18 +00:00
parent e964a9b8f4
commit fb21ad1541
56 changed files with 3750 additions and 27 deletions

View File

@@ -0,0 +1,35 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useTranslation } from "react-i18next";
import { toast } from "sonner";
import {
operationsStandardsService,
type OperationsStandardsPatch,
} from "@/services/operationsStandards.service";
import { useErrorHandler } from "@/shared/hooks/useErrorHandler";
const QUERY_KEY = ["operationsStandards"];
export const useOperationsStandardsQuery = () =>
useQuery({
queryKey: QUERY_KEY,
queryFn: () => operationsStandardsService.get(),
});
export const useUpdateOperationsStandards = () => {
const queryClient = useQueryClient();
const { t } = useTranslation();
const { handleError } = useErrorHandler(t);
return useMutation({
mutationFn: (patch: OperationsStandardsPatch) =>
operationsStandardsService.update(patch),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: QUERY_KEY });
toast.success(
t("operationsStandards.updated", "Operating standards updated"),
);
},
onError: handleError,
});
};