IO-782 Parts Label Multi.

This commit is contained in:
Patrick Fic
2022-09-13 15:43:05 -07:00
parent 9792773cf0
commit 3d9a24de4f
6 changed files with 54 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
import { Button, Card, Form, InputNumber, Popover } from "antd";
import { Button, Card, Form, InputNumber, Popover, Radio } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -24,7 +24,8 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
const { t } = useTranslation();
const [form] = Form.useForm();
const handleOk = () => {
const handleOk = (e) => {
e.stopPropagation();
form.submit();
setIsModalVisible(false);
};
@@ -33,12 +34,12 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
setIsModalVisible(false);
setLoading(false);
};
const handleFinish = async (values) => {
const handleFinish = async ({ template, ...values }) => {
const { sendtype, ...restVals } = values;
setLoading(true);
await GenerateDocument(
{
name: TemplateList("job_special").folder_label_multiple.key,
name: TemplateList("job_special")[template].key,
variables: { id: jobId },
context: restVals,
},
@@ -48,6 +49,7 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
);
setLoading(false);
setIsModalVisible(false);
form.resetFields();
};
const content = (
@@ -58,13 +60,28 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
layout="vertical"
form={form}
>
<Form.Item required name="template">
<Radio.Group>
<Radio.Button value="parts_label_multiple">
{t("printcenter.jobs.parts_label_multiple")}
</Radio.Button>
<Radio.Button value="folder_label_multiple">
{t("printcenter.jobs.folder_label_multiple")}
</Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item
required
label={t("printcenter.jobs.labels.position")}
name="position"
>
<InputNumber min={1} precision={0} />
</Form.Item>
<Form.Item label={t("printcenter.jobs.labels.count")} name="count">
<Form.Item
required
label={t("printcenter.jobs.labels.count")}
name="count"
>
<InputNumber min={1} precision={0} max={99} />
</Form.Item>
<Button type="primary" loading={loading} onClick={handleOk}>