Merge remote-tracking branch 'origin/feature/IO-3537-Bill-Entry-Scroll-to-Top-for-Errors' into release/2026-02-27

This commit is contained in:
Dave
2026-02-24 11:08:46 -05:00
5 changed files with 24 additions and 10 deletions

View File

@@ -58,6 +58,7 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop,
const notification = useNotification(); const notification = useNotification();
const fileInputRef = useRef(null); const fileInputRef = useRef(null);
const pollingIntervalRef = useRef(null); const pollingIntervalRef = useRef(null);
const formTopRef = useRef(null);
const { const {
treatments: { Enhanced_Payroll, Imgproxy, Bill_OCR_AI } treatments: { Enhanced_Payroll, Imgproxy, Bill_OCR_AI }
@@ -66,7 +67,7 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop,
names: ["Enhanced_Payroll", "Imgproxy", "Bill_OCR_AI"], names: ["Enhanced_Payroll", "Imgproxy", "Bill_OCR_AI"],
splitKey: bodyshop.imexshopid splitKey: bodyshop.imexshopid
}); });
const formValues = useMemo(() => { const formValues = useMemo(() => {
return { return {
...billEnterModal.context.bill, ...billEnterModal.context.bill,
@@ -499,17 +500,25 @@ function BillEnterModalContainer({ billEnterModal, toggleModalVisible, bodyshop,
autoComplete={"off"} autoComplete={"off"}
layout="vertical" layout="vertical"
form={form} form={form}
onFinishFailed={() => { onFinishFailed={(errorInfo) => {
setEnterAgain(false); 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);
}
}} }}
> >
<RbacWrapper action="bills:enter"> <div ref={formTopRef}>
<BillFormContainer <RbacWrapper action="bills:enter">
form={form} <BillFormContainer
isAiScan={isAiScan} form={form}
disableInvNumber={billEnterModal.context.disableInvNumber} isAiScan={isAiScan}
/> disableInvNumber={billEnterModal.context.disableInvNumber}
</RbacWrapper> />
</RbacWrapper>
</div>
</Form> </Form>
</Modal> </Modal>
); );

View File

@@ -39,11 +39,13 @@ export default function FormsFieldChanged({ form, skipPrompt }) {
{errors.length > 0 && ( {errors.length > 0 && (
<AlertComponent <AlertComponent
type="error" type="error"
title={ message={t("general.labels.validationerror")}
description={
<div> <div>
<ul>{errors.map((e, idx) => e.errors.map((e2, idx2) => <li key={`${idx}${idx2}`}>{e2}</li>))}</ul> <ul>{errors.map((e, idx) => e.errors.map((e2, idx2) => <li key={`${idx}${idx2}`}>{e2}</li>))}</ul>
</div> </div>
} }
showIcon
/> />
)} )}
</Space> </Space>

View File

@@ -1390,6 +1390,7 @@
"unknown": "Unknown", "unknown": "Unknown",
"unsavedchanges": "Unsaved changes.", "unsavedchanges": "Unsaved changes.",
"username": "Username", "username": "Username",
"validationerror": "Please fix the following errors:",
"view": "View", "view": "View",
"wednesday": "Wednesday", "wednesday": "Wednesday",
"yes": "Yes" "yes": "Yes"

View File

@@ -1390,6 +1390,7 @@
"unknown": "Desconocido", "unknown": "Desconocido",
"unsavedchanges": "", "unsavedchanges": "",
"username": "", "username": "",
"validationerror": "",
"view": "", "view": "",
"wednesday": "", "wednesday": "",
"yes": "" "yes": ""

View File

@@ -1390,6 +1390,7 @@
"unknown": "Inconnu", "unknown": "Inconnu",
"unsavedchanges": "", "unsavedchanges": "",
"username": "", "username": "",
"validationerror": "",
"view": "", "view": "",
"wednesday": "", "wednesday": "",
"yes": "" "yes": ""