From c6fdfe5842c34d26730886a207e1d5cfb020ec18 Mon Sep 17 00:00:00 2001 From: Srinath Date: Fri, 20 Feb 2026 15:33:21 +0530 Subject: [PATCH] Added Qr scann on mobile Funtionalites --- .../UtillComponents/BSNavBarSearch.jsx | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarSearch.jsx b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarSearch.jsx index bc14ed7..1e56375 100644 --- a/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarSearch.jsx +++ b/src/Pages/BookingScreen/Components/UtillComponents/BSNavBarSearch.jsx @@ -37,6 +37,7 @@ import { BiBarcodeReader } from 'react-icons/bi'; import { ApplicationPreferences } from '../../../../Features/BrachLogin/BranchLogin.js'; import { useDateStore } from '../../../../Features/BookingScreen/BookingData/DateStore.js'; import { Messages } from '../../../../../ownLib/my-ui-lib.js'; +import BarCodeScan from '../../../../Services/BarCodeScan.jsx'; const BSNavBarSearch = (props) => { const searchInputRef = useRef(null); @@ -362,28 +363,28 @@ const BSNavBarSearch = (props) => { await dispatch(getCardDataWithoutSub(data)); }; - const stopScannerFromParent = () => { - if (scannerRef?.current) { - scannerRef?.current?.stopScanner(); // Call stopScanner from the child component - } - }; + // const stopScannerFromParent = () => { + // if (scannerRef?.current) { + // scannerRef?.current?.stopScanner(); // Call stopScanner from the child component + // } + // }; - const handleQrcode = () => { - setOpenScanner((prev) => !prev); - if (!openScanner && scannerRef?.current) { - scannerRef?.current?.reinitializeCamera(); // Call the function to reinitialize the camera - } - }; + // const handleQrcode = () => { + // setOpenScanner((prev) => !prev); + // if (!openScanner && scannerRef?.current) { + // scannerRef?.current?.reinitializeCamera(); // Call the function to reinitialize the camera + // } + // }; - const handleQrData = async (value, err) => { - if (err && err?.error) { - setMessageData(err?.error); - setMessageType('error'); - } - await searchdata(value); - setOpenScanner(false); - stopScannerFromParent(); - }; + // const handleQrData = async (value, err) => { + // if (err && err?.error) { + // setMessageData(err?.error); + // setMessageType('error'); + // } + // await searchdata(value); + // setOpenScanner(false); + // stopScannerFromParent(); + // }; const onComplete = useCallback(() => { setMessageData(null); @@ -421,9 +422,14 @@ const BSNavBarSearch = (props) => { disabled={props.OrderType === 'Failed' ? true : false} /> {isMobile && screenWidth <= 768 ? ( - handleQrcode()} + // handleQrcode()} + // /> + { + searchdata(value); + }} /> ) : ( @@ -435,7 +441,7 @@ const BSNavBarSearch = (props) => { } */} - {isMobile && screenWidth <= 768 && ( + {/* {isMobile && screenWidth <= 768 && ( { /> )} - )} + )} */} ); };