import { Button, Card, Form, InputNumber, notification, Popover, Radio, } from "antd"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, }); const mapDispatchToProps = (dispatch) => ({ //setUserLanguage: language => dispatch(setUserLanguage(language)) }); export default connect( mapStateToProps, mapDispatchToProps )(PrintCenterJobsLabels); export function PrintCenterJobsLabels({ bodyshop, jobId }) { const [isModalVisible, setIsModalVisible] = useState(false); const [loading, setLoading] = useState(false); const { t } = useTranslation(); const [form] = Form.useForm(); const handleOk = (e) => { e.stopPropagation(); form.submit(); }; const handleCancel = () => { setIsModalVisible(false); setLoading(false); }; const handleFinish = async ({ template, ...values }) => { const { sendtype, ...restVals } = values; setLoading(true); try { await GenerateDocument( { name: TemplateList("job_special")[template].key, variables: { id: jobId }, context: restVals, }, {}, "p", jobId ); setIsModalVisible(false); } catch (error) { notification.open({ type: "error", message: JSON.stringify(error) }); } finally { setLoading(false); } form.resetFields(); }; const content = (
{t("printcenter.jobs.parts_label_multiple")} {t("printcenter.jobs.folder_label_multiple")}
); return ( ); }