Compare commits

...

10 Commits

9 changed files with 112 additions and 36 deletions
+3 -2
View File
@@ -78,11 +78,12 @@ export default function SocketIOContextProvider({children}) {
}); });
socket.on("marketjob_actions", (data) => { // Triggers refresh on owner side, when somebody sends/shows interest in a job socket.on("marketjob_actions", (data) => { // Triggers refresh on owner side, when somebody sends/shows interest in a job
// let user_uid = userDetails.account_type == 'FULL' ? userDetails.uid : sessionStorage.getItem('family_uid') // gets user UID let user_uid = userDetails.account_type == 'FULL' ? userDetails.uid : sessionStorage.getItem('family_uid') // gets user UID
let {message} = data let {message} = data
if(message.action == "REFRESH_OFFERS" && message.audience == "MERCHANT"){ // for refreshing job owner offer interest list when any worker sends interest if(message.action == "REFRESH_OFFERS" && message.audience == "MERCHANT" && message.market_uid == user_uid){ // for refreshing job owner offer interest list when any worker sends interest
dispatch(tableReload({type:'OFFERINTERESTLISTRELOAD'})) dispatch(tableReload({type:'OFFERINTERESTLISTRELOAD'}))
} }
console.log('data', data)
}); });
}, [socket]); }, [socket]);
+37 -2
View File
@@ -1,8 +1,9 @@
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom"; import { Link, useLocation, useNavigate } from "react-router-dom";
import Layout from "../Partials/Layout"; import Layout from "../Partials/Layout";
import LoadingSpinner from "../Spinners/LoadingSpinner"; import LoadingSpinner from "../Spinners/LoadingSpinner";
import FamilyManageTabs from "./FamilyManageTabs"; import FamilyManageTabs from "./FamilyManageTabs";
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
export default function FamilyManage() { export default function FamilyManage() {
const [selectTab, setValue] = useState("today"); const [selectTab, setValue] = useState("today");
@@ -34,7 +35,7 @@ export default function FamilyManage() {
<div className="notification-page w-full mb-10"> <div className="notification-page w-full mb-10">
<div className="notification-wrapper w-full"> <div className="notification-wrapper w-full">
{/* heading */} {/* heading */}
<div className="sm:flex justify-between items-center mb-6"> {/* <div className="sm:flex justify-between items-center mb-6">
<div className="mb-5 sm:mb-0"> <div className="mb-5 sm:mb-0">
<h1 className="text-26 font-bold inline-flex gap-3 text-dark-gray dark:text-white items-center"> <h1 className="text-26 font-bold inline-flex gap-3 text-dark-gray dark:text-white items-center">
<span <span
@@ -50,6 +51,40 @@ export default function FamilyManage() {
className="relative" className="relative"
></div> ></div>
</div> </div>
</div> */}
<div className="w-full mb-5 flex justify-between items-center">
<div className="">
<CustomBreadcrumb
title = {'Manage Family'}
breadcrumb={
[
{ link: "/", title: "Home" },
{ link: "/manage-family", title: "Manage Family", active: true},
]
}
/>
</div>
<Link
className="item-content relative text-[18px] transition-all duration-300 ease-in-out bg-[#76a5df] text-white font-medium dark:text-white h-12 px-2 flex items-center gap-2 rounded-md shadow-sm justify-center cursor-pointer dark:bg-[linear-gradient(134.38deg,#f539f8_0%,#c342f9_43.55%,#5356fb_104.51%)]"
to="/acc-family"
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
className="w-4 h-4"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"
/>
</svg>
<span>Family</span>
</Link>
</div> </div>
<FamilyManageTabs accountDetails={accountDetails} /> <FamilyManageTabs accountDetails={accountDetails} />
</div> </div>
+1 -1
View File
@@ -7,7 +7,7 @@ function DataIteration(props) {
{datas && {datas &&
datas?.length >= endLength && datas?.length >= endLength &&
datas?.slice(startLength, endLength) datas?.slice(startLength, endLength)
.map((value) => children({ datas: value }))} .map((value, index) => children({ datas: value, index }))}
</> </>
); );
} }
+15 -7
View File
@@ -96,7 +96,9 @@ export default function MainSection({
</div> </div>
{/* end of contentDisplay toggler */} {/* end of contentDisplay toggler */}
</div> </div>
<div className="filter-navigate-content w-full min-h-screen">
{/* OLD MARKET JOB LISTING */}
{/* <div className="filter-navigate-content w-full min-h-screen">
<div <div
className={ className={
contentDisplay == "grid" contentDisplay == "grid"
@@ -109,8 +111,8 @@ export default function MainSection({
startLength={process.env.REACT_APP_ZERO_STATE} startLength={process.env.REACT_APP_ZERO_STATE}
endLength={products?.length} endLength={products?.length}
> >
{({ datas }) => ( {({ datas, index }) => (
<div key={datas.job_uid}> <div key={datas.job_uid+index}>
<AvailableJobsCard <AvailableJobsCard
contentDisplay={contentDisplay} contentDisplay={contentDisplay}
image_server={image_server} image_server={image_server}
@@ -120,11 +122,13 @@ export default function MainSection({
)} )}
</DataIteration> </DataIteration>
</div> </div>
</div> </div> */}
{/* {products?.length && {/* END OF OLD MARKET JOB LISTING */}
{products?.length ?
<NewPaginatedList <NewPaginatedList
data={products} data={products}
itemsPerPage={6} itemsPerPage={9}
filterItem='' filterItem=''
tableTitle='' tableTitle=''
> >
@@ -154,7 +158,11 @@ export default function MainSection({
) )
} }
</NewPaginatedList> </NewPaginatedList>
} */} :
<div className="w-full h-[40rem] bg-white dark:bg-dark-white flex justify-center items-center">
No Jobs Found!
</div>
}
</div> </div>
</div> </div>
); );
@@ -16,6 +16,7 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
"offer_code": details?.offer_code, "offer_code": details?.offer_code,
"offer_uid": details?.offer_uid, "offer_uid": details?.offer_uid,
"job_uid": details?.job_uid, "job_uid": details?.job_uid,
"market_uid": details?.market_uid
} }
let room = `INTEREST-${details?.market_uid}` let room = `INTEREST-${details?.market_uid}`
sendJobInterestToOwner(message, room) sendJobInterestToOwner(message, room)
+7
View File
@@ -3,6 +3,7 @@ import Layout from "../Partials/Layout";
import CommonHead from "../UserHeader/CommonHead"; import CommonHead from "../UserHeader/CommonHead";
import MainSection from "./MainSection"; import MainSection from "./MainSection";
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb"; import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
import LoadingSpinner from "../Spinners/LoadingSpinner";
export default function MarketPlace({ commonHeadData }) { export default function MarketPlace({ commonHeadData }) {
let { jobLists } = useSelector((state) => state.jobLists); let { jobLists } = useSelector((state) => state.jobLists);
@@ -25,12 +26,18 @@ export default function MarketPlace({ commonHeadData }) {
} }
/> />
</div> </div>
{jobLists.loading ?
<div className="w-full flex justify-center items-center bg-white dark:bg-dark-white">
<LoadingSpinner size='20' height='h-[40rem]' />
</div>
:
<MainSection <MainSection
marketPlaceProduct={marketData} marketPlaceProduct={marketData}
categories={categories} categories={categories}
image_server={image_server} image_server={image_server}
className="mb-10" className="mb-10"
/> />
}
</Layout> </Layout>
</> </>
); );
+45 -22
View File
@@ -42,7 +42,11 @@ export default function NewPaginatedList({
filteredData?.slice(currentPage, numberOfSelection + currentPage) filteredData?.slice(currentPage, numberOfSelection + currentPage)
); );
}, [currentPage, filteredData]); }, [currentPage, filteredData]);
console.log("newData", newData, filteredData);
useEffect(()=>{
setCurrentPage(0)
},[itemsPerPage])
return ( return (
<div className="w-full"> <div className="w-full">
<h1 className="text-2xl mb-5 font-semibold">{tableTitle}</h1> <h1 className="text-2xl mb-5 font-semibold">{tableTitle}</h1>
@@ -74,27 +78,46 @@ export default function NewPaginatedList({
{/* show prev and next button if data exist */} {/* show prev and next button if data exist */}
{data.length > 0 && ( {data.length > 0 && (
<div className="mt-10 w-full flex gap-4 justify-center items-center"> <div className="mt-10 w-full flex gap-4 justify-center items-center">
<button <button
onClick={handlePrev} onClick={handlePrev}
className={`w-12 h-12 rounded-full flex justify-center items-center border ${ className={`w-12 h-12 rounded-full flex justify-center items-center transition-all duration-300 ${
currentPage == 0 currentPage == 0
? "text-slate-300 border-slate-300 dark:text-slate-400 dark:border-slate-400 pointer-events-none" ? "text-slate-400 border-slate-400 dark:text-slate-400 dark:border-slate-400 pointer-events-none"
: "text-slate-600 border-slate-600 dark:text-slate-300 dark:border-slate-300" : "text-slate-600 border-slate-600 dark:text-white dark:border-white"
} transition-all duration-500`} }`}
> >
&lt; &lt;
</button> </button>
<button
onClick={handleNext} {data.length && data.map((item, index)=>{
className={`w-12 h-12 rounded-full flex justify-center items-center border ${ if(index%itemsPerPage == 0 && index >= currentPage && index <= currentPage+itemsPerPage){
currentPage + numberOfSelection >= data.length return (
? "text-slate-300 border-slate-300 dark:text-slate-400 dark:border-slate-400 pointer-events-none" <button
: "text-slate-600 border-slate-600 dark:text-slate-300 dark:border-slate-300" key={index}
} transition-all duration-500`} onClick={handleNext}
> className={`w-12 h-12 rounded-full flex justify-center items-center border transition-all duration-300 ${
&gt; currentPage != index
</button> ? "text-slate-400 border-slate-400 dark:text-slate-400 dark:border-slate-400"
</div> : "text-slate-600 border-slate-600 dark:text-white dark:border-white pointer-events-none"
}`}
>
{index/itemsPerPage +1}
</button>
)
}
})}
<button
onClick={handleNext}
className={`w-12 h-12 rounded-full flex justify-center items-center transition-all duration-300 ${
currentPage + numberOfSelection >= data.length
? "text-slate-400 border-slate-400 dark:text-slate-400 dark:border-slate-400 pointer-events-none"
: "text-slate-600 border-slate-600 dark:text-white dark:border-white"
}`}
>
&gt;
</button>
</div>
)} )}
</div> </div>
); );
+2 -1
View File
@@ -219,8 +219,9 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
const getMarketActiveJobList = async () => { const getMarketActiveJobList = async () => {
try { try {
const res = await apiCall.getActiveJobList(); const res = await apiCall.getActiveJobList();
dispatch(updateJobs(res.data)); dispatch(updateJobs({loading: false, ...res.data}));
} catch (error) { } catch (error) {
dispatch(updateJobs({loading: false}));
console.log("Error getting mode"); console.log("Error getting mode");
} }
}; };
+1 -1
View File
@@ -1,7 +1,7 @@
import { createSlice } from "@reduxjs/toolkit"; import { createSlice } from "@reduxjs/toolkit";
const initialState = { const initialState = {
jobLists: {} jobLists: {loading: true}
}; };
export const jobSlice = createSlice({ export const jobSlice = createSlice({