import { useCallback, useEffect, useMemo, useState } from "react"; import { Link, useNavigate } from "react-router-dom"; import MarketPopUp from "../MarketPlace/PopUp/MarketPopUp"; import usersService from "../../services/UsersService"; import { PriceFormatter } from "../Helpers/PriceFormatter"; import dataImage2 from "../../assets/images/data-table-user-2.png"; export default function AvailableJobsCard({ className, datas, hidden = false, contentDisplay }) { //debugger; const [marketPopUp, setMarketPopUp] = useState({ show: false, data: {} }); const [manageInt, setManageInt] = useState(null); const [imageUrl, setImageUrl] = useState(""); const navigate = useNavigate(); const apiCall = useMemo(() => new usersService(), []); const marketInterestData = useCallback(async () => { let { offer_code } = datas; let reqData = { offer_code }; try { const manageInt = await apiCall.MarketInterest(reqData); const manageIntRes = await manageInt?.data; setManageInt(manageIntRes); } catch (error) { throw new Error(error); } }, [apiCall, datas]); let thePrice = PriceFormatter( datas?.price * 0.01, datas?.currency_code, datas?.currency ); useEffect(() => { if (!datas) { navigate("/market", { replace: true }); } marketInterestData(); }, []); useEffect(() => { const imagePath = require(`../../assets/images/${datas.thumbnil}`); // Replace with your directory path for local images setImageUrl(imagePath); }, []); return ( <> {contentDisplay == 'grid' ?

{datas.title}

Added

{datas.offer_added}

Expires

{datas.expire}

{datas.description}
{/*
*/} {/* {datas.isActive && (*/} {/* */} {/* Active*/} {/**/} {/* )}*/} {/*
*/} {/*
*/} {/* */} {/* */} {/* */} {/*
*/}

{/* {thePrice} | {datas.timeline_days} day(s) */} {thePrice}

( {datas.offer_code}) | {datas.timeline_days} day(s)

:
data

{datas?.title}

{datas?.description}

{/*

Added

{datas.offer_added}

Expires

{datas.expire}

*/}

Price: {thePrice}

Duration:{" "} {" "} {datas?.timeline_days} day(s)

Code:{" "} {" "} {datas?.offer_code}

} {marketPopUp.show && ( { setMarketPopUp({ show: false, data: {} }); }} situation={marketPopUp.show} marketInt={manageInt} /> )} ); }