diff --git a/client/src/components/bill-enter-ai-scan/bill-enter-ai-scan.component.jsx b/client/src/components/bill-enter-ai-scan/bill-enter-ai-scan.component.jsx index 3d2735333..0eff900d7 100644 --- a/client/src/components/bill-enter-ai-scan/bill-enter-ai-scan.component.jsx +++ b/client/src/components/bill-enter-ai-scan/bill-enter-ai-scan.component.jsx @@ -75,7 +75,7 @@ function BillEnterAiScan({ notification.error({ title: t("bills.labels.ai.scanfailed"), - message: data.error || "" + description: data.error || "" }); } // If status is IN_PROGRESS, continue polling @@ -89,7 +89,7 @@ function BillEnterAiScan({ notification.error({ title: t("bills.labels.ai.scanfailed"), - message: error.response?.data?.message || error.message || "Failed to check scan status" + description: error.response?.data?.message || error.message || "Failed to check scan status" }); } }; @@ -115,11 +115,22 @@ function BillEnterAiScan({ try { const { data, status } = await axios.post("/ai/bill-ocr", formdata); + // Add the scanned file to the upload field + const currentUploads = form.getFieldValue("upload") || []; + form.setFieldValue("upload", [ + ...currentUploads, + { + uid: `ai-scan-${Date.now()}`, + name: file.name, + originFileObj: file, + status: "done" + } + ]); if (status === 202) { // Multipage PDF - start polling notification.info({ title: t("bills.labels.ai.scanstarted"), - message: t("bills.labels.ai.multipage") + description: t("bills.labels.ai.multipage") }); //Workaround needed to bypass react-compiler error about manipulating refs in child components. Refactor may be needed in the future to clean this up. @@ -144,9 +155,11 @@ function BillEnterAiScan({ } } catch (error) { setScanLoading(false); + console.log("*** ~ BillEnterAiScan ~ error:", error, error.response?.data?.message); + notification.error({ title: t("bills.labels.ai.scanfailed"), - message: error.response?.data?.message || error.message || t("bills.labels.ai.generic_failure") + description: error.response?.data?.message || error.message || t("bills.labels.ai.generic_failure") }); } } @@ -166,7 +179,7 @@ function BillEnterAiScan({ onOk={handleBetaAcceptance} onCancel={() => setShowBetaModal(false)} okText={t("bills.labels.ai.accept_and_continue")} - cancelText={t("general.labels.cancel")} + cancelText={t("general.actions.cancel")} > { //This is explicitly not translated. diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx index 5985aed22..824581952 100644 --- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx +++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx @@ -66,8 +66,7 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop, names: ["Enhanced_Payroll", "Imgproxy", "Bill_OCR_AI"], splitKey: bodyshop.imexshopid }); - console.log("*** ~ BillEnterModalContainer ~ Bill_OCR_AI:", Bill_OCR_AI); - + const formValues = useMemo(() => { return { ...billEnterModal.context.bill,