This commit is contained in:
Pradeeppon01 2024-07-06 13:08:43 +05:30
parent d7c1927bb1
commit b8f72c2887
8 changed files with 349 additions and 172 deletions

2
.env
View File

@ -1,4 +1,4 @@
#VITE_REACT_APP_BACKEND_URL="https://sandbox.exampaper.vidh.ai" #VITE_REACT_APP_BACKEND_URL="https://sandbox.exampaper.vidh.ai"
METABASE_BASE_URL="http://metabase.usln.in/public/question/d8774923-09bb-4cd9-903b-559d417e12cf" METABASE_BASE_URL="http://metabase.usln.in/public/question/d8774923-09bb-4cd9-903b-559d417e12cf"
VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai" VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai"
# VITE_REACT_APP_BACKEND_URL="http://localhost:9999" #VITE_REACT_APP_BACKEND_URL="http://localhost:9999"

View File

@ -24,6 +24,7 @@ import AnomolyPartC from "./Components/AnomolyPartC";
import BarcodeScanner from "./Components/BarcodeScanner" import BarcodeScanner from "./Components/BarcodeScanner"
import EvQrcode from "./Components/EvQrcode"; import EvQrcode from "./Components/EvQrcode";
import QrcodeCardEditor from "./Components/QrCodeCardEditor"; import QrcodeCardEditor from "./Components/QrCodeCardEditor";
import StudentResultsData from "./Components/StudentsResultsData";
function App() { function App() {
return ( return (
@ -34,6 +35,7 @@ function App() {
<Route path="/sqlPlayground" element={<QueryExecutor />}></Route> <Route path="/sqlPlayground" element={<QueryExecutor />}></Route>
<Route path="/sqlPlayground/edit" element={<QueryCardEditor/>}></Route> <Route path="/sqlPlayground/edit" element={<QueryCardEditor/>}></Route>
<Route path="/evQrcode/edit" element={<QrcodeCardEditor/>}></Route> <Route path="/evQrcode/edit" element={<QrcodeCardEditor/>}></Route>
<Route path="/studentsDetails" element={<StudentResultsData/>}></Route>
<Route <Route
path="/anomoly/attendence/reassigned" path="/anomoly/attendence/reassigned"
element={<AnomolyReassigned />} element={<AnomolyReassigned />}

View File

@ -42,36 +42,39 @@ function AnomalyPartC() {
const [showSystemNoContainer, setShowSystemNoContainer] = useState(false); const [showSystemNoContainer, setShowSystemNoContainer] = useState(false);
const [selectedIndex, setSelectedIndex] = useState(null); const [selectedIndex, setSelectedIndex] = useState(null);
const [selectedDegreeType, setSelectedDegreeType] = useState(null); const [selectedDegreeType, setSelectedDegreeType] = useState(null);
const [dataFetched, setDataFetched] = useState([]);
const [counter, setCounter] = useState(0);
const degreeTypes = [ const degreeTypes = [
{ type: "UG", type_code: "0" }, { type: "UG", type_code: "0" },
{ type: "PG", type_code: "2" }, { type: "PG", type_code: "2" },
{ type: "UNIVERSITY" , type_code: "5"}
]; ];
const reduxDegreeType = useSelector((state)=> state?.partCDegreeType) const reduxDegreeType = useSelector((state) => state?.partCDegreeType);
console.log("Redux degree type ...",reduxDegreeType) console.log("Redux degree type ...", reduxDegreeType);
useEffect(()=>{ useEffect(() => {
if(reduxDegreeType){ if (reduxDegreeType) {
setSelectedDegreeType(reduxDegreeType) setSelectedDegreeType(reduxDegreeType);
}else{ } else {
setSelectedDegreeType("2") setSelectedDegreeType("2");
} }
},[reduxDegreeType]) }, [reduxDegreeType]);
const handleDegreeTypeChange = (e) => { const handleDegreeTypeChange = (e) => {
const newDegreeType = e.target.value const newDegreeType = e.target.value;
console.log("Value ===== ",newDegreeType); console.log("Value ===== ", newDegreeType);
setSelectedDegreeType(newDegreeType); setSelectedDegreeType(newDegreeType);
dispatch(updatePartCDegreeType(newDegreeType)) dispatch(updatePartCDegreeType(newDegreeType));
}; };
const { const {
token: { colorBgContainer, borderRadiusLG }, token: { colorBgContainer, borderRadiusLG },
} = theme.useToken(); } = theme.useToken();
const navigate = useNavigate(); const navigate = useNavigate();
const dispatch = useDispatch(); const dispatch = useDispatch();
const paramsError = searchParams.get("error") const paramsError = searchParams.get("error");
const paramsErrorReason = searchParams.get("error_reason") const paramsErrorReason = searchParams.get("error_reason");
const paramsSysNo = searchParams.get("sysNo") const paramsSysNo = searchParams.get("sysNo");
const paramsDegreeType = searchParams.get("degreeType") const paramsDegreeType = searchParams.get("degreeType");
const evErrorsList = useSelector((state) => state?.partCErrorList); const evErrorsList = useSelector((state) => state?.partCErrorList);
console.log("evErrorsList = ", evErrorsList); console.log("evErrorsList = ", evErrorsList);
@ -103,17 +106,18 @@ function AnomalyPartC() {
}, [reduxSystemNo]); }, [reduxSystemNo]);
useEffect(() => { useEffect(() => {
console.log("Use effect 11 called ...");
if (!reduxSystemNo) { if (!reduxSystemNo) {
setShowSystemNoContainer(true); setShowSystemNoContainer(true);
} else { } else {
if (evErrorsData && evErrorsData.length > 0) { if (evErrorsData && evErrorsData.length > 0) {
setEvErrors(evErrorsData); setEvErrors(evErrorsData);
} }
if (error && errorReason) { if (error) {
fetchAnomalyRecords(reduxSystemNo); fetchAnomalyRecords(reduxSystemNo);
} }
} }
}, [error, errorReason]); }, [error, errorReason,counter]);
useEffect(() => { useEffect(() => {
if (evErrors && evErrors.length > 0) { if (evErrors && evErrors.length > 0) {
@ -125,9 +129,10 @@ function AnomalyPartC() {
}, [evErrors]); }, [evErrors]);
useEffect(() => { useEffect(() => {
// dispatch(updatePartCErrorData([])); dispatch(updatePartCErrorData([]));
// setAnomalyData([]); // setAnomalyData([]);
// setEvErrors([]); setEvErrors([]);
setDataFetched(false);
fetchAnomalyData(); fetchAnomalyData();
}, [selectedDegreeType]); }, [selectedDegreeType]);
@ -160,6 +165,7 @@ function AnomalyPartC() {
const fetchAnomalyData = async () => { const fetchAnomalyData = async () => {
setIsLoading(true); setIsLoading(true);
setDataFetched(false);
try { try {
const response = await fetch( const response = await fetch(
`${ `${
@ -174,6 +180,7 @@ function AnomalyPartC() {
); );
const responseData = await response.json(); const responseData = await response.json();
setAnomalyData(responseData.data); setAnomalyData(responseData.data);
setDataFetched(true);
dispatch(updatePartCErrorList(responseData.data)); dispatch(updatePartCErrorList(responseData.data));
} catch (error) { } catch (error) {
console.error("Error fetching data: ", error); console.error("Error fetching data: ", error);
@ -183,8 +190,9 @@ function AnomalyPartC() {
}; };
const fetchAnomalyRecords = async (reduxSystemNo) => { const fetchAnomalyRecords = async (reduxSystemNo) => {
console.log("fetching anomoly records") console.log("fetching anomoly records");
setIsLoading(true); setIsLoading(true);
setDataFetched(false);
try { try {
const response = await fetch( const response = await fetch(
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/getpartcEvErrors`, `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/getpartcEvErrors`,
@ -208,7 +216,7 @@ function AnomalyPartC() {
systemRecords = getRecordsBySystemId(responseData?.data, reduxSystemNo); systemRecords = getRecordsBySystemId(responseData?.data, reduxSystemNo);
} }
console.log("System records : ", systemRecords); console.log("System records : ", systemRecords);
setDataFetched(true);
setEvErrors(systemRecords); setEvErrors(systemRecords);
setIsLoading(false); setIsLoading(false);
dispatch(updatePartCErrorData(systemRecords)); dispatch(updatePartCErrorData(systemRecords));
@ -222,7 +230,7 @@ function AnomalyPartC() {
function getRecordsBySystemId(records, systemId) { function getRecordsBySystemId(records, systemId) {
const new_data = []; const new_data = [];
if(!records) records = [] if (!records) records = [];
for (var i = 0; i < records.length; i++) { for (var i = 0; i < records.length; i++) {
var count = i % 5; var count = i % 5;
if (count === systemId - 1) { if (count === systemId - 1) {
@ -242,6 +250,7 @@ function AnomalyPartC() {
tmp["error_reason"] = errorReason; tmp["error_reason"] = errorReason;
console.log("tmp = ", tmp); console.log("tmp = ", tmp);
dispatch(updateSelectedJson(tmp)); dispatch(updateSelectedJson(tmp));
setCounter(prev=>prev+1)
}; };
const handlePageChange = (page) => { const handlePageChange = (page) => {
@ -333,7 +342,8 @@ function AnomalyPartC() {
</Select> </Select>
</FormControl> </FormControl>
</Box> </Box>
{anomalyData && {dataFetched ? (
anomalyData && anomalyData.length > 0 ? (
anomalyData.map((item, index) => ( anomalyData.map((item, index) => (
<Card <Card
onClick={() => onClick={() =>
@ -373,8 +383,14 @@ function AnomalyPartC() {
)} */} )} */}
</CardContent> </CardContent>
</Card> </Card>
))} ))
{evErrors && evErrors.length > 0 && ( ) : (
<Box className="p-3 my-3 bg-white rounded">
<h5>No data to display ...</h5>
</Box>
)
) : null}
{evErrors && evErrors.length > 0 && dataFetched ? (
<> <>
<Box <Box
display="flex" display="flex"
@ -406,12 +422,16 @@ function AnomalyPartC() {
error={error} error={error}
error_reason={errorReason} error_reason={errorReason}
reduxSystemNo={reduxSystemNo} reduxSystemNo={reduxSystemNo}
degreeType = {selectedDegreeType} degreeType={selectedDegreeType}
/> />
)) ))
)} )}
</> </>
)} ) : dataFetched && evErrorsList && evErrorsList.length == 0 ? (
<Box className="p-3 my-3 bg-white rounded">
<h5>No data to display ...</h5>
</Box>
) : null}
</> </>
)} )}
</Content> </Content>

View File

@ -20,6 +20,9 @@ const BarcodeScanner = () => {
}); });
const fetchBarcodeData = () => { const fetchBarcodeData = () => {
if(!scanResult){
return
}
setIsLoading(true); setIsLoading(true);
try { try {
const payload = { const payload = {

View File

@ -1,13 +1,21 @@
import { Layout, theme } from "antd"; import { Layout, theme } from "antd";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState, useRef } from "react";
import { useNavigate } from "react-router-dom/dist"; import { useNavigate } from "react-router-dom/dist";
import ArrowBackIcon from "@mui/icons-material/ArrowBack"; import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import HomeIcon from "@mui/icons-material/Home"; import HomeIcon from "@mui/icons-material/Home";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { Box, Button, Card, CardContent, Typography, CircularProgress } from "@mui/material"; import {
Box,
Button,
Card,
CardContent,
Typography,
CircularProgress,
} from "@mui/material";
import { updateEvQrcodeList } from "../redux/actions/actions"; import { updateEvQrcodeList } from "../redux/actions/actions";
import SystemNumberDialog from "./SystemNumberDialog"; import SystemNumberDialog from "./SystemNumberDialog";
import { toast, ToastContainer } from "react-toastify"; import { toast, ToastContainer } from "react-toastify";
import LoadingContainer from "./LoadingContainer";
const { Content, Header } = Layout; const { Content, Header } = Layout;
@ -16,6 +24,7 @@ function EvQrcode() {
const [showSystemNoContainer, setShowSystemNoContainer] = useState(false); const [showSystemNoContainer, setShowSystemNoContainer] = useState(false);
const [anomalyData, setAnomalyData] = useState([]); const [anomalyData, setAnomalyData] = useState([]);
const [currentIndex, setCurrentIndex] = useState(0); const [currentIndex, setCurrentIndex] = useState(0);
const inputRef = useRef(null);
const navigate = useNavigate(); const navigate = useNavigate();
@ -26,7 +35,9 @@ function EvQrcode() {
console.log("systemno: ", reduxSystemNo); console.log("systemno: ", reduxSystemNo);
const dispatch = useDispatch(); const dispatch = useDispatch();
const { token: { colorBgContainer } } = theme.useToken(); const {
token: { colorBgContainer },
} = theme.useToken();
useEffect(() => { useEffect(() => {
if (!reduxSystemNo) { if (!reduxSystemNo) {
@ -82,15 +93,18 @@ function EvQrcode() {
const fetchAnomalyData = async () => { const fetchAnomalyData = async () => {
setIsLoading(true); setIsLoading(true);
try { try {
const response = await fetch(`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/getEvRecords`, { const response = await fetch(
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/getEvRecords`,
{
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({
sysno: reduxSystemNo sysno: reduxSystemNo,
}), }),
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
}); }
);
const responseData = await response.json(); const responseData = await response.json();
var systemRecords = responseData?.data; var systemRecords = responseData?.data;
console.log("System record ====== ", responseData.systemRecord); console.log("System record ====== ", responseData.systemRecord);
@ -120,59 +134,75 @@ function EvQrcode() {
} }
const handleNext = () => { const handleNext = () => {
setIsLoading(true);
setAnomalyData([]);
setTimeout(() => {
const newItems = anomalyData.filter((_, index) => index !== currentIndex); const newItems = anomalyData.filter((_, index) => index !== currentIndex);
setAnomalyData(newItems); setAnomalyData(newItems);
if (currentIndex >= newItems.length) { if (currentIndex >= newItems.length) {
setCurrentIndex(0); setCurrentIndex(0);
} }
setIsLoading(false)
},1000);
}; };
const handleUpdate = async() => { const handleUpdate = async () => {
try { try {
const inputValue = document.getElementById('qrcodeInput').value; const inputValue = document.getElementById("qrcodeInput").value;
console.log("inputvalu = ", inputValue) console.log("inputvalu = ", inputValue);
const payload = { const payload = {
imageName: currentItem.image_name, imageName: currentItem.image_name,
qrvalue: inputValue, qrvalue: inputValue,
}; };
console.log("payload=", payload) console.log("payload=", payload);
const response = await fetch(`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/updateEvRecord`, { const response = await fetch(
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/updateEvRecord`,
{
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body:JSON.stringify(payload) body: JSON.stringify(payload),
}); }
);
const responseData = await response.json(); const responseData = await response.json();
console.log("responsedata: ", responseData) console.log("responsedata: ", responseData);
if (responseData?.status_code === 200) { if (responseData?.status_code === 200) {
toast.success("Record Updated Successfully"); toast.success("Record Updated Successfully");
handleNext() handleNext();
document.getElementById('qrcodeInput').value = '' document.getElementById("qrcodeInput").value = "";
}else{ } else {
toast.error("Updation Failed"); toast.error("Updation Failed");
} }
} catch (error) { } catch (error) {
console.error("Error fetching data: ", error); console.error("Error fetching data: ", error);
} finally { } finally {
setIsLoading(false); setIsLoading(false);
} }
} };
const handleArrowBack = () => { const handleArrowBack = () => {
dispatch(updateEvQrcodeList([])); dispatch(updateEvQrcodeList([]));
navigate(-1) navigate(-1);
} };
if (isLoading) { if (isLoading) {
return <CircularProgress />; return <CircularProgress />;
} }
const currentItem = anomalyData[currentIndex]; const currentItem = anomalyData[currentIndex];
const imageUrl = currentItem ? `https://docs.exampaper.vidh.ai/${currentItem.s3_path}` : ''; const imageUrl = currentItem
? `https://docs.exampaper.vidh.ai/${currentItem.s3_path}`
: "";
const handleKeyDown = (e) => {
if (e.key === "Enter") {
console.log("Updating ......");
handleUpdate();
}
};
return ( return (
<Layout style={{ minHeight: "100vh" }}> <Layout style={{ minHeight: "100vh" }}>
@ -180,7 +210,10 @@ function EvQrcode() {
<ToastContainer /> <ToastContainer />
<Header style={{ padding: 0, background: colorBgContainer }}> <Header style={{ padding: 0, background: colorBgContainer }}>
<Box className="d-flex justify-content-between h-100 py-1 px-2"> <Box className="d-flex justify-content-between h-100 py-1 px-2">
<Button className="bg-primary p-1 text-light" onClick={handleArrowBack}> <Button
className="bg-primary p-1 text-light"
onClick={handleArrowBack}
>
<ArrowBackIcon /> <ArrowBackIcon />
</Button> </Button>
<Box className="d-flex justify-content-between gap-2"> <Box className="d-flex justify-content-between gap-2">
@ -193,7 +226,10 @@ function EvQrcode() {
<b>System No : </b> {reduxSystemNo} <b>System No : </b> {reduxSystemNo}
</Box> </Box>
)} )}
<Button className="bg-primary p-1 text-light" onClick={() => navigate("/")}> <Button
className="bg-primary p-1 text-light"
onClick={() => navigate("/")}
>
<HomeIcon /> <HomeIcon />
</Button> </Button>
</Box> </Box>
@ -202,36 +238,77 @@ function EvQrcode() {
<Content> <Content>
{currentItem ? ( {currentItem ? (
<Box className="d-flex justify-content-center align-items-center flex-column" style={{ minHeight: '80vh' }}> <Box
<Card style={{ display: 'flex', flexDirection: 'row', margin:'20px 20px 20px 20px' }}> className="d-flex justify-content-center align-items-center flex-column"
<Box style={{ flex: '20%', padding: '20px', marginTop:'30px', textAlign:'left' }}> style={{ minHeight: "80vh" }}
<Typography variant="h5" style={{paddingBottom:'20px'}}>Records Count: {anomalyData.length}</Typography> >
<Typography variant="h6">Image Name: {currentItem.image_name}</Typography> <Card
style={{
display: "flex",
flexDirection: "row",
margin: "20px 20px 20px 20px",
}}
>
<Box
style={{
flex: "20%",
padding: "20px",
marginTop: "30px",
textAlign: "left",
}}
>
<Typography variant="h5" style={{ paddingBottom: "20px" }}>
Records Count: {anomalyData.length}
</Typography>
<Typography variant="h6">
Image Name: {currentItem.image_name}
</Typography>
{/* <Typography variant="body2">S3 Path: {currentItem.s3_path}</Typography> */} {/* <Typography variant="body2">S3 Path: {currentItem.s3_path}</Typography> */}
<Typography variant="subtitle1" style={{paddingTop:'20px', fontWeight:'bold'}}>Qrcode Value</Typography> <Typography
variant="subtitle1"
style={{ paddingTop: "20px", fontWeight: "bold" }}
>
Qrcode Value
</Typography>
<input <input
type="text" type="text"
id="qrcodeInput" id="qrcodeInput"
placeholder="Enter qrcode value" placeholder="Enter qrcode value"
style={{ style={{
marginTop: '10px', marginTop: "10px",
width: '100%', width: "100%",
padding: '5px', padding: "5px",
backgroundColor: 'transparent', backgroundColor: "transparent",
color: '#000000' // black text color color: "#000000", // black text color
}} }}
onKeyDown={handleKeyDown}
inputRef={inputRef}
/> />
<Box mt={2}> <Box mt={2}>
<Button variant="contained" color="primary" onClick={handleNext} style={{ marginRight: 10 }}> <Button
variant="contained"
color="primary"
onClick={handleNext}
style={{ marginRight: 10 }}
>
Skip Skip
</Button> </Button>
<Button variant="contained" color="secondary" onClick={handleUpdate} style={{backgroundColor:'green'}}> <Button
variant="contained"
color="secondary"
onClick={handleUpdate}
style={{ backgroundColor: "green" }}
>
Update Update
</Button> </Button>
</Box> </Box>
</Box> </Box>
<CardContent style={{ flex: '80%' }}> <CardContent style={{ flex: "80%" }}>
<img src={imageUrl} alt={currentItem.image_name} style={{ width: '100%', marginTop: '20px' }} /> <img
src={imageUrl}
alt={currentItem.image_name}
style={{ minWidth:"1000px",width: "100%", marginTop: "20px" }}
/>
</CardContent> </CardContent>
</Card> </Card>
</Box> </Box>
@ -241,9 +318,13 @@ function EvQrcode() {
</Content> </Content>
{showSystemNoContainer && ( {showSystemNoContainer && (
<SystemNumberDialog setShowSystemNoContainer={setShowSystemNoContainer} showSystemNoContainer={showSystemNoContainer} /> <SystemNumberDialog
setShowSystemNoContainer={setShowSystemNoContainer}
showSystemNoContainer={showSystemNoContainer}
/>
)} )}
</Layout> </Layout>
{isLoading && <LoadingContainer />}
</Layout> </Layout>
); );
} }

View File

@ -1,4 +1,4 @@
import { useState, useEffect } from "react"; import { useState, useEffect, useRef } from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { useSearchParams } from "react-router-dom"; import { useSearchParams } from "react-router-dom";
import { Box, Button } from "@mui/material"; import { Box, Button } from "@mui/material";
@ -37,8 +37,11 @@ const QueryCardEditor = () => {
const paramsSysNo = searchParams.get("sysNo"); const paramsSysNo = searchParams.get("sysNo");
const paramsDegreeType = searchParams.get("degreeType"); const paramsDegreeType = searchParams.get("degreeType");
const [items, setItems] = useState([]); const [items, setItems] = useState([]);
const [evErrorsData,setEvErrorsData] = useState([]); const [evErrorsData, setEvErrorsData] = useState([]);
const barcodeInputRef = useRef(null);
const qrInputRef = useRef(null);
const marksInputRef = useRef(null);
const subjectCodeInputRef = useRef(null);
const navigate = useNavigate(); const navigate = useNavigate();
const dispatch = useDispatch(); const dispatch = useDispatch();
console.log("Ev errors list ==== ", evErrorsList); console.log("Ev errors list ==== ", evErrorsList);
@ -71,22 +74,21 @@ const QueryCardEditor = () => {
useEffect(() => { useEffect(() => {
const marksLocalData = localStorage.getItem("marks_manual_data"); const marksLocalData = localStorage.getItem("marks_manual_data");
console.log("Marks local data 123 ========= ",marksLocalData) console.log("Marks local data 123 ========= ", marksLocalData);
if (marksLocalData) { if (marksLocalData) {
console.log("Into if and updating .......") console.log("Into if and updating .......");
console.log("marks local data ==== ",marksLocalData) console.log("marks local data ==== ", marksLocalData);
setEvErrorsData(JSON.parse(marksLocalData)); setEvErrorsData(JSON.parse(marksLocalData));
} }
}, []); }, []);
useEffect(()=>{ useEffect(() => {
dispatch(updateSystemNo(paramsSysNo)) dispatch(updateSystemNo(paramsSysNo));
},[paramsSysNo]) }, [paramsSysNo]);
useEffect(() => {
useEffect(()=>{ console.log("Ev error data =============== ", evErrorsData);
console.log("Ev error data =============== ",evErrorsData) }, [evErrorsData]);
},[evErrorsData])
useEffect(() => { useEffect(() => {
const fetchData = async () => { const fetchData = async () => {
@ -117,10 +119,9 @@ const QueryCardEditor = () => {
setS3Path(recordData?.s3_path); setS3Path(recordData?.s3_path);
}, [recordData]); }, [recordData]);
const updateRecord = async () => { const updateRecord = async () => {
if(!marks){ if (!marks) {
return return;
} }
setIsLoading(true); setIsLoading(true);
try { try {
@ -132,7 +133,7 @@ const QueryCardEditor = () => {
subjectCode, subjectCode,
marks, marks,
imageName, imageName,
rotateAngle rotateAngle,
}; };
const response = await fetch( const response = await fetch(
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/editPartCdata`, `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/editPartCdata`,
@ -150,7 +151,10 @@ const QueryCardEditor = () => {
if (responseData?.status === "success") { if (responseData?.status === "success") {
toast.success("Record Updated Successfully ..."); toast.success("Record Updated Successfully ...");
var currentIndex = null; var currentIndex = null;
console.log("Ev errors data before filter ============= ",evErrorsData) console.log(
"Ev errors data before filter ============= ",
evErrorsData
);
var newRecords = evErrorsData.filter((data, index) => { var newRecords = evErrorsData.filter((data, index) => {
if (data?.image_name === imageName) { if (data?.image_name === imageName) {
currentIndex = index; currentIndex = index;
@ -158,8 +162,8 @@ const QueryCardEditor = () => {
} }
return true; return true;
}); });
if(!currentIndex){ if (!currentIndex) {
currentIndex = 0 currentIndex = 0;
} }
console.log("new records ======1 ", newRecords); console.log("new records ======1 ", newRecords);
console.log("Current Index ===== ", currentIndex); console.log("Current Index ===== ", currentIndex);
@ -219,10 +223,10 @@ const QueryCardEditor = () => {
} }
}; };
const skipPage = () =>{ const skipPage = () => {
try{ try {
if(evErrorsData){ if (evErrorsData) {
var currentIndex = null var currentIndex = null;
var newRecords = evErrorsData.filter((data, index) => { var newRecords = evErrorsData.filter((data, index) => {
if (data?.image_name === imageName) { if (data?.image_name === imageName) {
currentIndex = index; currentIndex = index;
@ -230,12 +234,12 @@ const skipPage = () =>{
} }
return true; return true;
}); });
if(!currentIndex){ if (!currentIndex) {
currentIndex = 0 currentIndex = 0;
} }
console.log("Current Index ===== ", currentIndex); console.log("Current Index ===== ", currentIndex);
const newIndex = currentIndex+1 const newIndex = currentIndex + 1;
console.log("new index ===== ",newIndex) console.log("new index ===== ", newIndex);
if (newRecords.length > 0) { if (newRecords.length > 0) {
console.log("Has to navigte 12 ....."); console.log("Has to navigte 12 .....");
const newUrl = `/sqlPlayground/edit?image_name=${evErrorsData[newIndex]?.image_name}&table=ocr_scanned_part_c_v1&error=${paramsError}&error_reason=${paramsErrorReason}&degreeType=${paramsDegreeType}&sysNo=${paramsSysNo}`; const newUrl = `/sqlPlayground/edit?image_name=${evErrorsData[newIndex]?.image_name}&table=ocr_scanned_part_c_v1&error=${paramsError}&error_reason=${paramsErrorReason}&degreeType=${paramsDegreeType}&sysNo=${paramsSysNo}`;
@ -243,40 +247,72 @@ const skipPage = () =>{
window.location.href = newUrl; window.location.href = newUrl;
} }
} }
}catch(error){ } catch (error) {
throw new Error(error) throw new Error(error);
} }
} };
const handleKeyDown = (e) => {
try {
console.log("Handle key down clicked ...", e);
console.log("event target ..... ", e.target);
console.log("barcode targed .....", barcodeInputRef.current);
if (e.key === "Enter") {
if (e.target === barcodeInputRef.current) {
qrInputRef.current.focus();
} else if (e.target === qrInputRef.current) {
marksInputRef.current.focus();
} else if (e.target === marksInputRef.current) {
subjectCodeInputRef.current.focus();
} else if (e.target === subjectCodeInputRef.current) {
updateRecord();
}
}
} catch (error) {}
};
return ( return (
<AntdesignLayout> <AntdesignLayout>
<Box className="d-flex justify-content-between align-items-center"> <Box className="d-flex justify-content-between align-items-center">
<Box className="d-flex flex-column gap-3 w-25"> <Box className="d-flex flex-column gap-3 w-25">
{imageName && <h5 className="text-left">ID : {imageName}</h5>} {imageName && <h5 className="text-left">ID : {imageName}</h5>}
{paramsError && <h5 className="text-left">Error Code : {paramsError}</h5>} {paramsError && (
<h5 className="text-left">Error Code : {paramsError}</h5>
)}
{paramsDegreeType ? ( {paramsDegreeType ? (
paramsDegreeType === 0 ? <h5 className="text-left">Degree Type : UG</h5> : paramsDegreeType === 0 ? (
<h5 className="text-left">Degree Type : UG</h5>
) : (
<h5 className="text-left">Degree Type : PG</h5> <h5 className="text-left">Degree Type : PG</h5>
): null} )
) : null}
<TextInputField <TextInputField
placeholder={"Barcode"} placeholder="Barcode"
value={barcode} value={barcode}
setValue={setBarcode} setValue={setBarcode}
onKeyDown={handleKeyDown}
ref={barcodeInputRef}
/> />
<TextInputField <TextInputField
placeholder={"QR Code"} placeholder="QR Code"
value={qrcode} value={qrcode}
setValue={setQrcode} setValue={setQrcode}
onKeyDown={handleKeyDown}
ref={qrInputRef}
/> />
<TextInputField <TextInputField
placeholder={"Marks"} placeholder="Marks"
value={marks} value={marks}
setValue={setMarks} setValue={setMarks}
onKeyDown={handleKeyDown}
ref={marksInputRef}
/> />
<TextInputField <TextInputField
placeholder={"Subject Code"} placeholder="Subject Code"
value={subjectCode} value={subjectCode}
setValue={setSubjectCode} setValue={setSubjectCode}
onKeyDown={handleKeyDown}
ref={subjectCodeInputRef}
/> />
<Button <Button
className="bg-primary text-white rounded p-3" className="bg-primary text-white rounded p-3"
@ -289,7 +325,7 @@ const skipPage = () =>{
<Button <Button
className="bg-primary text-white rounded p-3" className="bg-primary text-white rounded p-3"
onClick={() => { onClick={() => {
skipPage() skipPage();
}} }}
> >
Skip Skip

View File

@ -0,0 +1,33 @@
import { useState, useEffect } from "react";
import { Box, Button } from "@mui/material";
import AntdesignLayout from "./AntdesignLayout";
import TextInputField from "./TextInputField";
const StudentResultsData = () => {
const [registerNumber, setRegisterNumber] = useState();
const [scannedValue, setScannedValue] = useState();
return (
<AntdesignLayout>
<Box>
<Box className="d-flex justify-content-center gap-3 flex-row">
<TextInputField
placeholder={"Register Number"}
value={registerNumber}
setValue={setRegisterNumber}
/>
<TextInputField
placeholder={"Scanned Value"}
value={scannedValue}
setValue={setScannedValue}
/>
<Box>
<Button className="bg-primary text-white p-3 rounded">Search</Button>
</Box>
</Box>
</Box>
</AntdesignLayout>
);
};
export default StudentResultsData;

View File

@ -1,10 +1,10 @@
import { Label } from "@mui/icons-material";
import { TextField, Box } from "@mui/material"; import { TextField, Box } from "@mui/material";
import React from 'react';
const TextInputField = ({ placeholder, value, setValue }) => { const TextInputField = React.forwardRef(({ placeholder, value, setValue, onKeyDown }, ref) => {
return ( return (
<Box className="d-flex flex-column"> <Box className="d-flex flex-column">
<label for="limit-input" className="text-left"> <label htmlFor="limit-input" className="text-left">
{placeholder} :- {placeholder} :-
</label> </label>
<TextField <TextField
@ -15,9 +15,11 @@ const TextInputField = ({ placeholder, value, setValue }) => {
autoComplete="off" autoComplete="off"
value={value} value={value}
onChange={(e) => setValue(e.target.value)} onChange={(e) => setValue(e.target.value)}
onKeyDown={onKeyDown}
inputRef={ref}
/> />
</Box> </Box>
); );
}; });
export default TextInputField; export default TextInputField;