latest
This commit is contained in:
parent
24e413f6cf
commit
8701ee0fd4
2
.env
2
.env
|
|
@ -1,5 +1,5 @@
|
||||||
#VITE_REACT_APP_BACKEND_URL="https://sandbox.exampaper.vidh.ai"
|
#VITE_REACT_APP_BACKEND_URL="https://sandbox.exampaper.vidh.ai"
|
||||||
METABASE_BASE_URL="http://metabase.usln.in/public/question/d8774923-09bb-4cd9-903b-559d417e12cf"
|
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="http://localhost:9999"
|
||||||
VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai"
|
VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai"
|
||||||
|
|
@ -188,7 +188,7 @@ useEffect(()=>{
|
||||||
<Box className="my-3">
|
<Box className="my-3">
|
||||||
<Button
|
<Button
|
||||||
className="p-3 bg-primary text-light rounded"
|
className="p-3 bg-primary text-light rounded"
|
||||||
onClick={reinitializeScanner}
|
onClick={()=>window.location.reload()}
|
||||||
>
|
>
|
||||||
Scan Again
|
Scan Again
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ import RotateRightIcon from "@mui/icons-material/RotateRight";
|
||||||
import PlayGroundEditContainer from "./PlayGroundEditContainer";
|
import PlayGroundEditContainer from "./PlayGroundEditContainer";
|
||||||
import saveRotatedImage from "./Utilities/PartCPlaygroundUtilities";
|
import saveRotatedImage from "./Utilities/PartCPlaygroundUtilities";
|
||||||
import markAsPartc from "./Utilities/PartAPlaygroundUtilities";
|
import markAsPartc from "./Utilities/PartAPlaygroundUtilities";
|
||||||
|
import { updateAttendenceBlank } from "./Utilities/AttendencePlaygroundUtilities";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const CustomQueryExecutorCard = ({
|
const CustomQueryExecutorCard = ({
|
||||||
|
|
@ -289,6 +291,11 @@ const CustomQueryExecutorCard = ({
|
||||||
// setEditorType(type)
|
// setEditorType(type)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const updateAttendenceBlankAction = () =>{
|
||||||
|
updateAttendenceBlank(setIsLoading,data,setShowEditContainer)
|
||||||
|
}
|
||||||
|
|
||||||
const buttonActions = {
|
const buttonActions = {
|
||||||
PartC: [
|
PartC: [
|
||||||
{ btnLabel: "Mark As Front", action: updateFront },
|
{ btnLabel: "Mark As Front", action: updateFront },
|
||||||
|
|
@ -305,8 +312,16 @@ const CustomQueryExecutorCard = ({
|
||||||
{ btnLabel: "Mark As Part-C", action: markAsPartc },
|
{ btnLabel: "Mark As Part-C", action: markAsPartc },
|
||||||
{ btnLabel: "Edit", action: showContainerAction },
|
{ btnLabel: "Edit", action: showContainerAction },
|
||||||
],
|
],
|
||||||
|
Attendence: [
|
||||||
|
{ btnLabel: "Mark As Blank", action:updateAttendenceBlankAction },
|
||||||
|
{ btnLabel: "Edit", action: showContainerAction },
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDataValue(data);
|
setDataValue(data);
|
||||||
setKeys(Object.keys(data));
|
setKeys(Object.keys(data));
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,10 @@ import TextInputField from "./TextInputField";
|
||||||
import { Height } from "@mui/icons-material";
|
import { Height } from "@mui/icons-material";
|
||||||
import HighlightOffIcon from "@mui/icons-material/HighlightOff";
|
import HighlightOffIcon from "@mui/icons-material/HighlightOff";
|
||||||
import LoadingContainer from "./LoadingContainer";
|
import LoadingContainer from "./LoadingContainer";
|
||||||
import {toast} from "react-toastify"
|
import { toast } from "react-toastify";
|
||||||
|
import { updatePlayGroundAttendence } from "./Utilities/AttendencePlaygroundUtilities";
|
||||||
|
import { updateAttendenceBlank } from "./Utilities/AttendencePlaygroundUtilities";
|
||||||
|
|
||||||
|
|
||||||
const PlayGroundEditContainer = ({
|
const PlayGroundEditContainer = ({
|
||||||
data,
|
data,
|
||||||
|
|
@ -19,13 +22,16 @@ const PlayGroundEditContainer = ({
|
||||||
tableName,
|
tableName,
|
||||||
setShowEditContainer,
|
setShowEditContainer,
|
||||||
rotateAngle,
|
rotateAngle,
|
||||||
type
|
type,
|
||||||
}) => {
|
}) => {
|
||||||
// const type = "PartC";
|
// const type = "PartC";
|
||||||
// const type = type;
|
// const type = type;
|
||||||
const dialogText = "This is dialog text";
|
const dialogText = "This is dialog text";
|
||||||
const [marks, setMarks] = useState(null);
|
const [marks, setMarks] = useState(null);
|
||||||
const [registerNumber, setRegisterNumber] = useState(null);
|
const [registerNumber, setRegisterNumber] = useState(null);
|
||||||
|
const [totalStudents, setTotalStudents] = useState(null);
|
||||||
|
const [totalPresent, setTotalPresent] = useState(null);
|
||||||
|
const [totalAbsent, setTotalAbsent] = useState(null);
|
||||||
const [barcode, setBarcode] = useState(null);
|
const [barcode, setBarcode] = useState(null);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [qrcode, setQrcode] = useState(null);
|
const [qrcode, setQrcode] = useState(null);
|
||||||
|
|
@ -40,10 +46,13 @@ const PlayGroundEditContainer = ({
|
||||||
setQrcode(data?.qrcode);
|
setQrcode(data?.qrcode);
|
||||||
setBarcode(data?.barcode);
|
setBarcode(data?.barcode);
|
||||||
setMarks(data?.marks);
|
setMarks(data?.marks);
|
||||||
setSubjectCode(data?.subject_code)
|
setSubjectCode(data?.subject_code);
|
||||||
setRegisterNumber(data?.register_number)
|
setRegisterNumber(data?.register_number);
|
||||||
|
setTotalAbsent(data?.total_absent)
|
||||||
|
setTotalPresent(data?.total_present)
|
||||||
|
setTotalStudents(data?.total_students)
|
||||||
}
|
}
|
||||||
console.log("the currect editor type: ", type)
|
console.log("the currect editor type: ", type);
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const updateRecordPartC = async () => {
|
const updateRecordPartC = async () => {
|
||||||
|
|
@ -55,7 +64,7 @@ const PlayGroundEditContainer = ({
|
||||||
const payload = {
|
const payload = {
|
||||||
qrcode,
|
qrcode,
|
||||||
barcode,
|
barcode,
|
||||||
table:tableName,
|
table: tableName,
|
||||||
s3Path,
|
s3Path,
|
||||||
subjectCode,
|
subjectCode,
|
||||||
marks,
|
marks,
|
||||||
|
|
@ -77,7 +86,7 @@ const PlayGroundEditContainer = ({
|
||||||
console.log("response data ========= ", responseData);
|
console.log("response data ========= ", responseData);
|
||||||
if (responseData?.status === "success") {
|
if (responseData?.status === "success") {
|
||||||
toast.success("Record Updated Successfully ...");
|
toast.success("Record Updated Successfully ...");
|
||||||
setShowEditContainer(false)
|
setShowEditContainer(false);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
@ -86,12 +95,11 @@ const PlayGroundEditContainer = ({
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const updateRecordPartA = async () => {
|
const updateRecordPartA = async () => {
|
||||||
console.log(registerNumber)
|
console.log(registerNumber);
|
||||||
console.log(subjectCode)
|
console.log(subjectCode);
|
||||||
console.log(barcode, qrcode)
|
console.log(barcode, qrcode);
|
||||||
console.log(!registerNumber && !subjectCode && (!barcode || !qrcode))
|
console.log(!registerNumber && !subjectCode && (!barcode || !qrcode));
|
||||||
if (!registerNumber && !subjectCode && (!barcode || !qrcode)) {
|
if (!registerNumber && !subjectCode && (!barcode || !qrcode)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -100,7 +108,7 @@ const PlayGroundEditContainer = ({
|
||||||
const payload = {
|
const payload = {
|
||||||
qrcode,
|
qrcode,
|
||||||
barcode,
|
barcode,
|
||||||
table:tableName,
|
table: tableName,
|
||||||
s3Path,
|
s3Path,
|
||||||
subjectCode,
|
subjectCode,
|
||||||
registerNumber,
|
registerNumber,
|
||||||
|
|
@ -122,7 +130,7 @@ const PlayGroundEditContainer = ({
|
||||||
console.log("response data ========= ", responseData);
|
console.log("response data ========= ", responseData);
|
||||||
if (responseData?.status === "success") {
|
if (responseData?.status === "success") {
|
||||||
toast.success("Record Updated Successfully ...");
|
toast.success("Record Updated Successfully ...");
|
||||||
setShowEditContainer(false)
|
setShowEditContainer(false);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
@ -132,16 +140,23 @@ const PlayGroundEditContainer = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const imageStyle = {
|
const imageStyle = {
|
||||||
transform:`rotate(${rotateAngle})deg`
|
transform: `rotate(${rotateAngle})deg !important`,
|
||||||
}
|
};
|
||||||
|
|
||||||
console.log("Image style ====== ",imageStyle)
|
console.log("Image style ====== ", imageStyle);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog open={open} sx={{ zIndex: 'fab' }} onClose={handleClose} maxWidth="xl" style={{zIndex:100}} fullWidth>
|
<Dialog
|
||||||
|
open={open}
|
||||||
|
sx={{ zIndex: "fab" }}
|
||||||
|
onClose={handleClose}
|
||||||
|
maxWidth="xl"
|
||||||
|
style={{ zIndex: 100 }}
|
||||||
|
fullWidth
|
||||||
|
>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
<Box className="d-flex justify-content-between align-items-start gap-4">
|
<Box className="d-flex justify-content-between align-items-start gap-4">
|
||||||
<Box className="d-flex flex-column">
|
<Box className="d-flex flex-column" style={imageStyle}>
|
||||||
<img
|
<img
|
||||||
src={`https://docs.exampaper.vidh.ai/${s3Path}`}
|
src={`https://docs.exampaper.vidh.ai/${s3Path}`}
|
||||||
height={"100%"}
|
height={"100%"}
|
||||||
|
|
@ -149,6 +164,8 @@ const PlayGroundEditContainer = ({
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
<Box className="py-3 d-flex flex-column justify-content-end w-100 gap-3">
|
<Box className="py-3 d-flex flex-column justify-content-end w-100 gap-3">
|
||||||
|
{type !== "Attendence" ? (
|
||||||
|
<>
|
||||||
<TextInputField
|
<TextInputField
|
||||||
value={qrcode}
|
value={qrcode}
|
||||||
setValue={setQrcode}
|
setValue={setQrcode}
|
||||||
|
|
@ -164,38 +181,82 @@ const PlayGroundEditContainer = ({
|
||||||
setValue={setSubjectCode}
|
setValue={setSubjectCode}
|
||||||
placeholder={"Subject code"}
|
placeholder={"Subject code"}
|
||||||
/>
|
/>
|
||||||
{
|
</>
|
||||||
type == 'PartC'?(
|
) : (
|
||||||
|
<>
|
||||||
|
<TextInputField
|
||||||
|
value={qrcode}
|
||||||
|
setValue={setQrcode}
|
||||||
|
placeholder={"QR code"}
|
||||||
|
/>
|
||||||
|
<TextInputField
|
||||||
|
value={subjectCode}
|
||||||
|
setValue={setSubjectCode}
|
||||||
|
placeholder={"Subject Code"}
|
||||||
|
/>
|
||||||
|
<TextInputField
|
||||||
|
value={totalStudents}
|
||||||
|
setValue={setTotalStudents}
|
||||||
|
placeholder={"Total Students"}
|
||||||
|
/>
|
||||||
|
<TextInputField
|
||||||
|
value={totalPresent}
|
||||||
|
setValue={setTotalPresent}
|
||||||
|
placeholder={"Total Present"}
|
||||||
|
/>
|
||||||
|
<TextInputField
|
||||||
|
value={totalAbsent}
|
||||||
|
setValue={setTotalAbsent}
|
||||||
|
placeholder={"Total Absent"}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{type == "PartC" ? (
|
||||||
<TextInputField
|
<TextInputField
|
||||||
value={marks}
|
value={marks}
|
||||||
setValue={setMarks}
|
setValue={setMarks}
|
||||||
placeholder={"Marks"}
|
placeholder={"Marks"}
|
||||||
/>
|
/>
|
||||||
): type == 'PartA'?(
|
) : type == "PartA" ? (
|
||||||
<TextInputField
|
<TextInputField
|
||||||
value={registerNumber}
|
value={registerNumber}
|
||||||
setValue={setRegisterNumber}
|
setValue={setRegisterNumber}
|
||||||
placeholder={"Register no"}
|
placeholder={"Register no"}
|
||||||
/>
|
/>
|
||||||
):null
|
) : null}
|
||||||
}
|
{type == "PartC" ? (
|
||||||
{
|
|
||||||
type == 'PartC'?(
|
|
||||||
<Button
|
<Button
|
||||||
className="bg-primary text-white p-3"
|
className="bg-primary text-white p-3"
|
||||||
onClick={() => updateRecordPartC()}
|
onClick={() => updateRecordPartC()}
|
||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
</Button>
|
</Button>
|
||||||
): type == 'PartA'?(
|
) : type == "PartA" ? (
|
||||||
<Button
|
<Button
|
||||||
className="bg-primary text-white p-3"
|
className="bg-primary text-white p-3"
|
||||||
onClick={() => updateRecordPartA()}
|
onClick={() => updateRecordPartA()}
|
||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
</Button>
|
</Button>
|
||||||
):null
|
) : type == "Attendence" ? (
|
||||||
|
<Button
|
||||||
|
className="bg-primary text-white p-3"
|
||||||
|
onClick={() =>
|
||||||
|
updatePlayGroundAttendence(
|
||||||
|
setIsLoading,
|
||||||
|
qrcode,
|
||||||
|
subjectCode,
|
||||||
|
totalStudents,
|
||||||
|
totalPresent,
|
||||||
|
totalAbsent,
|
||||||
|
data,
|
||||||
|
setShowEditContainer
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
>
|
||||||
|
Update
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
<Button
|
<Button
|
||||||
className="bg-primary text-white p-3"
|
className="bg-primary text-white p-3"
|
||||||
onClick={() => setShowEditContainer(false)}
|
onClick={() => setShowEditContainer(false)}
|
||||||
|
|
@ -205,7 +266,7 @@ const PlayGroundEditContainer = ({
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
{isLoading && <LoadingContainer/>}
|
{isLoading && <LoadingContainer />}
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ const PlayGrounds = () => {
|
||||||
title: "PART - C",
|
title: "PART - C",
|
||||||
url: "/Playground/PartC",
|
url: "/Playground/PartC",
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// title: "ATTENDENCE",
|
title: "ATTENDENCE",
|
||||||
// url: "/Playground/Attendence",
|
url: "/Playground/Attendence",
|
||||||
// },
|
},
|
||||||
];
|
];
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,138 @@
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
|
||||||
|
const saveRotatedImage = async (
|
||||||
|
imageName,
|
||||||
|
tableNameData,
|
||||||
|
rotateAngle,
|
||||||
|
data,
|
||||||
|
setIsLoading
|
||||||
|
) => {
|
||||||
|
try {
|
||||||
|
console.log("data=", data);
|
||||||
|
if (rotateAngle === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const payload = {
|
||||||
|
imageName,
|
||||||
|
tableNameData,
|
||||||
|
rotateAngle,
|
||||||
|
s3_path: data["s3_path"],
|
||||||
|
};
|
||||||
|
setIsLoading(true);
|
||||||
|
const response = await fetch(
|
||||||
|
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/saveRotatedImage`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
setIsLoading(false);
|
||||||
|
const responseData = await response.json();
|
||||||
|
if (responseData.status === "success") {
|
||||||
|
toast.success("Image Rotation Saved Successfully");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default saveRotatedImage;
|
||||||
|
|
||||||
|
export const updatePlayGroundAttendence = async (
|
||||||
|
setIsLoading,
|
||||||
|
qrcode,
|
||||||
|
subjectCode,
|
||||||
|
totalStudents,
|
||||||
|
totalPresent,
|
||||||
|
totalAbsent,
|
||||||
|
data,
|
||||||
|
setShowEditContainer
|
||||||
|
) => {
|
||||||
|
try {
|
||||||
|
console.log("qrcode ==== ", qrcode);
|
||||||
|
console.log("subject code ==== ", subjectCode);
|
||||||
|
console.log("total students ==== ", totalStudents);
|
||||||
|
console.log("total Absent ==== ", totalAbsent);
|
||||||
|
console.log("total preent ==== ", totalPresent);
|
||||||
|
|
||||||
|
if (!subjectCode || !String(totalStudents) || !String(totalAbsent) || !String(totalPresent)) {
|
||||||
|
toast.info("Please fill all the fields ...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("updating attendence ...");
|
||||||
|
console.log("Data ==== ", data);
|
||||||
|
setIsLoading(true);
|
||||||
|
const payload = {
|
||||||
|
qrcode,
|
||||||
|
subjectCode,
|
||||||
|
totalStudents,
|
||||||
|
totalPresent,
|
||||||
|
totalAbsent,
|
||||||
|
data,
|
||||||
|
};
|
||||||
|
const response = await fetch(
|
||||||
|
`${
|
||||||
|
import.meta.env.VITE_REACT_APP_BACKEND_URL
|
||||||
|
}/updatePlaygroundAttendence`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
setIsLoading(false);
|
||||||
|
const responseData = await response.json();
|
||||||
|
if (responseData.status === "success") {
|
||||||
|
toast.success("Attendence Updation Successfully");
|
||||||
|
setShowEditContainer(false);
|
||||||
|
}else{
|
||||||
|
toast.error("Something went Wrong !!")
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
toast.error("Something went Wrong !!");
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateAttendenceBlank = async (
|
||||||
|
setIsLoading,
|
||||||
|
data,
|
||||||
|
setShowEditContainer
|
||||||
|
) => {
|
||||||
|
try {
|
||||||
|
console.log("Data ==== ", data);
|
||||||
|
setIsLoading(true);
|
||||||
|
const payload = {
|
||||||
|
data,
|
||||||
|
};
|
||||||
|
const response = await fetch(
|
||||||
|
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/updateAttendenceBlank`,
|
||||||
|
{
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
body: JSON.stringify(payload),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
setIsLoading(false);
|
||||||
|
const responseData = await response.json();
|
||||||
|
if (responseData.status === "success") {
|
||||||
|
toast.success("Attendence Marked as blank Successfully");
|
||||||
|
setShowEditContainer(false);
|
||||||
|
} else {
|
||||||
|
toast.error("Something went Wrong !!");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setIsLoading(false);
|
||||||
|
toast.error("Something went Wrong !!");
|
||||||
|
throw new Error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue