import { HiLocationMarker, HiOutlineBadgeCheck } from "react-icons/hi";
import { TbTruckDelivery } from "react-icons/tb";
import { BsLightningChargeFill } from "react-icons/bs";
import { TbShare3 } from "react-icons/tb";
import { RiDeleteBinLine } from "react-icons/ri";
import { BiBookmark } from "react-icons/bi";
import React, { useEffect, useState } from "react";
import PropTypes from "prop-types";
import { RiArrowDownSFill } from "react-icons/ri";
import { BiRupee, BiStopwatch } from "react-icons/bi";
import { AiOutlineHeart, AiFillStar } from "react-icons/ai";
import { CiShop } from "react-icons/ci";
import { GiScooter } from "react-icons/gi";
import { IoCloseSharp } from "react-icons/io5";
import ModalPozoPublic from "../../Components/PozoPublicCard/ModalPozoPublic.jsx";
// import ShopCardQuantity from "./ShopCardQuantity";
import HeartSvg from "../../Images/Assets/HeartSvg";
import "../../Styles/Components/ShopCard.scss";
import pozologoimg from "../../Images/PozoStore.svg";
import { useNavigate } from "react-router-dom";
import FullPageLoader from "../../Components/Loader/PozoPublicLoader.jsx";
import { useDispatch } from "react-redux";
import { changeCartShow } from "../../Features/Cart/GlobalPublicBooking.js";
const ShopCard = ({
id,
shopName,
dishName,
imageUrl,
price,
deliveryTime,
deliveryDistance,
offer,
isVeg,
isNonVeg,
isFavorite,
addToCartBtn,
showCartShopName,
showQuantityModal,
showChangeQuantity,
offerValue,
deliveryAvailable,
MRP,
Buy,
QuantityPrice,
Review,
buyNow,
direction,
cartSDS,
deliveryStatus,
Cartoffer,
shopNameShow,
CartMRP,
Color,
Size,
Accredited,
showSize,
showColor,
youSave,
SDSIcon,
multiQty,
HomePrice,
ShowPinCodecheck,
ProductDescription,
InfoReview,
SingleImage,
ImageForwad,
Imagebackward,
imageChangeButtons,
imgwidth,
imgheight,
ShopCardDetailswidth,
Type,
}) => {
const navigate = useNavigate();
const dispatch = useDispatch();
const [fillColor, setFillColor] = useState(isFavorite ? "white" : "#D42527");
const [quantity, setQuantity] = useState(0);
const [isVisible, setIsVisible] = useState(false);
const [isModalOpen, setIsModalOpen] = useState(false);
const [loading, setLoading] = useState(false);
const [isOpen, setIsOpen] = useState(false);
const [isCartVisible, setIsCartVisible] = useState(false);
const openModal2 = () => setIsOpen(true);
const closeModal2 = () => setIsOpen(false);
const handleHeartClick = () => {
setFillColor((prevColor) => (prevColor === "white" ? "#D42527" : "white"));
};
const handleAddToCartClick = () => {
setIsVisible(true);
setIsCartVisible(true);
setQuantity((prevQuantity) => prevQuantity + 1);
dispatch(changeCartShow(true));
};
const handleQuantityChange = (change) => {
setQuantity((prevQuantity) => {
const newQuantity = Math.max(prevQuantity + change, 0);
if (newQuantity === 0) {
setIsVisible(false);
dispatch(changeCartShow(false));
}
return newQuantity;
});
};
const openModal = () => {
setIsModalOpen(true);
};
const closeModal = () => {
setIsModalOpen(false);
};
const PageNavigate = () => {
setLoading(true);
setTimeout(() => {
navigate("/Store");
}, 700);
};
const PageIndividualNavigate = () => {
setLoading(true);
setTimeout(() => {
navigate("/IndividualCard");
}, 700);
};
const [currentImage, setCurrentImage] = useState(imageUrl);
const [fade, setFade] = useState(true);
useEffect(() => {
changeImage(imageUrl);
}, [imageUrl]);
const changeImage = (newImage) => {
setFade(false);
setTimeout(() => {
setCurrentImage(newImage);
setFade(true);
}, 300); // Duration of the fade-out effect
};
return (
<>
{loading &&
{dishName}
{deliveryAvailable == "Y" && (Bluetooth Soundbar w/ 500W RMS Signature Sound,5.1 Channel Surround Sound,BTv5.3, Wall Mountable Design,Bass&Treble Controls&Master Remote Control(Premium Black)
From{" "}
Check Delivery
BUY
}
From
BUY NOW
} {isVisible ? ({quantity}
handleQuantityChange(1)}>+