General gendoc function & reprint parts orders IO-411
This commit is contained in:
@@ -3,6 +3,9 @@ import jsreport from "jsreport-browser-client-dist";
|
||||
import client from "../utils/GraphQLClient";
|
||||
import axios from "axios";
|
||||
import { auth } from "../firebase/firebase.utils";
|
||||
import { TemplateList } from "./TemplateConstants";
|
||||
import { store } from "../redux/store";
|
||||
import { setEmailOptions } from "../redux/email/email.actions";
|
||||
const server = process.env.REACT_APP_REPORTS_SERVER_URL;
|
||||
jsreport.serverUrl = server;
|
||||
|
||||
@@ -120,3 +123,17 @@ export const displayTemplateInWindowNoprint = (html) => {
|
||||
console.log("Unable to write to new window.", error);
|
||||
}
|
||||
};
|
||||
|
||||
export const GenerateDocument = async (template, messageOptions, sendType) => {
|
||||
const bodyshop = store.getState().user.bodyshop;
|
||||
if (sendType === "e") {
|
||||
store.dispatch(
|
||||
setEmailOptions({
|
||||
messageOptions,
|
||||
template,
|
||||
})
|
||||
);
|
||||
} else {
|
||||
displayTemplateInWindow(await RenderTemplate(template, bodyshop));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user