Print IH invoices after creation IO-724
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { MailFilled, PrinterFilled } from "@ant-design/icons";
|
||||
import { Space } from "antd";
|
||||
import React from "react";
|
||||
import { Space, Spin } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
|
||||
export default function PrintWrapperComponent({
|
||||
@@ -8,15 +8,19 @@ export default function PrintWrapperComponent({
|
||||
messageObject = {},
|
||||
children,
|
||||
}) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const handlePrint = async (type) => {
|
||||
setLoading(true);
|
||||
await GenerateDocument(templateObject, messageObject, type);
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
return (
|
||||
<Space>
|
||||
{children || null}
|
||||
<PrinterFilled
|
||||
onClick={() => GenerateDocument(templateObject, {}, "p")}
|
||||
/>
|
||||
<MailFilled
|
||||
onClick={() => GenerateDocument(templateObject, messageObject, "e")}
|
||||
/>
|
||||
<PrinterFilled onClick={() => handlePrint("p")} />
|
||||
<MailFilled onClick={() => handlePrint("e")} />
|
||||
{loading && <Spin size="small" />}
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user