From 33147c8b0e78c8f0fd1043c326e4df29c0e6c739 Mon Sep 17 00:00:00 2001 From: Pradeeppon01 Date: Wed, 12 Jun 2024 11:56:52 +0530 Subject: [PATCH] new ui changes --- .env | 4 +- src/App.jsx | 50 +- src/Components/AnomolyAttendencePage.jsx | 39 + src/Components/AnomolyReassigned.jsx | 6 +- src/Components/AttendenceAdditionalRecord.jsx | 286 +++++++ .../AttendenceAdditionalRecordCorrection.jsx | 708 ++++++++++++++++++ src/Components/AttendenceCorrection.jsx | 2 +- src/Components/Home.jsx | 10 +- src/Components/PartACorrection.jsx | 8 + src/Components/SimpleDialog.jsx | 23 + src/Components/TableComponent.jsx | 96 ++- 11 files changed, 1194 insertions(+), 38 deletions(-) create mode 100644 src/Components/AnomolyAttendencePage.jsx create mode 100644 src/Components/AttendenceAdditionalRecord.jsx create mode 100644 src/Components/AttendenceAdditionalRecordCorrection.jsx diff --git a/.env b/.env index d5f5fbc..f165e2c 100644 --- a/.env +++ b/.env @@ -1,4 +1,4 @@ # VITE_REACT_APP_BACKEND_URL="https://sandbox.exampaper.vidh.ai" -VITE_REACT_APP_BACKEND_URL="http://localhost:9999" +# VITE_REACT_APP_BACKEND_URL="http://localhost:9999" METABASE_BASE_URL="http://metabase.usln.in/public/question/d8774923-09bb-4cd9-903b-559d417e12cf" -# VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai" \ No newline at end of file +VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai" \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index f5f2802..8f453a6 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -12,6 +12,9 @@ import PartAReassigned from "./Components/PartAReassigned"; import PartACorrection from "./Components/PartACorrection"; import Verification from "./Components/Verification"; import Statistics from "./Components/Statistics"; +import AnomolyAttendencePage from "./Components/AnomolyAttendencePage"; +import AttendenceAdditionalRecord from "./Components/AttendenceAdditionalRecord"; +import AttendenceAdditionalRecordCorrection from "./Components/AttendenceAdditionalRecordCorrection"; function App() { return ( @@ -20,39 +23,44 @@ function App() { }> } > } - > - - } - > - + > } - > - + path="/anomoly/reassigned/stats" + element={} + > } - > - + path="/anomoly/attendence" + element={} + > + } + /> + } + /> + } + > + }> {/* } > */} - }> - } - > - + }> + } + > diff --git a/src/Components/AnomolyAttendencePage.jsx b/src/Components/AnomolyAttendencePage.jsx new file mode 100644 index 0000000..7f1dd6a --- /dev/null +++ b/src/Components/AnomolyAttendencePage.jsx @@ -0,0 +1,39 @@ +import { Box } from "@mui/material"; +import HomepageCard from "./HomepageCard"; +import {useState,useEffect} from "react" + + +const AnomolyAttendencePage = () =>{ + const cards = [ + { + title: "Reassingned Serial No", + url: "/anomoly/attendence/reassigned" + }, + { + title: "Additional Record Insertion", + url: "/anomoly/attendence/additionalRecord", + }, { + title: "Additional Sheet Insertion", + url: "/anomoly/attendence/additionalSheet", + } + ] + + return ( + <> + + +

Welcome to exampaper.vidh.ai

