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 824581952..a73b19663 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 @@ -58,6 +58,7 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop, const notification = useNotification(); const fileInputRef = useRef(null); const pollingIntervalRef = useRef(null); + const formTopRef = useRef(null); const { treatments: { Enhanced_Payroll, Imgproxy, Bill_OCR_AI } @@ -66,7 +67,7 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop, names: ["Enhanced_Payroll", "Imgproxy", "Bill_OCR_AI"], splitKey: bodyshop.imexshopid }); - + const formValues = useMemo(() => { return { ...billEnterModal.context.bill, @@ -499,17 +500,25 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop, autoComplete={"off"} layout="vertical" form={form} - onFinishFailed={() => { + onFinishFailed={(errorInfo) => { setEnterAgain(false); + // Scroll to the top of the form to show validation errors + if (errorInfo.errorFields && errorInfo.errorFields.length > 0) { + setTimeout(() => { + formTopRef.current?.scrollIntoView({ behavior: "smooth", block: "start" }); + }, 100); + } }} > - - - +
+ + + +
); diff --git a/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx b/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx index 56f4a5881..0f265d7db 100644 --- a/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx +++ b/client/src/components/form-fields-changed-alert/form-fields-changed-alert.component.jsx @@ -39,11 +39,13 @@ export default function FormsFieldChanged({ form, skipPrompt }) { {errors.length > 0 && ( } + showIcon /> )} diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 6d1eb98f6..271278df4 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1390,6 +1390,7 @@ "unknown": "Unknown", "unsavedchanges": "Unsaved changes.", "username": "Username", + "validationerror": "Please fix the following errors:", "view": "View", "wednesday": "Wednesday", "yes": "Yes" diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index ef6c0b151..349c1964a 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1390,6 +1390,7 @@ "unknown": "Desconocido", "unsavedchanges": "", "username": "", + "validationerror": "", "view": "", "wednesday": "", "yes": "" diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index ed93edd1a..8e48b756f 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1390,6 +1390,7 @@ "unknown": "Inconnu", "unsavedchanges": "", "username": "", + "validationerror": "", "view": "", "wednesday": "", "yes": ""