latest
This commit is contained in:
parent
878444d2a9
commit
72776c2008
|
|
@ -12,7 +12,7 @@
|
||||||
<title>exampaper.vidh.ai</title>
|
<title>exampaper.vidh.ai</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root" class="w-100 vh-100"></div>
|
<div id="root" class="w-100 vh-100 overflow-auto"></div>
|
||||||
<script type="module" src="/src/main.jsx"></script>
|
<script type="module" src="/src/main.jsx"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
48
src/App.jsx
48
src/App.jsx
|
|
@ -21,17 +21,18 @@ import RecordEditor from "./Components/RecordEditor";
|
||||||
import VerifyMarks from "./Components/VerifyMarks";
|
import VerifyMarks from "./Components/VerifyMarks";
|
||||||
import QueryCardEditor from "./Components/QueryCardEditor";
|
import QueryCardEditor from "./Components/QueryCardEditor";
|
||||||
import AnomolyPartC from "./Components/AnomolyPartC";
|
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";
|
import StudentResultsData from "./Components/StudentsResultsData";
|
||||||
import PlayGrounds from "./Components/PlayGrounds";
|
import PlayGrounds from "./Components/PlayGrounds";
|
||||||
import PlayGround from "./Components/PlayGround";
|
import PlayGround from "./Components/PlayGround";
|
||||||
import Revaluation from "./Components/Revaluation";
|
import Revaluation from "./Components/Revaluation";
|
||||||
import PlayGroundUpdated from "./Components/PlaygroundUpdated"
|
import PlayGroundUpdated from "./Components/PlaygroundUpdated";
|
||||||
import DummyDuplicates from "./Components/DummyDuplicates";
|
import DummyDuplicates from "./Components/DummyDuplicates";
|
||||||
import IndividualStudAttendence from "./Components/IndividualStudAttendence";
|
import IndividualStudAttendence from "./Components/IndividualStudAttendence";
|
||||||
|
import PendingAttendenceCorrection from "./Components/PendingAttendenceCorrection";
|
||||||
|
import QrcodeFinder from "./Components/QrcodeFinder";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -40,31 +41,47 @@ function App() {
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Home />}></Route>
|
<Route path="/" element={<Home />}></Route>
|
||||||
<Route path="/sqlPlayground" element={<QueryExecutor />}></Route>
|
<Route path="/sqlPlayground" element={<QueryExecutor />}></Route>
|
||||||
<Route path="/sqlPlayground/edit" element={<QueryCardEditor/>}></Route>
|
<Route
|
||||||
<Route path="/evQrcode/edit" element={<QrcodeCardEditor/>}></Route>
|
path="/sqlPlayground/edit"
|
||||||
<Route path="/studentsDetails" element={<StudentResultsData/>}></Route>
|
element={<QueryCardEditor />}
|
||||||
<Route path="/Playgrounds" element={<PlayGrounds/>}></Route>
|
></Route>
|
||||||
<Route path="/Playground/:type" element={<PlayGround/>}></Route>
|
<Route path="/evQrcode/edit" element={<QrcodeCardEditor />}></Route>
|
||||||
<Route path="/revaluation" element={<Revaluation/>}></Route>
|
<Route
|
||||||
<Route path="/playground/updated/:type" element={<PlayGroundUpdated/>}></Route>
|
path="/studentsDetails"
|
||||||
|
element={<StudentResultsData />}
|
||||||
|
></Route>
|
||||||
|
<Route path="/Playgrounds" element={<PlayGrounds />}></Route>
|
||||||
|
<Route path="/Playground/:type" element={<PlayGround />}></Route>
|
||||||
|
<Route path="/revaluation" element={<Revaluation />}></Route>
|
||||||
|
<Route
|
||||||
|
path="/playground/updated/:type"
|
||||||
|
element={<PlayGroundUpdated />}
|
||||||
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/anomoly/attendence/reassigned"
|
path="/anomoly/attendence/reassigned"
|
||||||
element={<AnomolyReassigned />}
|
element={<AnomolyReassigned />}
|
||||||
></Route>
|
></Route>
|
||||||
|
<Route
|
||||||
|
path="/anomoly/attendence/pending_stud_check"
|
||||||
|
element={<PendingAttendenceCorrection />}
|
||||||
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/DummyDuplicates/:type"
|
path="/DummyDuplicates/:type"
|
||||||
element={<DummyDuplicates/>}
|
element={<DummyDuplicates />}
|
||||||
></Route>
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/sqlPlayground/Editor"
|
path="/sqlPlayground/Editor"
|
||||||
element={<RecordEditor />}
|
element={<RecordEditor />}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path = "/anomoly/attendence/stud_check" element={<IndividualStudAttendence/>}></Route>
|
<Route
|
||||||
|
path="/anomoly/attendence/stud_check"
|
||||||
|
element={<IndividualStudAttendence />}
|
||||||
|
></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/anomoly/attendence/additionalSheet"
|
path="/anomoly/attendence/additionalSheet"
|
||||||
element={<AttendanceAdditionalSheet />}
|
element={<AttendanceAdditionalSheet />}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/barcodeScanner" element={<BarcodeScanner/>}></Route>
|
<Route path="/barcodeScanner" element={<BarcodeScanner />}></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/anomoly/reassigned/booklet"
|
path="/anomoly/reassigned/booklet"
|
||||||
element={<AttendenceCorrection />}
|
element={<AttendenceCorrection />}
|
||||||
|
|
@ -77,6 +94,7 @@ function App() {
|
||||||
path="/anomoly/attendence"
|
path="/anomoly/attendence"
|
||||||
element={<AnomolyAttendencePage />}
|
element={<AnomolyAttendencePage />}
|
||||||
></Route>
|
></Route>
|
||||||
|
<Route path ="/qrcodeFinder" element={<QrcodeFinder/>}></Route>
|
||||||
<Route
|
<Route
|
||||||
path="/anomoly/attendence/additionalRecord"
|
path="/anomoly/attendence/additionalRecord"
|
||||||
element={<AttendenceAdditionalRecord />}
|
element={<AttendenceAdditionalRecord />}
|
||||||
|
|
@ -100,8 +118,8 @@ function App() {
|
||||||
path="/anomoly/partA/booklet"
|
path="/anomoly/partA/booklet"
|
||||||
element={<PartACorrection />}
|
element={<PartACorrection />}
|
||||||
></Route>
|
></Route>
|
||||||
<Route path="/anomoly/partC" element={<AnomolyPartC/>}></Route>
|
<Route path="/anomoly/partC" element={<AnomolyPartC />}></Route>
|
||||||
<Route path="/evQrcode" element={<EvQrcode/>}></Route>
|
<Route path="/evQrcode" element={<EvQrcode />}></Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
</BrowserRouter>
|
</BrowserRouter>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,12 @@
|
||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
import HomepageCard from "./HomepageCard";
|
import HomepageCard from "./HomepageCard";
|
||||||
import {useState,useEffect} from "react"
|
import { useState, useEffect } from "react";
|
||||||
|
|
||||||
|
const AnomolyAttendencePage = () => {
|
||||||
const AnomolyAttendencePage = () =>{
|
|
||||||
const cards = [
|
const cards = [
|
||||||
{
|
{
|
||||||
title: "Reassigned Serial Number Updation",
|
title: "Reassigned Serial Number Updation",
|
||||||
url: "/anomoly/attendence/reassigned"
|
url: "/anomoly/attendence/reassigned",
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: "Additional Student Record Insertion",
|
// title: "Additional Student Record Insertion",
|
||||||
|
|
@ -20,8 +19,13 @@ const AnomolyAttendencePage = () =>{
|
||||||
{
|
{
|
||||||
title: "Individual Attendence Sheet Check",
|
title: "Individual Attendence Sheet Check",
|
||||||
url: "/anomoly/attendence/stud_check",
|
url: "/anomoly/attendence/stud_check",
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
|
title: "Pending Attendence Correction",
|
||||||
|
url: "/anomoly/attendence/pending_stud_check",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
@ -37,8 +41,6 @@ const AnomolyAttendencePage = () =>{
|
||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default AnomolyAttendencePage;
|
export default AnomolyAttendencePage;
|
||||||
|
|
@ -3,6 +3,7 @@ import HomepageCard from "./HomepageCard";
|
||||||
import {useState,useEffect} from "react"
|
import {useState,useEffect} from "react"
|
||||||
import Notification from "./Notification";
|
import Notification from "./Notification";
|
||||||
|
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
const cards = [
|
const cards = [
|
||||||
{
|
{
|
||||||
|
|
@ -33,6 +34,10 @@ const Home = () => {
|
||||||
title:"SQL Playground",
|
title:"SQL Playground",
|
||||||
url:"/sqlPlayground"
|
url:"/sqlPlayground"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title:"QR Code Finder",
|
||||||
|
url:"/qrcodeFinder"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title:"QR Code Scanner",
|
title:"QR Code Scanner",
|
||||||
url:"/barcodeScanner"
|
url:"/barcodeScanner"
|
||||||
|
|
@ -67,7 +72,7 @@ const Home = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box>
|
<Box className="overflow-auto">
|
||||||
<Box className="d-flex justify-content-center text-light bg-primary rounded py-3">
|
<Box className="d-flex justify-content-center text-light bg-primary rounded py-3">
|
||||||
<h1>Welcome to exampaper.vidh.ai</h1>
|
<h1>Welcome to exampaper.vidh.ai</h1>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,325 @@
|
||||||
|
import React, { useState, useEffect } from "react";
|
||||||
|
import { Box, Button } from "@mui/material";
|
||||||
|
import AntdesignLayout from "./AntdesignLayout";
|
||||||
|
import LoadingContainer from "./LoadingContainer";
|
||||||
|
import infinity_loader from "../../assets/Infinity_loader.gif";
|
||||||
|
import Notification from "./Notification"; // Import the Notification component
|
||||||
|
import { Height } from "@mui/icons-material";
|
||||||
|
import ZoomInIcon from "@mui/icons-material/ZoomIn";
|
||||||
|
import ZoomOutIcon from "@mui/icons-material/ZoomOut";
|
||||||
|
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
||||||
|
import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
|
||||||
|
|
||||||
|
const PendingAttendenceCorrection = () => {
|
||||||
|
const [registerNumber, setRegisterNumber] = useState(null);
|
||||||
|
const [subjectCode, setSubjectCode] = useState(null);
|
||||||
|
const [attendenceSerialNo, setAttendenceSerialNo] = useState(null);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [attendenceResults, setAttendenceResults] = useState(null);
|
||||||
|
const [zoomValue, setZoomValue] = useState(950);
|
||||||
|
const [absentStatus, setAbsentStatus] = useState(-1);
|
||||||
|
const [notification, setNotification] = useState(null); // Notification state
|
||||||
|
const [type, setType] = useState(null);
|
||||||
|
const [attendenceIndex, setAttendenceIndex] = useState(0);
|
||||||
|
|
||||||
|
const showNotification = (message, type) => {
|
||||||
|
setNotification({ message, type });
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchingPendingData = async () => {
|
||||||
|
setType(1);
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const response = await fetch(
|
||||||
|
`${
|
||||||
|
import.meta.env.VITE_REACT_APP_BACKEND_URL
|
||||||
|
}/fetchPendingAttendenceData`,
|
||||||
|
{
|
||||||
|
method: "GET",
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const responseData = await response.json();
|
||||||
|
console.log("The response data ===== ", responseData);
|
||||||
|
setIsLoading(false);
|
||||||
|
if (responseData?.status === "success") {
|
||||||
|
setAttendenceResults(responseData?.attendence_results);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
console.error("Error updating student status:", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
fetchingPendingData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const updateStudentStatus = async () => {
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const payload = {
|
||||||
|
attendenceResults,
|
||||||
|
absentStatus,
|
||||||
|
attendenceSerialNo,
|
||||||
|
register_number: registerNumber,
|
||||||
|
subject_code: subjectCode,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await fetch(
|
||||||
|
`${
|
||||||
|
import.meta.env.VITE_REACT_APP_BACKEND_URL
|
||||||
|
}/updateStudentAttendenceStatus`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const responseData = await response.json();
|
||||||
|
console.log("The response data ===== ", responseData);
|
||||||
|
|
||||||
|
if (responseData?.status === "success") {
|
||||||
|
setAttendenceIndex((prev) => prev + 1);
|
||||||
|
showNotification("Record updated successfully !!", "success");
|
||||||
|
setAbsentStatus(-1)
|
||||||
|
}
|
||||||
|
setIsLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
console.error("Error updating student status:", error);
|
||||||
|
showNotification("Error updating student status", "error");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("Absent status changed ==== ", absentStatus);
|
||||||
|
if (Number(absentStatus) === 0 || Number(absentStatus) === 1) {
|
||||||
|
updateStudentStatus();
|
||||||
|
}
|
||||||
|
}, [absentStatus]);
|
||||||
|
|
||||||
|
const fetchAttendenceData = async () => {
|
||||||
|
setAbsentStatus(-1);
|
||||||
|
if (!attendenceSerialNo) {
|
||||||
|
if (!registerNumber || !subjectCode) {
|
||||||
|
showNotification(
|
||||||
|
"Registration Number && Subject Code is Mandatory !!",
|
||||||
|
"error"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (registerNumber && subjectCode) {
|
||||||
|
setType(1);
|
||||||
|
} else if (attendenceSerialNo) {
|
||||||
|
setType(2);
|
||||||
|
}
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const payload = {
|
||||||
|
registerNumber,
|
||||||
|
subjectCode,
|
||||||
|
attendenceSerialNo,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await fetch(
|
||||||
|
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchAttendenceData`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const responseData = await response.json();
|
||||||
|
console.log("response data ========= ", responseData);
|
||||||
|
setIsLoading(false);
|
||||||
|
if (responseData?.status === "success") {
|
||||||
|
setType(responseData?.type);
|
||||||
|
const modifiedResponseData = responseData?.results;
|
||||||
|
console.log("attendence response data ===== ", modifiedResponseData);
|
||||||
|
if (modifiedResponseData) {
|
||||||
|
setAttendenceResults((prevResults) => {
|
||||||
|
const newAttendenceData = [...prevResults];
|
||||||
|
newAttendenceData[attendenceIndex] = modifiedResponseData;
|
||||||
|
console.log("new attendence data ==== ", newAttendenceData);
|
||||||
|
return newAttendenceData;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
console.error("Error fetching attendance data:", error);
|
||||||
|
showNotification("Error fetching attendance data", "error");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (attendenceResults?.length > 0) {
|
||||||
|
setRegisterNumber(attendenceResults[attendenceIndex]?.register_number);
|
||||||
|
setSubjectCode(attendenceResults[attendenceIndex]?.subject_code);
|
||||||
|
}
|
||||||
|
}, [attendenceIndex, attendenceResults]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AntdesignLayout>
|
||||||
|
{/* <Box className="d-flex justify-content-center w-100 gap-3 align-items-center">
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="exampleFormControlInput1" className="form-label">
|
||||||
|
Register Number:
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control p-3"
|
||||||
|
id="exampleFormControlInput1"
|
||||||
|
placeholder="Eg : 202385510254788"
|
||||||
|
onChange={(e) => setRegisterNumber(e.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="exampleFormControlInput1" className="form-label">
|
||||||
|
Subject Code:
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control p-3"
|
||||||
|
id="exampleFormControlInput1"
|
||||||
|
placeholder="Eg : E1TL11"
|
||||||
|
onChange={(e) => setSubjectCode(e.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="exampleFormControlInput1" className="form-label">
|
||||||
|
Attendence Serial No:
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control p-3"
|
||||||
|
id="exampleFormControlInput1"
|
||||||
|
placeholder=""
|
||||||
|
onChange={(e) => setAttendenceSerialNo(e.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-primary btn-sm px-4 h-75"
|
||||||
|
onClick={fetchAttendenceData}
|
||||||
|
>
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
</Box> */}
|
||||||
|
{attendenceResults?.length > 0 && (
|
||||||
|
<Box className="d-flex justify-content-center gap-5 mx-5">
|
||||||
|
<Box className="text-left" style={{ maxWidth: "500px" }}>
|
||||||
|
{Object.keys(attendenceResults[attendenceIndex]).map(
|
||||||
|
(key, index) => (
|
||||||
|
<Box key={index}>
|
||||||
|
<strong>
|
||||||
|
{key} : {attendenceResults[attendenceIndex][key]}
|
||||||
|
</strong>
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
{type === 1 && (
|
||||||
|
<>
|
||||||
|
<Box className="d-flex gap-3 my-3">
|
||||||
|
<Button
|
||||||
|
className="btn bg-primary rounded text-white p-3"
|
||||||
|
onClick={() => setAbsentStatus(1)}
|
||||||
|
>
|
||||||
|
Mark As Absent
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className="btn bg-primary rounded text-white p-3"
|
||||||
|
onClick={() => setAbsentStatus(0)}
|
||||||
|
>
|
||||||
|
Mark As Present
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<Box className="d-flex justify-content-end">
|
||||||
|
<strong>
|
||||||
|
{attendenceIndex + 1 + " / " + attendenceResults.length}
|
||||||
|
</strong>
|
||||||
|
</Box>
|
||||||
|
<Box className="d-flex justify-content-end gap-3 my-3">
|
||||||
|
<Button
|
||||||
|
className="btn bg-primary rounded text-white p-3"
|
||||||
|
onClick={() => setZoomValue((prev) => prev + 50)}
|
||||||
|
>
|
||||||
|
<ZoomInIcon />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className="btn bg-primary rounded text-white p-3"
|
||||||
|
onClick={() => setZoomValue((prev) => prev - 50)}
|
||||||
|
>
|
||||||
|
<ZoomOutIcon />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className="btn bg-primary rounded text-white p-3"
|
||||||
|
onClick={() => {
|
||||||
|
if (attendenceIndex !== 0) {
|
||||||
|
setAttendenceIndex((prev) => prev - 1);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowBackIcon />
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
className="btn bg-primary rounded text-white p-3"
|
||||||
|
onClick={() => {
|
||||||
|
if (attendenceIndex < attendenceResults.length) {
|
||||||
|
setAttendenceIndex((prev) => prev + 1);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ArrowForwardIcon />
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
<Box
|
||||||
|
id="image-container"
|
||||||
|
className="overflow-auto d-flex flex-column"
|
||||||
|
style={{ height: `${type === 1 ? "80vh" : ""}` }}
|
||||||
|
>
|
||||||
|
{attendenceResults.length > 0 && type === 2 && (
|
||||||
|
<img
|
||||||
|
src={`https://docs.exampaper.vidh.ai/${attendenceResults[attendenceIndex]?.s3_image_path}`}
|
||||||
|
width={`${zoomValue}px`}
|
||||||
|
alt="Attendence-image"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{attendenceResults.length > 0 && type === 1 && (
|
||||||
|
<img
|
||||||
|
src={`https://docs.exampaper.vidh.ai/${attendenceResults[attendenceIndex]?.s3_path}`}
|
||||||
|
width={`${zoomValue}px`}
|
||||||
|
alt="Attendence-image"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
{attendenceResults?.length == 0 && (
|
||||||
|
<Box className="my-3">Attendence Record Not Found !!</Box>
|
||||||
|
)}
|
||||||
|
{isLoading && <LoadingContainer />}
|
||||||
|
{notification && (
|
||||||
|
<Notification
|
||||||
|
message={notification.message}
|
||||||
|
type={notification.type}
|
||||||
|
onClose={() => setNotification(null)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</AntdesignLayout>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default PendingAttendenceCorrection;
|
||||||
|
|
@ -0,0 +1,290 @@
|
||||||
|
import React, { useState, useEffect } from "react";
|
||||||
|
import { Box, Button } from "@mui/material";
|
||||||
|
import AntdesignLayout from "./AntdesignLayout";
|
||||||
|
import LoadingContainer from "./LoadingContainer";
|
||||||
|
import infinity_loader from "../../assets/Infinity_loader.gif";
|
||||||
|
import Notification from "./Notification"; // Import the Notification component
|
||||||
|
import { Height } from "@mui/icons-material";
|
||||||
|
import ZoomInIcon from "@mui/icons-material/ZoomIn";
|
||||||
|
import ZoomOutIcon from "@mui/icons-material/ZoomOut";
|
||||||
|
|
||||||
|
const QrcodeFinder = () => {
|
||||||
|
const [registerNumber, setRegisterNumber] = useState(null);
|
||||||
|
const [subjectCode, setSubjectCode] = useState(null);
|
||||||
|
const [attendenceSerialNo, setAttendenceSerialNo] = useState(null);
|
||||||
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [attendenceResults, setAttendenceResults] = useState(null);
|
||||||
|
const [zoomValue, setZoomValue] = useState(950);
|
||||||
|
const [absentStatus, setAbsentStatus] = useState(-1);
|
||||||
|
const [notification, setNotification] = useState(null); // Notification state
|
||||||
|
const [type, setType] = useState(null);
|
||||||
|
const [coverBarcode, setCoverBarcode] = useState(null);
|
||||||
|
const [pdfPath, setPdfPath] = useState(null);
|
||||||
|
const [coverInfo, setCoverInfo] = useState(null);
|
||||||
|
const [pdfData, setPdfData] = useState(null);
|
||||||
|
|
||||||
|
const showNotification = (message, type) => {
|
||||||
|
setNotification({ message, type });
|
||||||
|
};
|
||||||
|
|
||||||
|
const updateStudentStatus = async () => {
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const payload = {
|
||||||
|
attendenceResults,
|
||||||
|
absentStatus,
|
||||||
|
attendenceSerialNo,
|
||||||
|
register_number: registerNumber,
|
||||||
|
subject_code: subjectCode,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await fetch(
|
||||||
|
`${
|
||||||
|
import.meta.env.VITE_REACT_APP_BACKEND_URL
|
||||||
|
}/updateStudentAttendenceStatus`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const responseData = await response.json();
|
||||||
|
console.log("The response data ===== ", responseData);
|
||||||
|
|
||||||
|
if (responseData?.status === "success") {
|
||||||
|
fetchAttendenceData();
|
||||||
|
showNotification("Record updated successfully !!", "success");
|
||||||
|
}
|
||||||
|
setIsLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
console.error("Error updating student status:", error);
|
||||||
|
showNotification("Error updating student status", "error");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("Absent status changed ==== ", absentStatus);
|
||||||
|
if (Number(absentStatus) === 0 || Number(absentStatus) === 1) {
|
||||||
|
updateStudentStatus();
|
||||||
|
}
|
||||||
|
}, [absentStatus]);
|
||||||
|
|
||||||
|
const fetchAttendenceData = async () => {
|
||||||
|
setAbsentStatus(-1);
|
||||||
|
if (!attendenceSerialNo) {
|
||||||
|
if (!registerNumber || !subjectCode) {
|
||||||
|
showNotification(
|
||||||
|
"Registration Number && Subject Code is Mandatory !!",
|
||||||
|
"error"
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (registerNumber && subjectCode) {
|
||||||
|
setType(1);
|
||||||
|
} else if (attendenceSerialNo) {
|
||||||
|
setType(2);
|
||||||
|
}
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const payload = {
|
||||||
|
registerNumber,
|
||||||
|
subjectCode,
|
||||||
|
attendenceSerialNo,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await fetch(
|
||||||
|
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchAttendenceData`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const responseData = await response.json();
|
||||||
|
console.log("response data ========= ", responseData);
|
||||||
|
setIsLoading(false);
|
||||||
|
if (responseData?.status === "success") {
|
||||||
|
setAttendenceResults(responseData?.results);
|
||||||
|
setType(responseData?.type);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
console.error("Error fetching attendance data:", error);
|
||||||
|
showNotification("Error fetching attendance data", "error");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchCoverCodeInfo = async () => {
|
||||||
|
if (!coverBarcode && !pdfPath) {
|
||||||
|
showNotification("CoverBarcode or Pdf path is mandatory !!", "error");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setCoverInfo(null)
|
||||||
|
setPdfData(null)
|
||||||
|
setIsLoading(true);
|
||||||
|
try {
|
||||||
|
const payload = {
|
||||||
|
coverBarcode,
|
||||||
|
pdfPath,
|
||||||
|
};
|
||||||
|
|
||||||
|
const response = await fetch(
|
||||||
|
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchCoverBarcode`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const responseData = await response.json();
|
||||||
|
console.log("response data ========= ", responseData);
|
||||||
|
setIsLoading(false);
|
||||||
|
if (responseData?.status === "success") {
|
||||||
|
setCoverInfo(responseData?.ev_results);
|
||||||
|
setPdfData(responseData?.part_c_results);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
console.error("Error fetching attendance data:", error);
|
||||||
|
showNotification("Error fetching attendance data", "error");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AntdesignLayout>
|
||||||
|
<Box className="d-flex justify-content-center w-100 gap-3 align-items-center">
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="exampleFormControlInput1" className="form-label">
|
||||||
|
<strong>Cover Barcode</strong>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
className="form-control p-3"
|
||||||
|
id="exampleFormControlInput1"
|
||||||
|
placeholder="Eg : MW9898"
|
||||||
|
onChange={(e) => setCoverBarcode(e.target.value)}
|
||||||
|
style={{ width: "600px" }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="mb-3">
|
||||||
|
<label htmlFor="exampleFormControlInput1" className="form-label">
|
||||||
|
<strong>Pdf Path</strong>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
style={{ width: "600px" }}
|
||||||
|
className="form-control p-3"
|
||||||
|
id="exampleFormControlInput1"
|
||||||
|
placeholder="Eg : /datadarive/scanned_files/05-07-2024/05-07-2024/scan1/20240705195510.pdf"
|
||||||
|
onChange={(e) => setPdfPath(e.target.value)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="btn btn-primary btn-sm px-4 h-75"
|
||||||
|
onClick={fetchCoverCodeInfo}
|
||||||
|
>
|
||||||
|
Submit
|
||||||
|
</button>
|
||||||
|
</Box>
|
||||||
|
{coverInfo && coverInfo?.length === 0 && <Box>Cover Info Not Found</Box>}
|
||||||
|
<Box className="d-flex justify-content-center gap-5 p-3">
|
||||||
|
{coverInfo && coverInfo?.length > 0 && (
|
||||||
|
<Box className="text-left rounded">
|
||||||
|
<Box>
|
||||||
|
<strong>Cover Info :</strong>
|
||||||
|
</Box>
|
||||||
|
<img
|
||||||
|
src={`https://docs.exampaper.vidh.ai/${coverInfo[0]?.s3_path}`}
|
||||||
|
width={"800px"}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
<Box>
|
||||||
|
{pdfData && pdfData.length > 0 && (
|
||||||
|
<Box className="text-left">
|
||||||
|
<strong>PDF Info - </strong> {pdfData.length} Pages
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
<Box className="overflow-auto my-2 shadow" style={{ height: "70vh" }}>
|
||||||
|
{pdfData &&
|
||||||
|
pdfData.length > 0 &&
|
||||||
|
pdfData.map((data, index) => (
|
||||||
|
<Box className="shadow mb-5 d-flex flex-column justify-content-between bg-white rounded p-3 align-items-center">
|
||||||
|
<Box className="text-left">
|
||||||
|
<strong>{index + 1 + "/" + pdfData.length}</strong>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
{" "}
|
||||||
|
<img
|
||||||
|
src={`https://docs.exampaper.vidh.ai/${data?.s3_path}`}
|
||||||
|
width={"800px"}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Box className="p-5 w-100">
|
||||||
|
<table className="w-100 text-center">
|
||||||
|
<tr className="text-center">
|
||||||
|
<th>Register Number</th>
|
||||||
|
<td className="text-center">
|
||||||
|
{data?.register_number || "NULL"}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Subject Code</th>
|
||||||
|
<td className="text-center">
|
||||||
|
{data?.subject_code || "NULL"}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Marks</th>
|
||||||
|
<td className="text-center">{data?.marks || "NULL"}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Marks R1</th>
|
||||||
|
<td className="text-center">
|
||||||
|
{data?.marks_R1 || "NULL"}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Marks R2</th>
|
||||||
|
<td className="text-center">
|
||||||
|
{data?.marks_R2 || "NULL"}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Page Number</th>
|
||||||
|
<td className="text-center">
|
||||||
|
{data?.page_number || "NULL"}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
))}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
{isLoading && <LoadingContainer/>}
|
||||||
|
{notification && (
|
||||||
|
<Notification
|
||||||
|
message={notification.message}
|
||||||
|
type={notification.type}
|
||||||
|
onClose={() => setNotification(null)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</AntdesignLayout>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default QrcodeFinder;
|
||||||
Loading…
Reference in New Issue