General gendoc function & reprint parts orders IO-411

This commit is contained in:
Patrick Fic
2021-01-14 16:40:16 -08:00
parent ffbe670499
commit 5a6991dad6
7 changed files with 146 additions and 117 deletions

View File

@@ -1,13 +1,11 @@
import { Button, Typography, List } from "antd";
import { Button, List, Typography } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { logImEXEvent } from "../../firebase/firebase.utils";
import { selectBodyshop } from "../../redux/user/user.selectors";
import RenderTemplate, {
displayTemplateInWindow,
} from "../../utils/RenderTemplate";
import { GenerateDocument } from "../../utils/RenderTemplate";
import { TemplateList } from "../../utils/TemplateConstants";
const mapStateToProps = createStructuredSelector({
@@ -20,17 +18,18 @@ const mapDispatchToProps = (dispatch) => ({
export function PrintCenterSpeedPrint({ bodyshop, jobId }) {
const { speedprint } = bodyshop;
const { t } = useTranslation();
const renderTemplate = async (templateKey) => {
logImEXEvent("speed_print_template_render");
const html = await RenderTemplate(
GenerateDocument(
{
name: templateKey,
variables: { id: jobId },
},
bodyshop
{},
"p"
);
displayTemplateInWindow(html);
};
const renderAllTemplates = (templateKeys) => {