latest
This commit is contained in:
parent
9e010d7f49
commit
f29a3bab00
4
.env
4
.env
|
|
@ -1,6 +1,6 @@
|
|||
#VITE_REACT_APP_BACKEND_URL="https://sandbox.exampaper.vidh.ai"
|
||||
METABASE_BASE_URL="http://metabase.usln.in/public/question/d8774923-09bb-4cd9-903b-559d417e12cf"
|
||||
|
||||
VITE_REACT_APP_BACKEND_URL="http://localhost:9999"
|
||||
# VITE_REACT_APP_BACKEND_URL="https://api.dev.exampaper.usln.in"
|
||||
# VITE_REACT_APP_BACKEND_URL="http://localhost:9999"
|
||||
VITE_REACT_APP_BACKEND_URL="https://api.dev.exampaper.usln.in"
|
||||
#VITE_REACT_APP_BACKEND_URL="https://api.exampaper.usln.in"
|
||||
|
|
|
|||
|
|
@ -90,7 +90,8 @@
|
|||
}
|
||||
|
||||
.grey-background{
|
||||
background-color: rgba(128, 128, 128, 0.1);
|
||||
/* background-color: rgba(128, 128, 128, 0.1); */
|
||||
background-color: rgba(3, 133, 8, 0.1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,271 @@
|
|||
import { useAsyncError } from "react-router-dom";
|
||||
import AntdesignLayout from "./AntdesignLayout";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
import { Box, Button } from "@mui/material";
|
||||
import LoadingContainer from "./LoadingContainer";
|
||||
import Notification from "./Notification";
|
||||
import SystemNumberDialog from "./SystemNumberDialog";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { Layout, theme, Pagination } from "antd";
|
||||
const { Content, Header } = Layout;
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import ArrowBackIcon from "@mui/icons-material/ArrowBack";
|
||||
import HomeIcon from "@mui/icons-material/Home";
|
||||
|
||||
const AttendenceNotShadedCorrection = () => {
|
||||
return(
|
||||
<div>Hl</div>
|
||||
)
|
||||
const { year } = useParams();
|
||||
const navigate = useNavigate();
|
||||
const [AttendenceData, setAttendenceData] = useState([]);
|
||||
const [notification, setNotification] = useState(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [showSystemNoContainer, setShowSystemNoContainer] = useState(false);
|
||||
|
||||
const reduxSystemNo = useSelector((state) => state?.systemNumber);
|
||||
console.log("systemno: ", reduxSystemNo);
|
||||
|
||||
const {
|
||||
token: { colorBgContainer, borderRadiusLG },
|
||||
} = theme.useToken();
|
||||
|
||||
const imageDomain =
|
||||
year === "april2024"
|
||||
? "https://docs.exampaper.vidh.ai"
|
||||
: year === "november2024"
|
||||
? "https://images.exampaper.usln.in"
|
||||
: "https://docs.exampaper.vidh.ai";
|
||||
|
||||
const showNotification = (message, type) => {
|
||||
setNotification({ message, type });
|
||||
};
|
||||
|
||||
const FetchAttendenceNotShadedCorrection = (reduxSystemNo) => {
|
||||
console.log("Fetching.......");
|
||||
setIsLoading(true);
|
||||
fetch(
|
||||
`${
|
||||
import.meta.env.VITE_REACT_APP_BACKEND_URL
|
||||
}/fetchAttendenceNotShaded?systemNo=${reduxSystemNo}`,
|
||||
{
|
||||
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") {
|
||||
setAttendenceData(responseData?.data);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error fetching data: ", error);
|
||||
setIsLoading(false);
|
||||
});
|
||||
};
|
||||
|
||||
const updateStatus = (type, data, index) => {
|
||||
console.log("Fetching.......");
|
||||
setIsLoading(true);
|
||||
const payload = {
|
||||
year,
|
||||
type,
|
||||
data,
|
||||
};
|
||||
fetch(
|
||||
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/updateAttendenceStatus`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
}
|
||||
)
|
||||
.then((response) => {
|
||||
console.log("Response fetched..");
|
||||
return response.json();
|
||||
})
|
||||
.then((responseData) => {
|
||||
console.log("Response Data is : ", responseData);
|
||||
setIsLoading(false);
|
||||
if (responseData.status === "success") {
|
||||
showNotification(
|
||||
`Record Record as ${type} Successfully...`,
|
||||
"success"
|
||||
);
|
||||
const newData = data;
|
||||
const tmpDatas = AttendenceData;
|
||||
newData.verified = 1;
|
||||
if (type == "OMIT") {
|
||||
newData.omitted = 1;
|
||||
newData.absent_status = null;
|
||||
newData.verified = 1;
|
||||
} else if (type == "ABSENT") {
|
||||
newData.omitted = null;
|
||||
newData.absent_status = 1;
|
||||
newData.verified = 1;
|
||||
} else if (type == "PRESENT") {
|
||||
newData.omitted = null;
|
||||
newData.absent_status = 0;
|
||||
newData.verified = 1;
|
||||
}
|
||||
tmpDatas[index] = newData;
|
||||
setAttendenceData(tmpDatas);
|
||||
const mainEle = document.getElementById(
|
||||
`attendence_data_container_${index}`
|
||||
);
|
||||
if (mainEle) {
|
||||
console.log("main Ele === ", mainEle);
|
||||
mainEle.classList.add("grey-background");
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error fetching data: ", error);
|
||||
setIsLoading(false);
|
||||
showNotification(`Something Went Wrong ...`, "error");
|
||||
});
|
||||
};
|
||||
|
||||
export default AttendenceNotShadedCorrection
|
||||
// useEffect(() => {
|
||||
// FetchAttendenceNotShadedCorrection();
|
||||
// }, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!reduxSystemNo) {
|
||||
setShowSystemNoContainer(true);
|
||||
} else {
|
||||
FetchAttendenceNotShadedCorrection(reduxSystemNo);
|
||||
}
|
||||
}, [reduxSystemNo]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Header style={{ padding: 0, background: colorBgContainer }}>
|
||||
<Box className="d-flex justify-content-between h-100 py-1 px-2">
|
||||
<Button
|
||||
className="bg-primary p-1 text-light"
|
||||
onClick={() => navigate(-1)}
|
||||
>
|
||||
<ArrowBackIcon />
|
||||
</Button>
|
||||
<Box className="d-flex justify-content-between gap-2">
|
||||
{reduxSystemNo && (
|
||||
<Box
|
||||
className="h6 p-0 m-0 text-light bg-primary rounded h-100 d-flex align-items-center px-3"
|
||||
style={{ cursor: "pointer" }}
|
||||
>
|
||||
<b>System No : </b> {reduxSystemNo}
|
||||
</Box>
|
||||
)}
|
||||
<Button
|
||||
className="bg-primary p-1 text-light"
|
||||
onClick={() => navigate("/")}
|
||||
>
|
||||
<HomeIcon />
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Header>
|
||||
<Content
|
||||
style={{
|
||||
padding: "24px",
|
||||
backgroundColor: "#5078f2",
|
||||
backgroundImage: "linear-gradient(315deg, #5078f2 0%, #efe9f4 74%)",
|
||||
}}
|
||||
>
|
||||
{AttendenceData.length > 0 && (
|
||||
<div className="my-3 rounded d-flex flex-column">
|
||||
{AttendenceData.map((data, index) => (
|
||||
<div
|
||||
className="d-flex justify-content-between my-3 rounded shadow white-background"
|
||||
id={`attendence_data_container_${index}`}
|
||||
>
|
||||
<div className="w-50 text-left p-4">
|
||||
<div className="h6">
|
||||
<strong>Register Number</strong> : {data?.register_number}
|
||||
</div>
|
||||
<div className="h6">
|
||||
<strong>Subject Code</strong> : {data?.subject_code}
|
||||
</div>
|
||||
<div className="h6">
|
||||
<strong>Row Number</strong> : {data?.rownumber}
|
||||
</div>
|
||||
<div className="h6">
|
||||
<strong>S3 Path</strong> : {data?.s3_path}
|
||||
</div>
|
||||
<div className="h6">
|
||||
<strong>Absent Status</strong> :{" "}
|
||||
{data?.absent_status || "NULL"}
|
||||
</div>
|
||||
<div className="h6">
|
||||
<strong>Omitted</strong> : {data?.omitted || "NULL"}
|
||||
</div>
|
||||
<div className="h6">
|
||||
<strong>Verified</strong> : {data?.verified}
|
||||
</div>
|
||||
<div className="d-flex flex-column gap-2 my-5 py-1">
|
||||
<Button
|
||||
className="m-0 bg-primary text-white p-3 rounded w-25"
|
||||
onClick={() => {
|
||||
updateStatus("OMIT", data, index);
|
||||
}}
|
||||
>
|
||||
OMIT
|
||||
</Button>
|
||||
<Button
|
||||
className="m-0 bg-primary text-white p-3 rounded w-25"
|
||||
onClick={() => {
|
||||
updateStatus("ABSENT", data, index);
|
||||
}}
|
||||
>
|
||||
Mark As Absent
|
||||
</Button>
|
||||
<Button
|
||||
className="m-0 bg-primary text-white p-3 rounded w-25"
|
||||
onClick={() => {
|
||||
updateStatus("PRESENT", data, index);
|
||||
}}
|
||||
>
|
||||
Mark As Present
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-50 p-4">
|
||||
<img
|
||||
src={`${imageDomain}/${data?.s3_path}`}
|
||||
width="850px"
|
||||
height="auto"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</Content>
|
||||
{isLoading && <LoadingContainer loadingText={"Loading"} />}
|
||||
{notification && (
|
||||
<Notification
|
||||
message={notification.message}
|
||||
type={notification.type}
|
||||
onClose={() => setNotification(null)}
|
||||
/>
|
||||
)}
|
||||
{showSystemNoContainer && (
|
||||
<SystemNumberDialog
|
||||
setShowSystemNoContainer={setShowSystemNoContainer}
|
||||
showSystemNoContainer={showSystemNoContainer}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default AttendenceNotShadedCorrection;
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ const HomeSections = () => {
|
|||
{
|
||||
title:"PlayGrounds",
|
||||
url:`/sections/${year}/Playgrounds`
|
||||
},
|
||||
{
|
||||
title:"Attendence Not Shaded Solver",
|
||||
url:`/sections/${year}/attendenceNotShadedCorrection`
|
||||
}
|
||||
// }, {
|
||||
// title:"Attendence Not Shaded Solver",
|
||||
// url:`/sections/${year}/attendenceNotShadedCorrection`
|
||||
// }
|
||||
|
||||
// {
|
||||
// title:"Revaluation",
|
||||
|
|
|
|||
Loading…
Reference in New Issue