diff --git a/src/components/FamilyAcc/FamilyTableNew.jsx b/src/components/FamilyAcc/FamilyTableNew.jsx
index ed17ffe..3a4842a 100644
--- a/src/components/FamilyAcc/FamilyTableNew.jsx
+++ b/src/components/FamilyAcc/FamilyTableNew.jsx
@@ -6,18 +6,13 @@ import React, {
useRef,
useState,
} from "react";
- import { useReactToPrint } from "react-to-print";
- import localImgLoad from "../../lib/localImgLoad";
import usersService from "../../services/UsersService";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import AssignTaskPopout from "./FamilyPopout/AssignTaskPopout";
- import FamilyWallet from "./Tabs/FamilyWallet";
import { apiConst } from "../../lib/apiConst";
// Lazy Imports for components
- const FamilyWaitlist = lazy(() => import("./Tabs/FamilyWaitlist"));
- const FamilyAccount = lazy(() => import("./Tabs/FamilyAccount"));
- const FamilyProfile = lazy(() => import("./Tabs/FamilyProfile"));
+ const FamilyWaitlist = lazy(() => import("./Tabs/FamilyNewWaitlist"));
const FamilyTasks = lazy(() => import("./Tabs/FamilyTasks"));
const FamilyPending = lazy(() => import("./Tabs/FamilyPending"));
@@ -73,15 +68,6 @@ import React, {
setFamilyTaskPopout((prev) => !prev);
};
-
- // Ref for the account section
- const accountRef = useRef();
-
- // React-to-Print hook for handling printing
- const useHandlePrint = useReactToPrint({
- content: () => accountRef.current,
- });
-
// Array of tab names
const tabs = [
{ id: 1, name: "Tasks" },
@@ -100,11 +86,16 @@ import React, {
// Object that maps tab names to their corresponding components
const tabComponents = {
Tasks: (
-
+
),
Waiting: (
@@ -121,27 +112,9 @@ import React, {
loader={details.familyPending.loading}
/>
),
- Account: (
-
- ),
- Profile: ,
- wallet: ,
};
-
- // Default tab component
- const defaultTabComponent = (
-
- );
+
+ const defaultTabComponent = tabComponents.Tasks;
// Selected tab component based on the current 'tab'
const selectedTabComponent = tabComponents[tab] || defaultTabComponent;
@@ -159,19 +132,19 @@ import React, {
familyPending: { loading: true },
});
- const { family_uid } = accountDetails;
- const reqData = { family_uid };
+ // const { family_uid } = accountDetails;
+ // const reqData = { family_uid };
- const [familyRes, tasksRes, familyWaitRes, familyPending] =
+ const [familyWaitRes, familyPending] =
await Promise.all([
- apiCall.ManageFamily(reqData),
- apiCall.ManageTasks(reqData),
- apiCall.ManageFamilyWaitlist(),
+ // apiCall.ManageFamily(reqData),
+ // apiCall.ManageTasks(reqData),
+ apiCall.ManageFamilyNewWaitlist(),
apiCall.ManageFamilyPending(),
]);
- const familyData = familyRes.data;
- const tasksData = tasksRes.data;
+ // const familyData = familyRes.data;
+ // const tasksData = tasksRes.data;
const familyWaitData = familyWaitRes.data;
const familyPendingData = familyPending.data;
@@ -179,8 +152,8 @@ import React, {
const checkDataError = (data) => data?.internal_return < 0;
if (
- checkDataError(familyData) ||
- checkDataError(tasksData) ||
+ // checkDataError(familyData) ||
+ // checkDataError(tasksData) ||
checkDataError(familyWaitData) ||
checkDataError(familyPendingData)
) {
@@ -188,8 +161,8 @@ import React, {
}
setDetails({
- familyDetails: { loading: false, data: familyData },
- familyTasks: { loading: false, data: tasksData },
+ // familyDetails: { loading: false, data: familyData },
+ // familyTasks: { loading: false, data: tasksData },
familyWaitList: { loading: false, data: familyWaitData },
familyPending: { loading: false, data: familyPendingData },
});
@@ -238,6 +211,8 @@ import React, {
checkFamilyTask = false;
};
}, []);
+
+ console.log("God please>> ", details.familyWaitList)
return (
+ familyData?.result_list?.filter(
+ (data) => data?.family_uid === accountDetails?.family_uid
+ ),
+ [accountDetails?.family_uid, familyData?.result_list]
+ );
+
+ const [currentPage, setCurrentPage] = useState(0);
+ const itemsPerPage = Number(process.env.REACT_APP_ITEM_PER_PAGE);
+ const indexOfFirstItem = Number(currentPage);
+ const indexOfLastItem =
+ Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
+ const currentPendingTasks = filteredFamilyData?.slice(
+ indexOfFirstItem,
+ indexOfLastItem
+ );
+
+ const handlePagination = (e) => {
+ handlePagingFunc(e, setCurrentPage);
+ };
+
+ return (
+
+ {filteredFamilyData && (
+
+
+
+ {
+ <>
+ {currentPendingTasks.length > 0 ? (
+ currentPendingTasks.map((value, index) => {
+ let deliveryDate = value?.expire?.split(" ")[0];
+ let thePrice = PriceFormatter(
+ value?.price * 0.01,
+ value?.currency_code,
+ value?.currency
+ );
+ let image = `${familyData.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
+ return (
+
+
+
+
+ 
+
+
+
+ {value.title}
+
+ {value.description}
+
+ Price:{" "}
+
+ {thePrice}
+
+
+
+
+ Duration:{" "}
+
+ {" "}
+ {value.timeline_days} day(s)
+
+
+
+ Expire:{" "}
+
+ {" "}
+ {deliveryDate}
+
+
+
+ Sent to:{" "}
+
+ {" "}
+ {value.job_to}
+
+
+
+
+
+ |
+
+
+
+ |
+
+ );
+ })
+ ) : (
+
+ |
+ No Pending Task!
+ |
+
+ )}
+ >
+ }
+
+
+ {/* PAGINATION BUTTON */}
+
= filteredFamilyData.length}
+ data={filteredFamilyData}
+ start={indexOfFirstItem}
+ stop={indexOfLastItem}
+ />
+ {/* END OF PAGINATION BUTTON */}
+
+ )}
+
+ {/* Active Job Popout */}
+ {jobPopout.show && (
+
{
+ setJobPopout({ show: false, data: {} });
+ }}
+ situation={jobPopout.show}
+ />
+ )}
+ {/* End of Active Job Popout */}
+
+ );
+}
diff --git a/src/components/FamilyAcc/Tabs/FamilyNewWaitlist.jsx b/src/components/FamilyAcc/Tabs/FamilyNewWaitlist.jsx
new file mode 100644
index 0000000..7f9536d
--- /dev/null
+++ b/src/components/FamilyAcc/Tabs/FamilyNewWaitlist.jsx
@@ -0,0 +1,148 @@
+import { useState } from "react";
+import SuggestTask from "../../FamilyPopup/SuggestTask";
+import { PaginatedList, handlePagingFunc } from "../../Pagination";
+import LoadingSpinner from "../../Spinners/LoadingSpinner";
+import AssignTaskPopout from "../FamilyPopout/AssignTaskPopout";
+
+const FamilyNewWaitlist = ({
+ familyData,
+ className,
+ accountDetails,
+ loader,
+}) => {
+ const [popUp, setPopUp] = useState({ show: false, data: {} });
+ const [continueTaskPopup, setContinueTaskPopup] = useState({
+ show: false,
+ data: {},
+ });
+
+ const [currentPage, setCurrentPage] = useState(0);
+ const itemsPerPage = Number(process.env.REACT_APP_ITEM_PER_PAGE);
+ const indexOfFirstItem = currentPage;
+ const indexOfLastItem = currentPage + itemsPerPage;
+ const currentTask = familyData?.result_list?.slice(
+ indexOfFirstItem,
+ indexOfLastItem
+ );
+
+ const handlePagination = (e) => handlePagingFunc(e, setCurrentPage);
+
+ const openPopUp = (value) => {
+ setPopUp({ show: true, data: { ...value } });
+ };
+
+ const closePopUp = () => {
+ setPopUp({ show: false, data: {} });
+ };
+
+ const openContinueTaskPopup = (value) => {
+ setContinueTaskPopup({ show: true, data: { ...value } });
+ };
+
+ const closeContinueTaskPopup = () => {
+ setContinueTaskPopup({ show: false, data: {} });
+ };
+
+ return (
+
+ {loader ? (
+
+
+
+ ) : (
+ <>
+ {currentTask && (
+
+
+
+ {currentTask.map((value) => {
+ const addedDate = value?.added.split(" ")[0];
+ const selectedImage = require(`../../../assets/images/family/${
+ value?.banner || "default.jpg"
+ }`);
+ // console.log("VALUE", value);
+ // let image = `${familyData.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
+ return (
+
+
+
+
+
+ 
+
+
+
+ {value.title}
+
+
+ {value.description}
+
+
+
+
+
+ {addedDate}
+
+
+ {value.status_text}
+
+
+
+ |
+
+
+ |
+
+ );
+ })}
+
+
+
= currentTask?.length}
+ data={currentTask}
+ start={indexOfFirstItem}
+ stop={indexOfLastItem}
+ />
+
+ )}
+ >
+ )}
+ {popUp.show && (
+
+ )}
+
+ {continueTaskPopup.show && (
+
+ )}
+
+ );
+};
+
+export default FamilyNewWaitlist;
diff --git a/src/components/FamilyAcc/Tabs/FamilyTasks.jsx b/src/components/FamilyAcc/Tabs/FamilyTasks.jsx
index 02a5ded..b8f2fcb 100644
--- a/src/components/FamilyAcc/Tabs/FamilyTasks.jsx
+++ b/src/components/FamilyAcc/Tabs/FamilyTasks.jsx
@@ -29,7 +29,7 @@ export default function FamilyTasks({
const indexOfFirstItem = Number(currentPage);
const indexOfLastItem =
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
- const currentTask = familyData?.result_list.slice(
+ const currentTask = familyData?.result_list?.slice(
indexOfFirstItem,
indexOfLastItem
);
diff --git a/src/services/UsersService.js b/src/services/UsersService.js
index cefb14c..444bd62 100644
--- a/src/services/UsersService.js
+++ b/src/services/UsersService.js
@@ -388,13 +388,26 @@ class usersService {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
- action: apiConst.WRENCHBOARD_JOB_CREATEJOB,
+ action: apiConst.WRENCHBOARD_JOB_CREATEJOB || apiConst.WRENCHBOARD_FAMILY_LIST,
limit: 30,
offset: 0,
};
return this.postAuxEnd("/familywaitingtasks", postData);
}
+ ManageFamilyNewWaitlist() {
+ var postData = {
+ uid: localStorage.getItem("uid"),
+ member_id: localStorage.getItem("member_id"),
+ sessionid: localStorage.getItem("session_token"),
+ action: apiConst.WRENCHBOARD_FAMILY_LIST,
+ limit: 20,
+ page: 1,
+ offset: 0,
+ };
+ return this.postAuxEnd("/familywaitingtasks", postData);
+ }
+
ManageFamilyPending() {
var postData = {
uuid: localStorage.getItem("uid"),