+
+ + {cards.map((card) => ( + + ))} + +
+ + ); +} + + + +export default AnomolyAttendencePage; \ No newline at end of file diff --git a/src/Components/AnomolyReassigned.jsx b/src/Components/AnomolyReassigned.jsx index 8fd9d1c..05fa6e9 100644 --- a/src/Components/AnomolyReassigned.jsx +++ b/src/Components/AnomolyReassigned.jsx @@ -77,7 +77,7 @@ const AnomolyReassigned = () => { const navigate = useNavigate(); function createData( attendence_serial_no, - student_slno, + answer_booklet_sno, exam_centre_code, exam_centre, student_name, @@ -86,7 +86,7 @@ const AnomolyReassigned = () => { ) { return { attendence_serial_no, - student_slno, + answer_booklet_sno, exam_centre_code, exam_centre, student_name, @@ -101,7 +101,7 @@ const AnomolyReassigned = () => { tmpData.push( createData( data.attendence_serial_no, - data.student_slno, + data.answer_booklet_sno, data.exam_centre_code, data.exam_centre, data.student_name, diff --git a/src/Components/AttendenceAdditionalRecord.jsx b/src/Components/AttendenceAdditionalRecord.jsx new file mode 100644 index 0000000..05d668b --- /dev/null +++ b/src/Components/AttendenceAdditionalRecord.jsx @@ -0,0 +1,286 @@ +import React, { useState } from "react"; +import { + DesktopOutlined, + FileOutlined, + PieChartOutlined, + TeamOutlined, + UserOutlined, +} from "@ant-design/icons"; +import { Breadcrumb, Layout, Menu, Typography, theme } from "antd"; +import BookletInput from "./BookletInput"; +import { Box, Button } from "@mui/material"; +import { useEffect } from "react"; +import TextField from "@mui/material/TextField"; +import EditButton from "./EditButton"; +import { width } from "@mui/system"; +import { ToastContainer, toast } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import { TablePagination } from "@mui/base/TablePagination"; +import TableComponent from "./TableComponent"; +import LoadingContainer from "./LoadingContainer"; +import HomeIcon from "@mui/icons-material/Home"; +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import { useNavigate } from "react-router-dom"; +import QueryStatsIcon from "@mui/icons-material/QueryStats"; +import { updateAttendenceAnomolyData } from "../redux/actions/actions"; +import { useDispatch, useSelector } from "react-redux"; + +const { Header, Content, Footer, Sider } = Layout; +function getItem(label, key, icon, children) { + return { + key, + icon, + children, + label, + }; +} + + +const items = [getItem("Reassigned Booklet No", "1", )]; + +const AttendenceAdditionalRecord = () => { + const [collapsed, setCollapsed] = useState(false); + const [anomolyData, setAnomolyData] = useState([]); + const [filteredAnomolyData,setFilterAnomolyData] = useState([]) + const [tableRowData, setTableRowData] = useState([]); + const [isLoading, setIsLoading] = useState(false); + const [windowWidth, setWindowWidth] = useState(window.innerWidth); + const [distinctExamCentreCodes,setDistinctExamCentreCodes] = useState([]) + const dispatch = useDispatch(); + const reduxAnomolyData = useSelector((state) => state.attendenceAnomolyData); + const [filterSelectedExamCentreCode,setFilterSelectedExamCentreCode] = useState("") + + // Log Redux store state + console.log("Redux store state after dispatch:", reduxAnomolyData); + + useEffect(() => { + const handleResize = () => { + setWindowWidth(window.innerWidth); + }; + + window.addEventListener("resize", handleResize); + + return () => { + window.removeEventListener("resize", handleResize); + }; + }, []); + + useEffect(() => { + if (windowWidth < 800) { + setCollapsed(true); + } + if (windowWidth > 800) { + setCollapsed(false); + } + }, [windowWidth]); + + const navigate = useNavigate(); + function createData( + qrcode, + coverA, + coverB, + subject_code, + total_students, + total_present, + total_absent + ) { + return { + qrcode, + coverA, + coverB, + subject_code, + total_students, + total_present, + total_absent + }; + } + + useEffect(()=>{ + const tmpData = []; + for (const data of anomolyData) { + tmpData.push( + createData( + data.qrcode, + data.coverA, + data.coverB, + data.subject_code, + data.total_students, + data.total_present, + data.total_absent + ) + ); + } + console.log("Tmp data is : ", tmpData); + if (tmpData.length > 0) { + setTableRowData(tmpData); + } + },[anomolyData]) + + const fetchAnomalyData = () => { + console.log("Fetching......."); + setIsLoading(true); + fetch( + `${ + import.meta.env.VITE_REACT_APP_BACKEND_URL + }/fetchAnamolyAttendencAdditionalRecordeData`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + } + ) + .then((response) => { + console.log("Response fetched.."); + return response.json(); + }) + .then((responseData) => { + console.log("Response Data is : ", responseData); + setIsLoading(false); + if (responseData.status === "success") { + setAnomolyData(responseData?.data); + const tmpExamCentreCodes = []; + const distinctExamCentreCodesSet = new Set(distinctExamCentreCodes); + + for (var data of responseData?.data) { + if (!distinctExamCentreCodesSet.has(data.exam_centre_code)) { + distinctExamCentreCodesSet.add(data.exam_centre_code); + tmpExamCentreCodes.push(data.exam_centre_code); + } + setFilterAnomolyData([...tmpExamCentreCodes]) + } + + + setDistinctExamCentreCodes([...distinctExamCentreCodesSet]); + console.log("Tmp exam centre code: ", tmpExamCentreCodes); + + // console.log("Data to be stored in store : ", responseData?.data); + //dispatch(updateAttendenceAnomolyData(responseData?.data)); + } + }) + .catch((error) => { + console.error("Error fetching data: ", error); + setIsLoading(false); + }); + }; + + useEffect(() => { + if (reduxAnomolyData.length > 0) { + console.log("Redux anomoly data found") + setAnomolyData(reduxAnomolyData) + } else { + console.log("Redux anomoly data not found") + fetchAnomalyData(); + } + }, []); + + + useEffect(()=>{ + const tmpData = [] + for(var data in anomolyData){ + if(data?.exam_centre_code == filterSelectedExamCentreCode){ + tmpData.push(data) + } + } + + },[filterSelectedExamCentreCode]) + + + + const { + token: { colorBgContainer, borderRadiusLG }, + } = theme.useToken(); + + return ( + + + setCollapsed(value)} + > +
+ + + +
+ + + + + + + +
+ + + + {tableRowData.length > 0 && ( + + )} + {tableRowData.length == 0 && ( + +
No Data Found !!
+
+ )} +
+
+
+
+ exampaper.vidh.ai ©{new Date().getFullYear()} +
+
+ {isLoading && } + + ); +}; +export default AttendenceAdditionalRecord; diff --git a/src/Components/AttendenceAdditionalRecordCorrection.jsx b/src/Components/AttendenceAdditionalRecordCorrection.jsx new file mode 100644 index 0000000..e59db86 --- /dev/null +++ b/src/Components/AttendenceAdditionalRecordCorrection.jsx @@ -0,0 +1,708 @@ +import React, { useState } from "react"; +import { + DesktopOutlined, + FileOutlined, + PieChartOutlined, + TeamOutlined, + UserOutlined, +} from "@ant-design/icons"; +import { Breadcrumb, Layout, Menu, Typography, theme } from "antd"; +import BookletInput from "./BookletInput"; +import { Box, Button } from "@mui/material"; +import { useEffect } from "react"; +import TextField from "@mui/material/TextField"; +import EditButton from "./EditButton"; +import { width } from "@mui/system"; +import { ToastContainer, toast } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; +import { useSearchParams } from "react-router-dom"; +import LoadingContainer from "./LoadingContainer"; +import HomeIcon from "@mui/icons-material/Home"; +import ArrowBackIcon from "@mui/icons-material/ArrowBack"; +import { useNavigate } from "react-router-dom"; +import QueryStatsIcon from "@mui/icons-material/QueryStats"; +import { useDispatch, useSelector } from "react-redux"; +import { updateAttendenceAnomolyData } from "../redux/actions/actions"; +import RotateLeftIcon from "@mui/icons-material/RotateLeft"; +import RotateRightIcon from "@mui/icons-material/RotateRight"; + +const { Header, Content, Footer, Sider } = Layout; +function getItem(label, key, icon, children) { + return { + key, + icon, + children, + label, + }; +} + +const items = [getItem("Reassigned Booklet No", "1", )]; + +const AttendenceAdditionalRecordCorrection = () => { + console.log("Checking1 ..."); + const [collapsed, setCollapsed] = useState(false); + const [bookletInput, setBookletInput] = useState(null); + const [dataFetched, setDataFetched] = useState(false); + const [studentData, setStudentData] = useState(null); + const [updateReassigned, setUpdateReassigned] = useState(false); + const [reasssingedSno, setReassignedSno] = useState(null); + const [isLoading, setIsLoading] = useState(false); + const [registerNumber, setRegisterNumber] = useState(null); + const [backgroundPosition, setBackgroundPosition] = useState("0% 0%"); + const [zoomed, setZoomed] = useState(false); + const dispatch = useDispatch(); + const [scaleWidthValue, setScaleWidthValue] = useState(80); + const [rotateValue, setRotateValue] = useState(0); + const [attendenceQRcode,setAttendenceQRcode] = useState(null) + + // const reduxAnomolyData = useSelector((state) => state.attendenceAnomolyData); + // console.log("Anomoly Data is : ", reduxAnomolyData); + const [anomolyData, setAnomolyData] = useState([]); + + const handleMouseMove = (e) => { + const { left, top, width, height } = e.target.getBoundingClientRect(); + const x = ((e.pageX - left) / width) * 100; + const y = ((e.pageY - top) / height) * 100; + setBackgroundPosition(`${x}% ${y}%`); + setZoomed(true); + }; + + const navigate = useNavigate(); + let [searchParams, setSearchParams] = useSearchParams(); + const searchParamsqrcode = searchParams.get("qrcode"); + // console.log("Serach parmas sno : ", searchParamsBookletSerialNo); + const [windowWidth, setWindowWidth] = useState(window.innerWidth); + + useEffect(() => { + const handleResize = () => { + setWindowWidth(window.innerWidth); + }; + + window.addEventListener("resize", handleResize); + + return () => { + window.removeEventListener("resize", handleResize); + }; + }, []); + + useEffect(() => { + if (windowWidth < 800) { + setCollapsed(true); + } + if (windowWidth > 800) { + setCollapsed(false); + } + }, [windowWidth]); + + useEffect(() => { + if (searchParamsqrcode) { + setAttendenceQRcode(searchParamsqrcode); + } + }, [searchParamsqrcode]); + + useEffect(() => { + submitQrInputData(); + }, [attendenceQRcode]); + + const { + token: { colorBgContainer, borderRadiusLG }, + } = theme.useToken(); + + // useEffect(() => { + // if (reduxAnomolyData.length === 0) { + // fetchAnomalyData(); + // } + // }, []); + + const fetchAnomalyData = () => { + console.log("Fetching......."); + setIsLoading(true); + fetch( + `${ + import.meta.env.VITE_REACT_APP_BACKEND_URL + }/fetchAnamolyAttendenceData`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + } + ) + .then((response) => { + console.log("Response fetched.."); + return response.json(); + }) + .then((responseData) => { + console.log("Response Data is : ", responseData); + setIsLoading(false); + if (responseData.status === "success") { + setAnomolyData(responseData?.data); + console.log("Data to be stored in store : ", responseData?.data); + // dispatch(updateAttendenceAnomolyData(responseData?.data)); + } + }) + .catch((error) => { + console.error("Error fetching data: ", error); + setIsLoading(false); + }); + }; + + const submitQrInputData = async () => { + setIsLoading(true); + setStudentData(null); + if (!bookletInput) { + console.log("Returning"); + } + const payload = { + attendenceQRcode, + }; + const response = await fetch( + `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchAttendenceAdditionalqrData`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + } + ); + const responseData = await response.json(); + console.log("Response Data is : ", responseData); + setDataFetched(true); + setIsLoading(false); + if (responseData.status === "success") { + console.log("Into top if"); + if (!responseData.data) { + setStudentData(null); + } + if (responseData.data) { + setStudentData(responseData.data[0]); + const student_data = responseData.data[0]; + setRegisterNumber(student_data?.register_number); + } + } + }; + + const url = `https://docs.exampaper.vidh.ai/${studentData?.s3_path}`; + // console.log("Url is : ", url); + const figureStyle = { + backgroundImage: `url(${url})`, + backgroundPosition: zoomed ? backgroundPosition : "center", + backgroundSize: zoomed ? "200%" : "cover", + height: "100%", // Adjust the height as needed + width: "60%", // Adjust the width as needed + border: "1px solid #ddd", + overflow: "hidden", + }; + + const ZoomInImage = () => { + console.log("Zooming In Image ...."); + const elements = document.getElementsByClassName("scanned-img"); + for (var ele of elements) { + console.log("Ele is : ", ele); + const newScaleWidthValue = scaleWidthValue + 10; + setScaleWidthValue(newScaleWidthValue); + // ele.style.transform = `scale(${newScaleValue})`; + ele.style.width = `${newScaleWidthValue}%`; + } + }; + + const ZoomOutImage = () => { + console.log("Zooming Out Image ...."); + const elements = document.getElementsByClassName("scanned-img"); + for (var ele of elements) { + console.log("Ele is : ", ele); + const newScaleWidthValue = scaleWidthValue - 10; + setScaleWidthValue(newScaleWidthValue); + // ele.style.transform = `scale(${newScaleValue})`; + ele.style.width = `${newScaleWidthValue}%`; + } + }; + + const RotateImageLeft = () => { + const elements = document.getElementsByClassName("scanned-img"); + for (var ele of elements) { + console.log("Ele is : ", ele); + const newRotateValue = rotateValue - 90; + setRotateValue(newRotateValue); + ele.style.transform = `rotate(${newRotateValue}deg)`; + } + }; + + const RotateImageRight = () => { + const elements = document.getElementsByClassName("scanned-img"); + for (var ele of elements) { + console.log("Ele is : ", ele); + const newRotateValue = rotateValue + 90; + setRotateValue(newRotateValue); + ele.style.transform = `rotate(${newRotateValue}deg)`; + } + }; + + const ImageStyle = { + // transform: `scale(${scaleValue})`, + transformOrigin: "left", // Adjust the zoom origin as needed + transition: "transform 0.2s ease-in-out", + }; + + const containerStyle = { + width: "auto", // Set the width and height as needed + maxHeight: "90%", + overflowX: "scroll", + position: "relative", + }; + + const handleMouseLeave = () => { + setBackgroundPosition("0% 0%"); + setZoomed(false); + }; + + const updateReassignedSno = async () => { + setIsLoading(true); + // if(reduxAnomolyData.length === 0){ + // console.log("Redux anomoly data length is 0.......") + // fetchAnomalyData() + // } + console.log("Reassgined Sno : ", reasssingedSno); + const payload = { + bookletInput, + reasssingedSno, + registerNumber, + }; + const response = await fetch( + `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/updateReassingedSno`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + } + ); + const responseData = await response.json(); + setIsLoading(false); + setReassignedSno(null); + if (responseData.status === "success" && responseData?.status_code == 200) { + console.log("Updation success"); + toast.success("Record Updated Successfully !!"); + var index = 0 + var RecordIndex = 0 + const filteredData = reduxAnomolyData.filter((data) => { + if (data?.student_slno === searchParamsBookletSerialNo) { + RecordIndex = index + console.log("data matched : ", data); + return false; // Return false to remove the matched item + } + index += 1 + return true; // Keep the unmatched items + }); + + console.log("Filtered Data: ", filteredData); + // dispatch(updateAttendenceAnomolyData(filteredData)); + if (filteredData.length > 0) { + navigate( + `/anomoly/reassigned/booklet?sno=${filteredData[RecordIndex].student_slno}` + ); + } + } else if ( + responseData.status === "success" && + responseData?.status_code == 405 + ) { + console.log("Updation not allowed"); + toast.error("Reassigned Serial No is Invalid !!"); + } + }; + + const markAsAssigned = async () => { + setIsLoading(true); + const payload = { bookletInput }; + const response = await fetch( + `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/markAsAssigned`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + } + ); + const responseData = await response.json(); + setIsLoading(false); + if (responseData.status === "success") { + toast.success("Record Updated Successfully !!"); + var index = 0 + var RecordIndex = 0 + const filteredData = reduxAnomolyData.filter((data) => { + if (data?.student_slno === searchParamsBookletSerialNo) { + RecordIndex = index + console.log("data matched : ", data); + return false; // Return false to remove the matched item + } + index += 1 + return true; // Keep the unmatched items + }); + + console.log("Filtered Data: ", filteredData); + // dispatch(updateAttendenceAnomolyData(filteredData)); + if (filteredData.length > 0) { + navigate( + `/anomoly/reassigned/booklet?sno=${filteredData[RecordIndex].student_slno}` + ); + } + } + }; + + return ( + + + setCollapsed(value)} + > +
+ + + +
+ + + + + + + + {/* Reassigned Booklet Serial Manual Updation : */} +
+ + {/* + User + Bill + */} + {/*
+ Bill is a cat. +
*/} + + + + {/* */} + + {/* */} + + {/* {!isLoading && !studentData && ( + +
Invalid Booklet Serial No !!
+
+ )} */} + {studentData && ( + <> + + +
+ Booklet Info: +
+
+ + + + +
{bookletInput}
+
+ + +
{studentData?.student_name}
+
+ + +
{studentData?.exam_centre_code}
+
+ + +
{studentData.exam_centre}
+
+ + +
{studentData?.exam_date}
+
+ + + + { + setReassignedSno(e.target.value); + }} + /> + + + + + + +
+
+ + )} +
+ + {/* {!isLoading && !studentData && ( + +
Invalid Booklet Serial No !!
+
+ )} */} + {studentData && ( + <> + + +
+ Booklet Info: +
+
+ + + + +
{bookletInput}
+
+ + +
{studentData?.student_name}
+
+ + +
{studentData?.exam_centre_code}
+
+ + +
{studentData.exam_centre}
+
+ + +
{studentData?.exam_date}
+
+ + + + { + setReassignedSno(e.target.value); + }} + /> + + + + + + +
+
+ + )} +
+ + {studentData && ( + <> + + + + + + + + + )} + + + {studentData && ( + <> + + + + + + + + + )} + +
+
+
+ exampaper.vidh.ai ©{new Date().getFullYear()} +
+
+ {isLoading && } + + ); +}; +export default AttendenceAdditionalRecordCorrection; diff --git a/src/Components/AttendenceCorrection.jsx b/src/Components/AttendenceCorrection.jsx index ea961ff..050376c 100644 --- a/src/Components/AttendenceCorrection.jsx +++ b/src/Components/AttendenceCorrection.jsx @@ -80,7 +80,7 @@ const AttendenceCorrection = () => { const navigate = useNavigate(); let [searchParams, setSearchParams] = useSearchParams(); const searchParamsBookletSerialNo = searchParams.get("sno"); - // console.log("Serach parmas sno : ", searchParamsBookletSerialNo); + console.log("Serach parmas sno : ", searchParamsBookletSerialNo); const [windowWidth, setWindowWidth] = useState(window.innerWidth); useEffect(() => { diff --git a/src/Components/Home.jsx b/src/Components/Home.jsx index f9e7866..85825a9 100644 --- a/src/Components/Home.jsx +++ b/src/Components/Home.jsx @@ -6,7 +6,7 @@ const Home = () => { const cards = [ { title: "Reassingned Serial No Anomoly Manual Updation", - url: "/anomoly/reassigned", + url: "/anomoly/attendence", }, // { // title: "Part A OCR Anomoly - Batch 2022", @@ -24,10 +24,10 @@ const Home = () => { // title:"Verification", // url:"/verification" // } - { - title:"Statistics", - url:"/statistics" - } + // { + // title:"Statistics", + // url:"/statistics" + // } ]; // const cards = [ diff --git a/src/Components/PartACorrection.jsx b/src/Components/PartACorrection.jsx index 8a01bcd..8debf34 100644 --- a/src/Components/PartACorrection.jsx +++ b/src/Components/PartACorrection.jsx @@ -102,6 +102,10 @@ const PartACorrection = () => { const subjectCodeInputRef = useRef(null); + const examcentreCodeInputRef = useRef(null); + const examDateInputRef = useRef(null); + const studentNameInputRef = useRef(null); + const bookletInputRef = useRef(null); // Handle the Enter key press in the register number input const handleRegisterNumberKeyDown = (e) => { @@ -793,6 +797,7 @@ const PartACorrection = () => { id="corrected-register-number-input" className="w-100" value={correctedExamCentreCode} + inputRef={examcentreCodeInputRef} autoComplete="off" onChange={(e) => { setCorrectedExamCentreCode( @@ -812,6 +817,7 @@ const PartACorrection = () => { className="w-100" value={correctedExamDate} autoComplete="off" + inputRef = {examDateInputRef} onChange={(e) => { setCorrectedExamDate(e.target.value); }} @@ -828,6 +834,7 @@ const PartACorrection = () => { id="corrected-register-number-input" className="w-100" value={correctedCandidateName} + inputRef = {studentNameInputRef} autoComplete="off" onChange={(e) => { setCorrectedCandidateName(e.target.value); @@ -845,6 +852,7 @@ const PartACorrection = () => { id="corrected-register-number-input" className="w-100" value={correctedSerialNo} + inputRef={bookletInputRef} autoComplete="off" onChange={(e) => { setCorrectedSerialNo(e.target.value); diff --git a/src/Components/SimpleDialog.jsx b/src/Components/SimpleDialog.jsx index 786f612..414bcc0 100644 --- a/src/Components/SimpleDialog.jsx +++ b/src/Components/SimpleDialog.jsx @@ -37,6 +37,29 @@ const SimpleDialog = ({dialogBoxConsent,setDialogBoxConsent,showDialogBox,setSh setShowDialogBox(false) } + + const handleKeyPress = (event) => { + if (event.key === 'n' || event.key === 'N') { + console.log('The "N" key was pressed!'); + handleNo() + }else if(event.key === "Y" || event.key === "y"){ + console.log("Y is pressed") + handleYes() + } + }; + + + + // Use useEffect to add the event listener + useEffect(() => { + window.addEventListener('keydown', handleKeyPress); + return () => { + window.removeEventListener('keydown', handleKeyPress); + }; + }, []); + + + useEffect(()=>{ if(examCentreCode && examDate){ setMetaDataLink(`http://metabase.usln.in/public/question/d8774923-09bb-4cd9-903b-559d417e12cf?internal_exam_centre_code=${examCentreCode}&ref_exam_date=${examDate}`) diff --git a/src/Components/TableComponent.jsx b/src/Components/TableComponent.jsx index 0eb45ae..920df01 100644 --- a/src/Components/TableComponent.jsx +++ b/src/Components/TableComponent.jsx @@ -18,7 +18,7 @@ export default function TableComponent({ rows, type, distinctExamCentreCodes, - batchType + batchType, }) { // console.log("Exam centre code in table component : ",distinctExamCentreCodes) console.log("Rows in table component : ", rows); @@ -90,9 +90,9 @@ export default function TableComponent({ {row.attendence_serial_no} - {row.student_slno} + {row.answer_booklet_sno} @@ -301,13 +301,15 @@ export default function TableComponent({ : rows ).map((row) => ( - - + + {row?.s3_path} - {row.barcode} + {row.barcode} {row.subject_code} @@ -351,6 +353,88 @@ export default function TableComponent({ )} + {type === "AttendenceAdditionalRecord" && ( + <> +
Part-A Anomoly Data :
+ + + + + + + + + + + + + + {(rowsPerPage > 0 + ? rows.slice( + page * rowsPerPage, + page * rowsPerPage + rowsPerPage + ) + : rows + ).map((row) => ( + + + + + + + + + + ))} + {emptyRows > 0 && ( + + + )} + + + + + + +
qrcodeCover ACover BSubject CodeTotal StudentsTotal PresentTotal Absent
+ + {row?.qrcode} + + + {row.coverA} + + {row.coverB} + + {row.subject_code} + + {row.total_students} + + {row.total_present} + + {row.total_absent} +
+
+ + )} ); }