const ScanBarcodeOrQRCode=(props)=>{
const { barcode, setBarcode, handleClose, isMobile=false, config} = props
const {Row, Col} = ReactBootstrap
const [loading, setLoading] = useState(false)
const handleChangeBarcodeCode=(value)=>{
if (value== null || value.trim()==''){
return
}
const cleanValue = value.replace(/[\n\r]+/g, '');
// 3. (Tùy chọn) Trim để loại bỏ khoảng trắng ở 2 đầu nếu còn sót lại
setBarcode(cleanValue.trim());
}
const handleCompleteScanQR=()=>{
handleChangeBarcodeCode(barcode)
handleClose()
}
return (
setBarcode(e.target.value)}
type='text'
required={false}
feedback={null}
onEnter={(e)=>handleChangeBarcodeCode(e.target.value)}
size="sm"
autoFocus={true} // Tự động tập trung vào TextInput
onFocus={(e) => e.target.select()}
tabIndex={1} // Thiết lập tabIndex cho TextInput
/>
{config?.lang === 'vi' ? "Đóng" : "Close"}}
onClick={handleClose}
variant='secondary'
type='button'
style={{ float: 'right', marginLeft: '10px' }} // Thêm khoảng cách giữa các nút
visible={true}
tabIndex={4} // Thay đổi tabIndex
/>
{config?.lang === 'vi' ? "Nhập" : "Enter"}}
onClick={handleChangeBarcodeCode(barcode)}
variant='primary'
type='button'
style={{ float: 'right' }}
visible={true}
tabIndex={2} // Thay đổi tabIndex
/>
{isMobile &&
}
)
}