latest
This commit is contained in:
parent
c31458330b
commit
aee9f5c534
|
|
@ -8,6 +8,7 @@ const BarcodeScanner = () => {
|
|||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [barcodeInfo, setBarcodeInfo] = useState([]);
|
||||
const [marksData, setMarksData] = useState([]);
|
||||
const [partAData, setPartAData] = useState([]);
|
||||
const scannerRef = useRef(null); // Use ref to store the scanner instance
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -20,10 +21,13 @@ const BarcodeScanner = () => {
|
|||
});
|
||||
|
||||
const fetchBarcodeData = () => {
|
||||
if(!scanResult){
|
||||
return
|
||||
if (!scanResult) {
|
||||
return;
|
||||
}
|
||||
setIsLoading(true);
|
||||
setMarksData([])
|
||||
setBarcodeInfo([])
|
||||
setPartAData([])
|
||||
try {
|
||||
const payload = {
|
||||
qrcodeValue: scanResult,
|
||||
|
|
@ -46,6 +50,7 @@ const BarcodeScanner = () => {
|
|||
if (responseData.status === "success") {
|
||||
setBarcodeInfo(responseData.results);
|
||||
setMarksData(responseData?.marks);
|
||||
setPartAData(responseData?.partAResults);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
|
|
@ -110,20 +115,20 @@ const BarcodeScanner = () => {
|
|||
<h1>Welcome to exampaper.vidh.ai</h1>
|
||||
</Box>
|
||||
<Box className="my-3">
|
||||
<Box className="d-none d-md-flex justify-content-center align-items-center w-100">
|
||||
<Box className="d-flex justify-content-center align-items-center w-100">
|
||||
{scanResult ? (
|
||||
<h5>QR : {scanResult}</h5>
|
||||
) : (
|
||||
<div id="reader" style={{ width: "400px", height: "400px" }}></div>
|
||||
)}
|
||||
</Box>
|
||||
<Box className="d-flex d-md-none justify-content-center align-items-center w-100">
|
||||
{/* <Box className="d-flex d-md-none justify-content-center align-items-center w-100">
|
||||
{scanResult ? (
|
||||
<h5>QR : {scanResult}</h5>
|
||||
) : (
|
||||
<div id="reader" style={{ width: "400px", height: "400px" }}></div>
|
||||
)}
|
||||
</Box>
|
||||
</Box> */}
|
||||
</Box>
|
||||
<Box className="w-100 d-flex justify-content-center">
|
||||
{barcodeInfo.length > 0 && (
|
||||
|
|
@ -135,6 +140,15 @@ const BarcodeScanner = () => {
|
|||
<h5>Exam center : {barcodeInfo[0]?.exam_center}</h5>
|
||||
</Box>
|
||||
)}
|
||||
{partAData.length > 0 && (
|
||||
<Box className="p-5 w-50 rounded shadow">
|
||||
<h5>Barcode : {partAData[0]?.barcode}</h5>
|
||||
<h5>QRcode : {partAData[0]?.qrcode}</h5>
|
||||
<h5>S.NO : {barcodeInfo[0]?.slno}</h5>
|
||||
<h5>Booklet No : {barcodeInfo[0]?.booklet_serial_no}</h5>
|
||||
<img src={`https://docs.exampaper.vidh.ai/${partAData?.s3_path}`} alt="PartA Image" width="50%" height="auto"/>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
<Box className="w-100 d-flex justify-content-center">
|
||||
{scanResult ? (
|
||||
|
|
@ -145,6 +159,7 @@ const BarcodeScanner = () => {
|
|||
<h5>Marks : {marksData[0]?.marks}</h5>
|
||||
<h5>File Scanned Date : {marksData[0]?.file_scanned_date}</h5>
|
||||
<h5>Cover QR code : {marksData[0]?.cover_barcode}</h5>
|
||||
<img src={`https://docs.exampaper.vidh.ai/${marksData?.s3_path}`} alt="PartC Image" width="50%" height="auto"/>
|
||||
</Box>
|
||||
<Box>
|
||||
<Button
|
||||
|
|
|
|||
Loading…
Reference in New Issue