import React, { useState } from 'react' import { handlePagingFunc } from '../../../Pagination/HandlePagination'; import PaginatedList from '../../../Pagination/PaginatedList'; import RelativePopout from './RelativePopout'; import RelativeReminderPopout from './RelativeReminderPopout'; export default function RelativeTable({relativeList, familyList}) { // Handle Pagination const [currentPage, setCurrentPage] = useState(0); const indexOfFirstItem = Number(currentPage); const indexOfLastItem =Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE); const currentRelativeList = relativeList?.slice(indexOfFirstItem, indexOfLastItem); const [relativePopout, setRelativePopout] = useState({show:false, data:null}) const [reminderPopout, setReminderPopout] = useState({show:false, data:null}) const closePopout = () => { setRelativePopout({show:false, data:null}) } const closeReminderPopout = () => { setReminderPopout({show:false, data:null}) } const handlePagination = (e) => { handlePagingFunc(e, setCurrentPage); }; return ( <>
<> {relativeList && relativeList?.length > 0 ? ( currentRelativeList.map((value, index) => ( {value.status_action ? : } )) ) : ( )}
Status Kids

{value.firstname && value.firstname} {value.lastname && value.lastname}

{value.email && value.email}
{/* Family Type */} {value.family_type && value.family_type.toUpperCase()} {value.status && value.status} {value.kid_count && value.kid_count}
No Members Found
{/* PAGINATION BUTTON */} = relativeList?.length ? true : false } data={relativeList} start={indexOfFirstItem} stop={indexOfLastItem} /> {/* END OF PAGINATION BUTTON */}
{relativePopout.show && } {reminderPopout.show && } ); };