IO-233 WS Updates and templat eadditions
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { Button, Dropdown, Menu } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { GenerateDocument } from "../../utils/RenderTemplate";
|
||||
|
||||
const ProdTemplates = TemplateList("production");
|
||||
|
||||
export default function ProductionListPrint() {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
return (
|
||||
<Dropdown
|
||||
trigger="click"
|
||||
overlay={
|
||||
<Menu>
|
||||
{Object.keys(ProdTemplates).map((key) => (
|
||||
<Menu.Item
|
||||
key={key}
|
||||
onClick={async () => {
|
||||
setLoading(true);
|
||||
await GenerateDocument(
|
||||
{
|
||||
name: ProdTemplates[key].key,
|
||||
// variables: { id: contract.id },
|
||||
},
|
||||
{},
|
||||
"p"
|
||||
);
|
||||
setLoading(false);
|
||||
}}
|
||||
>
|
||||
{ProdTemplates[key].title}
|
||||
</Menu.Item>
|
||||
))}
|
||||
</Menu>
|
||||
}
|
||||
>
|
||||
<Button loading={loading}>{t("general.labels.print")}</Button>
|
||||
</Dropdown>
|
||||
);
|
||||
}
|
||||
@@ -13,6 +13,7 @@ import ProductionListColumnsAdd from "../production-list-columns/production-list
|
||||
import ProductionListColumns from "../production-list-columns/production-list-columns.data";
|
||||
import ProductionListDetail from "../production-list-detail/production-list-detail.component";
|
||||
import ProductionListSaveConfigButton from "../production-list-save-config-button/production-list-save-config-button.component";
|
||||
import ProductionListPrint from "./production-list-print.component";
|
||||
import ProductionListTableViewSelect from "./production-list-table-view-select.component";
|
||||
import ResizeableTitle from "./production-list-table.resizeable.component";
|
||||
|
||||
@@ -88,14 +89,16 @@ export function ProductionListTable({
|
||||
setColumns(columns.filter((i) => i.key !== key));
|
||||
};
|
||||
|
||||
const handleResize = (index) => (e, { size }) => {
|
||||
const nextColumns = [...columns];
|
||||
nextColumns[index] = {
|
||||
...nextColumns[index],
|
||||
width: size.width,
|
||||
const handleResize =
|
||||
(index) =>
|
||||
(e, { size }) => {
|
||||
const nextColumns = [...columns];
|
||||
nextColumns[index] = {
|
||||
...nextColumns[index],
|
||||
width: size.width,
|
||||
};
|
||||
setColumns(nextColumns);
|
||||
};
|
||||
setColumns(nextColumns);
|
||||
};
|
||||
|
||||
const headerItem = (col) => (
|
||||
<Dropdown
|
||||
@@ -178,6 +181,7 @@ export function ProductionListTable({
|
||||
placeholder={t("general.labels.search")}
|
||||
value={searchText}
|
||||
/>
|
||||
<ProductionListPrint />
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user