From 01234e9295ed235056394ae9006082467e124130 Mon Sep 17 00:00:00 2001 From: Pradeeppon01 Date: Mon, 23 Sep 2024 18:18:53 +0530 Subject: [PATCH] latest --- .env | 4 +- deploy.sh | 6 +- src/App.css | 8 +- src/App.jsx | 2 + src/Components/Home.jsx | 4 + src/Components/IndividualMarksheetGen.jsx | 169 ++++++++++++++++++++++ 6 files changed, 187 insertions(+), 6 deletions(-) create mode 100644 src/Components/IndividualMarksheetGen.jsx diff --git a/.env b/.env index b433a17..75d0e85 100644 --- a/.env +++ b/.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="http://localhost:9999" #VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai" -VITE_REACT_APP_BACKEND_URL="https://api.exampaper.usln.in" +#VITE_REACT_APP_BACKEND_URL="https://api.exampaper.usln.in" diff --git a/deploy.sh b/deploy.sh index 3d928fd..45df997 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,13 +1,13 @@ #! /bin/bash -SOURCE_DIR=/home/neuu/attendence_UI/frontend +SOURCE_DIR=/home/neuu/attendence_UI/attendence_UI BRANCH=part_a_playground FRONTEND_DIR=/var/www/exampaper.usln.in #SERVER_IP=52.66.73.43 SERVER_IP=34.131.182.12 -cd ~/$SOURCE_DIR +cd $SOURCE_DIR echo "Changed into attendence UI frontend dir ....." echo "Pulling $BRANCH ..." @@ -18,7 +18,7 @@ if [[ $? -eq 0 ]];then npm run build if [[ $? -eq 0 ]];then echo "Build the latest file ....." - scp -r dist/* ubuntu@$SERVER_IP:$FRONTEND_DIR + scp -r dist/* ponpradeeep@$SERVER_IP:$FRONTEND_DIR if [[ $? -eq 0 ]];then echo "Copying build file to $FRONTEND_DIR successfull ...." else diff --git a/src/App.css b/src/App.css index 780b669..1ae4484 100644 --- a/src/App.css +++ b/src/App.css @@ -235,4 +235,10 @@ button{ color: #ce8500; font-size: 22px; line-height: 40px; -} \ No newline at end of file +} + + +::selection { + background: blue; + color: white; +} diff --git a/src/App.jsx b/src/App.jsx index 542dc1e..d70c910 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -33,6 +33,7 @@ import DummyDuplicates from "./Components/DummyDuplicates"; import IndividualStudAttendence from "./Components/IndividualStudAttendence"; import PendingAttendenceCorrection from "./Components/PendingAttendenceCorrection"; import QrcodeFinder from "./Components/QrcodeFinder"; +import IndividualMarksheetGen from "./Components/IndividualMarksheetGen"; function App() { return ( @@ -41,6 +42,7 @@ function App() { }> }> + }> } diff --git a/src/Components/Home.jsx b/src/Components/Home.jsx index fad5d6d..fd4ad4f 100644 --- a/src/Components/Home.jsx +++ b/src/Components/Home.jsx @@ -6,6 +6,10 @@ import Notification from "./Notification"; const Home = () => { const cards = [ + { + title:"Individual Student Marksheet Generation", + url:"/certificate/gen/individual" + }, { title: "Reassigned Serial No Anomoly Manual Updation (ATTENDANCE)", url: "/anomoly/attendence", diff --git a/src/Components/IndividualMarksheetGen.jsx b/src/Components/IndividualMarksheetGen.jsx new file mode 100644 index 0000000..906b76a --- /dev/null +++ b/src/Components/IndividualMarksheetGen.jsx @@ -0,0 +1,169 @@ +import React, { useState, useEffect } from "react"; +import { Box, Button } from "@mui/material"; +import AntdesignLayout from "./AntdesignLayout"; +import LoadingContainer from "./LoadingContainer"; +import infinity_loader from "../../assets/Infinity_loader.gif"; +import Notification from "./Notification"; // Import the Notification component +import { Height } from "@mui/icons-material"; +import ZoomInIcon from "@mui/icons-material/ZoomIn"; +import ZoomOutIcon from "@mui/icons-material/ZoomOut"; +import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Paper } from '@mui/material'; + + +const IndividualMarksheetGen = () => { + const [registerNumber, setRegisterNumber] = useState(null); + const [courseCode, setCourseCode] = useState(null); + const [isLoading, setIsLoading] = useState(null); + const [notification, setNotification] = useState(null); + const [processList, setProcesList] = useState([]); + + const showNotification = (message, type) => { + setNotification({ message, type }); + }; + + useEffect(() => { + fetchProcessList() + const fetchInterval = setInterval(() => { + // fetchProcessList(); + }, 20000); + return ()=>{ + clearInterval(fetchInterval) + } + }, []); + + const fetchProcessList = async () => { + try { + setIsLoading(true); + const response = await fetch( + `${ + import.meta.env.VITE_REACT_APP_BACKEND_URL + }/fetchCertificateProcessList`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + } + ); + + const responseData = await response.json(); + console.log("Response ==== ", responseData); + setIsLoading(false); + if (responseData?.status == "success") { + setProcesList(responseData?.data); + } + } catch (error) { + setIsLoading(false); + console.log(error); + } + }; + + const triggenCertificateGen = async () => { + console.log("Button clicked .."); + console.log("Register number ==== ", registerNumber); + if (!registerNumber) { + console.log("returning ...."); + return; + } + try { + const payload = { + registerNumber: registerNumber.trim(), + }; + setIsLoading(true); + const response = await fetch( + `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/triggerCertificateGen`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), + } + ); + + const responseData = await response.json(); + console.log("Response ==== ", responseData); + setIsLoading(false); + if (responseData?.status == "success") { + showNotification("Process Started ...", "success"); + fetchProcessList() + } else if (responseData?.status == "failed") { + showNotification("Something went wrong ...", "error"); + } else if (responseData?.status == "invalid") { + showNotification("Invalid Register No ...", "error"); + } + } catch (error) { + setIsLoading(false); + console.log(error); + } + }; + + return ( + + +
+ + setRegisterNumber(e.target.value)} + style={{ width: "600px" }} + /> +
+ + +
+ + {processList.length > 0 && ( + <> + + + + + ID + Register Number + Status + Created on + + + + {processList.map((processData) => ( + + {processData?.id} + {processData?.register_number} + + {processData?.created_on} + + ))} + +
+
+ + )} +
+ {isLoading && } + {notification && ( + setNotification(null)} + /> + )} +
+ ); +}; + +export default IndividualMarksheetGen;