This commit is contained in:
Pradeeppon01 2024-08-02 12:06:05 +05:30
parent 0f58d9967a
commit e28c9bce3d
3 changed files with 37 additions and 18 deletions

View File

@ -40,3 +40,12 @@
.read-the-docs {
color: #888;
}
.completed{
background-color: green !important;
color: white !important;
}
.visited{
background-color:rgba(128, 128, 128, 0.5) !important;
}

View File

@ -29,6 +29,7 @@ const DummyDuplicates = () => {
const [currentImagePath, setCurrentImagePath] = useState("");
const [barcode, SetBarcode] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const [isUpdated,setIsUpdated] = useState(false)
const { type } = useParams();
console.log("Type ======= ", type);
@ -103,10 +104,12 @@ const DummyDuplicates = () => {
{dummyDuplicatesData?.length > 0 &&
duplicateBarcodes.map((barcode) => (
<Box
className="p-3 rounded bg-white my-2 w-100 m-3 cursor-pointer overflow-auto"
stype={{ cursor: "pointer" }}
className="p-3 rounded my-2 w-100 m-3 cursor-pointer overflow-auto"
style={{ cursor: "pointer",background:"white" }}
onClick={handleImagePreview}
data-barcode={barcode}
id = {barcode}
>
<h5 data-barcode={barcode}>{barcode}</h5>
</Box>

View File

@ -47,6 +47,7 @@ export default function DummyDuplicatesPreview({
const [partAImageS3Path, setPartAImageS3Path] = useState(null);
const [partCImageS3Path, setPartCImageS3Path] = useState(null);
const [loadingText, setLoadingText] = useState(null);
const [isUpdated, setIsUpdated] = useState(false);
const openNotification = (pauseOnHover) => () => {
api.open({
@ -66,6 +67,15 @@ export default function DummyDuplicatesPreview({
setIsDialogOpen(false);
setTimeout(() => {
document.body.style.overflow = "auto";
const barcodeCardEle = document.getElementById(barcode);
console.log("barcodeCardEle ======== ", barcodeCardEle);
if (barcodeCardEle) {
if (isUpdated) {
barcodeCardEle.classList.add("completed");
} else {
barcodeCardEle.classList.add("visited");
}
}
}, 100);
};
@ -172,32 +182,28 @@ export default function DummyDuplicatesPreview({
setInputRegisterNumber(null);
setInputSubjectCode(null);
setPartAImageS3Path(null);
setInputSerialNo(null)
setInputSerialNo(null);
setTimeout(() => {
setInputBarcode(partAResults[partAImageIndex]?.barcode);
setInputRegisterNumber(partAResults[partAImageIndex]?.register_number);
setInputSubjectCode(partAResults[partAImageIndex]?.subject_code);
setPartAImageS3Path(partAResults[partAImageIndex]?.s3_path);
setInputSerialNo(partAResults[partAImageIndex]?.serial_no)
setInputSerialNo(partAResults[partAImageIndex]?.serial_no);
setIsLoading(false);
}, 500);
}
}, [dummyDuplicatesData, partAImageIndex]);
useEffect(()=>{
console.log("part c image index changing ....",partCImageIndex)
if(partCResults.length > 0 && partCImageIndex <= partCResults.length){
console.log("into if ..")
setPartCImageS3Path(null)
setTimeout(()=>{
setPartCImageS3Path(partCResults[partCImageIndex]?.s3_path)
},5000)
}
},[partCImageIndex])
useEffect(() => {
console.log("part c image index changing ....", partCImageIndex);
if (partCResults.length > 0 && partCImageIndex <= partCResults.length) {
console.log("into if ..");
setPartCImageS3Path(null);
setTimeout(() => {
setPartCImageS3Path(partCResults[partCImageIndex]?.s3_path);
}, 5000);
}
}, [partCImageIndex]);
useEffect(() => {
if (partAImageS3Path) {
@ -281,6 +287,7 @@ useEffect(()=>{
} else {
console.log("showing notification ...");
toast.success("Record updated Successfully ..");
setIsUpdated(true);
}
}
} catch (error) {