Add traslations

This commit is contained in:
Urtzi Alfaro
2025-12-25 18:35:37 +01:00
parent 82567b8701
commit b95b86ee2c
18 changed files with 516 additions and 52 deletions

View File

@@ -8,6 +8,7 @@ import {
IngredientCreate,
IngredientUpdate,
IngredientResponse,
BulkIngredientResponse,
StockCreate,
StockUpdate,
StockResponse,
@@ -239,7 +240,7 @@ export const useCreateIngredient = (
options?: UseMutationOptions<IngredientResponse, ApiError, { tenantId: string; ingredientData: IngredientCreate }>
) => {
const queryClient = useQueryClient();
return useMutation<IngredientResponse, ApiError, { tenantId: string; ingredientData: IngredientCreate }>({
mutationFn: ({ tenantId, ingredientData }) => inventoryService.createIngredient(tenantId, ingredientData),
onSuccess: (data, { tenantId }) => {
@@ -253,6 +254,22 @@ export const useCreateIngredient = (
});
};
export const useBulkCreateIngredients = (
options?: UseMutationOptions<BulkIngredientResponse, ApiError, { tenantId: string; ingredients: IngredientCreate[] }>
) => {
const queryClient = useQueryClient();
return useMutation<BulkIngredientResponse, ApiError, { tenantId: string; ingredients: IngredientCreate[] }>({
mutationFn: ({ tenantId, ingredients }) => inventoryService.bulkCreateIngredients(tenantId, ingredients),
onSuccess: (data, { tenantId }) => {
// Invalidate all ingredient lists to refetch
queryClient.invalidateQueries({ queryKey: inventoryKeys.ingredients.lists() });
queryClient.invalidateQueries({ queryKey: inventoryKeys.ingredients.byCategory(tenantId) });
},
...options,
});
};
export const useUpdateIngredient = (
options?: UseMutationOptions<
IngredientResponse,