IO-2109 Resolve label printing validation issue.
This commit is contained in:
@@ -1,4 +1,12 @@
|
|||||||
import { Button, Card, Form, InputNumber, Popover, Radio } from "antd";
|
import {
|
||||||
|
Button,
|
||||||
|
Card,
|
||||||
|
Form,
|
||||||
|
InputNumber,
|
||||||
|
notification,
|
||||||
|
Popover,
|
||||||
|
Radio,
|
||||||
|
} from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -27,7 +35,6 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
|
|||||||
const handleOk = (e) => {
|
const handleOk = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
form.submit();
|
form.submit();
|
||||||
setIsModalVisible(false);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
@@ -37,18 +44,24 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
|
|||||||
const handleFinish = async ({ template, ...values }) => {
|
const handleFinish = async ({ template, ...values }) => {
|
||||||
const { sendtype, ...restVals } = values;
|
const { sendtype, ...restVals } = values;
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
await GenerateDocument(
|
try {
|
||||||
{
|
await GenerateDocument(
|
||||||
name: TemplateList("job_special")[template].key,
|
{
|
||||||
variables: { id: jobId },
|
name: TemplateList("job_special")[template].key,
|
||||||
context: restVals,
|
variables: { id: jobId },
|
||||||
},
|
context: restVals,
|
||||||
{},
|
},
|
||||||
"p",
|
{},
|
||||||
jobId
|
"p",
|
||||||
);
|
jobId
|
||||||
setLoading(false);
|
);
|
||||||
setIsModalVisible(false);
|
setIsModalVisible(false);
|
||||||
|
} catch (error) {
|
||||||
|
notification.open({ type: "error", message: JSON.stringify(error) });
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -60,7 +73,15 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
|
|||||||
layout="vertical"
|
layout="vertical"
|
||||||
form={form}
|
form={form}
|
||||||
>
|
>
|
||||||
<Form.Item required name="template">
|
<Form.Item
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
name="template"
|
||||||
|
>
|
||||||
<Radio.Group>
|
<Radio.Group>
|
||||||
<Radio.Button value="parts_label_multiple">
|
<Radio.Button value="parts_label_multiple">
|
||||||
{t("printcenter.jobs.parts_label_multiple")}
|
{t("printcenter.jobs.parts_label_multiple")}
|
||||||
@@ -71,14 +92,24 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {
|
|||||||
</Radio.Group>
|
</Radio.Group>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
required
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
label={t("printcenter.jobs.labels.position")}
|
label={t("printcenter.jobs.labels.position")}
|
||||||
name="position"
|
name="position"
|
||||||
>
|
>
|
||||||
<InputNumber min={1} precision={0} />
|
<InputNumber min={1} precision={0} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
required
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
label={t("printcenter.jobs.labels.count")}
|
label={t("printcenter.jobs.labels.count")}
|
||||||
name="count"
|
name="count"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user