From c06b37b28d56b8695516173a3dda7eb7ddb6b700 Mon Sep 17 00:00:00 2001 From: yokesh22 Date: Wed, 24 Jul 2024 14:31:16 +0530 Subject: [PATCH] part-a fixes in palyground --- .env | 2 +- src/Components/UpdatedPlaygroundUpdater.jsx | 111 ++++++++++---------- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/.env b/.env index 43b1052..a596950 100644 --- a/.env +++ b/.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" \ No newline at end of file diff --git a/src/Components/UpdatedPlaygroundUpdater.jsx b/src/Components/UpdatedPlaygroundUpdater.jsx index f1185ab..4a69184 100644 --- a/src/Components/UpdatedPlaygroundUpdater.jsx +++ b/src/Components/UpdatedPlaygroundUpdater.jsx @@ -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 = ({ Image Alt + {/* @@ -726,11 +692,43 @@ const UpdatedPlaygroundUpdater = ({ /> ) : type == "PartA" ? ( ) : null} + + + + + + {/* */} + {type == "PartC" ? ( */} + + +