From 15adddb0ed60b14ece0ace805e6741e9e6f1794e Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 14 Jun 2023 15:22:54 +0100 Subject: [PATCH 1/2] offer interest list page added --- .../OffersInterest/OffersInterestTable.jsx | 286 +++++++++++------- src/components/OffersInterest/index.jsx | 14 +- src/services/UsersService.js | 13 + src/views/OffersInterestPage.jsx | 17 +- 4 files changed, 202 insertions(+), 128 deletions(-) diff --git a/src/components/OffersInterest/OffersInterestTable.jsx b/src/components/OffersInterest/OffersInterestTable.jsx index a5d6b10..bb0f035 100644 --- a/src/components/OffersInterest/OffersInterestTable.jsx +++ b/src/components/OffersInterest/OffersInterestTable.jsx @@ -7,17 +7,21 @@ import PaginatedList from "../Pagination/PaginatedList"; import familyImage from '../../assets/images/no-family-side.png' -export default function FamilyTable({ className, familyList, loader, popUpHandler }) { +export default function OffersInterestTable({offerInterestList, className}) { + + const navigate = useNavigate(); + let { pathname } = useLocation(); + + console.log('TESTING',offerInterestList?.data) + const filterCategories = ["All Categories", "Explore", "Featured"]; const [selectedCategory, setCategory] = useState(filterCategories[0]); - const navigate = useNavigate(); - // let location = useLocation(); const [currentPage, setCurrentPage] = useState(0); const indexOfFirstItem = Number(currentPage); const indexOfLastItem = Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE); - const currentFamilyList = familyList?.slice(indexOfFirstItem, indexOfLastItem); + const currentOfferInterestList = offerInterestList?.data?.slice(indexOfFirstItem, indexOfLastItem); const handlePagination = (e) => { handlePagingFunc(e, setCurrentPage); @@ -25,133 +29,183 @@ export default function FamilyTable({ className, familyList, loader, popUpHandle return (
-
- {loader ? ( -
- -
+ + {offerInterestList?.loading ? ( +
+ +
+ ) + : + offerInterestList?.data?.length > 0 ? + ( + + + {/* + + + + + */} + + + {currentOfferInterestList?.map((item, idx) => { + return ( + + + + + + + + ); + }) + } + +
NameLast LoginNo of Tasks
+
+
+ data +
+
+

+ {item?.title} +

+ {item?.expire} +
+
+
+
+ + + + + + + + + + + + + 7473 ETH + +
+
+
+ + + + + + + + + + 6392.99$ + +
+
+ +
) : - familyList?.length > 0 ? - ( - - - - - - - - - - - {currentFamilyList?.map((props, idx) => { - let { - firstname, - lastname, - age, - added, - last_login, - task_count, - family_uid, - } = props; - let addedDate = added?.split(" ")[0]; - let LoginDate = last_login?.split(" ")[0]; - return ( - - - - - - - ); - }) - } - -
NameLast LoginNo of Tasks
-
-
- data -
-
-

- {`${firstname} ${lastname} (${age})`} -

- - Added:{" "} - - {addedDate} - - -
-
-
-
- - {LoginDate} - -
-
-
- - {task_count} - -
-
- -
- ) - : - ( -
-
-

Add your family, assign tasks, and get the whole team engaged.

- -
-
- Add Family -
+ ( +
+
+

No Offer list avaliable.

+
- ) - } -
+
+ Add Family +
+
+ ) + } + {/* PAGINATION BUTTON */} = - familyList?.length + offerInterestList?.data?.length ? true : false } - data={familyList} + data={offerInterestList?.data} start={indexOfFirstItem} stop={indexOfLastItem} /> diff --git a/src/components/OffersInterest/index.jsx b/src/components/OffersInterest/index.jsx index 1444c37..673c698 100644 --- a/src/components/OffersInterest/index.jsx +++ b/src/components/OffersInterest/index.jsx @@ -2,6 +2,7 @@ import React, { useState } from "react"; import { Link } from "react-router-dom"; import Layout from "../Partials/Layout"; import CommonHead from "../UserHeader/CommonHead"; +import OffersInterestTable from './OffersInterestTable' export default function OffersInterest(props) { const [selectTab, setValue] = useState("today"); @@ -19,22 +20,13 @@ export default function OffersInterest(props) {

- - Offer Interest - + Offer Interest

-
- -
-
-
- Blog Items Details
+ ); } diff --git a/src/services/UsersService.js b/src/services/UsersService.js index a29a277..a342095 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -653,6 +653,19 @@ class usersService { return this.postAuxEnd("/offersresponse", postData); } + // END POINT FOR OFFERS INTEREST LIST + offersInterestList() { + var postData = { + uid: localStorage.getItem("uid"), + member_id: localStorage.getItem("member_id"), + sessionid: localStorage.getItem("session_token"), + action: 13024, + limit: 30, + offset: 0 + }; + return this.postAuxEnd("/offersinterestlist", postData); + } + // END POINT FOR WORKER TO MARK TASK AS COMPLETED workerJobAction(reqData) { var postData = { diff --git a/src/views/OffersInterestPage.jsx b/src/views/OffersInterestPage.jsx index 9d87cfe..d8b50ae 100644 --- a/src/views/OffersInterestPage.jsx +++ b/src/views/OffersInterestPage.jsx @@ -3,12 +3,27 @@ import React, { useContext, useState, useEffect } from "react"; import { useSelector } from "react-redux"; import OffersInterest from "../components/OffersInterest"; +import usersService from "../services/UsersService"; + export default function OffersInterestPage() { + const apiCall = new usersService() + let {commonHeadBanner} = useSelector(state => state.commonHeadBanner) + let [offerInterestList, setOfferInterestList] = useState({loading: true, data: []}) + + useEffect(()=>{ + apiCall.offersInterestList().then(res => { + setOfferInterestList({loading: false, data: res.data.result_list}) + }).catch(err => { + setOfferInterestList({loading: false, data: []}) + console.log('Error: ', err) + }) + },[]) + return ( <> - + ); } \ No newline at end of file From 6df489a0c28e2dd4d3294bfdfeddfc0bef816a58 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 14 Jun 2023 15:36:16 +0100 Subject: [PATCH 2/2] price and client name added --- .../OffersInterest/OffersInterestTable.jsx | 151 +++++++++--------- 1 file changed, 76 insertions(+), 75 deletions(-) diff --git a/src/components/OffersInterest/OffersInterestTable.jsx b/src/components/OffersInterest/OffersInterestTable.jsx index bb0f035..176586f 100644 --- a/src/components/OffersInterest/OffersInterestTable.jsx +++ b/src/components/OffersInterest/OffersInterestTable.jsx @@ -11,8 +11,6 @@ export default function OffersInterestTable({offerInterestList, className}) { const navigate = useNavigate(); let { pathname } = useLocation(); - - console.log('TESTING',offerInterestList?.data) const filterCategories = ["All Categories", "Explore", "Featured"]; const [selectedCategory, setCategory] = useState(filterCategories[0]); @@ -35,7 +33,7 @@ export default function OffersInterestTable({offerInterestList, className}) { > {offerInterestList?.loading ? ( -
+
) @@ -65,7 +63,7 @@ export default function OffersInterestTable({offerInterestList, className}) { />
-

+

{item?.title}

{item?.expire} @@ -74,84 +72,87 @@ export default function OffersInterestTable({offerInterestList, className}) {
- - - - - - - - - - - + {/* + + + + + + + + + + 7473 ETH - + */} +

{item?.client_name}

- - - - - - - - - + + + + + + + + + {/* 6392.99$ - + */} + {item?.price} + {item?.currency}