latest
This commit is contained in:
parent
2b0e3b11be
commit
01e475baca
4
.env
4
.env
|
|
@ -1,4 +1,4 @@
|
||||||
#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="https://api.exampaper.vidh.ai"
|
# VITE_REACT_APP_BACKEND_URL="https://api.exampaper.vidh.ai"
|
||||||
# VITE_REACT_APP_BACKEND_URL="http://localhost:9999"
|
VITE_REACT_APP_BACKEND_URL="http://localhost:9999"
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,12 @@ import InputLabel from "@mui/material/InputLabel";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import FormControl from "@mui/material/FormControl";
|
import FormControl from "@mui/material/FormControl";
|
||||||
import Select from "@mui/material/Select";
|
import Select from "@mui/material/Select";
|
||||||
|
import { useSearchParams } from "react-router-dom";
|
||||||
|
|
||||||
const { Content, Header } = Layout;
|
const { Content, Header } = Layout;
|
||||||
|
|
||||||
function AnomalyPartC() {
|
function AnomalyPartC() {
|
||||||
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [isLoading2, setIsLoading2] = useState(false);
|
const [isLoading2, setIsLoading2] = useState(false);
|
||||||
const [anomalyData, setAnomalyData] = useState(null);
|
const [anomalyData, setAnomalyData] = useState(null);
|
||||||
|
|
@ -38,7 +40,7 @@ function AnomalyPartC() {
|
||||||
const [totalPages, setTotalPages] = useState(1);
|
const [totalPages, setTotalPages] = useState(1);
|
||||||
const [showSystemNoContainer, setShowSystemNoContainer] = useState(false);
|
const [showSystemNoContainer, setShowSystemNoContainer] = useState(false);
|
||||||
const [selectedIndex, setSelectedIndex] = useState(null);
|
const [selectedIndex, setSelectedIndex] = useState(null);
|
||||||
const [selectedDegreeType, setSelectedDegreeType] = useState("0");
|
const [selectedDegreeType, setSelectedDegreeType] = useState("2");
|
||||||
const degreeTypes = [
|
const degreeTypes = [
|
||||||
{ type: "UG", type_code: "0" },
|
{ type: "UG", type_code: "0" },
|
||||||
{ type: "PG", type_code: "2" },
|
{ type: "PG", type_code: "2" },
|
||||||
|
|
@ -53,6 +55,10 @@ function AnomalyPartC() {
|
||||||
} = theme.useToken();
|
} = theme.useToken();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const paramsError = searchParams.get("error")
|
||||||
|
const paramsErrorReason = searchParams.get("error_reason")
|
||||||
|
const paramsSysNo = searchParams.get("sysNo")
|
||||||
|
const paramsDegreeType = searchParams.get("degreeType")
|
||||||
const evErrorsList = useSelector((state) => state?.partCErrorList);
|
const evErrorsList = useSelector((state) => state?.partCErrorList);
|
||||||
console.log("evErrorsList = ", evErrorsList);
|
console.log("evErrorsList = ", evErrorsList);
|
||||||
|
|
||||||
|
|
@ -106,9 +112,9 @@ function AnomalyPartC() {
|
||||||
}, [evErrors]);
|
}, [evErrors]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(updatePartCErrorData([]));
|
// dispatch(updatePartCErrorData([]));
|
||||||
setAnomalyData([]);
|
// setAnomalyData([]);
|
||||||
setEvErrors([]);
|
// setEvErrors([]);
|
||||||
fetchAnomalyData();
|
fetchAnomalyData();
|
||||||
}, [selectedDegreeType]);
|
}, [selectedDegreeType]);
|
||||||
|
|
||||||
|
|
@ -164,6 +170,7 @@ function AnomalyPartC() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchAnomalyRecords = async (reduxSystemNo) => {
|
const fetchAnomalyRecords = async (reduxSystemNo) => {
|
||||||
|
console.log("fetching anomoly records")
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
|
|
@ -192,7 +199,7 @@ function AnomalyPartC() {
|
||||||
setEvErrors(systemRecords);
|
setEvErrors(systemRecords);
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
dispatch(updatePartCErrorData(systemRecords));
|
dispatch(updatePartCErrorData(systemRecords));
|
||||||
|
localStorage.setItem("marks_manual_data", JSON.stringify(systemRecords));
|
||||||
updateSystemReservationStatus(systemRecords);
|
updateSystemReservationStatus(systemRecords);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
@ -345,11 +352,11 @@ function AnomalyPartC() {
|
||||||
Count: {item["count(*)"]}
|
Count: {item["count(*)"]}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{item.error_reason && (
|
{/* {item.error_reason && (
|
||||||
<Typography id="3" variant="body2" color="whitesmoke">
|
<Typography id="3" variant="body2" color="whitesmoke">
|
||||||
Reason: {item.error_reason}
|
Reason: {item.error_reason}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)} */}
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
))}
|
||||||
|
|
@ -382,6 +389,10 @@ function AnomalyPartC() {
|
||||||
data={data}
|
data={data}
|
||||||
s3_image_column="s3_path"
|
s3_image_column="s3_path"
|
||||||
query="ocr_scanned_part_c_v1"
|
query="ocr_scanned_part_c_v1"
|
||||||
|
error={error}
|
||||||
|
error_reason={errorReason}
|
||||||
|
reduxSystemNo={reduxSystemNo}
|
||||||
|
degreeType = {selectedDegreeType}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
import { useSearchParams } from "react-router-dom";
|
import { useSearchParams } from "react-router-dom";
|
||||||
import { Box, Button } from "@mui/material";
|
import { Box, Button } from "@mui/material";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
import AntdesignLayout from "./AntdesignLayout";
|
import AntdesignLayout from "./AntdesignLayout";
|
||||||
import TextInputField from "./TextInputField";
|
import TextInputField from "./TextInputField";
|
||||||
|
|
@ -9,6 +12,9 @@ import LoadingContainer from "./LoadingContainer";
|
||||||
import SimpleDialog from "./SimpleDialog";
|
import SimpleDialog from "./SimpleDialog";
|
||||||
import RotateLeftIcon from "@mui/icons-material/RotateLeft";
|
import RotateLeftIcon from "@mui/icons-material/RotateLeft";
|
||||||
import RotateRightIcon from "@mui/icons-material/RotateRight";
|
import RotateRightIcon from "@mui/icons-material/RotateRight";
|
||||||
|
import { updatePartCErrorData, updateSystemNo } from "../redux/actions/actions";
|
||||||
|
import { updatePartCErrorList } from "../redux/actions/actions";
|
||||||
|
import { DiscFullTwoTone } from "@mui/icons-material";
|
||||||
|
|
||||||
const QueryCardEditor = () => {
|
const QueryCardEditor = () => {
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
@ -22,11 +28,23 @@ const QueryCardEditor = () => {
|
||||||
const [s3Path, setS3Path] = useState(null);
|
const [s3Path, setS3Path] = useState(null);
|
||||||
const [showDialog, setShowDialog] = useState(false);
|
const [showDialog, setShowDialog] = useState(false);
|
||||||
const [rotationResults, setRotationResults] = useState([]);
|
const [rotationResults, setRotationResults] = useState([]);
|
||||||
|
const [rotateAngle, setRotateAngle] = useState(0);
|
||||||
|
const evErrorsList = useSelector((state) => state?.partCErrorList);
|
||||||
const table = searchParams.get("table");
|
const table = searchParams.get("table");
|
||||||
const image_name = searchParams.get("image_name");
|
const image_name = searchParams.get("image_name");
|
||||||
|
const paramsError = searchParams.get("error");
|
||||||
|
const paramsErrorReason = searchParams.get("error_reason");
|
||||||
|
const paramsSysNo = searchParams.get("sysNo");
|
||||||
|
const paramsDegreeType = searchParams.get("degreeType");
|
||||||
|
const [items, setItems] = useState([]);
|
||||||
|
const [evErrorsData,setEvErrorsData] = useState([]);
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
console.log("Ev errors list ==== ", evErrorsList);
|
||||||
console.log("table is : ", table);
|
console.log("table is : ", table);
|
||||||
|
// const evErrorsData = useSelector((state) => state?.partCErrorData);
|
||||||
|
// console.log("evErrorData: ", evErrorsData);
|
||||||
|
|
||||||
const fetchPrimaryKeyData = async () => {
|
const fetchPrimaryKeyData = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -51,6 +69,25 @@ const QueryCardEditor = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const marksLocalData = localStorage.getItem("marks_manual_data");
|
||||||
|
console.log("Marks local data 123 ========= ",marksLocalData)
|
||||||
|
if (marksLocalData) {
|
||||||
|
console.log("Into if and updating .......")
|
||||||
|
console.log("marks local data ==== ",marksLocalData)
|
||||||
|
setEvErrorsData(JSON.parse(marksLocalData));
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
dispatch(updateSystemNo(paramsSysNo))
|
||||||
|
},[paramsSysNo])
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
console.log("Ev error data =============== ",evErrorsData)
|
||||||
|
},[evErrorsData])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
if (table && image_name) {
|
if (table && image_name) {
|
||||||
|
|
@ -80,7 +117,11 @@ const QueryCardEditor = () => {
|
||||||
setS3Path(recordData?.s3_path);
|
setS3Path(recordData?.s3_path);
|
||||||
}, [recordData]);
|
}, [recordData]);
|
||||||
|
|
||||||
|
|
||||||
const updateRecord = async () => {
|
const updateRecord = async () => {
|
||||||
|
if(!marks){
|
||||||
|
return
|
||||||
|
}
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
try {
|
try {
|
||||||
const payload = {
|
const payload = {
|
||||||
|
|
@ -91,6 +132,7 @@ const QueryCardEditor = () => {
|
||||||
subjectCode,
|
subjectCode,
|
||||||
marks,
|
marks,
|
||||||
imageName,
|
imageName,
|
||||||
|
rotateAngle
|
||||||
};
|
};
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/editPartCdata`,
|
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/editPartCdata`,
|
||||||
|
|
@ -107,6 +149,30 @@ const QueryCardEditor = () => {
|
||||||
console.log("response data ========= ", responseData);
|
console.log("response data ========= ", responseData);
|
||||||
if (responseData?.status === "success") {
|
if (responseData?.status === "success") {
|
||||||
toast.success("Record Updated Successfully ...");
|
toast.success("Record Updated Successfully ...");
|
||||||
|
var currentIndex = null;
|
||||||
|
console.log("Ev errors data before filter ============= ",evErrorsData)
|
||||||
|
var newRecords = evErrorsData.filter((data, index) => {
|
||||||
|
if (data?.image_name === imageName) {
|
||||||
|
currentIndex = index;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if(!currentIndex){
|
||||||
|
currentIndex = 0
|
||||||
|
}
|
||||||
|
console.log("new records ======1 ", newRecords);
|
||||||
|
console.log("Current Index ===== ", currentIndex);
|
||||||
|
dispatch(updatePartCErrorData(newRecords));
|
||||||
|
if (newRecords.length > 0) {
|
||||||
|
console.log("Has to navigte 12 .....");
|
||||||
|
localStorage.setItem("marks_manual_data", JSON.stringify(newRecords));
|
||||||
|
const newUrl = `/sqlPlayground/edit?image_name=${newRecords[currentIndex]?.image_name}&table=ocr_scanned_part_c_v1&error=${paramsError}&error_reason=${paramsErrorReason}°reeType=${paramsDegreeType}&sysNo=${paramsSysNo}`;
|
||||||
|
console.log("new url ==== ", newUrl);
|
||||||
|
window.location.href = newUrl;
|
||||||
|
} else {
|
||||||
|
navigate("/");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
@ -114,6 +180,15 @@ const QueryCardEditor = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("Rotate angle changed to ========== ", rotateAngle);
|
||||||
|
const imageContainer = document.getElementById("img-container");
|
||||||
|
console.log("Imge container ===== ", imageContainer);
|
||||||
|
if (imageContainer) {
|
||||||
|
imageContainer.style.transform = `rotate(${rotateAngle}deg)`;
|
||||||
|
}
|
||||||
|
}, [rotateAngle]);
|
||||||
|
|
||||||
const initateRotation = async () => {
|
const initateRotation = async () => {
|
||||||
console.log("Rotating initiated ...");
|
console.log("Rotating initiated ...");
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
@ -144,6 +219,35 @@ const QueryCardEditor = () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const skipPage = () =>{
|
||||||
|
try{
|
||||||
|
if(evErrorsData){
|
||||||
|
var currentIndex = null
|
||||||
|
var newRecords = evErrorsData.filter((data, index) => {
|
||||||
|
if (data?.image_name === imageName) {
|
||||||
|
currentIndex = index;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
if(!currentIndex){
|
||||||
|
currentIndex = 0
|
||||||
|
}
|
||||||
|
console.log("Current Index ===== ", currentIndex);
|
||||||
|
const newIndex = currentIndex+1
|
||||||
|
console.log("new index ===== ",newIndex)
|
||||||
|
if (newRecords.length > 0) {
|
||||||
|
console.log("Has to navigte 12 .....");
|
||||||
|
const newUrl = `/sqlPlayground/edit?image_name=${evErrorsData[newIndex]?.image_name}&table=ocr_scanned_part_c_v1&error=${paramsError}&error_reason=${paramsErrorReason}°reeType=${paramsDegreeType}&sysNo=${paramsSysNo}`;
|
||||||
|
console.log("new url ==== ", newUrl);
|
||||||
|
window.location.href = newUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(error){
|
||||||
|
throw new Error(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AntdesignLayout>
|
<AntdesignLayout>
|
||||||
<Box className="d-flex justify-content-between align-items-center">
|
<Box className="d-flex justify-content-between align-items-center">
|
||||||
|
|
@ -177,23 +281,31 @@ const QueryCardEditor = () => {
|
||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
</Button>
|
</Button>
|
||||||
{/* <Box className="d-flex justify-content-between">
|
|
||||||
<Button
|
<Button
|
||||||
className="bg-primary text-white rounded p-3"
|
className="bg-primary text-white rounded p-3"
|
||||||
onClick={() => initateRotation()}
|
onClick={() => {
|
||||||
|
skipPage()
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Skip
|
||||||
|
</Button>
|
||||||
|
<Box className="d-flex justify-content-between">
|
||||||
|
<Button
|
||||||
|
className="bg-primary text-white rounded p-3"
|
||||||
|
onClick={() => setRotateAngle((prev) => prev - 90)}
|
||||||
>
|
>
|
||||||
Rotate <RotateLeftIcon />
|
Rotate <RotateLeftIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="bg-primary text-white rounded p-3"
|
className="bg-primary text-white rounded p-3"
|
||||||
onClick={() => initateRotation()}
|
onClick={() => setRotateAngle((prev) => prev + 90)}
|
||||||
>
|
>
|
||||||
Rotate <RotateRightIcon />
|
Rotate <RotateRightIcon />
|
||||||
</Button>
|
</Button>
|
||||||
</Box> */}
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Box className="w-75">
|
<Box className="w-75">
|
||||||
<Box className="px-5">
|
<Box className="px-5" id="img-container">
|
||||||
<img
|
<img
|
||||||
src={`https://docs.exampaper.vidh.ai/${recordData?.s3_path}`}
|
src={`https://docs.exampaper.vidh.ai/${recordData?.s3_path}`}
|
||||||
width="100%"
|
width="100%"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,10 @@ import { ToastContainer, toast } from "react-toastify";
|
||||||
import LoadingContainer from "./LoadingContainer";
|
import LoadingContainer from "./LoadingContainer";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const QueryExecutorCard = ({ data, s3_image_column, query }) => {
|
const QueryExecutorCard = ({ data, s3_image_column, query, error, error_reason, reduxSystemNo,degreeType }) => {
|
||||||
|
// console.log("ERROR ============= ",error)
|
||||||
|
// console.log("ERROR REASON ============== ",error_reason)
|
||||||
|
// console.log("REDUX SYSTEM NO ================== ",reduxSystemNo)
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const [dataValue, setDataValue] = useState({});
|
const [dataValue, setDataValue] = useState({});
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
@ -172,7 +175,7 @@ const QueryExecutorCard = ({ data, s3_image_column, query }) => {
|
||||||
<>
|
<>
|
||||||
<Button
|
<Button
|
||||||
className="w-50 m-0 bg-primary text-white p-1 rounded"
|
className="w-50 m-0 bg-primary text-white p-1 rounded"
|
||||||
onClick={() => navigate(`/sqlPlayground/edit?image_name=${data["image_name"]}&table=ocr_scanned_part_c_v1`)}
|
onClick={() => navigate(`/sqlPlayground/edit?image_name=${data["image_name"]}&table=ocr_scanned_part_c_v1&error=${error}&error_reason=${error_reason}&sysNo=${reduxSystemNo}°reeType=${degreeType}`)}
|
||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ const initialState = {
|
||||||
selectedError: null,
|
selectedError: null,
|
||||||
selectedErrorData: [],
|
selectedErrorData: [],
|
||||||
selectedErrorJson: {},
|
selectedErrorJson: {},
|
||||||
|
partCDegreeType : null
|
||||||
};
|
};
|
||||||
|
|
||||||
const reducer = (state = initialState, action) => {
|
const reducer = (state = initialState, action) => {
|
||||||
|
|
@ -41,10 +42,12 @@ const initialState = {
|
||||||
return { ...state, selectedErrorData:action?.payload}
|
return { ...state, selectedErrorData:action?.payload}
|
||||||
case 'UPDATE_SELECTED_ERROR_JSON':
|
case 'UPDATE_SELECTED_ERROR_JSON':
|
||||||
return { ...state, selectedErrorJson:action?.payload}
|
return { ...state, selectedErrorJson:action?.payload}
|
||||||
|
case 'UPDATE_PART_C_DEGREE_TYPE':
|
||||||
|
return { ...state, partCDegreeType:action?.payload}
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default reducer;
|
export default reducer;
|
||||||
|
|
||||||
Loading…
Reference in New Issue