part-a fixes in palyground
This commit is contained in:
parent
d247442c8f
commit
c06b37b28d
2
.env
2
.env
|
|
@ -1,5 +1,5 @@
|
|||
#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="http://localhost:9999"
|
||||
VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai"
|
||||
|
|
@ -53,8 +53,9 @@ const UpdatedPlaygroundUpdater = ({
|
|||
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 [qrcode, setQrcode] = useState(null);
|
||||
const [bar_code, set_Barcode] = useState(null);
|
||||
const [s3Path, setS3Path] = useState(null);
|
||||
const [subjectCode, setSubjectCode] = useState(null);
|
||||
const [data,setData] = useState(null)
|
||||
|
|
@ -67,62 +68,26 @@ const UpdatedPlaygroundUpdater = ({
|
|||
useEffect(() => {
|
||||
console.log("data ========== ", data);
|
||||
if (data) {
|
||||
console.log("barcode = ", data.barcode)
|
||||
setQrcode(data.qrcode);
|
||||
setBarcode(data.barcode);
|
||||
// set_Barcode(data.barcode)
|
||||
set_Barcode(data.barcode === '' ? null : data.barcode);
|
||||
setMarks(data.marks);
|
||||
setS3Path(data.s3Path);
|
||||
setS3Path(data.s3_path);
|
||||
setSubjectCode(data.subject_code);
|
||||
setRegisterNumber(data.register_number);
|
||||
setTotalAbsent(data?.total_absent);
|
||||
setTotalPresent(data?.total_present);
|
||||
setTotalStudents(data?.total_students);
|
||||
setRotateAngle(0);
|
||||
}
|
||||
console.log("the currect editor type: ", type);
|
||||
}, [data]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("barcode in use effect ==== ", barcode);
|
||||
}, [barcode]);
|
||||
// useEffect(() => {
|
||||
// console.log("barcode in use effect ==== ", barcode);
|
||||
// }, [barcode]);
|
||||
|
||||
const updateRecordPartC = async () => {
|
||||
if (!marks) {
|
||||
return;
|
||||
}
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const payload = {
|
||||
qrcode,
|
||||
barcode,
|
||||
table: tableName,
|
||||
s3Path,
|
||||
subjectCode,
|
||||
marks,
|
||||
imageName,
|
||||
rotateAngle,
|
||||
};
|
||||
const response = await fetch(
|
||||
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/editPartCdata`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(payload),
|
||||
}
|
||||
);
|
||||
const responseData = await response.json();
|
||||
setIsLoading(false);
|
||||
console.log("response data ========= ", responseData);
|
||||
if (responseData?.status === "success") {
|
||||
//toast.success("Record Updated Successfully ...");
|
||||
setShowEditContainer(false);
|
||||
}
|
||||
} catch (error) {
|
||||
setIsLoading(false);
|
||||
//toast.error("Something Went Wrong ...");
|
||||
throw new Error(error);
|
||||
}
|
||||
};
|
||||
|
||||
console.log("data =================== ", data);
|
||||
// console.log("image column ====== ", s3_image_column);
|
||||
|
|
@ -440,16 +405,16 @@ const UpdatedPlaygroundUpdater = ({
|
|||
const updateRecordPartA = async () => {
|
||||
console.log(registerNumber);
|
||||
console.log(subjectCode);
|
||||
console.log(barcode, qrcode);
|
||||
console.log(!registerNumber && !subjectCode && (!barcode || !qrcode));
|
||||
if (!registerNumber && !subjectCode && (!barcode || !qrcode)) {
|
||||
console.log(bar_code, qrcode);
|
||||
console.log(!registerNumber && !subjectCode && (!bar_code || !qrcode));
|
||||
if (!registerNumber && !subjectCode && (!bar_code || !qrcode)) {
|
||||
return;
|
||||
}
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const payload = {
|
||||
qrcode,
|
||||
barcode,
|
||||
bar_code,
|
||||
table: tableName,
|
||||
s3Path,
|
||||
subjectCode,
|
||||
|
|
@ -618,13 +583,14 @@ const UpdatedPlaygroundUpdater = ({
|
|||
<Box className="border border-dark" id={imageName}>
|
||||
<img
|
||||
src={`https://docs.exampaper.vidh.ai/${oldData[s3_image_column]}`}
|
||||
width="1200px"
|
||||
width="850px"
|
||||
height="auto"
|
||||
alt="Image Alt"
|
||||
ref={imageEleRef}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{/* <Box
|
||||
className="d-flex flex-column gap-2 mx-2 py-3"
|
||||
style={{ minWidth: "250px" }}
|
||||
|
|
@ -674,17 +640,17 @@ const UpdatedPlaygroundUpdater = ({
|
|||
{type !== "Attendence" ? (
|
||||
<>
|
||||
<TextInputField
|
||||
value={qrcode}
|
||||
value={qrcode || ''}
|
||||
setValue={setQrcode}
|
||||
placeholder={"QR code"}
|
||||
/>
|
||||
<TextInputField
|
||||
value={barcode | null}
|
||||
setValue={setBarcode}
|
||||
value={bar_code || ''}
|
||||
setValue={set_Barcode}
|
||||
placeholder={"BarCode"}
|
||||
/>
|
||||
<TextInputField
|
||||
value={subjectCode}
|
||||
value={subjectCode || ''}
|
||||
setValue={setSubjectCode}
|
||||
placeholder={"Subject code"}
|
||||
/>
|
||||
|
|
@ -726,11 +692,43 @@ const UpdatedPlaygroundUpdater = ({
|
|||
/>
|
||||
) : type == "PartA" ? (
|
||||
<TextInputField
|
||||
value={registerNumber}
|
||||
value={registerNumber || ''}
|
||||
setValue={setRegisterNumber}
|
||||
placeholder={"Register no"}
|
||||
/>
|
||||
) : null}
|
||||
<Box display="flex" justifyContent="space-between">
|
||||
<Button
|
||||
className="m-0 bg-primary text-white p-3 rounded"
|
||||
onClick={rotateLeft}
|
||||
>
|
||||
Rotate left
|
||||
<RotateLeftIcon />
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
className="m-0 bg-primary text-white p-3 rounded"
|
||||
onClick={rotateRight}
|
||||
>
|
||||
Rotate Right
|
||||
<RotateRightIcon />
|
||||
</Button>
|
||||
</Box>
|
||||
{/* <Button
|
||||
className="m-0 bg-primary text-white p-3 rounded"
|
||||
onClick={() =>
|
||||
saveRotatedImage(
|
||||
imageName,
|
||||
tableNameData,
|
||||
rotateAngle,
|
||||
data,
|
||||
setIsLoading
|
||||
)
|
||||
}
|
||||
>
|
||||
Save
|
||||
</Button> */}
|
||||
|
||||
{type == "PartC" ? (
|
||||
<Button
|
||||
className="bg-primary text-white p-3"
|
||||
|
|
@ -765,6 +763,9 @@ const UpdatedPlaygroundUpdater = ({
|
|||
</Button>
|
||||
) : null}
|
||||
{/* <Button className="bg-primary text-white p-3">Skip</Button> */}
|
||||
|
||||
|
||||
|
||||
<Box className="d-flex justify-content-between gap-5">
|
||||
<Button
|
||||
className="bg-primary text-white p-3 w-50"
|
||||
|
|
|
|||
Loading…
Reference in New Issue