Merge branch 'manage-family-page' of WrenchBoard/Users-Wrench into master
This commit is contained in:
@@ -1,76 +1,18 @@
|
|||||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
import React, { useState } from "react";
|
||||||
import InputCom from "../Helpers/Inputs/InputCom";
|
|
||||||
import Layout from "../Partials/Layout";
|
import Layout from "../Partials/Layout";
|
||||||
import FamilyTable from "./FamilyTable";
|
|
||||||
import SiteService from "../../services/SiteService";
|
|
||||||
import ModalCom from "../Helpers/ModalCom";
|
|
||||||
import FamilyManageTabs from "./FamilyManageTabs";
|
import FamilyManageTabs from "./FamilyManageTabs";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
|
|
||||||
export default function FamilyManage() {
|
export default function FamilyManage() {
|
||||||
const [selectTab, setValue] = useState("today");
|
const [selectTab, setValue] = useState("today");
|
||||||
const [selectedAge, setSelectedAge] = useState(undefined);
|
|
||||||
const [familyList, setFamilyList] = useState([]);
|
|
||||||
const [loader, setLoader] = useState(false);
|
|
||||||
const [popUp, setPopUp] = useState(false);
|
|
||||||
const [listReload, setListReload] = useState(false);
|
|
||||||
const [msgErr, setMsgErr] = useState("");
|
|
||||||
const [formData, setFormData] = useState({
|
|
||||||
first_name: "",
|
|
||||||
last_name: "",
|
|
||||||
});
|
|
||||||
|
|
||||||
let location = useLocation();
|
let location = useLocation();
|
||||||
let accountDetails = location?.state
|
let accountDetails = location?.state
|
||||||
|
|
||||||
const apiCall = useMemo(() => new SiteService(), []);
|
|
||||||
|
|
||||||
// This is to make sure it's called once and used everywhere
|
|
||||||
let memberId = localStorage.getItem("member_id");
|
|
||||||
let uid = localStorage.getItem("uid");
|
|
||||||
let sessionId = localStorage.getItem("session_token");
|
|
||||||
|
|
||||||
const popUpHandler = () => {
|
|
||||||
setPopUp((prev) => !prev);
|
|
||||||
};
|
|
||||||
|
|
||||||
// tab handler
|
// tab handler
|
||||||
const filterHandler = (value) => {
|
const filterHandler = (value) => {
|
||||||
setValue(value);
|
setValue(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
// member listing
|
|
||||||
const memberList = useCallback(async () => {
|
|
||||||
setLoader(true);
|
|
||||||
try {
|
|
||||||
let reqData = {
|
|
||||||
member_id: memberId,
|
|
||||||
uid: uid,
|
|
||||||
session_id: sessionId,
|
|
||||||
limit: 20,
|
|
||||||
offset: 0,
|
|
||||||
action: 22010,
|
|
||||||
};
|
|
||||||
|
|
||||||
let res = await apiCall.familyListings(reqData);
|
|
||||||
const { data } = res;
|
|
||||||
if (data?.internal_return >= 0 && data?.status == "OK") {
|
|
||||||
let { result_list } = data;
|
|
||||||
setFamilyList(result_list);
|
|
||||||
setLoader(false);
|
|
||||||
} else return;
|
|
||||||
} catch (error) {
|
|
||||||
setLoader(false);
|
|
||||||
throw new Error(error);
|
|
||||||
}
|
|
||||||
}, [apiCall, memberId, sessionId, uid]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
memberList();
|
|
||||||
}, [listReload, memberList]);
|
|
||||||
|
|
||||||
console.log('Ebueb', familyList)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
{/*<CommonHead />*/}
|
{/*<CommonHead />*/}
|
||||||
@@ -94,7 +36,7 @@ export default function FamilyManage() {
|
|||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<FamilyManageTabs accountDetails={accountDetails} loader={loader} />
|
<FamilyManageTabs accountDetails={accountDetails} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import React, {
|
|||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import cover from "../../assets/images/profile-info-cover.png";
|
|
||||||
import profile from "../../assets/images/profile-info-profile.png";
|
import profile from "../../assets/images/profile-info-profile.png";
|
||||||
import usersService from "../../services/UsersService";
|
import usersService from "../../services/UsersService";
|
||||||
import FamilyTasks from "./FamilyTasks";
|
import FamilyTasks from "./FamilyTasks";
|
||||||
@@ -14,6 +13,7 @@ import FamilyTasks from "./FamilyTasks";
|
|||||||
export default function FamilyManageTabs({
|
export default function FamilyManageTabs({
|
||||||
className,
|
className,
|
||||||
accountDetails,
|
accountDetails,
|
||||||
|
listReload,
|
||||||
loader,
|
loader,
|
||||||
}) {
|
}) {
|
||||||
const [familyDetails, setFamilyDetails] = useState(null);
|
const [familyDetails, setFamilyDetails] = useState(null);
|
||||||
@@ -75,9 +75,8 @@ export default function FamilyManageTabs({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
familyManageHandler();
|
familyManageHandler();
|
||||||
}, []);
|
}, [tab]);
|
||||||
|
|
||||||
console.log(familyDetails);
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`update-table w-full bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow min-h-[520px] max-h-[600px] ${
|
className={`update-table w-full bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow min-h-[520px] max-h-[600px] ${
|
||||||
@@ -212,10 +211,6 @@ function ProfileInfo({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Tasks() {
|
|
||||||
return <>Tasks</>;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Account({ familyDetails }) {
|
function Account({ familyDetails }) {
|
||||||
return (
|
return (
|
||||||
<div className="w-full lg:min-h-[400px] h-full flex items-center justify-center">
|
<div className="w-full lg:min-h-[400px] h-full flex items-center justify-center">
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ export default function FamilyAcc() {
|
|||||||
if (data?.internal_return > 0 && data?.status == "OK") {
|
if (data?.internal_return > 0 && data?.status == "OK") {
|
||||||
setLoader(false);
|
setLoader(false);
|
||||||
setListReload((prev) => !prev);
|
setListReload((prev) => !prev);
|
||||||
|
popUpHandler()
|
||||||
} else {
|
} else {
|
||||||
setLoader(false);
|
setLoader(false);
|
||||||
setMsgErr("Sorry, something went wrong");
|
setMsgErr("Sorry, something went wrong");
|
||||||
@@ -93,6 +94,7 @@ export default function FamilyAcc() {
|
|||||||
first_name: "",
|
first_name: "",
|
||||||
last_name: "",
|
last_name: "",
|
||||||
});
|
});
|
||||||
|
setSelectedAge("")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ function DataIteration(props) {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{datas &&
|
{datas &&
|
||||||
datas.length >= endLength &&
|
datas?.length >= endLength &&
|
||||||
datas
|
datas?.slice(startLength, endLength)
|
||||||
.slice(startLength, endLength)
|
|
||||||
.map((value) => children({ datas: value }))}
|
.map((value) => children({ datas: value }))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
//import ProductCardStyleTwo from "../Cards/ProductCardStyleTwo";
|
|
||||||
import DataIteration from "../Helpers/DataIteration";
|
import DataIteration from "../Helpers/DataIteration";
|
||||||
// import SearchCom from "../Helpers/SearchCom";
|
|
||||||
// import ActiveJobsCard from "../Cards/ActiveJobsCard";
|
|
||||||
import AvailableJobsCard from "../Cards/AvailableJobsCard";
|
import AvailableJobsCard from "../Cards/AvailableJobsCard";
|
||||||
|
|
||||||
export default function MainSection({ className, marketPlaceProduct }) {
|
export default function MainSection({ className, marketPlaceProduct }) {
|
||||||
@@ -13,13 +10,13 @@ export default function MainSection({ className, marketPlaceProduct }) {
|
|||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (tab === "artist") {
|
if (tab === "artist") {
|
||||||
setProducts(marketPlaceProduct.slice(0, 3));
|
setProducts(marketPlaceProduct?.slice(0, 3));
|
||||||
} else if (tab === "market") {
|
} else if (tab === "market") {
|
||||||
setProducts(marketPlaceProduct.slice(0, 6));
|
setProducts(marketPlaceProduct?.slice(0, 6));
|
||||||
} else if (tab === "shop") {
|
} else if (tab === "shop") {
|
||||||
setProducts(marketPlaceProduct.slice(6, 9));
|
setProducts(marketPlaceProduct?.slice(6, 9));
|
||||||
} else if (tab === "assets") {
|
} else if (tab === "assets") {
|
||||||
setProducts(marketPlaceProduct.slice(3, 6));
|
setProducts(marketPlaceProduct?.slice(3, 6));
|
||||||
} else {
|
} else {
|
||||||
setProducts(marketPlaceProduct);
|
setProducts(marketPlaceProduct);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user