Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f6471a16e | |||
| 98a4baddab | |||
| 67f8de325f | |||
| 594d2a4224 |
@@ -8,9 +8,13 @@ import { useSelector } from "react-redux";
|
|||||||
// import TopSellerTopBuyerSliderSection from "./TopSellerTopBuyerSliderSection";
|
// import TopSellerTopBuyerSliderSection from "./TopSellerTopBuyerSliderSection";
|
||||||
//import UpdateTable from "./UpdateTable";
|
//import UpdateTable from "./UpdateTable";
|
||||||
import HomeActivities from "./HomeActivities";
|
import HomeActivities from "./HomeActivities";
|
||||||
|
import MyOffersTable from "../MyTasks/MyOffersTable";
|
||||||
|
import MyJobTable from "../MyTasks/MyJobTable";
|
||||||
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
|
|
||||||
export default function FullAccountDash(props) {
|
export default function FullAccountDash(props) {
|
||||||
console.log("PROPS IN HOME->", props);
|
console.log("PROPS IN HOME->", props);
|
||||||
|
|
||||||
const { userDetails } = useSelector((state) => state?.userDetails);
|
const { userDetails } = useSelector((state) => state?.userDetails);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -22,7 +26,31 @@ export default function FullAccountDash(props) {
|
|||||||
bannerList={props.bannerList}
|
bannerList={props.bannerList}
|
||||||
nextDueTask={props.nextDueTask}
|
nextDueTask={props.nextDueTask}
|
||||||
/>
|
/>
|
||||||
<HomeActivities className="mb-10" />
|
{ props.offersList?.data?.result_list?.length ?
|
||||||
|
<MyOffersTable
|
||||||
|
MyActiveOffersList={props.offersList?.data}
|
||||||
|
className="mb-10"
|
||||||
|
/>
|
||||||
|
: props.MyActiveJobList?.data?.length ?
|
||||||
|
<>
|
||||||
|
<div className="w-full mb-5 flex justify-between items-center gap-1">
|
||||||
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
|
||||||
|
<span>
|
||||||
|
My Tasks
|
||||||
|
</span>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<MyJobTable ActiveJobList={props.MyActiveJobList} Account={userDetails} />
|
||||||
|
</>
|
||||||
|
|
||||||
|
: !props.offersList?.loading && !props.MyActiveJobList?.loading?
|
||||||
|
<HomeActivities className="mb-10" />
|
||||||
|
:
|
||||||
|
<div className="w-full h-[220px] flex items-center justify-center">
|
||||||
|
<LoadingSpinner size="16" color="sky-blue" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
{/*<UpdateTable className="mb-10"/>*/}
|
{/*<UpdateTable className="mb-10"/>*/}
|
||||||
{/*<SellHistoryMarketVisitorAnalytic className="mb-10"/>*/}
|
{/*<SellHistoryMarketVisitorAnalytic className="mb-10"/>*/}
|
||||||
{/*<TopSellerTopBuyerSliderSection className="mb-10" />*/}
|
{/*<TopSellerTopBuyerSliderSection className="mb-10" />*/}
|
||||||
|
|||||||
@@ -12,23 +12,25 @@ export default function Home(props) {
|
|||||||
const { commonHeadBanner } = useSelector((state) => state.commonHeadBanner);
|
const { commonHeadBanner } = useSelector((state) => state.commonHeadBanner);
|
||||||
|
|
||||||
let [nextDueTask, setNextDueTask] = useState({});
|
let [nextDueTask, setNextDueTask] = useState({});
|
||||||
const [MyOffersList, setMyOffersList] = useState([]);
|
const [MyOffersList, setMyOffersList] = useState({loading: true, data: []});
|
||||||
|
|
||||||
const { userDetails } = useSelector((state) => state?.userDetails);
|
const { userDetails } = useSelector((state) => state?.userDetails);
|
||||||
|
|
||||||
const [MyActiveJobList, setMyActiveJobList] = useState([]); // STATE TO HOLD ACTIVE/CURRENT TASKS
|
const [MyActiveJobList, setMyActiveJobList] = useState({loading:true, data:[]}); // STATE TO HOLD ACTIVE/CURRENT TASKS
|
||||||
|
// const [MyActiveJobList, setMyActiveJobList] = useState([]); // STATE TO HOLD ACTIVE/CURRENT TASKS
|
||||||
|
|
||||||
const getMyActiveJobList = async () => { // FUNCTION TO POPULATE ACTIVE/CURRENT TASK LIST
|
const getMyActiveJobList = async () => { // FUNCTION TO POPULATE ACTIVE/CURRENT TASK LIST
|
||||||
try {
|
try {
|
||||||
const res = await userApi.getMyActiveTaskList();
|
const res = await userApi.getMyActiveTaskList();
|
||||||
setMyActiveJobList(res?.data?.result_list);
|
setMyActiveJobList({loading:false, data:res?.data?.result_list});
|
||||||
|
// setMyActiveJobList(res?.data?.result_list);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setMyActiveJobList([]);
|
setMyActiveJobList({loading:false, data:[]});
|
||||||
|
// setMyActiveJobList([]);
|
||||||
console.log("Error getting tasks");
|
console.log("Error getting tasks");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// FUNCTION TO GET DASH DATA TO DETERMINE CURRENT TASK DUE TIME
|
// FUNCTION TO GET DASH DATA TO DETERMINE CURRENT TASK DUE TIME
|
||||||
const getHomeDate = () => {
|
const getHomeDate = () => {
|
||||||
userApi
|
userApi
|
||||||
@@ -47,8 +49,9 @@ export default function Home(props) {
|
|||||||
const getMyOffersList = async () => {
|
const getMyOffersList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await userApi.getOffersList();
|
const res = await userApi.getOffersList();
|
||||||
setMyOffersList(res.data?.result_list);
|
setMyOffersList({loading:false, data:res.data});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
setMyOffersList({loading:false, data:[]});
|
||||||
console.log("Error getting offers", error);
|
console.log("Error getting offers", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -64,7 +67,7 @@ export default function Home(props) {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getMyActiveJobList();
|
getMyActiveJobList();
|
||||||
}, []);
|
}, []);
|
||||||
|
console.log('MyActiveJobList',MyActiveJobList)
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<div className="home-page-wrapper">
|
<div className="home-page-wrapper">
|
||||||
@@ -72,13 +75,15 @@ export default function Home(props) {
|
|||||||
<FamilyDash
|
<FamilyDash
|
||||||
account={userDetails}
|
account={userDetails}
|
||||||
commonHeadData={props.bannerList}
|
commonHeadData={props.bannerList}
|
||||||
familyOffers={MyOffersList}
|
familyOffers={MyOffersList?.data?.result_list}
|
||||||
MyActiveJobList={MyActiveJobList}
|
MyActiveJobList={MyActiveJobList?.data}
|
||||||
/>
|
/>
|
||||||
) : userDetails && userDetails?.account_type == "FULL" ? (
|
) : userDetails && userDetails?.account_type == "FULL" ? (
|
||||||
<FullAccountDash
|
<FullAccountDash
|
||||||
nextDueTask={nextDueTask}
|
nextDueTask={nextDueTask}
|
||||||
bannerList={props.bannerList}
|
bannerList={props.bannerList}
|
||||||
|
offersList={MyOffersList}
|
||||||
|
MyActiveJobList={MyActiveJobList}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -55,15 +55,14 @@ export default function MyJobTable({ className, ActiveJobList, Account }) {
|
|||||||
{!ActiveJobList?.data.length && accountType && (
|
{!ActiveJobList?.data.length && accountType && (
|
||||||
<div className="absolute inset-0 bg-black opacity-30"></div>
|
<div className="absolute inset-0 bg-black opacity-30"></div>
|
||||||
)}
|
)}
|
||||||
{ActiveJobList?.data.length > 0 && ActiveJobList.loading && (
|
{ActiveJobList.loading ?
|
||||||
<div className="w-full h-[520px] flex items-center justify-center">
|
<div className="w-full h-[520px] flex items-center justify-center">
|
||||||
<LoadingSpinner size="16" color="sky-blue" />
|
<LoadingSpinner size="16" color="sky-blue" />
|
||||||
</div>
|
</div>
|
||||||
)}
|
:
|
||||||
|
|
||||||
<div className="relative w-full sm:rounded-lg">
|
<div className="relative w-full sm:rounded-lg">
|
||||||
<div className="h-auto w-full">
|
<div className="h-auto w-full">
|
||||||
{ActiveJobList?.data?.length > 0 &&
|
{ActiveJobList?.data?.length > 0 ?
|
||||||
currentTask?.map((task, idx) => {
|
currentTask?.map((task, idx) => {
|
||||||
// find due date
|
// find due date
|
||||||
const dueDate = task?.delivery_date.split(" ")[0];
|
const dueDate = task?.delivery_date.split(" ")[0];
|
||||||
@@ -136,9 +135,8 @@ export default function MyJobTable({ className, ActiveJobList, Account }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})
|
||||||
|
:
|
||||||
{ActiveJobList?.data?.length <= 0 && (
|
|
||||||
<div
|
<div
|
||||||
className={`flex flex-col ${
|
className={`flex flex-col ${
|
||||||
accountType ? "items-center" : "items-end"
|
accountType ? "items-center" : "items-end"
|
||||||
@@ -175,12 +173,12 @@ export default function MyJobTable({ className, ActiveJobList, Account }) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
}
|
||||||
{ActiveJobList?.internal_return < 0 && (
|
{/* {ActiveJobList?.internal_return < 0 && (
|
||||||
<div className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
<div className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
||||||
<p className="p-2">Error Occurred! Unable to display Tasks!</p>
|
<p className="p-2">Error Occurred! Unable to display Tasks!</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)} */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* PAGINATION BUTTON */}
|
{/* PAGINATION BUTTON */}
|
||||||
@@ -199,6 +197,7 @@ export default function MyJobTable({ className, ActiveJobList, Account }) {
|
|||||||
/>
|
/>
|
||||||
{/* END OF PAGINATION BUTTON */}
|
{/* END OF PAGINATION BUTTON */}
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user