From 52cb0cb2daae5908070982ada1414807bacc3f04 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Thu, 22 Jun 2023 20:41:17 +0100 Subject: [PATCH] manage offer reformatted --- .../MarketPlace/PopUp/MarketPopUp.jsx | 2 +- .../OffersInterest/ManageInterestOffer.jsx | 99 ++++++++++++++----- 2 files changed, 78 insertions(+), 23 deletions(-) diff --git a/src/components/MarketPlace/PopUp/MarketPopUp.jsx b/src/components/MarketPlace/PopUp/MarketPopUp.jsx index b45f68a..4c08188 100644 --- a/src/components/MarketPlace/PopUp/MarketPopUp.jsx +++ b/src/components/MarketPlace/PopUp/MarketPopUp.jsx @@ -170,7 +170,7 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
{content?.text} - {content?.bold} + {thePrice}
diff --git a/src/components/OffersInterest/ManageInterestOffer.jsx b/src/components/OffersInterest/ManageInterestOffer.jsx index c472d9e..6cd251a 100644 --- a/src/components/OffersInterest/ManageInterestOffer.jsx +++ b/src/components/OffersInterest/ManageInterestOffer.jsx @@ -4,8 +4,8 @@ import Layout from "../Partials/Layout"; import CommonHead from "../UserHeader/CommonHead"; import usersService from "../../services/UsersService"; -import { handlePagingFunc } from "../Pagination/HandlePagination"; -import PaginatedList from "../Pagination/PaginatedList"; +// import { handlePagingFunc } from "../Pagination/HandlePagination"; +// import PaginatedList from "../Pagination/PaginatedList"; import LoadingSpinner from "../Spinners/LoadingSpinner"; import OthersInterestedTable from "./OthersInterestedTable"; @@ -15,25 +15,50 @@ export default function ManageInterestOffer(props) { let [redirectTime, setRedirectTime] = useState(5) + let [messageToSend, setMessageToSend] = useState('') + let [tab, setTab] = useState("info"); //message STATE FOR SWITCHING BETWEEN TABS let [requestStatus, setRequestStatus] = useState({loading: false, status: false, message: '', processType: ''}) - const messageList = {data: [1,2,3,4,5,6]} // TO BE REMOVED AND REPLACE WITH REAL MESSAGE FROM API CALL - const [currentPage, setCurrentPage] = useState(0); - const indexOfFirstItem = Number(currentPage); - const indexOfLastItem = Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE); - const currentMessageList = messageList?.data?.slice(indexOfFirstItem, indexOfLastItem); + const messageList = {data: [1,2,3,4,5,6,7,8,95,6,7,8,9]} // TO BE REMOVED AND REPLACE WITH REAL MESSAGE FROM API CALL + // const [currentPage, setCurrentPage] = useState(0); + // const indexOfFirstItem = Number(currentPage); + // const indexOfLastItem = Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE); + // const currentMessageList = messageList?.data?.slice(indexOfFirstItem, indexOfLastItem); - const handlePagination = (e) => { - handlePagingFunc(e, setCurrentPage); - }; + // const handlePagination = (e) => { + // handlePagingFunc(e, setCurrentPage); + // }; const [selectTab, setValue] = useState("today"); const filterHandler = (value) => { setValue(value); }; + //FUNCTION TO HANDLE ON CHANGE MESSAGE IN TEXTAREA + const onMessageChange = ({target:{value}}) => { + if(messageToSend.length > 149){ + setRequestStatus({loading: false, status: false, message: 'max of 150 characters', processType: 'sendmessage'}) + }else{ + setRequestStatus({loading: false, status: false, message: '', processType: 'sendmessage'}) + } + setMessageToSend(value) + } + + //FUNCTION TO SEND MESSAGE TO CLIENT + const sendMessage = () => { + setRequestStatus(prev => ({...prev, loading: true, processType: 'sendmessage'})) + if(!messageToSend){ + setRequestStatus({loading: false, status: false, message: 'Please enter message to send', processType: 'sendmessage'}) + return + } + if(messageToSend.length > 149){ + return + } + console.log('GOOD TO GO') + } + //FUNCTION TO ACCEPT/REJECT OFFER INTEREST const interestOfferProcess = ({target:{name}}) => { setRequestStatus(prev => ({...prev, loading: true, processType: name})) @@ -180,23 +205,53 @@ export default function ManageInterestOffer(props) { :
-
-
-

Message to dummy name

-