product and sales fixers

This commit is contained in:
2026-09-30 17:06:28 +05:30
parent 9fd290e256
commit cea433e320
98 changed files with 85367 additions and 1516 deletions
@@ -22,6 +22,9 @@ export interface ScanInputProps {
hint?: string
placeholder?: string
disabled?: boolean
/** Grab focus on mount/re-enable (default true). Turn off when another field on the page
* should get the cursor first (e.g. a type-ahead "Add item" box). */
autoFocus?: boolean
className?: string
}
@@ -31,6 +34,7 @@ export function ScanInput({
hint = "Scan item or lot barcode",
placeholder = "Scan or type a barcode, then press Enter",
disabled = false,
autoFocus = true,
className,
}: ScanInputProps) {
const [value, setValue] = useState("")
@@ -39,8 +43,8 @@ export function ScanInput({
// Refocus whenever the field becomes usable again (e.g. after being briefly disabled while a
// lookup for the previous scan was in flight) so a scanner's next read always lands here.
useEffect(() => {
if (!disabled) inputRef.current?.focus()
}, [disabled])
if (!disabled && autoFocus) inputRef.current?.focus()
}, [disabled, autoFocus])
function commit() {
const code = value.trim()