From 9ace531edba5c47943929c9020c8702664adbf9d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 8 Jul 2025 14:31:32 -0700 Subject: [PATCH] IO-3294 fix upload to image proxy for bills. --- .../bill-enter-modal.container.jsx | 52 +++++++++++++------ 1 file changed, 36 insertions(+), 16 deletions(-) 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 8073cc2f0..27dc0a1b0 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 @@ -25,6 +25,7 @@ import BillFormContainer from "../bill-form/bill-form.container"; import { CalculateBillTotal } from "../bill-form/bill-form.totals.utility"; import { handleUpload as handleLocalUpload } from "../documents-local-upload/documents-local-upload.utility"; import { handleUpload } from "../documents-upload/documents-upload.utility"; +import { handleUpload as handleUploadToImageProxy } from "../documents-upload-imgproxy/documents-upload-imgproxy.utility"; const mapStateToProps = createStructuredSelector({ billEnterModal: selectBillEnterModal, @@ -53,10 +54,10 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop, const notification = useNotification(); const { - treatments: { Enhanced_Payroll } + treatments: { Enhanced_Payroll, Imgproxy } } = useSplitTreatments({ attributes: {}, - names: ["Enhanced_Payroll"], + names: ["Enhanced_Payroll", "Imgproxy"], splitKey: bodyshop.imexshopid }); @@ -298,20 +299,39 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop, }); }); } else { - upload.forEach((u) => { - handleUpload( - { file: u.originFileObj }, - { - bodyshop: bodyshop, - uploaded_by: currentUser.email, - jobId: values.jobid, - billId: billId, - tagsArray: null, - callback: null - }, - notification - ); - }); + //Check if using Imgproxy or cloudinary + + if (Imgproxy.treatment === "on") { + upload.forEach((u) => { + handleUploadToImageProxy( + { file: u.originFileObj }, + { + bodyshop: bodyshop, + uploaded_by: currentUser.email, + jobId: values.jobid, + billId: billId, + tagsArray: null, + callback: null + }, + notification + ); + }); + } else { + upload.forEach((u) => { + handleUpload( + { file: u.originFileObj }, + { + bodyshop: bodyshop, + uploaded_by: currentUser.email, + jobId: values.jobid, + billId: billId, + tagsArray: null, + callback: null + }, + notification + ); + }); + } } } ///////////////////////////