feat: barcodes printing

This commit is contained in:
2025-10-10 20:47:44 +04:00
parent 8af4fcce2f
commit 73e3fd4ba2
14 changed files with 313 additions and 13 deletions

View File

@ -47,6 +47,7 @@ import {
getDealProducts,
getDeals,
getDealServices,
getProductBarcodePdf,
getProducts,
getProjects,
getServiceCategories,
@ -168,6 +169,9 @@ import type {
GetDealsError,
GetDealServicesData,
GetDealsResponse2,
GetProductBarcodePdfData,
GetProductBarcodePdfError,
GetProductBarcodePdfResponse2,
GetProductsData,
GetProductsError,
GetProductsResponse2,
@ -1867,6 +1871,57 @@ export const updateProductMutation = (
return mutationOptions;
};
export const getProductBarcodePdfQueryKey = (
options: Options<GetProductBarcodePdfData>
) => createQueryKey("getProductBarcodePdf", options);
/**
* Get Product Barcode Pdf
*/
export const getProductBarcodePdfOptions = (
options: Options<GetProductBarcodePdfData>
) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await getProductBarcodePdf({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: getProductBarcodePdfQueryKey(options),
});
};
/**
* Get Product Barcode Pdf
*/
export const getProductBarcodePdfMutation = (
options?: Partial<Options<GetProductBarcodePdfData>>
): UseMutationOptions<
GetProductBarcodePdfResponse2,
AxiosError<GetProductBarcodePdfError>,
Options<GetProductBarcodePdfData>
> => {
const mutationOptions: UseMutationOptions<
GetProductBarcodePdfResponse2,
AxiosError<GetProductBarcodePdfError>,
Options<GetProductBarcodePdfData>
> = {
mutationFn: async localOptions => {
const { data } = await getProductBarcodePdf({
...options,
...localOptions,
throwOnError: true,
});
return data;
},
};
return mutationOptions;
};
export const getServicesQueryKey = (options?: Options<GetServicesData>) =>
createQueryKey("getServices", options);