fix: print deal's barcodes button moved from deals table to deal page
This commit is contained in:
@@ -9,17 +9,16 @@ import DealEditDrawer from "../drawers/DealEditDrawer/DealEditDrawer.tsx";
|
||||
import { DealPageContextProvider } from "../contexts/DealPageContext.tsx";
|
||||
import { modals } from "@mantine/modals";
|
||||
import { DealService, DealSummary, DealSummaryReorderRequest } from "../../../client";
|
||||
import { ActionIcon, Flex, NumberInput, rem, Text, Tooltip } from "@mantine/core";
|
||||
import { ActionIcon, Flex, NumberInput, rem, Text } from "@mantine/core";
|
||||
import classNames from "classnames";
|
||||
import { notifications } from "../../../shared/lib/notifications.ts";
|
||||
import { IconBarcode, IconMenu2, IconMenuDeep } from "@tabler/icons-react";
|
||||
import { IconMenu2, IconMenuDeep } from "@tabler/icons-react";
|
||||
import useDealsPageState from "../../DealsPage/hooks/useDealsPageState.tsx";
|
||||
import DealStatusSelect from "../../DealsPage/components/DealStatusSelect/DealStatusSelect.tsx";
|
||||
import BaseMarketplaceSelect from "../../../components/Selects/BaseMarketplaceSelect/BaseMarketplaceSelect.tsx";
|
||||
import ClientSelectNew from "../../../components/Selects/ClientSelectNew/ClientSelectNew.tsx";
|
||||
import DealsTable from "../../DealsPage/components/DealsTable/DealsTable.tsx";
|
||||
import { motion } from "framer-motion";
|
||||
import { base64ToBlob } from "../../../shared/lib/utils.ts";
|
||||
|
||||
enum DisplayMode {
|
||||
BOARD,
|
||||
@@ -346,39 +345,6 @@ export const LeadsPage: FC = () => {
|
||||
? "flex"
|
||||
: "none",
|
||||
}}>
|
||||
{
|
||||
selectedDeals.length === 1 &&
|
||||
<Tooltip
|
||||
className={styles["print-deals-button"]}
|
||||
label={"Распечатать штрихкоды сделки"}
|
||||
>
|
||||
<ActionIcon
|
||||
onClick={async () => {
|
||||
const response =
|
||||
await DealService.getDealProductsBarcodesPdf({
|
||||
requestBody: {
|
||||
dealId: selectedDeals[0].id,
|
||||
},
|
||||
});
|
||||
const pdfBlob = base64ToBlob(
|
||||
response.base64String,
|
||||
response.mimeType,
|
||||
);
|
||||
const pdfUrl = URL.createObjectURL(pdfBlob);
|
||||
const pdfWindow = window.open(pdfUrl);
|
||||
if (!pdfWindow) {
|
||||
notifications.error({ message: "Ошибка" });
|
||||
return;
|
||||
}
|
||||
pdfWindow.onload = () => {
|
||||
pdfWindow.print();
|
||||
};
|
||||
}}
|
||||
variant={"default"}>
|
||||
<IconBarcode />
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
}
|
||||
<NumberInput
|
||||
min={1}
|
||||
placeholder={"Введите номер"}
|
||||
|
||||
Reference in New Issue
Block a user