IO-3515 fix notifications & auto attach document.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user