// import { Dimensions, Image, Platform, RefreshControl, ScrollView, TouchableOpacity, View } from "react-native"; // import { ActivityIndicator, Avatar, Button, Card, Colors, IconButton, Modal, Surface, Text, TextInput, TouchableRipple } from "react-native-paper"; // import { useDispatch, useSelector } from "react-redux"; // import React, { useEffect, useState } from "react"; // import Header from "./header/header"; // import ImageCarousel from "../../components/custom/image-carousel"; // import { getBiddingProductDetails, getbiddingpartnerProductsAction, getbiddingUserReviewsbyIdAction, addbiddingProductReviewAction, getProductsImageAction } from "../../state/actions/bidding/biddingproductActions"; // import isEmpty from "../../state/validations/is-empty"; // import ESIbiddingCommentModel from "./biddingcomments"; // import { useToast } from "../../components/custom/react-native-paper-toast/src"; // import { Rating } from "react-native-ratings"; // import RenderHTML from "react-native-render-html"; // export default function BidProductDetails(props: any) { // const EmailID = useSelector(state => state.auth.user?.Email_Id); // const ID = useSelector(state => state.auth.user?.Partner_Details_Id) // const isAuthenticated = useSelector(state => state?.auth?.isAuthenticated); // console.log(isAuthenticated,"ddddddddddddd") // const dimensions = Dimensions.get('window'); // const { height, width } = dimensions; // const { navigation } = props; // const dispatch = useDispatch(); // const [loading, setLoading] = useState(false); // const [product, setProduct] = useState({}); // console.log(product, "product") // const [addData, setDataChat] = useState({}); // const [chatvisible, setChatVisible] = React.useState(false); // const [partnerproductss, setPartnerproduct] = useState({}); // const [review, setReview] = useState({}); // let partnerproduct = useSelector((state) => state.comment.biddingpartnerproducts.all); // console.log(partnerproduct, "ggggggggggg") // let productImage = useSelector((state) => state.comment.biddingproductImages.all); // let productReviews = useSelector((state) => state.comment.biddingquoteReviews.all); // console.log(productReviews, "reviews") // const hideModal = () => setChatVisible(false); // const Product_Id = props?.route?.params?.id; // const containerStyle = { backgroundColor: 'white', padding: 20, flex: 1, width: 350, maxWidth: 500, minWidth: 300, minHeight: 350, maxHeight: 400, borderRadius: 10, alignSelf: "center" }; // const [productLoading, setProductLoading] = useState(false); // const [id, setID] = useState(); // const [commenterror, setCommentError] = useState("") // const [ratingerror, setRatingError] = useState("") // const [comment, setComment] = useState(""); // const [rating, setRating] = useState(0); // const toast = useToast(); // const [error, setError] = useState("") // const [isModalVisible, setModalVisible] = React.useState(false); // const [isReviewModalVisible, setReviewModalVisible] = React.useState(false); // const [size, setSize] = useState({ size: "", quantity: "" }) // const [modalIsOpen, setModalIsOpen] = React.useState(false); // const [PartnerDetails, setPartnerDetails] = useState(); // const [selected, setSelected] = useState(false); // const [visible, setVisible] = useState(2); // let quoteid =partnerproduct.B2B_Partner_Bidding_Quote_Id // let existcomment; // const addReviewModal = () => { // if (!isEmpty(comment) && rating > 0) { // setCommentError("") // setRatingError("") // let formData = { // B2B_User_Products_Bidding_Id: Product_Id, // User_Review_For_Partner: comment, // } // let formValues = JSON.parse(JSON.stringify(formData)); // dispatch(addbiddingProductReviewAction(formValues, Product_Id, responseFunction)); // } else { // if (isEmpty(comment)) { // setCommentError("Comment is required.") // } // if (isEmpty(rating)) { // setRatingError("Rating is required.") // } // } // } // const responseFunction = (status, message) => { // toast.show({ message: message, type: 'info', duration: 3000, position: 'top' }); // setReviewModalVisible(!isReviewModalVisible); // setComment(""); // setRating(""); // } // const toggleModal = () => { // if (isAuthenticated) { // setReviewModalVisible(!isReviewModalVisible); // } // else { // setModalVisible(true); // } // }; // // Comment validations // const handleOnChange = (value) => { // if (existcomment > 0) { // setError("You have already added review.") // } // if (value === "") { // setError("") // } // } // const onCloseModal = () => { // setSize({ size: "", quantity: "" }) // setModalIsOpen(false); // setSelected(false) // // setPartnerDetails() // setComment("") // setRating("") // }; // const [reviewId, setData] = useState() // let Id = []; // let multiID; // const callBackGetData = (data) => { // if (data) { // setProduct(data); // setPartnerproduct(data); // setReview(data); // getreviews(data); // setID(Product_Id) // } // }; // let image = [] // if (productImage) { // if (productImage[0]) { // if (productImage[0].Product_Image) { // let data = productImage[0].Product_Image // for (var i = 0; i < data.length; i++) { // image.push({ imageuri: data[i].Product_Image }) // } // } // } // } // useEffect(() => { // if (Product_Id != product?.Bidding_Product_Id) { // setProductLoading(true); // setProduct({}); // dispatch(getBiddingProductDetails(Product_Id, callBackGetData, ID)); // dispatch(getbiddingpartnerProductsAction(Product_Id, ID)); // // dispatch(getbiddingUserReviewsbyIdAction(Product_Id)); // dispatch(getProductsImageAction(Product_Id)); // } // }, [Product_Id]); // const getreviews = () => { // setReview({}) // dispatch(getbiddingUserReviewsbyIdAction(quoteid)); // } // if (productReviews) { // existcomment = productReviews.filter(review => review.User_Email_Id === EmailID).length // } // return ( // //
// // {navigation.canGoBack() && // props.navigation.goBack()} // />} // // {product ? // // // // {product[0]?.Product_Name} // Status: {product[0]?.Status} // Quantity: {product[0]?.Quantity} // Pincode: {product[0]?.User_Pincode} // Advance Amount: {product[0]?.Total_Advance_Amount} // Remaining Amount: {product[0]?.Partner_Balance_Amount} // // // { // payNow(); // }} // > // Pay // // // Description:{product[0]?.Description} // // // // // {!isEmpty(partnerproduct) ? ( // partnerproduct.Is_Data_Exist === "0" ? ( // // ) : typeof partnerproduct === "object" ? ( // partnerproduct.map((data, index) => ( // // 250 ? 250 : 90, // minHeight: 100, // borderColor: 'grey', // borderWidth: 0.5, // }}> // // // // // {data?.Partner_Name} // Quantity: {data?.Quantity} {data?.Measurement_Type} // Advance Amount : {data?.Advance_Amount} // Balance Amount : {data?.Total_Amount} // // // // ))) : ( // typeof partnerproduct // ) // ) : ( // // Oops!!! No Partner Products found. // // )} // // // // // // // { // return review.User_Email_Id=== EmailID // }).length) <= 0 ? false : true} style={{ // backgroundColor: (productReviews?.filter((review) => { // return review.User_Email_Id === EmailID // }).length) <= 0 ? '#27B6CC' : '#F0F0F0', width: 110, height: 30, borderRadius: 5, justifyContent: 'center', alignItems: 'center' // }} onPress={() =>setReviewModalVisible(true) }> // ADD REVIEW // // // {!isEmpty(productReviews) && ( // productReviews.Is_Data_Exist === "0" || isEmpty(productReviews) ? ( // // No Product Reviews found! // // ) : typeof productReviews === "object" && ( // <> // {productReviews?.slice(0, visible).map((data, index) => ( // // // // // // {data.Full_Name} // // // {data.User_Review_For_Partner && // } // // // // ))} // // {productReviews?.length > visible && // setVisible(visible + 3)}>Show More ▼ // } // // // ))} // // // // // // { setReviewModalVisible(false), setComment(''), setRating(0) }}> // // // // // { setComment(Text); handleOnChange(Text); setCommentError("") }} // multiline={true} // numberOfLines={4} // value={comment} // /> // {commenterror} // {error} // // // // // // // // // : // // } // // // // // ) // }