diff --git a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx index 8ada3616f..c7f7d46e4 100644 --- a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx +++ b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx @@ -46,8 +46,8 @@ function JobsDocumentsImgproxyComponent({ const [modalState, setModalState] = useState({ open: false, index: 0 }); const fetchThumbnails = useCallback(() => { - fetchImgproxyThumbnails({ setStateCallback: setGalleryImages, jobId }); - }, [jobId, setGalleryImages]); + fetchImgproxyThumbnails({ setStateCallback: setGalleryImages, jobId, billId }); + }, [jobId, billId, setGalleryImages]); useEffect(() => { if (data) { @@ -208,8 +208,8 @@ function JobsDocumentsImgproxyComponent({ export default connect(mapStateToProps, mapDispatchToProps)(JobsDocumentsImgproxyComponent); -export const fetchImgproxyThumbnails = async ({ setStateCallback, jobId, imagesOnly }) => { - const result = await axios.post("/media/imgproxy/thumbnails", { jobid: jobId }); +export const fetchImgproxyThumbnails = async ({ setStateCallback, jobId, billId, imagesOnly }) => { + const result = await axios.post("/media/imgproxy/thumbnails", { jobid: jobId, billid: billId }); const documents = result.data.reduce( (acc, value) => { if (value.type.startsWith("image")) { diff --git a/client/src/components/shop-info/shop-info.general.component.jsx b/client/src/components/shop-info/shop-info.general.component.jsx index 2a20e9549..6803e53ae 100644 --- a/client/src/components/shop-info/shop-info.general.component.jsx +++ b/client/src/components/shop-info/shop-info.general.component.jsx @@ -145,124 +145,168 @@ export function ShopInfoGeneral({ form, bodyshop }) { - {HasFeatureAccess({ featureName: "export", bodyshop }) && ( - <> - - - - {InstanceRenderManager({ - imex: ( - - {() => ( - - - - )} - - ) - })} - - - - - - 2 - 3 - - - - {() => { - return ( - - - {t("bodyshop.labels.2tiername")} - {t("bodyshop.labels.2tiersource")} - - - ); - }} - - - - - - - - - )} - - - - - - - {InstanceRenderManager({ - imex: ( - - - - ) - })} - - - - {HasFeatureAccess({ featureName: "bills", bodyshop }) && ( - <> - {InstanceRenderManager({ - imex: ( + {[ + ...(HasFeatureAccess({ featureName: "export", bodyshop }) + ? [ + + , + InstanceRenderManager({ + imex: ( + + {() => ( + + + + )} + + ) + }), + + + , + + + 2 + 3 + + , + + {() => { + return ( + + + {t("bodyshop.labels.2tiername")} + {t("bodyshop.labels.2tiersource")} + + + ); + }} + , + + + , + + + + ] + : []), + + + , + + + , + InstanceRenderManager({ + imex: ( + + + + ) + }), + + + , + ...(HasFeatureAccess({ featureName: "bills", bodyshop }) + ? [ + InstanceRenderManager({ + imex: ( + + + + ) + }), + + + , + - ) - })} - - - - - - - - )} - - - - {HasFeatureAccess({ featureName: "export", bodyshop }) && ( - <> - - {ReceivableCustomFieldSelect} - - - {ReceivableCustomFieldSelect} - - - {ReceivableCustomFieldSelect} - - { - return { - required: getFieldValue("enforce_class"), - //message: t("general.validation.required"), - type: "array" - }; - } - ]} - > - - - )} - {ADPPayroll.treatment === "on" && ( - - - - )} - - )} + ] + : []), + + + , + ...(HasFeatureAccess({ featureName: "export", bodyshop }) + ? [ + + {ReceivableCustomFieldSelect} + , + + {ReceivableCustomFieldSelect} + , + + {ReceivableCustomFieldSelect} + , + { + return { + required: getFieldValue("enforce_class"), + //message: t("general.validation.required"), + type: "array" + }; + } + ]} + > + + + ] + : []), + ...(ADPPayroll.treatment === "on" + ? [ + + + + ] + : []) + ] + : []) + ]} null}> @@ -446,211 +491,255 @@ export function ShopInfoGeneral({ form, bodyshop }) { - - + , + + + , + + + , + + + , + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ]} + > + + , + + + , + ({ + validator(rule, value) { + if (!value && !getFieldValue(["md_hour_split", "paint"])) { + return Promise.resolve(); + } + if (value + getFieldValue(["md_hour_split", "paint"]) === 1) { + return Promise.resolve(); + } + return Promise.reject(t("bodyshop.validation.larsplit")); + } + }) + ]} + > + + , + ({ + validator(rule, value) { + if (!value && !getFieldValue(["md_hour_split", "paint"])) { + return Promise.resolve(); + } + if (value + getFieldValue(["md_hour_split", "prep"]) === 1) { + return Promise.resolve(); + } + return Promise.reject(t("bodyshop.validation.larsplit")); + } + }) + ]} + > + + , + + + , + + + , + + + , + + + , + + + , + + + , + + + , + + + , + + + , + + + , + + + , + + + + ]} { //Delayed as the key structure may change slightly from what it is currently and will require evaluating mobile components. const client = req.userGraphQLClient; //If there's no jobid and no billid, we're in temporary documents. - const data = await (jobid - ? client.request(GET_DOCUMENTS_BY_JOB, { jobId: jobid }) - : client.request(QUERY_TEMPORARY_DOCS)); + const data = await ( + billid ? client.request(GET_DOCUMENTS_BY_BILL, { billId: billid }) : + jobid + ? client.request(GET_DOCUMENTS_BY_JOB, { jobId: jobid }) + : client.request(QUERY_TEMPORARY_DOCS)); const thumbResizeParams = `rs:fill:250:250:1/g:ce`; const s3client = new S3Client({ region: InstanceRegion() });