- Merge client update into test-beta

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-18 19:20:08 -05:00
696 changed files with 92291 additions and 107075 deletions

View File

@@ -1,40 +1,40 @@
import { MailFilled, PrinterFilled } from "@ant-design/icons";
import { Space, Spin } from "antd";
import React, { useState } from "react";
import { GenerateDocument } from "../../utils/RenderTemplate";
import {MailFilled, PrinterFilled} from "@ant-design/icons";
import {Space, Spin} from "antd";
import React, {useState} from "react";
import {GenerateDocument} from "../../utils/RenderTemplate";
export default function PrintWrapperComponent({
templateObject,
messageObject = {},
children,
id,
emailOnly = false,
disabled,
}) {
const [loading, setLoading] = useState(false);
const handlePrint = async (type) => {
if (disabled) return;
setLoading(true);
await GenerateDocument(templateObject, messageObject, type, id);
setLoading(false);
};
templateObject,
messageObject = {},
children,
id,
emailOnly = false,
disabled,
}) {
const [loading, setLoading] = useState(false);
const handlePrint = async (type) => {
if (disabled) return;
setLoading(true);
await GenerateDocument(templateObject, messageObject, type, id);
setLoading(false);
};
return (
<Space>
{children || null}
{!emailOnly && (
<PrinterFilled
disabled={disabled}
onClick={() => handlePrint("p")}
style={{ cursor: disabled ? "not-allowed" : null }}
/>
)}
<MailFilled
disabled={disabled}
onClick={() => handlePrint("e")}
style={{ cursor: disabled ? "not-allowed" : null }}
/>
{loading && <Spin />}
</Space>
);
return (
<Space>
{children || null}
{!emailOnly && (
<PrinterFilled
disabled={disabled}
onClick={() => handlePrint("p")}
style={{cursor: disabled ? "not-allowed" : null}}
/>
)}
<MailFilled
disabled={disabled}
onClick={() => handlePrint("e")}
style={{cursor: disabled ? "not-allowed" : null}}
/>
{loading && <Spin/>}
</Space>
);
}