diff --git a/client/src/components/print-center-jobs-labels/print-center-jobs-labels.component.jsx b/client/src/components/print-center-jobs-labels/print-center-jobs-labels.component.jsx index 182618579..5bd0f15e5 100644 --- a/client/src/components/print-center-jobs-labels/print-center-jobs-labels.component.jsx +++ b/client/src/components/print-center-jobs-labels/print-center-jobs-labels.component.jsx @@ -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 { useTranslation } from "react-i18next"; import { connect } from "react-redux"; @@ -27,7 +35,6 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) { const handleOk = (e) => { e.stopPropagation(); form.submit(); - setIsModalVisible(false); }; const handleCancel = () => { @@ -37,18 +44,24 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) { const handleFinish = async ({ template, ...values }) => { const { sendtype, ...restVals } = values; setLoading(true); - await GenerateDocument( - { - name: TemplateList("job_special")[template].key, - variables: { id: jobId }, - context: restVals, - }, - {}, - "p", - jobId - ); - setLoading(false); - setIsModalVisible(false); + 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(); }; @@ -60,7 +73,15 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) { layout="vertical" form={form} > - + {t("printcenter.jobs.parts_label_multiple")} @@ -71,14 +92,24 @@ export function PrintCenterJobsLabels({ bodyshop, jobId }) {