latest
This commit is contained in:
parent
878444d2a9
commit
72776c2008
|
|
@ -12,7 +12,7 @@
|
|||
<title>exampaper.vidh.ai</title>
|
||||
</head>
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
32
src/App.jsx
32
src/App.jsx
|
|
@ -21,17 +21,18 @@ import RecordEditor from "./Components/RecordEditor";
|
|||
import VerifyMarks from "./Components/VerifyMarks";
|
||||
import QueryCardEditor from "./Components/QueryCardEditor";
|
||||
import AnomolyPartC from "./Components/AnomolyPartC";
|
||||
import BarcodeScanner from "./Components/BarcodeScanner"
|
||||
import BarcodeScanner from "./Components/BarcodeScanner";
|
||||
import EvQrcode from "./Components/EvQrcode";
|
||||
import QrcodeCardEditor from "./Components/QrCodeCardEditor";
|
||||
import StudentResultsData from "./Components/StudentsResultsData";
|
||||
import PlayGrounds from "./Components/PlayGrounds";
|
||||
import PlayGround from "./Components/PlayGround";
|
||||
import Revaluation from "./Components/Revaluation";
|
||||
import PlayGroundUpdated from "./Components/PlaygroundUpdated"
|
||||
import PlayGroundUpdated from "./Components/PlaygroundUpdated";
|
||||
import DummyDuplicates from "./Components/DummyDuplicates";
|
||||
import IndividualStudAttendence from "./Components/IndividualStudAttendence";
|
||||
|
||||
import PendingAttendenceCorrection from "./Components/PendingAttendenceCorrection";
|
||||
import QrcodeFinder from "./Components/QrcodeFinder";
|
||||
|
||||
function App() {
|
||||
return (
|
||||
|
|
@ -40,17 +41,30 @@ function App() {
|
|||
<Routes>
|
||||
<Route path="/" element={<Home />}></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="/studentsDetails" element={<StudentResultsData/>}></Route>
|
||||
<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
|
||||
path="/playground/updated/:type"
|
||||
element={<PlayGroundUpdated />}
|
||||
></Route>
|
||||
<Route
|
||||
path="/anomoly/attendence/reassigned"
|
||||
element={<AnomolyReassigned />}
|
||||
></Route>
|
||||
<Route
|
||||
path="/anomoly/attendence/pending_stud_check"
|
||||
element={<PendingAttendenceCorrection />}
|
||||
/>
|
||||
<Route
|
||||
path="/DummyDuplicates/:type"
|
||||
element={<DummyDuplicates />}
|
||||
|
|
@ -59,7 +73,10 @@ function App() {
|
|||
path="/sqlPlayground/Editor"
|
||||
element={<RecordEditor />}
|
||||
></Route>
|
||||
<Route path = "/anomoly/attendence/stud_check" element={<IndividualStudAttendence/>}></Route>
|
||||
<Route
|
||||
path="/anomoly/attendence/stud_check"
|
||||
element={<IndividualStudAttendence />}
|
||||
></Route>
|
||||
<Route
|
||||
path="/anomoly/attendence/additionalSheet"
|
||||
element={<AttendanceAdditionalSheet />}
|
||||
|
|
@ -77,6 +94,7 @@ function App() {
|
|||
path="/anomoly/attendence"
|
||||
element={<AnomolyAttendencePage />}
|
||||
></Route>
|
||||
<Route path ="/qrcodeFinder" element={<QrcodeFinder/>}></Route>
|
||||
<Route
|
||||
path="/anomoly/attendence/additionalRecord"
|
||||
element={<AttendenceAdditionalRecord />}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
import { Box } from "@mui/material";
|
||||
import HomepageCard from "./HomepageCard";
|
||||
import {useState,useEffect} from "react"
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
const AnomolyAttendencePage = () => {
|
||||
const cards = [
|
||||
{
|
||||
title: "Reassigned Serial Number Updation",
|
||||
url: "/anomoly/attendence/reassigned"
|
||||
url: "/anomoly/attendence/reassigned",
|
||||
},
|
||||
// {
|
||||
// title: "Additional Student Record Insertion",
|
||||
|
|
@ -20,8 +19,13 @@ const AnomolyAttendencePage = () =>{
|
|||
{
|
||||
title: "Individual Attendence Sheet Check",
|
||||
url: "/anomoly/attendence/stud_check",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: "Pending Attendence Correction",
|
||||
url: "/anomoly/attendence/pending_stud_check",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -37,8 +41,6 @@ const AnomolyAttendencePage = () =>{
|
|||
</Box>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
export default AnomolyAttendencePage;
|
||||
|
|
@ -3,6 +3,7 @@ import HomepageCard from "./HomepageCard";
|
|||
import {useState,useEffect} from "react"
|
||||
import Notification from "./Notification";
|
||||
|
||||
|
||||
const Home = () => {
|
||||
const cards = [
|
||||
{
|
||||
|
|
@ -33,6 +34,10 @@ const Home = () => {
|
|||
title:"SQL Playground",
|
||||
url:"/sqlPlayground"
|
||||
},
|
||||
{
|
||||
title:"QR Code Finder",
|
||||
url:"/qrcodeFinder"
|
||||
},
|
||||
{
|
||||
title:"QR Code Scanner",
|
||||
url:"/barcodeScanner"
|
||||
|
|
@ -67,7 +72,7 @@ const Home = () => {
|
|||
|
||||
return (
|
||||
<>
|
||||
<Box>
|
||||
<Box className="overflow-auto">
|
||||
<Box className="d-flex justify-content-center text-light bg-primary rounded py-3">
|
||||
<h1>Welcome to exampaper.vidh.ai</h1>
|
||||
</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