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 && } {isOpen && (
e.stopPropagation()}> large
)}
{Type == "individualCard" ? (
{imageChangeButtons && (
)} {dishName} {imageChangeButtons && (
)} {isFavorite == "Y" && (

)} {offer == "Y" && ( {offerValue ? `${offerValue} % OFF` : ""} )} {isVeg == "veg" && (
●
)} {isNonVeg == "Y" && (
●
)}
) : (
{imageChangeButtons && (
)} {dishName} {imageChangeButtons && (
)} {isFavorite == "Y" && (

)} {offer == "Y" && ( {offerValue ? `${offerValue} % OFF` : ""} )} {isVeg == "veg" && (
●
)} {isNonVeg == "Y" && (
●
)}
)}
{showQuantityModal == "Y" && (
400 g
{QuantityPrice && (

{QuantityPrice}

)}

4.5

(1 Review)
)} {shopNameShow == "Y" && (
{Type == "PozoCart" ? "From" : "Visit"} {shopName}
)}

{dishName}

{deliveryAvailable == "Y" && (
{" "} Delivery Available
)} {ProductDescription == "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)

)} {showCartShopName == "Y" && (
From {shopName}
)} {Accredited == "Y" && (
pozologoimg {" "} Accredited
)} {InfoReview == "Y" && (

{" "} 4.5

(1 Review)
Lorem ipsum dolor sit amet consectetur adipisicing elit. At quas eius quaerat rerum, accusantium quis maxime reiciendis
)}
{Type == "individualCard" && (
{price && (

{price}

)} {HomePrice && (

From{" "} {" "} {HomePrice} /-

)} {CartMRP == "Y" && ( M.R.P.: ₹1,0099.00 )} {Cartoffer == "Y" && ( {offerValue ? `${offerValue} % OFF` : ""} )} {youSave && (
You Save ₹{youSave}
)}
{deliveryTime && (
{deliveryTime}{" "} {deliveryDistance && " • " + deliveryDistance}
)}
)}
{ShowPinCodecheck == "Y" && (
{ if (e.target.value.length > 6) { e.target.value = e.target.value.slice(0, 6); } }} />

Check Delivery

)}
{showSize == "Y" && (
Size :
 {Size}
)} {showColor == "Y" && (
Color :
  {Color}
)}
{Review == "Y" && (

4.5

(1 Review)
Lorem ipsum dolor sit amet consectetur adipisicing elit. At quas eius quaerat rerum, accusantium quis maxime reiciendis
)} {cartSDS == "Y" && (

{" "} Save for later

{" "} delete

{" "} share

)} {SDSIcon == "Y" && (

{" "}

)}
{MRP && M.R.P.:₹{MRP}} {Buy == "Y" &&

BUY

}
{Type !== "individualCard" && (
{price && (

{price}

)} {HomePrice && (

From {HomePrice} /-

)} {/*================== cart MRP ============= */} {CartMRP == "Y" && ( M.R.P.: ₹1,0099.00 )} {Cartoffer == "Y" && ( {offerValue ? `${offerValue} % OFF` : ""} )} {youSave && (
You Save ₹{youSave}
)}
{deliveryTime && (
{deliveryTime} {deliveryDistance && " • " + deliveryDistance}
)}
)}
{deliveryStatus == "Y" && (
DELIVERY   Free •{" "} 6 | Jul | Saturday  {" "} Fast • Today
)}
{showChangeQuantity == "Y" && (
400 g
)} {buyNow == "Y" &&

BUY NOW

} {isVisible ? (
handleQuantityChange(-1)}>-

{quantity}

handleQuantityChange(1)}>+
) : ( addToCartBtn == "Y" && ( <>
Add to Cart
) )}
} title="Select your Quantity" isOpen={isModalOpen} >
{multiQty?.map((data) => ( ))}
); }; // console.log(ShopCard.propTypes, "ShopCardShopCard"); ShopCard.propTypes = { id: PropTypes.number.isRequired, shopName: PropTypes.string.isRequired, dishName: PropTypes.string.isRequired, imageUrl: PropTypes.string.isRequired, price: PropTypes.string.isRequired, deliveryTime: PropTypes.string.isRequired, deliveryDistance: PropTypes.string.isRequired, direction: PropTypes.string.isRequired, QuantityPrice: PropTypes.string.isRequired, Color: PropTypes.string.isRequired, Size: PropTypes.string.isRequired, youSave: PropTypes.string.isRequired, HomePrice: PropTypes.string.isRequired, offer: PropTypes.bool, isVeg: PropTypes.bool, isNonVeg: PropTypes.bool, isFavorite: PropTypes.bool, addToCartBtn: PropTypes.bool, showCartShopName: PropTypes.bool, showQuantityModal: PropTypes.bool, showChangeQuantity: PropTypes.bool, deliveryAvailable: PropTypes.bool, Buy: PropTypes.bool, Review: PropTypes.bool, buyNow: PropTypes.bool, cartSDS: PropTypes.bool, deliveryStatus: PropTypes.bool, Cartoffer: PropTypes.bool, shopNameShow: PropTypes.bool, CartMRP: PropTypes.bool, Accredited: PropTypes.bool, showSize: PropTypes.bool, showColor: PropTypes.bool, youSave: PropTypes.bool, SDSIcon: PropTypes.bool, }; ShopCard.defaultProps = { offer: true, isVeg: false, isNonVeg: false, isFavorite: true, addToCartBtn: true, showCartShopName: true, showQuantityModal: true, showChangeQuantity: true, deliveryAvailable: true, Buy: true, Review: true, buyNow: true, cartSDS: true, deliveryStatus: true, Cartoffer: true, shopNameShow: true, CartMRP: true, Accredited: true, showSize: true, showColor: true, SDSIcon: false, }; export default ShopCard;