From 30e5027c8c91185153f1242f69633856a6f3701a Mon Sep 17 00:00:00 2001 From: Dave Date: Tue, 26 May 2026 12:05:31 -0400 Subject: [PATCH] feature/IO-3567-New-Job-Line-Tab - Fix --- .../bill-form/bill-form.lines.component.jsx | 36 ++++++++++++++++++- client/src/translations/en_us/common.json | 2 +- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/client/src/components/bill-form/bill-form.lines.component.jsx b/client/src/components/bill-form/bill-form.lines.component.jsx index e11266583..098a8a2a1 100644 --- a/client/src/components/bill-form/bill-form.lines.component.jsx +++ b/client/src/components/bill-form/bill-form.lines.component.jsx @@ -36,6 +36,7 @@ export function BillEnterModalLinesComponent({ const { t } = useTranslation(); const { setFieldsValue, getFieldsValue, getFieldValue } = form; const firstFieldRefs = useRef({}); + const lineDescriptionRefs = useRef({}); const CONTROL_HEIGHT = 32; @@ -94,6 +95,23 @@ export function BillEnterModalLinesComponent({ }); }; + const focusLineDescription = (index) => { + const lineDescription = lineDescriptionRefs.current[index]; + + if (typeof lineDescription?.focus === "function") { + lineDescription.focus({ preventScroll: true }); + return; + } + + lineDescription?.resizableTextArea?.textArea?.focus?.({ preventScroll: true }); + }; + + const focusJobLineSelect = (index) => { + window.setTimeout(() => { + firstFieldRefs.current[index]?.focus?.({ preventScroll: true }); + }, 0); + }; + // Only fill actual_cost when the user forward-tabs out of Retail (actual_price) const autofillActualCost = (index) => { if (bodyshop.accountingconfig?.disableBillCostCalculation) return; @@ -195,6 +213,12 @@ export function BillEnterModalLinesComponent({ minHeight: `${CONTROL_HEIGHT}px` }} allowRemoved={form.getFieldValue("is_credit_memo") || false} + onInputKeyDown={(event) => { + if (event.key !== "Tab" || event.shiftKey || event.defaultPrevented) return; + + event.preventDefault(); + focusLineDescription(index); + }} onSelect={(value, opt) => { // IMPORTANT: // Do NOT autofill actual_cost here. It should only fill when the user forward-tabs @@ -221,6 +245,7 @@ export function BillEnterModalLinesComponent({ }; }) }); + focusJobLineSelect(index); }} /> ) @@ -236,7 +261,16 @@ export function BillEnterModalLinesComponent({ label: t("billlines.fields.line_desc"), rules: [{ required: true }] }), - formInput: () => + formInput: (record, index) => ( + { + lineDescriptionRefs.current[index] = el; + }} + disabled={disabled} + autoSize + tabIndex={0} + /> + ) }, { diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index f49fc0d77..4494f75af 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -3054,7 +3054,7 @@ "appointment_confirmation": "Appointment Confirmation" }, "banners": { - "esignature_promo": "Tired of getting paper signatures? Try E-Signatures today. Contact sales to add this feature." + "esignature_promo": "Tired of getting paper signatures? Try E-Signatures today. Contact support to add this feature." }, "bills": { "inhouse_invoice": "In House Invoice"