diff --git a/src/Components/CustomQueryExecutorCard.jsx b/src/Components/CustomQueryExecutorCard.jsx
index 4314214..d5955b5 100644
--- a/src/Components/CustomQueryExecutorCard.jsx
+++ b/src/Components/CustomQueryExecutorCard.jsx
@@ -10,8 +10,8 @@ import { useNavigate } from "react-router-dom";
import RotateLeftIcon from "@mui/icons-material/RotateLeft";
import RotateRightIcon from "@mui/icons-material/RotateRight";
import PlayGroundEditContainer from "./PlayGroundEditContainer"
-import saveRotatedImage from "./Utilities/PlaygroundUtilities"
-
+import saveRotatedImage from "./Utilities/PartCPlaygroundUtilities"
+import markAsPartc from "./Utilities/PartAPlaygroundUtilities";
const CustomQueryExecutorCard = ({
data,
@@ -38,6 +38,8 @@ const CustomQueryExecutorCard = ({
const [tableNameData, setTableNameData] = useState(null);
const imageEleRef = useRef();
const [showEditContainer,setShowEditContainer] = useState(false)
+ const [editorType, setEditorType] = useState(null);
+
console.log("data =================== ", data);
// console.log("image column ====== ", s3_image_column);
// console.log("s3 image ======= ", data[s3_image_column]);
@@ -278,6 +280,8 @@ const CustomQueryExecutorCard = ({
const showContainerAction = () =>{
setShowEditContainer(true)
+ console.log("type === ", type)
+ // setEditorType(type)
}
const buttonActions = {
@@ -290,9 +294,10 @@ const CustomQueryExecutorCard = ({
],
PartA: [
{ btnLabel: "Mark As Front", action: updatePartAFront },
- { btnLabel: "Mark As Instruction", action: updatePartAInstructions },
- { btnLabel: "Initiate Process", action: initateProcess },
+ { btnLabel: "Mark As Backpage", action: updatePartAInstructions },
+ // { btnLabel: "Initiate Process", action: initateProcess },
{ btnLabel: "Mark As Dummy",action:markAsDummy },
+ { btnLabel: "Mark As Part-C",action: markAsPartc },
{ btnLabel: "Edit",action: showContainerAction}
],
};
@@ -422,7 +427,7 @@ const CustomQueryExecutorCard = ({
@@ -437,7 +442,7 @@ const CustomQueryExecutorCard = ({
{isLoading && }
- {showEditContainer && }
+ {showEditContainer && }
);
};
diff --git a/src/Components/PlayGroundEditContainer.jsx b/src/Components/PlayGroundEditContainer.jsx
index 8608d9d..0cb2ff2 100644
--- a/src/Components/PlayGroundEditContainer.jsx
+++ b/src/Components/PlayGroundEditContainer.jsx
@@ -18,10 +18,13 @@ const PlayGroundEditContainer = ({
tableName,
setShowEditContainer,
rotateAngle,
+ type
}) => {
- const type = "PartC";
+ // const type = "PartC";
+ // const type = type;
const dialogText = "This is dialog text";
const [marks, setMarks] = useState(null);
+ const [registerNumber, setRegisterNumber] = useState(null);
const [barcode, setBarcode] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const [qrcode, setQrcode] = useState(null);
@@ -37,10 +40,12 @@ const PlayGroundEditContainer = ({
setBarcode(data?.barcode);
setMarks(data?.marks);
setSubjectCode(data?.subject_code)
+ setRegisterNumber(data?.registerNumber)
}
+ console.log("the currect editor type: ", type)
}, [data]);
- const updateRecord = async () => {
+ const updateRecordPartC = async () => {
if (!marks) {
return;
}
@@ -80,6 +85,51 @@ const PlayGroundEditContainer = ({
}
};
+
+ const updateRecordPartA = async () => {
+ console.log(registerNumber)
+ console.log(subjectCode)
+ console.log(barcode, qrcode)
+ console.log(!registerNumber && !subjectCode && (!barcode || !qrcode))
+ if (!registerNumber && !subjectCode && (!barcode || !qrcode)) {
+ return;
+ }
+ setIsLoading(true);
+ try {
+ const payload = {
+ qrcode,
+ barcode,
+ table:tableName,
+ s3Path,
+ subjectCode,
+ registerNumber,
+ imageName,
+ rotateAngle,
+ };
+ const response = await fetch(
+ `${import.meta.env.VITE_REACT_APP_BACKEND_URL}/editPartAdata`,
+ {
+ 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);
+ }
+ };
+
return (