import { Button, Space } from "antd"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; import { useNotification } from "../../contexts/Notifications/notificationContext.jsx"; export default function BillPrintButton({ billid }) { const { t } = useTranslation(); const [loading, setLoading] = useState(false); const Templates = TemplateList("job_special"); const notification = useNotification(); const submitHandler = async () => { setLoading(true); try { await GenerateDocument( { name: Templates.parts_invoice_label_single.key, variables: { id: billid } }, {}, "p", null, notification ); } catch { console.warn("Warning: Error generating a document."); } setLoading(false); }; return ( ); }