feat: cards, attributes and modules
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { useCardPageContext } from "../../../contexts/CardPageContext.tsx";
|
||||
|
||||
|
||||
const useShippingQrs = () => {
|
||||
const { selectedCard: card } = useCardPageContext();
|
||||
|
||||
const basePdfUrl = `${import.meta.env.VITE_API_URL}/shipping/pdf`;
|
||||
|
||||
const getPdf = (url: string) => {
|
||||
if (!card) return;
|
||||
const pdfWindow = window.open(url);
|
||||
if (!pdfWindow) return;
|
||||
pdfWindow.print();
|
||||
};
|
||||
|
||||
const onGetDealQrPdfClick = () => {
|
||||
getPdf(`${basePdfUrl}/deal/${card?.id}`);
|
||||
};
|
||||
|
||||
const onGetPalletsPdfClick = () => {
|
||||
getPdf(`${basePdfUrl}/pallets/${card?.id}`);
|
||||
};
|
||||
|
||||
const onGetBoxesPdfClick = () => {
|
||||
getPdf(`${basePdfUrl}/boxes/${card?.id}`);
|
||||
};
|
||||
|
||||
return {
|
||||
onGetDealQrPdfClick,
|
||||
onGetPalletsPdfClick,
|
||||
onGetBoxesPdfClick,
|
||||
};
|
||||
};
|
||||
|
||||
export default useShippingQrs;
|
||||
Reference in New Issue
Block a user