From 63831d050b29bf03efd0278c28cbb6acf1e22b26 Mon Sep 17 00:00:00 2001 From: Pradeeppon01 Date: Tue, 13 Aug 2024 20:55:39 +0530 Subject: [PATCH] latest --- .env | 3 +- deploy.sh | 6 +- src/Components/PlayGround.jsx | 2 +- src/Components/PlayGroundEditContainer.jsx | 136 +++++++++++---------- 4 files changed, 80 insertions(+), 67 deletions(-) diff --git a/.env b/.env index a5d5a49..b433a17 100644 --- a/.env +++ b/.env @@ -2,4 +2,5 @@ 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.exampaper.vidh.ai" +#VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai" +VITE_REACT_APP_BACKEND_URL="https://api.exampaper.usln.in" diff --git a/deploy.sh b/deploy.sh index 6f33528..3d928fd 100755 --- a/deploy.sh +++ b/deploy.sh @@ -2,8 +2,10 @@ SOURCE_DIR=/home/neuu/attendence_UI/frontend BRANCH=part_a_playground -FRONTEND_DIR=/var/www/exampaper.vidh.ai -SERVER_IP=52.66.73.43 +FRONTEND_DIR=/var/www/exampaper.usln.in +#SERVER_IP=52.66.73.43 +SERVER_IP=34.131.182.12 + cd ~/$SOURCE_DIR echo "Changed into attendence UI frontend dir ....." diff --git a/src/Components/PlayGround.jsx b/src/Components/PlayGround.jsx index 02313f0..a26abb5 100644 --- a/src/Components/PlayGround.jsx +++ b/src/Components/PlayGround.jsx @@ -77,7 +77,7 @@ const PlayGround = () => { const [query, setQuery] = useState(""); const [isLoading, setIsLoading] = useState(false); const [paginationPages, setPaginationPages] = useState(null); - const [limit, setLimit] = useState(""); + const [limit, setLimit] = useState("100"); const recordsPerPage = 50; const resultsContainerRef = useRef(); const navigate = useNavigate(); diff --git a/src/Components/PlayGroundEditContainer.jsx b/src/Components/PlayGroundEditContainer.jsx index b900ab5..8211739 100644 --- a/src/Components/PlayGroundEditContainer.jsx +++ b/src/Components/PlayGroundEditContainer.jsx @@ -40,13 +40,14 @@ const PlayGroundEditContainer = ({ const [marksR1, setMarksR1] = useState(null); const [marksR2, setMarksR2] = useState(null); const [open, setOpen] = useState(true); // Set open state to true by default + const [serialNo, setSerialNo] = useState(null); const [notification, setNotification] = useState(null); // Notification state const showNotification = (message, type) => { console.log("setting notification ===== ", message); - const notificationData = { message, type} - console.log("notification data ==== ",notificationData) + const notificationData = { message, type }; + console.log("notification data ==== ", notificationData); setNotification(notificationData); }; const handleClose = () => { @@ -56,52 +57,53 @@ const PlayGroundEditContainer = ({ console.log("data === i ==== ", data); useEffect(() => { const fetchImageData = async () => { - setIsLoading(true) - try{ - if (data) { - const payload = { - type, - imageName, - tableName, - }; - const response = await fetch( - `${ - import.meta.env.VITE_REACT_APP_BACKEND_URL - }/fetchTableImageNameData`, - { - 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") { - const imageData = responseData?.results; - if (imageData && imageData?.length > 0) { - const imageDataEle = imageData[0]; - setQrcode(imageDataEle?.qrcode); - setBarcode(imageDataEle?.barcode); - setMarks(imageDataEle?.marks); - setMarksR1(imageDataEle?.marks_R1); - setMarksR2(imageDataEle?.marks_R2); - setSubjectCode(imageDataEle?.subject_code); - setRegisterNumber(imageDataEle?.register_number); - setTotalAbsent(imageDataEle?.total_absent); - setTotalPresent(imageDataEle?.total_present); - setTotalStudents(imageDataEle?.total_students); + setIsLoading(true); + try { + if (data) { + const payload = { + type, + imageName, + tableName, + }; + const response = await fetch( + `${ + import.meta.env.VITE_REACT_APP_BACKEND_URL + }/fetchTableImageNameData`, + { + 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") { + const imageData = responseData?.results; + if (imageData && imageData?.length > 0) { + const imageDataEle = imageData[0]; + setQrcode(imageDataEle?.qrcode); + setBarcode(imageDataEle?.barcode); + setMarks(imageDataEle?.marks); + setMarksR1(imageDataEle?.marks_R1); + setMarksR2(imageDataEle?.marks_R2); + setSubjectCode(imageDataEle?.subject_code); + setRegisterNumber(imageDataEle?.register_number); + setTotalAbsent(imageDataEle?.total_absent); + setTotalPresent(imageDataEle?.total_present); + setTotalStudents(imageDataEle?.total_students); + setSerialNo(imageDataEle?.manually_corrected_serial_no) + } } } + } catch (error) { + throw new Error(error); + setIsLoading(false); } - }catch(error){ - throw new Error(error) - setIsLoading(false) - } }; - fetchImageData() + fetchImageData(); console.log("the currect editor type: ", type); }, [data]); @@ -155,11 +157,11 @@ const PlayGroundEditContainer = ({ if (responseData?.status === "success") { showNotification("Record updated successfully !!", "success"); setShowEditContainer(false); - const queryContainerEle = document.getElementById(imageName) - console.log("querycontainerEle ===== ",queryContainerEle) - if(queryContainerEle){ - queryContainerEle.classList.add("grey-background") - toast.success("Record Updated Successfully !!") + const queryContainerEle = document.getElementById(imageName); + console.log("querycontainerEle ===== ", queryContainerEle); + if (queryContainerEle) { + queryContainerEle.classList.add("grey-background"); + toast.success("Record Updated Successfully !!"); } } } catch (error) { @@ -170,7 +172,7 @@ const PlayGroundEditContainer = ({ }; const updateRecordPartA = async () => { - setNotification({}) + setNotification({}); console.log(registerNumber); console.log(subjectCode); console.log(barcode, qrcode); @@ -190,6 +192,7 @@ const PlayGroundEditContainer = ({ registerNumber, imageName, rotateAngle, + serialNo }; const response = await fetch( `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/editPartAdata`, @@ -207,14 +210,14 @@ const PlayGroundEditContainer = ({ if (responseData?.status === "success") { showNotification("Record updated successfully !!", "success"); setShowEditContainer(false); - const queryContainerEle = document.getElementById(imageName) - console.log("querycontainerEle ===== ",queryContainerEle) - if(queryContainerEle){ - queryContainerEle.classList.add("grey-background") + const queryContainerEle = document.getElementById(imageName); + console.log("querycontainerEle ===== ", queryContainerEle); + if (queryContainerEle) { + queryContainerEle.classList.add("grey-background"); } - setTimeout(()=>{ - showNotification("Record Updated Successfully !!","success") - },500) + setTimeout(() => { + showNotification("Record Updated Successfully !!", "success"); + }, 500); } } catch (error) { setIsLoading(false); @@ -238,7 +241,7 @@ const PlayGroundEditContainer = ({ style={{ zIndex: 100 }} fullWidth > - + @@ -315,11 +318,18 @@ const PlayGroundEditContainer = ({ /> ) : type == "PartA" ? ( - + <> + + + ) : null} {type == "PartC" ? (