IO-3515 set po context, update confidence UI showing
This commit is contained in:
@@ -5,6 +5,7 @@ import { createStructuredSelector } from "reselect";
|
||||
import { useNotification } from "../../contexts/Notifications/notificationContext";
|
||||
import { selectBillEnterModal } from "../../redux/modals/modals.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { FaWandMagicSparkles } from "react-icons/fa6";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
billEnterModal: selectBillEnterModal,
|
||||
@@ -19,7 +20,8 @@ function BillEnterAiScan({
|
||||
form,
|
||||
fileInputRef,
|
||||
scanLoading,
|
||||
setScanLoading
|
||||
setScanLoading,
|
||||
setIsAiScan
|
||||
}) {
|
||||
const notification = useNotification();
|
||||
|
||||
@@ -59,8 +61,6 @@ function BillEnterAiScan({
|
||||
}
|
||||
// If status is IN_PROGRESS, continue polling
|
||||
} catch (error) {
|
||||
console.error("Error polling job status:", error);
|
||||
|
||||
// Stop polling on error
|
||||
if (pollingIntervalRef.current) {
|
||||
clearInterval(pollingIntervalRef.current);
|
||||
@@ -86,11 +86,12 @@ function BillEnterAiScan({
|
||||
const file = e.target.files?.[0];
|
||||
if (file) {
|
||||
setScanLoading(true);
|
||||
setIsAiScan(true);
|
||||
const formdata = new FormData();
|
||||
formdata.append("billScan", file);
|
||||
formdata.append("jobid", billEnterModal.context.job.id);
|
||||
formdata.append("bodyshopid", bodyshop.id);
|
||||
formdata.append("partsorderid", "3dd26419-a139-4399-af4e-43eeb6f0dbad");
|
||||
formdata.append("partsorderid", billEnterModal.context.parts_order?.id);
|
||||
//formdata.append("skipTextract", "true"); // For testing purposes
|
||||
axios
|
||||
.post("/ai/bill-ocr", formdata)
|
||||
@@ -123,7 +124,6 @@ function BillEnterAiScan({
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("*** ~ BillEnterModalContainer ~ error:", error);
|
||||
setScanLoading(false);
|
||||
notification.error({
|
||||
title: "AI Scan Failed",
|
||||
@@ -137,9 +137,9 @@ function BillEnterAiScan({
|
||||
/>
|
||||
<Button
|
||||
onClick={() => {
|
||||
console.log("Fields Object", form.getFieldsValue());
|
||||
fileInputRef.current?.click();
|
||||
}}
|
||||
icon={<FaWandMagicSparkles />}
|
||||
loading={scanLoading}
|
||||
disabled={scanLoading}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user