This commit is contained in:
Pradeeppon01 2024-07-24 03:24:31 +05:30
commit 56f3422a84
2 changed files with 72 additions and 5 deletions

View File

@ -94,6 +94,39 @@ const CustomQueryExecutorCard = ({
} }
}; };
const markAsPartc = async () => {
console.log("update markAsPartc");
const payload = {
data,
};
try {
setIsLoading(true);
const response = await fetch(
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/markAsPartc`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
}
);
setIsLoading(false);
const responseData = await response.json();
if (responseData.status === "success") {
console.log("Updation successfull ....");
const updatedData = { ...dataValue, is_backpage: 1 };
// console.log("Data ===== ", updatedData);
setDataValue(updatedData);
// toast.success("Record Marked as Backpage ! ....");
} else {
throw new Error(responseData?.message);
}
} catch (error) {
throw new Error(error);
}
};
const updatePartAFront = async () => { const updatePartAFront = async () => {
console.log("update front"); console.log("update front");
const payload = { const payload = {
@ -151,7 +184,7 @@ const CustomQueryExecutorCard = ({
const updatedData = { ...dataValue, is_backpage: 1 }; const updatedData = { ...dataValue, is_backpage: 1 };
// console.log("Data ===== ", updatedData); // console.log("Data ===== ", updatedData);
setDataValue(updatedData); setDataValue(updatedData);
toast.success("Record Marked as Frontpage ! ...."); // toast.success("Record Marked as Frontpage ! ....");
} else { } else {
toast.error("Something Went Wrong !..."); toast.error("Something Went Wrong !...");
setIsLoading(false) setIsLoading(false)
@ -185,7 +218,7 @@ const CustomQueryExecutorCard = ({
const updatedData = { ...dataValue, is_backpage: 1 }; const updatedData = { ...dataValue, is_backpage: 1 };
// console.log("Data ===== ", updatedData); // console.log("Data ===== ", updatedData);
setDataValue(updatedData); setDataValue(updatedData);
toast.success("Record Marked as Backpage ! ...."); // toast.success("Record Marked as Backpage ! ....");
} else { } else {
setIsLoading(false); setIsLoading(false);
toast.error("Something Went Wrong !..."); toast.error("Something Went Wrong !...");
@ -249,6 +282,38 @@ const CustomQueryExecutorCard = ({
} }
}; };
const markAsPart_A = async () => {
const payload = {
data,
};
try {
setIsLoading(true);
const response = await fetch(
`${import.meta.env.VITE_REACT_APP_BACKEND_URL}/markAsPartA`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
}
);
setIsLoading(false);
const responseData = await response.json();
if (responseData.status === "success") {
const updatedData = { ...dataValue, is_cover: 1 };
// console.log("Data ===== ", updatedData);
setDataValue(updatedData);
console.log("Updation successfull ....");
// toast.success("Record Marked As Ev !...");
} else {
throw new Error(responseData?.message);
}
} catch (error) {
throw new Error(error);
}
};
const markAsDummy = async () => { const markAsDummy = async () => {
const payload = { const payload = {
data, data,
@ -272,7 +337,7 @@ const CustomQueryExecutorCard = ({
// console.log("Data ===== ", updatedData); // console.log("Data ===== ", updatedData);
setDataValue(updatedData); setDataValue(updatedData);
console.log("Updation successfull ...."); console.log("Updation successfull ....");
toast.success("Record Marked As Ev !..."); // toast.success("Record Marked As Ev !...");
} else { } else {
setIsLoading(false) setIsLoading(false)
toast.error("Something Went Wrong !..."); toast.error("Something Went Wrong !...");
@ -302,6 +367,7 @@ const CustomQueryExecutorCard = ({
{ btnLabel: "Mark As Back", action: updateBack }, { btnLabel: "Mark As Back", action: updateBack },
{ btnLabel: "Mark As Ev", action: updateEvCover }, { btnLabel: "Mark As Ev", action: updateEvCover },
{ btnLabel: "Mark As Dummy", action: markAsDummy }, { btnLabel: "Mark As Dummy", action: markAsDummy },
{btnLabel: "Mark As Part-A", action: markAsPart_A},
{ btnLabel: "Edit", action: showContainerAction }, { btnLabel: "Edit", action: showContainerAction },
], ],
PartA: [ PartA: [

View File

@ -40,7 +40,7 @@ const PlayGroundEditContainer = ({
const handleClose = () => { const handleClose = () => {
setOpen(false); setOpen(false);
}; };
console.log("image_name ======================= ", imageName)
useEffect(() => { useEffect(() => {
if (data) { if (data) {
setQrcode(data?.qrcode); setQrcode(data?.qrcode);
@ -99,6 +99,7 @@ const PlayGroundEditContainer = ({
console.log(registerNumber); console.log(registerNumber);
console.log(subjectCode); console.log(subjectCode);
console.log(barcode, qrcode); console.log(barcode, qrcode);
console.log("image_name = ", imageName)
console.log(!registerNumber && !subjectCode && (!barcode || !qrcode)); console.log(!registerNumber && !subjectCode && (!barcode || !qrcode));
if (!registerNumber && !subjectCode && (!barcode || !qrcode)) { if (!registerNumber && !subjectCode && (!barcode || !qrcode)) {
return; return;
@ -129,7 +130,7 @@ const PlayGroundEditContainer = ({
setIsLoading(false); setIsLoading(false);
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 ...");
setShowEditContainer(false); setShowEditContainer(false);
} }
} catch (error) { } catch (error) {