This commit is contained in:
Pradeeppon01 2024-09-23 18:18:53 +05:30
parent 63831d050b
commit 01234e9295
6 changed files with 187 additions and 6 deletions

4
.env
View File

@ -1,6 +1,6 @@
#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"
VITE_REACT_APP_BACKEND_URL="https://api.exampaper.usln.in" #VITE_REACT_APP_BACKEND_URL="https://api.exampaper.usln.in"

View File

@ -1,13 +1,13 @@
#! /bin/bash #! /bin/bash
SOURCE_DIR=/home/neuu/attendence_UI/frontend SOURCE_DIR=/home/neuu/attendence_UI/attendence_UI
BRANCH=part_a_playground BRANCH=part_a_playground
FRONTEND_DIR=/var/www/exampaper.usln.in FRONTEND_DIR=/var/www/exampaper.usln.in
#SERVER_IP=52.66.73.43 #SERVER_IP=52.66.73.43
SERVER_IP=34.131.182.12 SERVER_IP=34.131.182.12
cd ~/$SOURCE_DIR cd $SOURCE_DIR
echo "Changed into attendence UI frontend dir ....." echo "Changed into attendence UI frontend dir ....."
echo "Pulling $BRANCH ..." echo "Pulling $BRANCH ..."
@ -18,7 +18,7 @@ if [[ $? -eq 0 ]];then
npm run build npm run build
if [[ $? -eq 0 ]];then if [[ $? -eq 0 ]];then
echo "Build the latest file ....." 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 if [[ $? -eq 0 ]];then
echo "Copying build file to $FRONTEND_DIR successfull ...." echo "Copying build file to $FRONTEND_DIR successfull ...."
else else

View File

@ -236,3 +236,9 @@ button{
font-size: 22px; font-size: 22px;
line-height: 40px; line-height: 40px;
} }
::selection {
background: blue;
color: white;
}

View File

@ -33,6 +33,7 @@ import DummyDuplicates from "./Components/DummyDuplicates";
import IndividualStudAttendence from "./Components/IndividualStudAttendence"; import IndividualStudAttendence from "./Components/IndividualStudAttendence";
import PendingAttendenceCorrection from "./Components/PendingAttendenceCorrection"; import PendingAttendenceCorrection from "./Components/PendingAttendenceCorrection";
import QrcodeFinder from "./Components/QrcodeFinder"; import QrcodeFinder from "./Components/QrcodeFinder";
import IndividualMarksheetGen from "./Components/IndividualMarksheetGen";
function App() { function App() {
return ( return (
@ -41,6 +42,7 @@ function App() {
<Routes> <Routes>
<Route path="/" element={<Home />}></Route> <Route path="/" element={<Home />}></Route>
<Route path="/sqlPlayground" element={<QueryExecutor />}></Route> <Route path="/sqlPlayground" element={<QueryExecutor />}></Route>
<Route path="/certificate/gen/individual" element={<IndividualMarksheetGen/>}></Route>
<Route <Route
path="/sqlPlayground/edit" path="/sqlPlayground/edit"
element={<QueryCardEditor />} element={<QueryCardEditor />}

View File

@ -6,6 +6,10 @@ import Notification from "./Notification";
const Home = () => { const Home = () => {
const cards = [ const cards = [
{
title:"Individual Student Marksheet Generation",
url:"/certificate/gen/individual"
},
{ {
title: "Reassigned Serial No Anomoly Manual Updation (ATTENDANCE)", title: "Reassigned Serial No Anomoly Manual Updation (ATTENDANCE)",
url: "/anomoly/attendence", url: "/anomoly/attendence",

View File

@ -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 (
<AntdesignLayout>
<Box
className="d-flex justify-content-center w-100 gap-3 align-items-center mx-auto"
style={{ maxWidth: "1600px" }}
>
<div className="mb-3">
<label htmlFor="exampleFormControlInput1" className="form-label">
<strong>Register Number</strong>
</label>
<input
type="text"
className="form-control p-3"
id="regnoInput"
placeholder="Eg : 20213091515201"
onChange={(e) => setRegisterNumber(e.target.value)}
style={{ width: "600px" }}
/>
</div>
<button
type="button"
className="btn btn-primary btn-sm px-4 h-75"
onClick={triggenCertificateGen}
>
Submit
</button>
</Box>
<Box style={{width:"70%",margin:"auto",textAlign:'center'}}>
{processList.length > 0 && (
<>
<TableContainer component={Paper}>
<Table>
<TableHead>
<TableRow>
<TableCell><strong>ID</strong></TableCell>
<TableCell><strong>Register Number</strong></TableCell>
<TableCell><strong>Status</strong></TableCell>
<TableCell><strong>Created on</strong></TableCell>
</TableRow>
</TableHead>
<TableBody>
{processList.map((processData) => (
<TableRow key={processData.id}>
<TableCell>{processData?.id}</TableCell>
<TableCell>{processData?.register_number}</TableCell>
<TableCell style={{textAlign:'center'}}><button style={{backgroundColor:processData?.status === "INCOMPLETE" ? 'red' : 'green',color:"white",borderRadius:'10px',padding:'3px 10px'}}>{processData?.status}</button></TableCell>
<TableCell>{processData?.created_on}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</>
)}
</Box>
{isLoading && <LoadingContainer />}
{notification && (
<Notification
message={notification.message}
type={notification.type}
onClose={() => setNotification(null)}
/>
)}
</AntdesignLayout>
);
};
export default IndividualMarksheetGen;