diff --git a/.env b/.env
index 8c63c48..d5f5fbc 100644
--- a/.env
+++ b/.env
@@ -1 +1,4 @@
+# VITE_REACT_APP_BACKEND_URL="https://sandbox.exampaper.vidh.ai"
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
diff --git a/.gitignore b/.gitignore
index a547bf3..6c92f0b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,7 @@ node_modules
dist
dist-ssr
*.local
+*.zip
# Editor directories and files
.vscode/*
diff --git a/dist_jun11.zip b/dist_jun11.zip
new file mode 100644
index 0000000..cdcb553
Binary files /dev/null and b/dist_jun11.zip differ
diff --git a/dist_jun9.zip b/dist_jun9.zip
new file mode 100644
index 0000000..96d33dd
Binary files /dev/null and b/dist_jun9.zip differ
diff --git a/package-lock.json b/package-lock.json
index 363a25c..0fd7523 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18,8 +18,12 @@
"react": "^18.2.0",
"react-bootstrap": "^2.10.2",
"react-dom": "^18.2.0",
+ "react-medium-image-zoom": "^5.2.4",
+ "react-redux": "^9.1.2",
"react-router-dom": "^6.23.1",
- "react-toastify": "^10.0.5"
+ "react-toastify": "^10.0.5",
+ "react-zoom-pan-pinch": "^3.4.4",
+ "redux": "^5.0.1"
},
"devDependencies": {
"@types/react": "^18.2.66",
@@ -1961,6 +1965,11 @@
"@types/react": "*"
}
},
+ "node_modules/@types/use-sync-external-store": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz",
+ "integrity": "sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA=="
+ },
"node_modules/@types/warning": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.3.tgz",
@@ -5175,6 +5184,43 @@
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
},
+ "node_modules/react-medium-image-zoom": {
+ "version": "5.2.4",
+ "resolved": "https://registry.npmjs.org/react-medium-image-zoom/-/react-medium-image-zoom-5.2.4.tgz",
+ "integrity": "sha512-XLu/fLqpbmhiDAGA6yie78tDv4kh8GxvS7kKQArSOvCvm5zvgItoh4h01NAAvnezQ60ovsTeedHiHG3eG9CcGg==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/rpearce"
+ }
+ ],
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
+ "node_modules/react-redux": {
+ "version": "9.1.2",
+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.2.tgz",
+ "integrity": "sha512-0OA4dhM1W48l3uzmv6B7TXPCGmokUU4p1M44DGN2/D9a1FjVPukVjER1PcPX97jIg6aUeLq1XJo1IpfbgULn0w==",
+ "dependencies": {
+ "@types/use-sync-external-store": "^0.0.3",
+ "use-sync-external-store": "^1.0.0"
+ },
+ "peerDependencies": {
+ "@types/react": "^18.2.25",
+ "react": "^18.0",
+ "redux": "^5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "redux": {
+ "optional": true
+ }
+ }
+ },
"node_modules/react-refresh": {
"version": "0.14.2",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz",
@@ -5241,6 +5287,24 @@
"react-dom": ">=16.6.0"
}
},
+ "node_modules/react-zoom-pan-pinch": {
+ "version": "3.4.4",
+ "resolved": "https://registry.npmjs.org/react-zoom-pan-pinch/-/react-zoom-pan-pinch-3.4.4.tgz",
+ "integrity": "sha512-lGTu7D9lQpYEQ6sH+NSlLA7gicgKRW8j+D/4HO1AbSV2POvKRFzdWQ8eI0r3xmOsl4dYQcY+teV6MhULeg1xBw==",
+ "engines": {
+ "node": ">=8",
+ "npm": ">=5"
+ },
+ "peerDependencies": {
+ "react": "*",
+ "react-dom": "*"
+ }
+ },
+ "node_modules/redux": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
+ "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="
+ },
"node_modules/reflect.getprototypeof": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz",
@@ -5874,6 +5938,14 @@
"punycode": "^2.1.0"
}
},
+ "node_modules/use-sync-external-store": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz",
+ "integrity": "sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw==",
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/vite": {
"version": "5.2.11",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz",
@@ -7312,6 +7384,11 @@
"@types/react": "*"
}
},
+ "@types/use-sync-external-store": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz",
+ "integrity": "sha512-EwmlvuaxPNej9+T4v5AuBPJa2x2UOJVdjCtDHgcDqitUeOtjnJKJ+apYjVcAoBEMjKW1VVFGZLUb5+qqa09XFA=="
+ },
"@types/warning": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.3.tgz",
@@ -9599,6 +9676,21 @@
"resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz",
"integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA=="
},
+ "react-medium-image-zoom": {
+ "version": "5.2.4",
+ "resolved": "https://registry.npmjs.org/react-medium-image-zoom/-/react-medium-image-zoom-5.2.4.tgz",
+ "integrity": "sha512-XLu/fLqpbmhiDAGA6yie78tDv4kh8GxvS7kKQArSOvCvm5zvgItoh4h01NAAvnezQ60ovsTeedHiHG3eG9CcGg==",
+ "requires": {}
+ },
+ "react-redux": {
+ "version": "9.1.2",
+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.1.2.tgz",
+ "integrity": "sha512-0OA4dhM1W48l3uzmv6B7TXPCGmokUU4p1M44DGN2/D9a1FjVPukVjER1PcPX97jIg6aUeLq1XJo1IpfbgULn0w==",
+ "requires": {
+ "@types/use-sync-external-store": "^0.0.3",
+ "use-sync-external-store": "^1.0.0"
+ }
+ },
"react-refresh": {
"version": "0.14.2",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz",
@@ -9641,6 +9733,17 @@
"prop-types": "^15.6.2"
}
},
+ "react-zoom-pan-pinch": {
+ "version": "3.4.4",
+ "resolved": "https://registry.npmjs.org/react-zoom-pan-pinch/-/react-zoom-pan-pinch-3.4.4.tgz",
+ "integrity": "sha512-lGTu7D9lQpYEQ6sH+NSlLA7gicgKRW8j+D/4HO1AbSV2POvKRFzdWQ8eI0r3xmOsl4dYQcY+teV6MhULeg1xBw==",
+ "requires": {}
+ },
+ "redux": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
+ "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w=="
+ },
"reflect.getprototypeof": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz",
@@ -10080,6 +10183,12 @@
"punycode": "^2.1.0"
}
},
+ "use-sync-external-store": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.2.tgz",
+ "integrity": "sha512-PElTlVMwpblvbNqQ82d2n6RjStvdSoNe9FG28kNfz3WiXilJm4DdNkEzRhCZuIDwY8U08WVihhGR5iRqAwfDiw==",
+ "requires": {}
+ },
"vite": {
"version": "5.2.11",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.2.11.tgz",
diff --git a/package.json b/package.json
index 3172717..614dec1 100644
--- a/package.json
+++ b/package.json
@@ -20,8 +20,12 @@
"react": "^18.2.0",
"react-bootstrap": "^2.10.2",
"react-dom": "^18.2.0",
+ "react-medium-image-zoom": "^5.2.4",
+ "react-redux": "^9.1.2",
"react-router-dom": "^6.23.1",
- "react-toastify": "^10.0.5"
+ "react-toastify": "^10.0.5",
+ "react-zoom-pan-pinch": "^3.4.4",
+ "redux": "^5.0.1"
},
"devDependencies": {
"@types/react": "^18.2.66",
diff --git a/src/App.jsx b/src/App.jsx
index 3849169..f5f2802 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -10,6 +10,8 @@ import ReassignedStats from "./Components/ReassignedStats";
import IndividualExamCentreStats from "./Components/IndividualExamCentreStats";
import PartAReassigned from "./Components/PartAReassigned";
import PartACorrection from "./Components/PartACorrection";
+import Verification from "./Components/Verification";
+import Statistics from "./Components/Statistics";
function App() {
return (
@@ -36,15 +38,21 @@ function App() {
element={}
>
- {/* }
>
+ {/* }
+ >
+ */}
+ }>
}
>
- */}
+
>
diff --git a/src/Components/AnomolyReassigned.jsx b/src/Components/AnomolyReassigned.jsx
index 6b4fc5f..8fd9d1c 100644
--- a/src/Components/AnomolyReassigned.jsx
+++ b/src/Components/AnomolyReassigned.jsx
@@ -22,6 +22,8 @@ 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) {
@@ -32,26 +34,24 @@ function getItem(label, key, icon, children) {
label,
};
}
-// const items = [
-// getItem('Option 1', '1', ),
-// getItem('Option 2', '2', ),
-// getItem('User', 'sub1', , [
-// getItem('Tom', '3'),
-// getItem('Bill', '4'),
-// getItem('Alex', '5'),
-// ]),
-// getItem('Team', 'sub2', , [getItem('Team 1', '6'), getItem('Team 2', '8')]),
-// getItem('Files', '9', ),
-// ];
+
const items = [getItem("Reassigned Booklet No", "1", )];
const AnomolyReassigned = () => {
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 = () => {
@@ -95,16 +95,41 @@ const AnomolyReassigned = () => {
};
}
+ useEffect(()=>{
+ const tmpData = [];
+ for (const data of anomolyData) {
+ tmpData.push(
+ createData(
+ data.attendence_serial_no,
+ data.student_slno,
+ data.exam_centre_code,
+ data.exam_centre,
+ data.student_name,
+ data.register_number,
+ data.reassigned_serial_no
+ )
+ );
+ }
+ 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}/fetchAnamolyAttendenceData`, {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- },
- })
+ 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();
@@ -113,25 +138,24 @@ const AnomolyReassigned = () => {
console.log("Response Data is : ", responseData);
setIsLoading(false);
if (responseData.status === "success") {
- setAnomolyData(responseData.data);
- const tmpData = [];
- for (const data of responseData.data) {
- tmpData.push(
- createData(
- data.attendence_serial_no,
- data.student_slno,
- data.exam_centre_code,
- data.exam_centre,
- data.student_name,
- data.register_number,
- data.reassigned_serial_no
- )
- );
- }
- console.log("Tmp data is : ", tmpData);
- if (tmpData.length > 0) {
- setTableRowData(tmpData);
+ 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) => {
@@ -141,10 +165,28 @@ const AnomolyReassigned = () => {
};
useEffect(() => {
- fetchAnomalyData();
+ 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();
@@ -214,10 +256,18 @@ const AnomolyReassigned = () => {
{tableRowData.length > 0 && (
)}
+ {tableRowData.length == 0 && (
+
+ No Data Found !!
+
+ )}
diff --git a/src/Components/AttendenceCorrection.jsx b/src/Components/AttendenceCorrection.jsx
index 2d54f95..ea961ff 100644
--- a/src/Components/AttendenceCorrection.jsx
+++ b/src/Components/AttendenceCorrection.jsx
@@ -17,11 +17,14 @@ 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 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 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) {
@@ -47,6 +50,7 @@ function getItem(label, key, icon, children) {
const items = [getItem("Reassigned Booklet No", "1", )];
const AttendenceCorrection = () => {
+ console.log("Checking1 ...");
const [collapsed, setCollapsed] = useState(false);
const [bookletInput, setBookletInput] = useState(null);
const [dataFetched, setDataFetched] = useState(false);
@@ -54,10 +58,29 @@ const AttendenceCorrection = () => {
const [updateReassigned, setUpdateReassigned] = useState(false);
const [reasssingedSno, setReassignedSno] = useState(null);
const [isLoading, setIsLoading] = useState(false);
- const navigate = useNavigate()
+ 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 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 searchParamsBookletSerialNo = searchParams.get("sno");
- console.log("Serach parmas sno : ", searchParamsBookletSerialNo);
+ // console.log("Serach parmas sno : ", searchParamsBookletSerialNo);
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
useEffect(() => {
@@ -65,19 +88,19 @@ const AttendenceCorrection = () => {
setWindowWidth(window.innerWidth);
};
- window.addEventListener('resize', handleResize);
+ window.addEventListener("resize", handleResize);
return () => {
- window.removeEventListener('resize', handleResize);
+ window.removeEventListener("resize", handleResize);
};
}, []);
useEffect(() => {
if (windowWidth < 800) {
- setCollapsed(true)
+ setCollapsed(true);
}
- if(windowWidth > 800){
- setCollapsed(false)
+ if (windowWidth > 800) {
+ setCollapsed(false);
}
}, [windowWidth]);
@@ -91,29 +114,68 @@ const AttendenceCorrection = () => {
submitBookletInput();
}, [bookletInput]);
-
-
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 submitBookletInput = async () => {
setIsLoading(true);
setStudentData(null);
if (!bookletInput) {
console.log("Returning");
- return;
}
const payload = {
bookletInput,
};
- const response = await fetch(`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchBookletInfo`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(payload),
- });
+ const response = await fetch(
+ `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchBookletInfo`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(payload),
+ }
+ );
const responseData = await response.json();
console.log("Response Data is : ", responseData);
setDataFetched(true);
@@ -125,26 +187,133 @@ const AttendenceCorrection = () => {
}
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 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
@@ -154,6 +323,45 @@ const AttendenceCorrection = () => {
}
};
+ 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 (
{
background: colorBgContainer,
}}
>
-
+
*/}
- {!isLoading && !studentData && (
+ {/* {!isLoading && !studentData && (
Invalid Booklet Serial No !!
- )}
- {dataFetched && studentData && (
+ )} */}
+ {studentData && (
<>
- Booklet Info:
+
+ Booklet Info:
+
-
-
-
-
-
- Exam Centre:
-
+
+ Student Name:
+
+ {studentData?.student_name}
- Exam Date:
-
+
+ Exam Center Code:
+
+ {studentData?.exam_centre_code}
+
+
+
+ Exam Centre:
+
+ {studentData.exam_centre}
+
+
+
+ Exam Date:
+
+ {studentData?.exam_date}
- Reassigned Serial No:
+ Reassigned Serial No:
{
setReassignedSno(e.target.value);
}}
/>
- {
- setUpdateReassigned(!updateReassigned);
- }}
- >
-
-
-
+
Update
+
+ Mark As Assigned
+
@@ -340,125 +542,163 @@ const AttendenceCorrection = () => {
)}
-
-
-
- Submit
-
-
- {!isLoading && !studentData && (
+ {/* {!isLoading && !studentData && (
Invalid Booklet Serial No !!
- )}
- {dataFetched && studentData && (
+ )} */}
+ {studentData && (
<>
- Booklet Info:
+
+ Booklet Info:
+
- Student Name:
-
-
-
-
- Exam Center Code:
+
+ Booklet Serial No:
-
+ {bookletInput}
- Exam Centre:
-
+
+ Student Name:
+
+ {studentData?.student_name}
- Exam Date:
-
+
+ Exam Center Code:
+
+ {studentData?.exam_centre_code}
+
+
+
+ Exam Centre:
+
+ {studentData.exam_centre}
+
+
+
+ Exam Date:
+
+ {studentData?.exam_date}
- Reassigned Serial No:
+ Reassigned Serial No:
{
setReassignedSno(e.target.value);
}}
/>
- {
- setUpdateReassigned(!updateReassigned);
- }}
- >
-
-
-
+
Update
+
+ Mark As Assigned
+
>
)}
-
- {dataFetched && studentData && (
-
+
+ {studentData && (
+ <>
+
+
+ ZoomIn
+
+
+ ZoomOut
+
+
+
+
+
+
+
+
+
+ >
)}
-
- {dataFetched && studentData && (
-
+
+ {studentData && (
+ <>
+
+
+ ZoomIn
+
+
+ ZoomOut
+
+
+
+
+
+
+
+
+
+ >
)}
diff --git a/src/Components/BarcodeInput.jsx b/src/Components/BarcodeInput.jsx
index fbc9e4b..2986dfb 100644
--- a/src/Components/BarcodeInput.jsx
+++ b/src/Components/BarcodeInput.jsx
@@ -11,6 +11,7 @@ const BarcodeInput = ({setBookletInput,setDataFetched,bookletInput}) =>{
// }}
// noValidate
autoComplete="off"
+ className = "w-100"
>
{
setBookletInput(e.target.value)
diff --git a/src/Components/BookletInput.jsx b/src/Components/BookletInput.jsx
index 7a0f6d2..6e36109 100644
--- a/src/Components/BookletInput.jsx
+++ b/src/Components/BookletInput.jsx
@@ -1,23 +1,32 @@
-import * as React from 'react';
-import Box from '@mui/material/Box';
-import TextField from '@mui/material/TextField';
+import * as React from "react";
+import Box from "@mui/material/Box";
+import TextField from "@mui/material/TextField";
-const BookletInput = ({setBookletInput,setDataFetched,bookletInput}) =>{
- return (
- :not(style)': { m: 1, width: '25ch' },
- // }}
- // noValidate
- autoComplete="off"
- >
- {
- setBookletInput(e.target.value)
- setDataFetched(false)
- }}/>
-
- );
-}
+const BookletInput = ({ setBookletInput, setDataFetched, bookletInput }) => {
+ return (
+ :not(style)': { m: 1, width: '25ch' },
+ // }}
+ // noValidate
+ className="w-100"
+ autoComplete="off"
+ >
+ {
+ setBookletInput(e.target.value);
+ setDataFetched(false);
+ }}
+ />
+
+ );
+};
-export default BookletInput;
\ No newline at end of file
+export default BookletInput;
diff --git a/src/Components/Home.jsx b/src/Components/Home.jsx
index c2bc3a0..f9e7866 100644
--- a/src/Components/Home.jsx
+++ b/src/Components/Home.jsx
@@ -1,23 +1,40 @@
import { Box } from "@mui/material";
import HomepageCard from "./HomepageCard";
-
+import {useState,useEffect} from "react"
const Home = () => {
- // const cards = [
- // {
- // title: "Reassingned Serial No Anomoly Manual Updation",
- // url: "/anomoly/reassigned",
- // },
- // {
- // title: "Part A OCR Anomoly Manual Updation",
- // url: "/anomoly/partA",
- // }
- // ];
const cards = [
{
title: "Reassingned Serial No Anomoly Manual Updation",
url: "/anomoly/reassigned",
- }]
+ },
+ // {
+ // title: "Part A OCR Anomoly - Batch 2022",
+ // url: "/anomoly/partA",
+ // },
+ {
+ title: "Part A OCR Anomoly Dummy",
+ url: "/anomoly/partA?type=new",
+ },
+ {
+ title: "Part A OCR Anomoly - Old Dummy",
+ url: "/anomoly/partA?type=old",
+ },
+ // {
+ // title:"Verification",
+ // url:"/verification"
+ // }
+ {
+ title:"Statistics",
+ url:"/statistics"
+ }
+ ];
+
+ // const cards = [
+ // {
+ // title: "Reassingned Serial No Anomoly Manual Updation",
+ // url: "/anomoly/reassigned",
+ // }]
return (
<>
diff --git a/src/Components/LoadingContainer.jsx b/src/Components/LoadingContainer.jsx
index a58e298..2af8320 100644
--- a/src/Components/LoadingContainer.jsx
+++ b/src/Components/LoadingContainer.jsx
@@ -1,17 +1,32 @@
-import React from "react";
+import React, { useEffect } from "react";
import { Box } from "@mui/material";
import Spinner from "react-bootstrap/Spinner";
const LoadingContainer = ({ loadingText }) => {
const LoadingContainerStyle = {
backgroundColor: "rgba(0,0,0,0.5)",
- overflow: "auto",
+ overflow: "hidden",
+ position: "fixed",
+ top: 0,
+ left: 0,
+ width: "100vw",
+ height: "100vh",
+ zIndex: 1000, // Ensure it appears above other content
};
+ useEffect(() => {
+ const body = document.querySelector("body");
+ body.scrollTop = 0;
+ body.style.overflow = "hidden";
+ return () => {
+ body.style.overflow = "auto";
+ };
+ }, []);
+
return (
<>
diff --git a/src/Components/PartACorrection.jsx b/src/Components/PartACorrection.jsx
index 309571f..8a01bcd 100644
--- a/src/Components/PartACorrection.jsx
+++ b/src/Components/PartACorrection.jsx
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React, { useState,useRef } from "react";
import {
DesktopOutlined,
FileOutlined,
@@ -7,8 +7,6 @@ import {
UserOutlined,
} from "@ant-design/icons";
import { Breadcrumb, Layout, Menu, Typography, theme } from "antd";
-import BookletInput from "./BookletInput";
-import BarcodeInput from "./BarcodeInput";
import { Box, Button } from "@mui/material";
import { useEffect } from "react";
import TextField from "@mui/material/TextField";
@@ -18,11 +16,20 @@ 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 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 QueryStatsIcon from "@mui/icons-material/QueryStats";
+import RotateLeftIcon from "@mui/icons-material/RotateLeft";
+import RotateRightIcon from "@mui/icons-material/RotateRight";
+import { useSelector, useDispatch } from "react-redux";
+import {
+ updatePartAanomolyData,
+ updateSystemNo,
+} from "../redux/actions/actions";
+import SimpleDialog from "./SimpleDialog";
+import SystemNumberDialog from "./SystemNumberDialog";
+import ValidationContainer from "./ValidationContainer";
const { Header, Content, Footer, Sider } = Layout;
function getItem(label, key, icon, children) {
@@ -49,72 +56,382 @@ const items = [getItem("Reassigned Booklet No", "1", )];
const PartACorrection = () => {
const [collapsed, setCollapsed] = useState(false);
- const [bookletInput, setBookletInput] = useState(null);
+ const [barcodeInput, setBarcodeInput] = 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 navigate = useNavigate()
+ const [scaleWidthValue, setScaleWidthValue] = useState(80);
+ const [rotateValue, setRotateValue] = useState(0);
+ const navigate = useNavigate();
let [searchParams, setSearchParams] = useSearchParams();
const searchParamsBarcode = searchParams.get("barcode");
- console.log("Serach parmas sno : ", searchParamsBarcode);
+ const batchType = searchParams.get("batchType");
+ const s3Path = searchParams.get("s3Path");
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
+ const [backgroundPosition, setBackgroundPosition] = useState("0% 0%");
+ const [zoomed, setZoomed] = useState(false);
+ const [correctedRegisterNo, setCorrectedRegisterNo] = useState(null);
+ const [correctedAnswerBookletNo, setCorrectedAnswerBookletNo] =
+ useState(null);
+ const [correctedSubjectCode, setCorrectedSubjectCode] = useState(null);
+ const [correctedSerialNo, setCorrectedSerialNo] = useState(null);
+ const [correctedExamDate, setCorrectedExamDate] = useState(null);
+ const [correctedCandidateName, setCorrectedCandidateName] = useState(null);
+ const [correctedExamCentreCode, setCorrectedExamCentreCode] = useState(null);
+ const [correctedBarcodeNo, setCorrectedBarcodeNo] = useState(null);
+ const [correctedSubjectTitle, setCorrectedSubjectTitle] = useState(null);
+ const [showSubjectTitleInput, setShowSubjectTitleInput] = useState(false);
+ const [showAdditionalStudentInputs, setShowAdditionalStudentInputs] =
+ useState(false);
+ const [fallbackText, setFallBackText] = useState(null);
+ const [showDialogBox, setShowDialogBox] = useState(false);
+ const [dialogBoxConsent, setDialogBoxConsent] = useState(null);
+ const [dialogText, setDialogText] = useState(null);
+ const [metaBaseSubjectLinkWithTitle, setMetaBaseSubjectLinkWithTitle] =
+ useState(null);
+ const [metaBaseSubjectLinkWithoutTitle, setMetaBaseSubjectLinkWithoutTitle] =
+ useState(null);
+ const [metaBaseRegnoLink, setMetaBaseRegnoLink] = useState(null);
+ const reduxSystemNo = useSelector((state) => state?.systemNumber);
+ const systemNo = searchParams.get("sysNo");
+ const [showSystemNoContainer, setShowSystemNoContainer] = useState(false);
+ const [validateContainerData, setValidateContainerData] = useState([]);
+ const [showValidationContainer, setShowValidationContainer] = useState(false);
+
+
+ const subjectCodeInputRef = useRef(null);
+
+ // Handle the Enter key press in the register number input
+ const handleRegisterNumberKeyDown = (e) => {
+ if (e.key === 'Enter') {
+ // Focus on the subject code input
+ const subjectCodeInput = subjectCodeInputRef.current;
+ subjectCodeInput.focus();
+ subjectCodeInput.select();
+ }
+ };
+
+
+
+ const dispatch = useDispatch();
+ useEffect(() => {
+ if (!reduxSystemNo && !systemNo) {
+ setShowSystemNoContainer(true);
+ } else {
+ dispatch(updateSystemNo(systemNo));
+ fetchAnomalyData();
+ }
+ }, [reduxSystemNo]);
+
+ useEffect(() => {
+ if (batchType === "old") {
+ setShowAdditionalStudentInputs(true);
+ }
+ }, []);
+
+ const reduxPartA2023AnomolyData = useSelector(
+ (state) => state.partABatchAnomolyData
+ );
+ // console.log("Redux partA 2023 anomoly data : ",reduxPartA2023AnomolyData)
+
+ 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);
+ };
useEffect(() => {
const handleResize = () => {
setWindowWidth(window.innerWidth);
};
- window.addEventListener('resize', handleResize);
+ window.addEventListener("resize", handleResize);
return () => {
- window.removeEventListener('resize', handleResize);
+ window.removeEventListener("resize", handleResize);
};
}, []);
useEffect(() => {
if (windowWidth < 800) {
- setCollapsed(true)
+ setCollapsed(true);
}
- if(windowWidth > 800){
- setCollapsed(false)
+ if (windowWidth > 800) {
+ setCollapsed(false);
}
}, [windowWidth]);
useEffect(() => {
if (searchParamsBarcode) {
- setBookletInput(searchParamsBarcode);
+ setBarcodeInput(searchParamsBarcode);
}
}, [searchParamsBarcode]);
useEffect(() => {
- submitBookletInput();
- }, [bookletInput]);
+ submitbarcodeInput();
+ }, [barcodeInput]);
+ const url = `https://docs.exampaper.vidh.ai/${studentData?.s3_path}`;
+ const figureStyle = {
+ backgroundImage: `url(${url})`,
+ backgroundPosition: zoomed ? backgroundPosition : "center",
+ backgroundSize: zoomed ? "200%" : "cover",
+ height: "100%", // Adjust the height as needed
+ width: "90%", // Adjust the width as needed
+ border: "1px solid #ddd",
+ overflow: "hidden",
+ };
+ const handleMouseLeave = () => {
+ setBackgroundPosition("0% 0%");
+ setZoomed(false);
+ };
+
+ function getRecordsBySystemId(records, systemId) {
+ const new_data = [];
+ for (var i = 0; i < records.length; i++) {
+ var count = i % 5;
+ if (count === systemId - 1) {
+ new_data.push(records[i]);
+ }
+ }
+ return new_data;
+ }
+
+ useEffect(() => {
+ console.log("Show additional inputs : ", showAdditionalStudentInputs);
+ }, [showAdditionalStudentInputs]);
const {
token: { colorBgContainer, borderRadiusLG },
} = theme.useToken();
- const submitBookletInput = async () => {
+ const validateData = () => {
+ setIsLoading(true);
+ try {
+ const payload = {
+ correctedRegisterNo,
+ correctedSubjectCode,
+ };
+ fetch(
+ `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/validateStudentData`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(payload),
+ }
+ )
+ .then((response) => response.json())
+ .then((responseData) => {
+ setIsLoading(false);
+ if (responseData.status === "success") {
+ setValidateContainerData(responseData?.data);
+ if ((responseData?.data).length === 0) {
+ setShowAdditionalStudentInputs(true);
+ } else {
+ if (batchType !== "old") {
+ setShowAdditionalStudentInputs(false);
+ }
+ }
+ setShowValidationContainer(true);
+ } else {
+ toast.error("Something Went Wrong !!");
+ }
+ });
+ } catch (error) {
+ throw new Error(error);
+ }
+ };
+
+ const fetchAnomalyData = () => {
+ setFallBackText(null);
+ console.log("Fetching.......");
+ setIsLoading(true);
+ fetch(
+ `${
+ import.meta.env.VITE_REACT_APP_BACKEND_URL
+ }/fetchAnamolyPartAData?type=${batchType}`,
+ {
+ 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") {
+ const systemRecords = getRecordsBySystemId(
+ responseData?.data,
+ reduxSystemNo
+ );
+ console.log("System records : ", systemRecords);
+ // setAnomolyData(systemRecords);
+ dispatch(updatePartAanomolyData(systemRecords));
+ dispatch(updatePartAanomolyData(responseData?.data));
+ if ((responseData?.data).length == 0) {
+ setFallBackText("No Data Found !!");
+ }
+ }
+ })
+ .catch((error) => {
+ console.error("Error fetching data: ", error);
+ setIsLoading(false);
+ });
+ };
+
+ useEffect(() => {
+ // console.log("12345 Useeffect called");
+ console.log("Consent is : ", dialogBoxConsent);
+ // console.log("Dialog text before if condition :: ",dialogText)
+ // console.log("showDialog Box : ",showDialogBox)
+ if (dialogBoxConsent == "No" && !showDialogBox) {
+ console.log("Consent is NO");
+ var index = 0;
+ var RecordIndex = 0;
+ var localStoragePartAanomoly = [];
+ if (batchType === "old") {
+ localStoragePartAanomoly = localStorage.getItem("part-a-old-anomoly");
+ console.log(
+ "localstorage parta anomoly : ",
+ JSON.parse(localStoragePartAanomoly)
+ );
+ if (localStoragePartAanomoly) {
+ localStoragePartAanomoly = JSON.parse(localStoragePartAanomoly);
+ }
+ } else if (batchType !== "old") {
+ localStoragePartAanomoly = localStorage.getItem("part-a-anomoly");
+ console.log(
+ "localstorage parta anomoly : ",
+ JSON.parse(localStoragePartAanomoly)
+ );
+ if (localStoragePartAanomoly) {
+ localStoragePartAanomoly = JSON.parse(localStoragePartAanomoly);
+ }
+ }
+ console.log(
+ "Length of redux data >>>>>>>>>>>>>>>>>>>>> ",
+ localStoragePartAanomoly.length
+ );
+ const filteredData = localStoragePartAanomoly.filter((data) => {
+ console.log("S3path : ", s3Path);
+ if (data?.s3_path == s3Path) {
+ 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("RecordIndex is : ", RecordIndex);
+ console.log("Lenght of filtered Data >>>>>>>>>>> ", filteredData.length);
+ console.log("Filtered Data Part A: ", filteredData);
+ dispatch(updatePartAanomolyData(filteredData));
+ if (batchType === "old") {
+ localStorage.setItem(
+ "part-a-old-anomoly",
+ JSON.stringify(filteredData)
+ );
+ } else if (batchType !== "old") {
+ localStorage.setItem("part-a-anomoly", JSON.stringify(filteredData));
+ }
+ if (filteredData.length > 0) {
+ console.log("navigating ...", filteredData[RecordIndex].s3_path);
+ setDialogBoxConsent(null);
+ const navigationLink = `/anomoly/partA/booklet?batchType=${batchType}&barcode=${filteredData[RecordIndex].barcode}&s3Path=${filteredData[RecordIndex].s3_path}&sysNo=${reduxSystemNo}`;
+ console.log("Navigation link123 : ", navigationLink);
+ // navigate(navigationLink);
+ window.location.href = navigationLink;
+ } else {
+ toast.success("All Records Are Updated ....");
+ navigate("/");
+ }
+ } else if (dialogBoxConsent == "Yes" && !showDialogBox) {
+ if (dialogText) {
+ const lowerCaseDialogText = dialogText.toLowerCase();
+ console.log("Lower case dialog text :: ", lowerCaseDialogText);
+ if (
+ lowerCaseDialogText.includes("registration") &&
+ !lowerCaseDialogText.includes("subject")
+ ) {
+ console.log("Register number not found");
+ setShowAdditionalStudentInputs(true);
+ setMetaBaseRegnoLink(
+ "https://metabase.usln.in/public/question/8f4aaf13-7cee-4378-bfb7-1635b6ae8265"
+ );
+ } else if (
+ lowerCaseDialogText.includes("registration") &&
+ lowerCaseDialogText.includes("subject")
+ ) {
+ setShowSubjectTitleInput(true);
+ setShowAdditionalStudentInputs(true);
+ console.log("Both register number and subject code not found");
+ setMetaBaseSubjectLinkWithTitle(
+ "https://metabase.usln.in/public/question/65dee651-0b18-4f07-b992-48b07d74f2c9"
+ );
+ setMetaBaseSubjectLinkWithoutTitle(
+ "https://metabase.usln.in/public/question/3175d0f2-b292-42ec-a72f-41382d442879"
+ );
+ setMetaBaseRegnoLink(
+ "https://metabase.usln.in/public/question/8f4aaf13-7cee-4378-bfb7-1635b6ae8265"
+ );
+ } else if (
+ lowerCaseDialogText.includes("subject") &&
+ !lowerCaseDialogText.includes("registration")
+ ) {
+ setShowSubjectTitleInput(true);
+ console.log("Subject Code not found");
+ setMetaBaseSubjectLinkWithTitle(
+ "https://metabase.usln.in/public/question/65dee651-0b18-4f07-b992-48b07d74f2c9"
+ );
+ setMetaBaseSubjectLinkWithoutTitle(
+ "https://metabase.usln.in/public/question/3175d0f2-b292-42ec-a72f-41382d442879"
+ );
+ }
+ }
+ const container = document.getElementById("iframe-container");
+ if (container) {
+ console.log("Container found");
+ setTimeout(function () {
+ console.log("Scrolling....");
+ container.scrollIntoView();
+ }, 1000); // 2000 milliseconds = 2 seconds
+ }
+ }
+ }, [dialogBoxConsent, setDialogBoxConsent, showDialogBox]);
+
+ const submitbarcodeInput = async () => {
setIsLoading(true);
setStudentData(null);
- if (!bookletInput) {
+ if (!barcodeInput) {
console.log("Returning");
return;
}
const payload = {
- bookletInput,
+ barcodeInput,
+ s3Path,
};
- const response = await fetch(`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchBarcodeInfo`, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(payload),
- });
+ const response = await fetch(
+ `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchBarcodeInfo`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(payload),
+ }
+ );
const responseData = await response.json();
console.log("Response Data is : ", responseData);
setDataFetched(true);
@@ -125,37 +442,186 @@ const PartACorrection = () => {
setStudentData(null);
}
if (responseData.data) {
- console.log("Students Data :",responseData.data[0])
+ console.log("Students Data :", responseData.data[0]);
setStudentData(responseData.data[0]);
+ const students_data = responseData.data[0];
+ setCorrectedRegisterNo(students_data?.register_number);
+ setCorrectedSubjectCode(students_data?.subject_code);
+ setCorrectedSerialNo(students_data?.slno);
}
}
+ if (reduxPartA2023AnomolyData.length == 0) {
+ fetchAnomalyData();
+ }
};
- const updateReassignedSno = async () => {
+ const updatePartAanomoly = async (e) => {
+ setIsLoading(true);
+ setMetaBaseRegnoLink(null);
+ setMetaBaseSubjectLinkWithTitle(null);
+ setMetaBaseSubjectLinkWithoutTitle(null);
+ const s3_path = studentData?.s3_path;
const payload = {
- bookletInput,
- reasssingedSno,
+ batchType,
+ s3_path,
+ barcodeInput,
+ correctedRegisterNo,
+ correctedSubjectCode,
+ correctedBarcodeNo,
+ correctedCandidateName,
+ correctedExamDate,
+ correctedSerialNo,
+ correctedExamCentreCode,
+ correctedSubjectTitle,
};
- 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 response = await fetch(
+ `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/updatePartAanomoly`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(payload),
+ }
+ );
const responseData = await response.json();
- if (responseData.status === "success" && responseData?.status_code == 200) {
- console.log("Updation success");
- toast.success("Record Updated Successfully !!");
- } else if (
- responseData.status === "success" &&
- responseData?.status_code == 405
+ setIsLoading(false);
+ if (
+ responseData?.status === "success" &&
+ responseData?.status_code == 200
) {
- console.log("Updation not allowed");
- toast.error("Reassigned Serial No is Invalid !!");
+ toast.success(responseData?.message);
+ var index = 0;
+ var RecordIndex = 0;
+ console.log(
+ "length of redux data >>>>>>>>>>>>>> ",
+ reduxPartA2023AnomolyData.length
+ );
+ var localStoragePartAanomoly = [];
+ if (batchType === "old") {
+ localStoragePartAanomoly = localStorage.getItem("part-a-old-anomoly");
+ console.log(
+ "localstorage parta anomoly : ",
+ JSON.parse(localStoragePartAanomoly)
+ );
+ if (localStoragePartAanomoly) {
+ localStoragePartAanomoly = JSON.parse(localStoragePartAanomoly);
+ }
+ } else if (batchType !== "old") {
+ localStoragePartAanomoly = localStorage.getItem("part-a-anomoly");
+ console.log(
+ "localstorage parta anomoly : ",
+ JSON.parse(localStoragePartAanomoly)
+ );
+ if (localStoragePartAanomoly) {
+ localStoragePartAanomoly = JSON.parse(localStoragePartAanomoly);
+ }
+ }
+ const filteredData = localStoragePartAanomoly.filter((data) => {
+ console.log("S3path : ", s3Path);
+ if (data?.s3_path == s3Path) {
+ 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("Record Index is : ", RecordIndex);
+ console.log("Filtered Data Part A: ", filteredData);
+ console.log(
+ "Filtered array length >>>>>>>>>>>>>>>>>>>> ",
+ filteredData.length
+ );
+ dispatch(updatePartAanomolyData(filteredData));
+ if (batchType === "old") {
+ localStorage.setItem(
+ "part-a-old-anomoly",
+ JSON.stringify(filteredData)
+ );
+ } else if (batchType !== "old") {
+ localStorage.setItem("part-a-anomoly", JSON.stringify(filteredData));
+ }
+ if (filteredData.length > 0) {
+ console.log("navigating ...", filteredData[RecordIndex].s3_path);
+ setDialogBoxConsent(null);
+ const navigationLink = `/anomoly/partA/booklet?batchType=${batchType}&barcode=${filteredData[RecordIndex].barcode}&s3Path=${filteredData[RecordIndex].s3_path}&sysNo=${reduxSystemNo}`;
+ console.log("Navigation link123 : ", navigationLink);
+ // navigate(navigationLink);
+ window.location.href = navigationLink;
+ } else {
+ toast.success("All Records Are Updated ....");
+ navigate("/");
+ }
+ } else if (responseData?.status_code == 500) {
+ toast.error("Something Went Wrong !!");
+ } else if (
+ responseData?.status === "success" &&
+ responseData?.status_code == 205
+ ) {
+ setShowDialogBox(true);
+
+ setDialogText(responseData?.missing_data);
}
};
+ 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 handleKeyDown = (event) => {
+ console.log("Handling key down ...");
+ if (event.key === "Enter") {
+ console.log("Enter pressed ...");
+ updatePartAanomoly(event);
+ }
+ };
+
+ const handleSystemNoChange = () => {
+ console.log("System No Change is called");
+ setShowSystemNoContainer(true);
+ };
+
return (
{
background: colorBgContainer,
}}
>
-
+ {fallbackText && {fallbackText}
}
+ {showDialogBox && (
+
+ )}
+
{
navigate(-1);
}}
>
-
- {/* {
- navigate("/anomoly/reassigned/stats");
- }}
- >
-
- */}
- {
- navigate("/");
- }}
- >
-
-
+
+ {reduxSystemNo && (
+
+ System No : {reduxSystemNo}
+
+ )}
+
+ {
+ navigate("/");
+ }}
+ >
+
+
+
- {/* Reassigned Booklet Serial Manual Updation : */}
- {/*
- User
- Bill
- */}
- {/*
- Bill is a cat.
-
*/}
-
-
-
- Submit
-
+
+
+ OCR Barcode:
+
+ {barcodeInput}
{!isLoading && !studentData && (
@@ -260,78 +713,200 @@ const PartACorrection = () => {
{dataFetched && studentData && (
<>
-
- Barcode Info:
-
-
+ {batchType != "old" && (
+
+
+ OCR Booklet No:
+
+
+ {studentData?.booklet_serial_no}
+
+
+ )}
- Register Number:
-
-
-
-
- Subject Code:
+
+ OCR Register Number:
-
+
+ {studentData?.register_number}
+
- Type:
-
+
+ OCR Subject Code:
+
+
+ {studentData?.subject_code}
+
- {/*
- Exam Date:
-
- */}
-
- Reassigned Serial No:
+
+ Type:
+
+ {studentData?.type}
+
+ {
+ <>
+ {/*
+
+ Corrected Barcode Number:
+
+
+ {
+ setCorrectedBarcodeNo(e.target.value);
+ }}
+ />
+
+ */}
+ {showSubjectTitleInput && (
+
+
+ Corrected Subject Title:
+
+
+ {
+ correctedSubjectTitle(e.target.value);
+ }}
+ />
+
+
+ )}
+ {showAdditionalStudentInputs && (
+ <>
+
+
+ Corrected Exam Centre Code:
+
+
+ {
+ setCorrectedExamCentreCode(
+ e.target.value
+ );
+ }}
+ />
+
+
+
+
+ Corrected Exam Date:
+
+
+ {
+ setCorrectedExamDate(e.target.value);
+ }}
+ placeholder="(DD-MM-YYYY)"
+ />
+
+
+
+
+ Corrected Student Name:
+
+
+ {
+ setCorrectedCandidateName(e.target.value);
+ }}
+ />
+
+
+ {batchType === "old" && (
+
+
+ Corrected Booklet Serial No:
+
+
+ {
+ setCorrectedSerialNo(e.target.value);
+ }}
+ />
+
+
+ )}
+ >
+ )}
+ >
+ }
+
+
+ Corrected Student Register Number:
{
- setReassignedSno(e.target.value);
+ setCorrectedRegisterNo(e.target.value);
}}
/>
- {
- setUpdateReassigned(!updateReassigned);
- }}
- >
-
-
-
+
+
+ Corrected Subject Code:
+
+
+ {
+ // if(correctedRegisterNo && correctedSubjectCode){
+ // validateData()
+ // }
+ // }}
+ autoComplete="off"
+ onKeyDown={handleKeyDown}
+ inputRef={subjectCodeInputRef}
+ onChange={(e) => {
+ setCorrectedSubjectCode(e.target.value);
+ }}
+ />
+
+
+
+ Validate
+
+
Update
@@ -342,19 +917,11 @@ const PartACorrection = () => {
)}
-
-
-
- Submit
-
+
+
+ Barcode:
+
+ {barcodeInput}
{!isLoading && !studentData && (
@@ -364,78 +931,181 @@ const PartACorrection = () => {
{dataFetched && studentData && (
<>
-
- Barcode Info:
-
-
- Register Number:
-
-
-
-
- Subject Code:
+
+ OCR Register Number:
-
+
+ {studentData?.register_number}
+
- Type:
-
+
+ OCR Subject Code:
+
+
+ {studentData?.subject_code}
+
- {/*
- Exam Date:
-
- */}
-
- Reassigned Serial No:
+
+ Type:
+
+ {studentData?.type}
+
+ {
+ <>
+ {/*
+
+ Corrected Barcode Number:
+
+
+ {
+ setCorrectedBarcodeNo(e.target.value);
+ }}
+ />
+
+ */}
+ {showSubjectTitleInput && (
+
+
+ Corrected Subject Title:
+
+
+ {
+ correctedSubjectTitle(e.target.value);
+ }}
+ />
+
+
+ )}
+ {showAdditionalStudentInputs && (
+ <>
+
+
+ Corrected Exam Centre Code:
+
+
+ {
+ setCorrectedExamCentreCode(
+ e.target.value
+ );
+ }}
+ />
+
+
+
+
+ Corrected Exam Date:
+
+
+ {
+ setCorrectedExamDate(e.target.value);
+ }}
+ placeholder="(DD-MM-YYYY)"
+ />
+
+
+
+
+ Corrected Student Name:
+
+
+ {
+ setCorrectedCandidateName(e.target.value);
+ }}
+ />
+
+
+
+
+ Corrected Booklet Serial No:
+
+
+ {
+ setCorrectedSerialNo(e.target.value);
+ }}
+ />
+
+
+ >
+ )}
+ >
+ }
+
+
+ Corrected Student Register Number:
{
- setReassignedSno(e.target.value);
+ setCorrectedRegisterNo(e.target.value);
}}
/>
- {
- setUpdateReassigned(!updateReassigned);
- }}
- >
-
-
-
+
+
+ Corrected Subject Code:
+
+
+ {
+ setCorrectedSubjectCode(e.target.value);
+ }}
+ />
+
+
+
+ Validate
+
+
Update
@@ -445,22 +1115,147 @@ const PartACorrection = () => {
>
)}
-
- {dataFetched && studentData && (
-
+
+ {studentData && (
+
+
+ ZoomIn
+
+
+ ZoomOut
+
+
+
+
+
+
+
+
+ )}
+ {studentData && (
+ <>
+
+
+
+
+ {metaBaseSubjectLinkWithTitle && (
+
+
+
+ )}
+ {metaBaseSubjectLinkWithoutTitle && (
+
+
+
+ )}
+ {metaBaseRegnoLink && (
+
+
+
+ )}
+
+ >
)}
-
- {dataFetched && studentData && (
-
+
+ {studentData && (
+
+
+ ZoomIn
+
+
+ ZoomOut
+
+
+
+
+
+
+
+
+ )}
+ {studentData && (
+ <>
+
+
+
+
+ {metaBaseSubjectLinkWithTitle && (
+
+
+
+ )}
+ {metaBaseSubjectLinkWithoutTitle && (
+
+
+
+ )}
+ {metaBaseRegnoLink && (
+
+
+
+ )}
+
+ >
)}
@@ -474,6 +1269,21 @@ const PartACorrection = () => {
{isLoading && }
+ {showSystemNoContainer && (
+
+ )}
+ {showValidationContainer && (
+
+ )}
);
};
diff --git a/src/Components/PartAReassigned.jsx b/src/Components/PartAReassigned.jsx
index eea1908..79e00dc 100644
--- a/src/Components/PartAReassigned.jsx
+++ b/src/Components/PartAReassigned.jsx
@@ -22,6 +22,16 @@ 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 { useSearchParams } from "react-router-dom";
+import { updatePartAanomolyData } from "../redux/actions/actions";
+import {
+ useSelector,
+ useDispatch,
+ ReactReduxContext,
+ batch,
+} from "react-redux";
+import useEnhancedEffect from "@mui/material/utils/useEnhancedEffect";
+import SystemNumberDialog from "./SystemNumberDialog";
const { Header, Content, Footer, Sider } = Layout;
function getItem(label, key, icon, children) {
@@ -32,17 +42,6 @@ function getItem(label, key, icon, children) {
label,
};
}
-// const items = [
-// getItem('Option 1', '1', ),
-// getItem('Option 2', '2', ),
-// getItem('User', 'sub1', , [
-// getItem('Tom', '3'),
-// getItem('Bill', '4'),
-// getItem('Alex', '5'),
-// ]),
-// getItem('Team', 'sub2', , [getItem('Team 1', '6'), getItem('Team 2', '8')]),
-// getItem('Files', '9', ),
-// ];
const items = [getItem("Reassigned Booklet No", "1", )];
@@ -52,6 +51,68 @@ const PartAReassigned = () => {
const [tableRowData, setTableRowData] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
+ let [searchParams, setSearchParams] = useSearchParams();
+ const [showSystemNoContainer, setShowSystemNoContainer] = useState(false);
+ const searchParamsType = searchParams.get("type");
+ const dispatch = useDispatch();
+ const reduxPartA2023AnomolyData = useSelector(
+ (state) => state?.partABatchAnomolyData
+ );
+ const reduxSystemNo = useSelector((state) => state?.systemNumber);
+ console.log("Redux partA 2023 anomoly data : ", reduxPartA2023AnomolyData);
+
+ useEffect(() => {
+ if (!reduxSystemNo) {
+ setShowSystemNoContainer(true);
+ } else {
+ let localstorageRecords;
+ // if (searchParamsType === "old") {
+ // localstorageRecords = localStorage.getItem("part-a-old-anomoly");
+ // if (localstorageRecords) {
+ // localstorageRecords = JSON.parse(localstorageRecords);
+ // }
+ // } else if (searchParamsType !== "old") {
+ // localstorageRecords = localStorage.getItem("part-a-anomoly");
+ // if (localstorageRecords) {
+ // localstorageRecords = JSON.parse(localstorageRecords);
+ // }
+ // }
+ fetchAnomalyData(reduxSystemNo)
+ // if (localstorageRecords && localstorageRecords.length > 0) {
+ // console.log(
+ // "Length of local storage records is high so aborting fetching ..."
+ // );
+ // console.log("The local storage records are ... ", localstorageRecords);
+ // setAnomolyData(localstorageRecords);
+ // dispatch(updatePartAanomolyData(localstorageRecords));
+ // const tmpData = [];
+ // for (const data of localstorageRecords) {
+ // tmpData.push(
+ // createData(
+ // data.s3_path,
+ // data.barcode,
+ // data.register_number,
+ // data.subject_code,
+ // data.type,
+ // reduxSystemNo
+ // )
+ // );
+ // }
+ // // console.log("Tmp data is : ", tmpData);
+ // if (tmpData.length > 0) {
+ // setTableRowData(tmpData);
+ // }
+ // } else {
+ // fetchAnomalyData(reduxSystemNo);
+ // }
+
+ // if(searchParamsType==="old"){
+ // const sytemData = localStorage.get("part-a-anomoly")
+ // }else if(searchParamsType !== "old"){
+ // const sytemData = localStorage.get("part-a-old-anomoly")
+ // }
+ }
+ }, [reduxSystemNo]);
useEffect(() => {
const handleResize = () => {
@@ -75,17 +136,58 @@ const PartAReassigned = () => {
}, [windowWidth]);
const navigate = useNavigate();
- function createData(barcode,register_number,subject_code,type) {
+ function createData(
+ s3_path,
+ barcode,
+ register_number,
+ subject_code,
+ type,
+ systemNo
+ ) {
return {
- barcode,register_number,subject_code,type
+ s3_path,
+ barcode,
+ register_number,
+ subject_code,
+ type,
+ systemNo,
};
}
- const fetchAnomalyData = () => {
+ const updateSystemReservationStatus = async (systemRecords) => {
+ const payload = {
+ systemRecords,
+ sysNo:reduxSystemNo
+ };
+ try {
+ fetch(
+ `${
+ import.meta.env.VITE_REACT_APP_BACKEND_URL
+ }/updateSystemReservationStatus`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(payload),
+ }
+ )
+ .then((response) => response.json())
+ .then((responseData) => {
+ console.log("response from updation : ", responseData);
+ });
+ } catch (error) {
+ throw new Error("Error in update system records : ", systemRecords);
+ }
+ };
+
+ const fetchAnomalyData = (reduxSystemNo) => {
console.log("Fetching.......");
setIsLoading(true);
fetch(
- `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchAnamolyPartAData`,
+ `${
+ import.meta.env.VITE_REACT_APP_BACKEND_URL
+ }/fetchAnamolyPartAData?type=${searchParamsType}&sysNo=${reduxSystemNo}`,
{
method: "GET",
headers: {
@@ -101,12 +203,43 @@ const PartAReassigned = () => {
console.log("Response Data is : ", responseData);
setIsLoading(false);
if (responseData.status === "success") {
- setAnomolyData(responseData.data);
- const tmpData = [];
- for (const data of responseData.data) {
- tmpData.push(createData(data.barcode,data.register_number,data.subject_code,data.type));
+ console.log("System record ====== ",responseData.systemRecord)
+ var systemRecords = responseData?.data
+ if(!responseData.systemRecord){
+ systemRecords = getRecordsBySystemId(
+ responseData?.data,
+ reduxSystemNo
+ );
}
- console.log("Tmp data is : ", tmpData);
+ updateSystemReservationStatus(systemRecords);
+ console.log("System records : ", systemRecords);
+ if (searchParamsType === "old") {
+ localStorage.setItem(
+ "part-a-old-anomoly",
+ JSON.stringify(systemRecords)
+ );
+ } else if (searchParamsType !== "old") {
+ localStorage.setItem(
+ "part-a-anomoly",
+ JSON.stringify(systemRecords)
+ );
+ }
+ setAnomolyData(systemRecords);
+ dispatch(updatePartAanomolyData(systemRecords));
+ const tmpData = [];
+ for (const data of systemRecords) {
+ tmpData.push(
+ createData(
+ data.s3_path,
+ data.barcode,
+ data.register_number,
+ data.subject_code,
+ data.type,
+ reduxSystemNo
+ )
+ );
+ }
+ // console.log("Tmp data is : ", tmpData);
if (tmpData.length > 0) {
setTableRowData(tmpData);
}
@@ -118,9 +251,29 @@ const PartAReassigned = () => {
});
};
+ // useEffect(() => {
+ // fetchAnomalyData();
+ // }, []);
+
+ function getRecordsBySystemId(records, systemId) {
+ const new_data = [];
+ for (var i = 0; i < records.length; i++) {
+ var count = i % 5;
+ if (count === systemId - 1) {
+ new_data.push(records[i]);
+ }
+ }
+ return new_data;
+ }
+
+ const handleSystemNoChange = () => {
+ console.log("System No Change is called");
+ setShowSystemNoContainer(true);
+ };
+
useEffect(() => {
- fetchAnomalyData();
- }, []);
+ console.log("System no container show status : ", showSystemNoContainer);
+ }, [showSystemNoContainer]);
const {
token: { colorBgContainer, borderRadiusLG },
@@ -171,14 +324,25 @@ const PartAReassigned = () => {
>
*/}
- {
- navigate("/");
- }}
- >
-
-
+
+ {reduxSystemNo && (
+
+ System No : {reduxSystemNo}
+
+ )}
+ {
+ navigate("/");
+ }}
+ >
+
+
+
@@ -191,10 +355,16 @@ const PartAReassigned = () => {
{tableRowData.length > 0 && (
)}
+ {tableRowData.length == 0 && (
+
+ No Data Found !!
+
+ )}
@@ -207,6 +377,12 @@ const PartAReassigned = () => {
{isLoading && }
+ {showSystemNoContainer && (
+
+ )}
);
};
diff --git a/src/Components/SimpleDialog.jsx b/src/Components/SimpleDialog.jsx
new file mode 100644
index 0000000..786f612
--- /dev/null
+++ b/src/Components/SimpleDialog.jsx
@@ -0,0 +1,86 @@
+import React, { useState,useEffect } from "react";
+import Dialog from "@mui/material/Dialog";
+import DialogContent from "@mui/material/DialogContent";
+import DialogContentText from "@mui/material/DialogContentText";
+import DialogTitle from "@mui/material/DialogTitle";
+import { Button,Box } from "@mui/material";
+import TextField from "@mui/material/TextField";
+import { NavLink,Link } from "react-router-dom";
+
+
+const SimpleDialog = ({dialogBoxConsent,setDialogBoxConsent,showDialogBox,setShowDialogBox,dialogText,batchType}) => {
+ const [open, setOpen] = useState(true); // Set open state to true by default
+ const [examCentreCode,setExamCentreCode] = useState(null)
+ const [examDate,setExamDate] = useState(null)
+ const [metaDataLink,setMetaDataLink] = useState(null)
+ const MetabaseLink = "http://metabase.usln.in/public/question/d8774923-09bb-4cd9-903b-559d417e12cf"
+ console.log("MetabaseLink : ",MetabaseLink)
+ console.log(import.meta.env)
+ const handleClose = () => {
+ setOpen(false);
+ };
+
+ const handleYes = () =>{
+ console.log("Consent is : ", dialogBoxConsent);
+ console.log("Dialog text before if condition :: ",dialogText)
+ console.log("showDialog Box : ",showDialogBox)
+ console.log("Setting Conset Yes")
+ setDialogBoxConsent("Yes")
+ setShowDialogBox(false)
+ }
+ const handleNo = () =>{
+ console.log("Consent is : ", dialogBoxConsent);
+ console.log("Dialog text before if condition :: ",dialogText)
+ console.log("showDialog Box : ",showDialogBox)
+ console.log("Setting consent NO")
+ setDialogBoxConsent("No")
+ setShowDialogBox(false)
+ }
+
+ 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}`)
+ }
+ },[examDate,examCentreCode])
+
+ return (
+
+ );
+}
+
+export default SimpleDialog;
diff --git a/src/Components/Statistics.jsx b/src/Components/Statistics.jsx
new file mode 100644
index 0000000..0972ded
--- /dev/null
+++ b/src/Components/Statistics.jsx
@@ -0,0 +1,410 @@
+import React, { useState, useRef } from "react";
+import {
+ DesktopOutlined,
+ FileOutlined,
+ PieChartOutlined,
+ TeamOutlined,
+ UserOutlined,
+} from "@ant-design/icons";
+import {
+ Breadcrumb,
+ Layout,
+ Menu,
+ Typography,
+ theme,
+ Select,
+ DatePicker,
+} from "antd";
+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 RotateLeftIcon from "@mui/icons-material/RotateLeft";
+import RotateRightIcon from "@mui/icons-material/RotateRight";
+import { useSelector, useDispatch } from "react-redux";
+import {
+ updatePartAanomolyData,
+ updateSystemNo,
+} from "../redux/actions/actions";
+import SimpleDialog from "./SimpleDialog";
+import SystemNumberDialog from "./SystemNumberDialog";
+import ValidationContainer from "./ValidationContainer";
+import { Height } from "@mui/icons-material";
+import StatsCard from "./StatsCard";
+import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
+import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
+
+const { Header, Content, Footer, Sider } = Layout;
+function getItem(label, key, icon, children) {
+ return {
+ key,
+ icon,
+ children,
+ label,
+ };
+}
+
+const Statistics = () => {
+ const navigate = useNavigate();
+ const [part, setPart] = useState(null);
+ const [collapsed, setCollapsed] = useState(false);
+ const [isLoading, setIsLoading] = useState(false);
+ const [examCentreCode, setExamCentreCode] = useState(null);
+ const [isManualVerificationNeeded, setIsManualVerificationNeeded] =
+ useState(false);
+ const [recordsData, setRecordsData] = useState([]);
+ const [isCoverPage, setIsCoverPage] = useState(false);
+ const [isBackPage, setIsBackPage] = useState(false);
+ const [totalPages, setTotalPages] = useState(0);
+ const [startDate,setStartDate] = useState(null);
+ const [endDate,setEndDate] = useState(null);
+ const [pageNumber, setPageNumber] = useState(1);
+ const [currentPageRecords, setCurrentPageRecords] = useState(0);
+ const [distinctExamCentreCodes, setDistinctExamCentreCodes] = useState([]);
+ const items = [getItem("Reassigned Booklet No", "1", )];
+ const {
+ token: { colorBgContainer, borderRadiusLG },
+ } = theme.useToken();
+ const recordsPerPage = 5;
+
+ const fetchDistinctInternalExamCentreCode = () => {
+ try {
+ fetch(
+ `${
+ import.meta.env.VITE_REACT_APP_BACKEND_URL
+ }/fetchDistinctExamCentreCodes`,
+ {
+ method: "GET",
+ }
+ )
+ .then((response) => response.json())
+ .then((responseData) => {
+ console.log("ResponseData :: ", responseData);
+ if (responseData?.status === "success") {
+ setDistinctExamCentreCodes(responseData?.results);
+ }
+ });
+ } catch (error) {
+ throw new Error(error);
+ }
+ };
+
+ useEffect(() => {
+ fetchDistinctInternalExamCentreCode();
+ }, []);
+
+ useEffect(() => {
+ console.log("Distinct exam centre codes : ", distinctExamCentreCodes);
+ }, [distinctExamCentreCodes]);
+
+ const handleBackpageChange = (e) => {
+ if (e === "yes") {
+ setIsBackPage(1);
+ } else {
+ setIsBackPage(0);
+ }
+ };
+
+ const handleManualVerificatonChange = (e) => {
+ if (e === "yes") {
+ setIsManualVerificationNeeded(1);
+ } else {
+ setIsManualVerificationNeeded(0);
+ }
+ };
+
+ const handleCoverChange = (e) => {
+ console.log("Cover change : ", e);
+ if (e === "yes") {
+ setIsCoverPage(1);
+ } else {
+ setIsCoverPage(0);
+ }
+ };
+
+ const submitStatistics = async () => {
+ setIsLoading(true);
+ const payload = {
+ examCentreCode,
+ isBackPage,
+ isCoverPage,
+ isManualVerificationNeeded,
+ part,
+ startDate,
+ endDate
+ };
+ try {
+ const responseData = await fetch(
+ `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/fetchStatsData`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(payload),
+ }
+ );
+ setIsLoading(false);
+ const response = await responseData.json();
+ console.log("Response data in fetchStatsdata : ", response);
+ if (response?.status === "success") {
+ setRecordsData(response?.results);
+ if (response.results !== 0) {
+ setTotalPages(Math.ceil(response?.results.length / recordsPerPage));
+ const startIndex = (pageNumber - 1) * recordsPerPage;
+ const endIndex = startIndex + recordsPerPage;
+ const newRecords = response.results.splice(startIndex, endIndex);
+ setCurrentPageRecords(newRecords);
+ }
+ }
+ } catch (err) {
+ throw new Error(err);
+ }
+ };
+
+ useEffect(() => {
+ console.log("Record Data in useeffeect : ", recordsData);
+ }, [recordsData]);
+
+ useEffect(() => {
+ console.log("Page number : ", pageNumber);
+ const startIndex = (pageNumber - 1) * recordsPerPage;
+ console.log("Start Index :: ", startIndex);
+ const endIndex = startIndex + recordsPerPage;
+ console.log("End index : ", endIndex);
+ const newPageRecords = recordsData.slice(startIndex, endIndex);
+ console.log("recordsData : ", recordsData);
+ console.log("New records : ", newPageRecords);
+ setCurrentPageRecords(newPageRecords);
+ const body = document.querySelector("body");
+ window.scrollTo(0, 0);
+ }, [pageNumber]);
+
+ return (
+
+
+
+ setCollapsed(value)}
+ >
+
+
+
+
+
+
+
{
+ navigate(-1);
+ }}
+ >
+
+
+
+
+ {
+ navigate("/");
+ }}
+ >
+
+
+
+
+
+
+
+ {/* Add the dropdowns and select buttons here */}
+
+
+ Exam Centre Code:
+
+
+
+ Manual Verification Needed:
+
+
+
+ Is Cover:
+
+
+
+ Is Backpage:
+
+
+
+ Part:
+
+
+
+ Date Range:
+ {
+ console.log("E ==== ",e)
+ if(e.length == 2){
+ setStartDate(`${e[0].$y}-${e[0].$M}-${e[0].$D}`)
+ setEndDate(`${e[1].$y}-${e[1].$M}-${e[1].$D}`)
+ }
+ }}/>
+
+
+
+ Submit
+
+
+
+
+ {currentPageRecords.length > 0 &&
+ currentPageRecords.map((data, index) => (
+
+ ))}
+
+ {recordsData.length > 0 && (
+
+ {
+ if (pageNumber > 1) {
+ setPageNumber((prev) => prev - 1);
+ }
+ }}
+ >
+ Previous
+
+ {pageNumber}/{totalPages}
+ {
+ if (pageNumber >= 0) {
+ setPageNumber((prev) => prev + 1);
+ }
+ }}
+ >
+ Next
+
+
+ )}
+
+ {
+ console.log("Going down ..")
+ const body = document.body
+ window.scrollTo(0,body.scrollHeight)
+ }}>
+
+
+
+
+
+
+ {isLoading && }
+
+
+ );
+};
+
+export default Statistics;
diff --git a/src/Components/StatsCard.jsx b/src/Components/StatsCard.jsx
new file mode 100644
index 0000000..efd53b8
--- /dev/null
+++ b/src/Components/StatsCard.jsx
@@ -0,0 +1,80 @@
+import { Box } from "@mui/material";
+
+const StatsCard = ({ records, data, part }) => {
+ console.log("Records : ", records);
+ // console.log("data ================ : ", data);
+ const keys = Object.keys(data);
+ // console.log("Part : ", part);
+ // // const Values = Object.Values(data)
+ // console.log("values ====== ", Object.values(data));
+ const values = Object.values(data);
+ // console.log("keys : ", keys);
+ const PartCKeysToCapture = [
+ "barcode",
+ "exam_centre_code",
+ "booklet_serial_no",
+ "subject_code",
+ "marks",
+ "manual_verification_needed",
+ "error",
+ "error_reason",
+ "error"
+ ];
+ const PartAKeysToCapture = [
+ "barcode",
+ "exam_centre_code",
+ "booklet_serial_no",
+ "subject_code",
+ "manual_verification_needed",
+ "error",
+ "error_reason",
+ "error",
+ "type",
+ ];
+ return (
+ <>
+
+
+ {part === "partC" && (
+ <>
+
+
+
+ Record Data:
+
+
+
+
+ {PartCKeysToCapture.map((key, index) => (
+
+ {key}: {data[key]}
+
+ ))}
+ >
+ )}
+
+ {part === "partA" && (
+ <>
+ {PartAKeysToCapture.map((key, index) => (
+
+ {key} : {data[key]}
+ {/* {key}
+ {index}
*/}
+
+ ))}
+ >
+ )}
+
+
+
+
+
+ >
+ );
+};
+
+export default StatsCard;
diff --git a/src/Components/SystemNumberDialog.jsx b/src/Components/SystemNumberDialog.jsx
new file mode 100644
index 0000000..0580b2c
--- /dev/null
+++ b/src/Components/SystemNumberDialog.jsx
@@ -0,0 +1,80 @@
+import React, { useState, useEffect } from "react";
+import Dialog from "@mui/material/Dialog";
+import DialogContent from "@mui/material/DialogContent";
+import DialogContentText from "@mui/material/DialogContentText";
+import DialogTitle from "@mui/material/DialogTitle";
+import { Button, Box } from "@mui/material";
+import TextField from "@mui/material/TextField";
+import { NavLink, Link, useNavigate } from "react-router-dom";
+import InputLabel from "@mui/material/InputLabel";
+import MenuItem from "@mui/material/MenuItem";
+import FormControl from "@mui/material/FormControl";
+import Select from "@mui/material/Select";
+import { useDispatch,useSelector } from "react-redux";
+import { updateSystemNo } from "../redux/actions/actions";
+
+
+const SystemNumberDialog = (setShowSystemNoContainer,showSystemNoContainer) => {
+ const dispatch = useDispatch();
+ const navigate = useNavigate()
+ const [open, setOpen] = useState(true); // Set open state to true by default
+ const reduxSystemNo = useSelector((state)=>state?.systemNumber)
+ console.log("Redux system No : ",reduxSystemNo)
+ const [systemNo, setSystemNo] = useState(1);
+ const handleClose = () => {
+ setOpen(false);
+ };
+
+ const handleSubmit = () => {
+ console.log("Handling submit")
+ dispatch(updateSystemNo(systemNo));
+ navigate("/")
+ handleClose(true)
+ };
+
+ useEffect(()=>{
+ console.log("System No in useEffect : ",systemNo)
+ },[systemNo])
+
+ const numberOfSystems = 5;
+ const selectValues = [];
+ for (var i = 1; i <= numberOfSystems; i++) {
+ selectValues.push({ value: Number(i), systemLabel: `System ${i}` });
+ }
+
+ return (
+
+ );
+};
+
+export default SystemNumberDialog;
diff --git a/src/Components/TableComponent.jsx b/src/Components/TableComponent.jsx
index 39bca12..0eb45ae 100644
--- a/src/Components/TableComponent.jsx
+++ b/src/Components/TableComponent.jsx
@@ -4,10 +4,25 @@ import {
TablePagination,
tablePaginationClasses as classes,
} from "@mui/base/TablePagination";
+import { Link } from "react-router-dom";
+import TextField from "@mui/material/TextField";
+import { Box } from "@mui/material";
+import InputLabel from "@mui/material/InputLabel";
+import MenuItem from "@mui/material/MenuItem";
+import FormControl from "@mui/material/FormControl";
+import Select from "@mui/material/Select";
-export default function TableComponent({ rows, type }) {
+export default function TableComponent({
+ filterSelectedExamCentreCode,
+ setFilterSelectedExamCentreCode,
+ rows,
+ type,
+ distinctExamCentreCodes,
+ batchType
+}) {
+ // console.log("Exam centre code in table component : ",distinctExamCentreCodes)
console.log("Rows in table component : ", rows);
- console.log("Type is : ", type);
+ // console.log("Type is : ", type);
const [page, setPage] = React.useState(0);
const [rowsPerPage, setRowsPerPage] = React.useState(5);
@@ -24,11 +39,33 @@ export default function TableComponent({ rows, type }) {
setPage(0);
};
+ const handleFilterExamCentreCode = (e) => {
+ const ExamCentreCode = e.target.value;
+ setFilterSelectedExamCentreCode(ExamCentreCode);
+ };
+
return (
{type === "AnomolyReassigned" && (
<>
Manual Verification Needed Students :
+ {/*
+
+ Exam Centre Code
+
+
+ */}
@@ -52,11 +89,11 @@ export default function TableComponent({ rows, type }) {
| {row.attendence_serial_no} |
-
{row.student_slno}
-
+
|
{row.exam_centre_code}
@@ -248,6 +285,7 @@ export default function TableComponent({ rows, type }) {
+ | s3_path |
Barcode |
Subject Code |
Register Number |
@@ -263,8 +301,13 @@ export default function TableComponent({ rows, type }) {
: rows
).map((row) => (
+ |
+
+ {row?.s3_path}
+
+ |
- {row.barcode}
+ {row.barcode}
|
{row.subject_code}
diff --git a/src/Components/ValidationContainer.jsx b/src/Components/ValidationContainer.jsx
new file mode 100644
index 0000000..83d3e8c
--- /dev/null
+++ b/src/Components/ValidationContainer.jsx
@@ -0,0 +1,95 @@
+import React, { useState, useEffect } from "react";
+import Dialog from "@mui/material/Dialog";
+import DialogContent from "@mui/material/DialogContent";
+import DialogContentText from "@mui/material/DialogContentText";
+import DialogTitle from "@mui/material/DialogTitle";
+import { Button, Box } from "@mui/material";
+import TextField from "@mui/material/TextField";
+import { NavLink, Link } from "react-router-dom";
+
+const ValidationContainer = ({
+ showValidationContainer,
+ setShowValidationContainer,
+ validateContainerData,
+ s3Path,
+ updatePartAanomoly
+}) => {
+ const [open, setOpen] = useState(true); // Set open state to true by default
+ console.log("Validate Container Data : ", validateContainerData);
+ // const [examCentreCode,setExamCentreCode] = useState(null)
+ // const [examDate,setExamDate] = useState(null)
+ // const [metaDataLink,setMetaDataLink] = useState(null)
+ // const MetabaseLink = "http://metabase.usln.in/public/question/d8774923-09bb-4cd9-903b-559d417e12cf"
+ // console.log("MetabaseLink : ",MetabaseLink)
+ // console.log(import.meta.env)
+ const handleClose = () => {
+ setOpen(false);
+ };
+
+ return (
+
+ );
+};
+
+export default ValidationContainer;
diff --git a/src/Components/Verification.jsx b/src/Components/Verification.jsx
new file mode 100644
index 0000000..f5f47ee
--- /dev/null
+++ b/src/Components/Verification.jsx
@@ -0,0 +1,335 @@
+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 { useSearchParams } from "react-router-dom";
+import { updatePartAanomolyData } from "../redux/actions/actions";
+import { useSelector, useDispatch, ReactReduxContext } from "react-redux";
+import useEnhancedEffect from "@mui/material/utils/useEnhancedEffect";
+import SystemNumberDialog from "./SystemNumberDialog";
+
+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 Verification = () => {
+ const [collapsed, setCollapsed] = useState(false);
+ const [anomolyData, setAnomolyData] = useState([]);
+ const [tableRowData, setTableRowData] = useState([]);
+ const [isLoading, setIsLoading] = useState(false);
+ const [windowWidth, setWindowWidth] = useState(window.innerWidth);
+ let [searchParams, setSearchParams] = useSearchParams();
+ const [showSystemNoContainer, setShowSystemNoContainer] = useState(false);
+ const searchParamsType = searchParams.get("type");
+ const dispatch = useDispatch();
+ const reduxPartA2023AnomolyData = useSelector(
+ (state) => state?.partABatchAnomolyData
+ );
+ const reduxSystemNo = useSelector((state) => state?.systemNumber);
+ console.log("Redux partA 2023 anomoly data : ", reduxPartA2023AnomolyData);
+
+ useEffect(() => {
+ if (!reduxSystemNo) {
+ setShowSystemNoContainer(true);
+ } else {
+ fetchAnomalyData(reduxSystemNo);
+ // if(searchParamsType==="old"){
+ // const sytemData = localStorage.get("part-a-anomoly")
+ // }else if(searchParamsType !== "old"){
+ // const sytemData = localStorage.get("part-a-old-anomoly")
+ // }
+ }
+ }, [reduxSystemNo]);
+
+ 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(
+ s3_path,
+ barcode,
+ register_number,
+ subject_code,
+ type,
+ systemNo
+ ) {
+ return {
+ s3_path,
+ barcode,
+ register_number,
+ subject_code,
+ type,
+ systemNo,
+ };
+ }
+
+
+ const updateSystemReservationStatus = async (systemRecords) => {
+ const payload={
+ systemRecords,
+ }
+ try {
+ fetch(`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/updateSystemReservationStatus`,{
+ method:"POST",
+ headers:{
+ "Content-Type":"application/json"
+ },
+ body:JSON.stringify(payload)
+ }).then(response=>response.json()).then(responseData=>{
+ console.log("response from updation : ",responseData)
+ })
+ } catch (error) {
+ throw new Error("Error in update system records : ",systemRecords)
+ }
+ };
+
+
+
+ const fetchAnomalyData = (reduxSystemNo) => {
+ console.log("Fetching.......");
+ setIsLoading(true);
+ fetch(
+ `${
+ import.meta.env.VITE_REACT_APP_BACKEND_URL
+ }/fetchAnamolyPartAData?type=${searchParamsType}`,
+ {
+ 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") {
+ const systemRecords = getRecordsBySystemId(
+ responseData?.data,
+ reduxSystemNo
+ );
+ updateSystemReservationStatus(systemRecords)
+ console.log("System records : ", systemRecords);
+ if (searchParamsType === "old") {
+ localStorage.setItem(
+ "part-a-old-anomoly",
+ JSON.stringify(systemRecords)
+ );
+ } else if (searchParamsType !== "old") {
+ localStorage.setItem(
+ "part-a-anomoly",
+ JSON.stringify(systemRecords)
+ );
+ }
+ setAnomolyData(systemRecords);
+ dispatch(updatePartAanomolyData(systemRecords));
+ const tmpData = [];
+ for (const data of systemRecords) {
+ tmpData.push(
+ createData(
+ data.s3_path,
+ data.barcode,
+ data.register_number,
+ data.subject_code,
+ data.type,
+ reduxSystemNo
+ )
+ );
+ }
+ // console.log("Tmp data is : ", tmpData);
+ if (tmpData.length > 0) {
+ setTableRowData(tmpData);
+ }
+ }
+ })
+ .catch((error) => {
+ console.error("Error fetching data: ", error);
+ setIsLoading(false);
+ });
+ };
+
+ // useEffect(() => {
+ // fetchAnomalyData();
+ // }, []);
+
+ function getRecordsBySystemId(records, systemId) {
+ const new_data = [];
+ for (var i = 0; i < records.length; i++) {
+ var count = i % 5;
+ if (count === systemId - 1) {
+ new_data.push(records[i]);
+ }
+ }
+ return new_data;
+ }
+
+ const handleSystemNoChange = () => {
+ console.log("System No Change is called");
+ setShowSystemNoContainer(true);
+ };
+
+ useEffect(() => {
+ console.log("System no container show status : ", showSystemNoContainer);
+ }, [showSystemNoContainer]);
+
+ const {
+ token: { colorBgContainer, borderRadiusLG },
+ } = theme.useToken();
+
+ return (
+
+
+ setCollapsed(value)}
+ >
+
+
+
+
+
+
+ {
+ navigate(-1);
+ }}
+ >
+
+
+
+ {/* {
+ navigate("/anomoly/reassigned/stats");
+ }}
+ >
+
+ */}
+
+ {reduxSystemNo && (
+
+ System No : {reduxSystemNo}
+
+ )}
+ {
+ navigate("/");
+ }}
+ >
+
+
+
+
+
+
+
+
+
+ {tableRowData.length > 0 && (
+
+ )}
+ {tableRowData.length == 0 && (
+
+ No Data Found !!
+
+ )}
+
+
+
+
+
+ {isLoading && }
+ {showSystemNoContainer && (
+
+ )}
+
+ );
+};
+export default Verification;
diff --git a/src/main.jsx b/src/main.jsx
index 40dcce1..d9d85cb 100644
--- a/src/main.jsx
+++ b/src/main.jsx
@@ -1,12 +1,15 @@
-import React from 'react'
-import ReactDOM from 'react-dom/client'
-import App from './App.jsx'
-import './index.css'
-import 'bootstrap/dist/css/bootstrap.min.css';
+import React from "react";
+import ReactDOM from "react-dom/client";
+import App from "./App.jsx";
+import "./index.css";
+import "bootstrap/dist/css/bootstrap.min.css";
+import { Provider } from "react-redux";
+import store from "./redux/store/store";
-
-ReactDOM.createRoot(document.getElementById('root')).render(
+ReactDOM.createRoot(document.getElementById("root")).render(
-
- ,
-)
+
+
+
+
+);
diff --git a/src/redux/actions/actions.jsx b/src/redux/actions/actions.jsx
new file mode 100644
index 0000000..10016ac
--- /dev/null
+++ b/src/redux/actions/actions.jsx
@@ -0,0 +1,14 @@
+export const updateAttendenceAnomolyData = (data) =>({
+ type:"UPDATE_ATTENDENCE_ANOMOLY_DATA",
+ payload:data,
+ })
+
+export const updatePartAanomolyData = (data) =>({
+ type:"UPDATE_PART-A_ANOMOLY_DATA",
+ payload:data
+})
+
+export const updateSystemNo = (data) => ({
+ type:"UPDATE_SYSTEM_NO",
+ payload:data
+})
\ No newline at end of file
diff --git a/src/redux/reducers/Reducer.jsx b/src/redux/reducers/Reducer.jsx
new file mode 100644
index 0000000..1590237
--- /dev/null
+++ b/src/redux/reducers/Reducer.jsx
@@ -0,0 +1,22 @@
+
+const initialState = {
+ attendenceAnomolyData : [],
+ partABatchAnomolyData : [],
+ systemNumber : null
+ };
+
+ const reducer = (state = initialState, action) => {
+ switch (action.type) {
+ case 'UPDATE_ATTENDENCE_ANOMOLY_DATA':
+ return { ...state, attendenceAnomolyData:action?.payload};
+ case 'UPDATE_PART-A_ANOMOLY_DATA':
+ return { ...state, partABatchAnomolyData:action?.payload};
+ case 'UPDATE_SYSTEM_NO':
+ return { ...state,systemNumber:action?.payload}
+ default:
+ return state;
+ }
+ };
+
+ export default reducer;
+
\ No newline at end of file
diff --git a/src/redux/store/store.jsx b/src/redux/store/store.jsx
new file mode 100644
index 0000000..1d47317
--- /dev/null
+++ b/src/redux/store/store.jsx
@@ -0,0 +1,7 @@
+// store.js
+import { createStore } from 'redux';
+import reducer from '../reducers/Reducer'; // Import your reducer
+
+const store = createStore(reducer); // Create store with single reducer
+
+export default store;
| |