From d0237872ad3dc17076687fd1bbb6e5ce11beda8a Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Tue, 4 Jul 2023 07:32:40 +0100 Subject: [PATCH] added family suggest list API --- .../MyPendingJobs/ParentWaiting.jsx | 9 +- .../MyPendingJobs/ParentWaitingTable.jsx | 368 ++++-------------- src/services/UsersService.js | 13 + 3 files changed, 102 insertions(+), 288 deletions(-) diff --git a/src/components/MyPendingJobs/ParentWaiting.jsx b/src/components/MyPendingJobs/ParentWaiting.jsx index 1655e7e..747a0c1 100644 --- a/src/components/MyPendingJobs/ParentWaiting.jsx +++ b/src/components/MyPendingJobs/ParentWaiting.jsx @@ -23,16 +23,17 @@ export default function ParentWaiting({ className }) { Waiting for Parent to Get Started... -
-
+ {/*
*/} +
+
banner
-
+
{} {/*
*/} diff --git a/src/components/MyPendingJobs/ParentWaitingTable.jsx b/src/components/MyPendingJobs/ParentWaitingTable.jsx index db4cdc9..e5d20a8 100644 --- a/src/components/MyPendingJobs/ParentWaitingTable.jsx +++ b/src/components/MyPendingJobs/ParentWaitingTable.jsx @@ -1,8 +1,14 @@ -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import transaction1 from "../../assets/images/recent-transation-1.png"; import transaction2 from "../../assets/images/recent-transation-2.png"; import transaction3 from "../../assets/images/recent-transation-3.png"; +import LoadingSpinner from "../Spinners/LoadingSpinner"; +import { handlePagingFunc } from "../Pagination/HandlePagination"; +import PaginatedList from "../Pagination/PaginatedList"; +import usersService from "../../services/UsersService"; + + export default function ParentWaitingTable() { const transationFilterData = [ { @@ -25,11 +31,34 @@ export default function ParentWaitingTable() { const filterHander = (value) => { setValue(value); }; - return ( -
- {/* heading */} -
+ const apiCall = new usersService() + + let [familySuggestList, setFamilySuggestList] = useState({loading: true, data:[]}) + + const [currentPage, setCurrentPage] = useState(0); + const indexOfFirstItem = Number(currentPage); + const indexOfLastItem = + Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE); + const currentList = familySuggestList?.data?.slice(indexOfFirstItem, indexOfLastItem); + + const handlePagination = (e) => { + handlePagingFunc(e, setCurrentPage); + }; + + useEffect(()=>{ + apiCall.getFamilySuggestList().then(res => { + setFamilySuggestList({loading: false, data:res.data?.result_list}) + }).catch(err => { + setFamilySuggestList({loading: false, data:[]}) + console.log('ERROR==>Familysuggestlist', err) + }) + },[]) + + return ( +
+ {/* heading */} + {/*
    {transationFilterData.map((value) => ( @@ -43,297 +72,68 @@ export default function ParentWaitingTable() { {value.name} ))} - {/*
  • - All -
  • -
  • - SEND -
  • -
  • - recent -
  • */}
-
- {/* content */} +
*/} - {filterActive === 2 ? ( -
+ {/* content */} +
+ {familySuggestList.loading ? +
+ +
+ : + familySuggestList && familySuggestList.length != 0?
    -
  • -
    -
    -
    - -
    -
    -
    -

    - Add ETH from MetaMask -

    + {currentList.map((item)=>( +
  • +
    +
    +
    +
    -
    +
    +

    + {item.title} +

    +

    - 22 hours ago + {item.description}

    -
    -
    -

    - $512.44 -

    -

    - +324.75 -

    -
    -
    -
  • -
  • -
    -
    -
    - -
    -
    -
    -

    - Add BTC from Coinbase Wallet -

    -
    -
    -

    - 22 hours ago -

    -
    +
    +

    + {new Date(item.added).toLocaleString().split(',')[0]} + {/* {item.added} */} +

    + {/*

    */}
    -
    -

    - $512.44 -

    -

    - -824.78 -

    -
    -
    -
  • -
  • -
    -
    -
    - -
    -
    -
    -

    - Buy Nft art from LTC -

    -
    -
    -

    - 22 hours ago -

    -
    -
    -
    -
    -

    - $512.44 -

    -

    - -924.54 -

    -
    -
    -
  • + + ))}
-
- ) : filterActive === 3 ? ( -
-
    -
  • -
    -
    -
    - -
    -
    -
    -

    - Add ETH from MetaMask -

    -
    -
    -

    - 22 hours ago -

    -
    -
    -
    -
    -

    - $512.44 -

    -

    - +324.75 -

    -
    -
    -
  • -
  • -
    -
    -
    - -
    -
    -
    -

    - Add BTC from Coinbase Wallet -

    -
    -
    -

    - 22 hours ago -

    -
    -
    -
    -
    -

    - $512.44 -

    -

    - -824.78 -

    -
    -
    -
  • -
-
- ) : ( -
-
    -
  • -
    -
    -
    - -
    -
    -
    -

    - Add ETH from MetaMask -

    -
    -
    -

    - 22 hours ago -

    -
    -
    -
    -
    -

    - $512.44 -

    -

    - +324.75 -

    -
    -
    -
  • -
  • -
    -
    -
    - -
    -
    -
    -

    - Add BTC from Coinbase Wallet -

    -
    -
    -

    - 22 hours ago -

    -
    -
    -
    -
    -

    - $512.44 -

    -

    - -824.78 -

    -
    -
    -
  • -
  • -
    -
    -
    - -
    -
    -
    -

    - Buy Nft art from LTC -

    -
    -
    -

    - 22 hours ago -

    -
    -
    -
    -
    -

    - $512.44 -

    -

    - -924.54 -

    -
    -
    -
  • -
  • -
    -
    -
    - -
    -
    -
    -

    - Add ETH from MetaMask -

    -
    -
    -

    - 22 hours ago -

    -
    -
    -
    -
    -

    - $512.44 -

    -

    - +324.75 -

    -
    -
    -
  • -
-
- )} + : +

No List Found!

+ } +
+ + {/* PAGINATION BUTTON */} + = + familySuggestList?.data?.length + ? true + : false + } + data={familySuggestList?.data} + start={indexOfFirstItem} + stop={indexOfLastItem} + /> + {/* END OF PAGINATION BUTTON */} +
); } diff --git a/src/services/UsersService.js b/src/services/UsersService.js index c1acd82..2f935d5 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -812,6 +812,19 @@ class usersService { return this.postAuxEnd("/assigntask", postData); } + // FUNCTION TO GET FAMILY SUGGEST LIST + getFamilySuggestList() { + var postData = { + uid: localStorage.getItem("uid"), + member_id: localStorage.getItem("member_id"), + sessionid: localStorage.getItem("session_token"), + limit: 30, + offset: 0, + action: 13010 + }; + return this.postAuxEnd("/familysuggestlist", postData); + } + /* - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username) - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)