Compare commits
72 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c64d372193 | |||
| abff42e0a8 | |||
| d5c342a57a | |||
| 60d6629526 | |||
| b1fbf89f10 | |||
| ae346d5ac5 | |||
| 75b5102766 | |||
| 9b12ffe0cd | |||
| 408165e718 | |||
| f7a0594447 | |||
| c733b006fb | |||
| 5a6b60578e | |||
| cdd998235e | |||
| 6e9efd7f43 | |||
| 07e9520774 | |||
| c1600a2a13 | |||
| 58e1745ac5 | |||
| 35db4fe536 | |||
| dfdbf404a5 | |||
| 985afa3c7b | |||
| 70d82d89b3 | |||
| 7f5eccb3b7 | |||
| 6729b780bd | |||
| 06224f121a | |||
| dc91649114 | |||
| 22f6eb436d | |||
| f2ab0cd6c9 | |||
| a2819786ae | |||
| 6cd92f6372 | |||
| 7173901c9b | |||
| 380d014964 | |||
| 9032b36b13 | |||
| f291382786 | |||
| 69dcee859d | |||
| fe295dc775 | |||
| 044c8edf7d | |||
| c22cffd167 | |||
| 6d77bfa1b0 | |||
| 60cc6f375e | |||
| e6684c56fd | |||
| 4f675b30ef | |||
| 00c7f65092 | |||
| 9a978b1913 | |||
| 23f8346734 | |||
| 585632c1e1 | |||
| 11ee1195c2 | |||
| c44f456cc1 | |||
| b769e4a4ba | |||
| a6ff06e2b4 | |||
| 0f801b2408 | |||
| c26f2b725a | |||
| ee94cbc92c | |||
| dccbe76c5b | |||
| 735d13b440 | |||
| 7f83cd5cc6 | |||
| 71ee75072d | |||
| 265f2b7655 | |||
| 4d264fa18e | |||
| cd6ab8b504 | |||
| 8c81073443 | |||
| 14566de037 | |||
| 69d711eddc | |||
| 159623eb69 | |||
| da26d5c24a | |||
| 40850b7342 | |||
| 28098169b9 | |||
| 2ff6ed777f | |||
| 723a2a09ab | |||
| 68482c7956 | |||
| 225e3ae34c | |||
| 251d5abf10 | |||
| 22314a61c5 |
@@ -15,6 +15,9 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
|
|||||||
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
||||||
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
||||||
|
|
||||||
|
#SOCKETS ENDS
|
||||||
|
REACT_APP_PRIMARY_SOCKET="https://socket-dev.wrenchboard.com"
|
||||||
|
|
||||||
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
|
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
|
||||||
|
|
||||||
REACT_APP_SESSION_EXPIRE_MINUTES=600000
|
REACT_APP_SESSION_EXPIRE_MINUTES=600000
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
|
|||||||
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
||||||
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
||||||
|
|
||||||
|
#SOCKETS ENDS
|
||||||
|
REACT_APP_PRIMARY_SOCKET="https://socket-dev.wrenchboard.com"
|
||||||
|
|
||||||
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
|
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
|
||||||
|
|
||||||
REACT_APP_SESSION_EXPIRE_MINUTES=600000
|
REACT_APP_SESSION_EXPIRE_MINUTES=600000
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
|
|||||||
REACT_APP_AUX_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/en/wrench/api/v1"
|
REACT_APP_AUX_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/en/wrench/api/v1"
|
||||||
REACT_APP_USERS_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/en/wrench/api/v1"
|
REACT_APP_USERS_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/en/wrench/api/v1"
|
||||||
|
|
||||||
|
#SOCKETS ENDS
|
||||||
|
REACT_APP_PRIMARY_SOCKET="https://socket.wrenchboard.com"
|
||||||
|
|
||||||
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
|
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
|
||||||
|
|
||||||
REACT_APP_SESSION_EXPIRE_MINUTES=600000
|
REACT_APP_SESSION_EXPIRE_MINUTES=600000
|
||||||
|
|||||||
+3
-2
@@ -21,9 +21,10 @@ services:
|
|||||||
- backend.wrenchboard.api.live:10.10.33.15
|
- backend.wrenchboard.api.live:10.10.33.15
|
||||||
- backend.wrenchboard.api.test:10.10.33.15
|
- backend.wrenchboard.api.test:10.10.33.15
|
||||||
- apigate.lotus.g1.wrenchboard.com:10.10.33.15
|
- apigate.lotus.g1.wrenchboard.com:10.10.33.15
|
||||||
|
- apigate.nebula.g1.wrenchboard.com:10.10.33.15
|
||||||
- apigate.orion.g1.wrenchboard.com:10.10.33.15
|
- apigate.orion.g1.wrenchboard.com:10.10.33.15
|
||||||
# #- backend.wrenchboard.api.live:172.31.4.27
|
- socket-dev.wrenchboard.com:10.10.33.15
|
||||||
# #- backend.wrenchboard.api.test:10.20.30.27
|
- socket.wrenchboard.com:10.10.33.15
|
||||||
- apigateway.wrenchboard.app.dev.fluxtra.net:10.20.30.19
|
- apigateway.wrenchboard.app.dev.fluxtra.net:10.20.30.19
|
||||||
- apigateway.wrenchboard.app.lotus.fluxtra.net:172.31.4.19
|
- apigateway.wrenchboard.app.lotus.fluxtra.net:172.31.4.19
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
"react-to-print": "^2.14.12",
|
"react-to-print": "^2.14.12",
|
||||||
"react-toastify": "^9.0.1",
|
"react-toastify": "^9.0.1",
|
||||||
"redux": "^4.2.0",
|
"redux": "^4.2.0",
|
||||||
|
"socket.io-client": "^4.4.1",
|
||||||
"slick-carousel": "^1.8.1",
|
"slick-carousel": "^1.8.1",
|
||||||
"web-vitals": "^1.0.1",
|
"web-vitals": "^1.0.1",
|
||||||
"yup": "^1.1.1"
|
"yup": "^1.1.1"
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ import { Navigate, useLocation } from "react-router-dom";
|
|||||||
import Routers from "./Routers";
|
import Routers from "./Routers";
|
||||||
import Toaster from "./components/Helpers/Toaster";
|
import Toaster from "./components/Helpers/Toaster";
|
||||||
import Default from "./components/Partials/Default";
|
import Default from "./components/Partials/Default";
|
||||||
|
import SocketIOContextProvider from "./components/Contexts/SocketIOContext";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
return (
|
return (
|
||||||
<Default>
|
<Default>
|
||||||
|
<SocketIOContextProvider>
|
||||||
<>
|
<>
|
||||||
{pathname.startsWith("/@") ? (
|
{pathname.startsWith("/@") ? (
|
||||||
<Navigate to="/app" replace={true} />
|
<Navigate to="/app" replace={true} />
|
||||||
@@ -15,6 +17,7 @@ function App() {
|
|||||||
)}
|
)}
|
||||||
<Toaster />
|
<Toaster />
|
||||||
</>
|
</>
|
||||||
|
</SocketIOContextProvider>
|
||||||
</Default>
|
</Default>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,8 +145,9 @@ export default function Login() {
|
|||||||
localStorage.setItem("member_id", `${res.data.member_id}`);
|
localStorage.setItem("member_id", `${res.data.member_id}`);
|
||||||
localStorage.setItem("uid", `${res.data.uid}`);
|
localStorage.setItem("uid", `${res.data.uid}`);
|
||||||
localStorage.setItem("session_token", `${res.data.session}`);
|
localStorage.setItem("session_token", `${res.data.session}`);
|
||||||
if (name === "family") {
|
if (res.data?.account_type == "FAMILY") {
|
||||||
sessionStorage.setItem("family_uid", res.data?.family_uid);
|
sessionStorage.setItem("family_uid", res.data?.family_uid);
|
||||||
|
sessionStorage.setItem("parent_uid", res.data?.parent_uid);
|
||||||
}
|
}
|
||||||
// localStorage.setItem("session", `${res.data.session}`);
|
// localStorage.setItem("session", `${res.data.session}`);
|
||||||
dispatch(updateUserDetails({ ...res.data }));
|
dispatch(updateUserDetails({ ...res.data }));
|
||||||
|
|||||||
@@ -1,22 +1,25 @@
|
|||||||
import React from 'react'
|
import React from "react";
|
||||||
import { Link } from 'react-router-dom'
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
export default function CustomBreadcrumb({ title, breadcrumb }) {
|
export default function CustomBreadcrumb({ title, breadcrumb }) {
|
||||||
return (
|
return (
|
||||||
<div className="">
|
<div className="">
|
||||||
<h3 className="text-26 font-bold text-dark-gray dark:text-white">{title}</h3>
|
<h3 className="text-26 font-bold text-dark-gray dark:text-white">
|
||||||
<nav aria-label="breadcrumb" className='text-base text-dark-gray dark:text-white flex items-center'>
|
{title}
|
||||||
|
</h3>
|
||||||
|
<nav
|
||||||
|
aria-label="breadcrumb"
|
||||||
|
className="text-base text-dark-gray dark:text-white flex items-center"
|
||||||
|
>
|
||||||
{breadcrumb.map((value, index) => (
|
{breadcrumb.map((value, index) => (
|
||||||
<p key={index}>
|
<React.Fragment key={index}>
|
||||||
<Link className={`${value.active ? 'opacity-60' : ''}`} to={value.link}>{value.title}</Link>
|
<Link className={value.active ? "opacity-60" : ""} to={value.link}>
|
||||||
{index != breadcrumb.length - 1 ?
|
{value.title}
|
||||||
<span className='px-1'>/</span>
|
</Link>
|
||||||
:
|
{index !== breadcrumb.length - 1 && <span className="px-1">\</span>}
|
||||||
null
|
</React.Fragment>
|
||||||
}
|
|
||||||
</p>
|
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
import React, { createContext, useContext, useEffect, useState } from "react";
|
||||||
|
import { tableReload } from "../../store/TableReloads";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
|
import io from "socket.io-client";
|
||||||
|
|
||||||
|
let SocketIOContext = createContext({})
|
||||||
|
|
||||||
|
export default function SocketIOContextProvider({children}) {
|
||||||
|
const {userDetails} = useSelector((state) => state?.userDetails); // CHECKS IF USER UID, to determine if user is active
|
||||||
|
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
|
||||||
|
const socket = io.connect(process.env.REACT_APP_PRIMARY_SOCKET);
|
||||||
|
|
||||||
|
// //Room State
|
||||||
|
// const [room, setRoom] = useState("");
|
||||||
|
|
||||||
|
// // Messages States
|
||||||
|
// const [message, setMessage] = useState("");
|
||||||
|
const [socketMsgReceived, setSocketMsgReceived] = useState("");
|
||||||
|
|
||||||
|
const joinRoom = (room) => {
|
||||||
|
if (room !== "") {
|
||||||
|
socket.emit("join_room", room);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const sendMessage = (message, room) => {
|
||||||
|
if(message && room){
|
||||||
|
socket.emit("send_message", { message, room });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const marketUpdate = (message, room) => {
|
||||||
|
if(message && room){
|
||||||
|
socket.emit("marketjob_addded", { message, room });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const parentAssignJobToKid = (message, room) => {
|
||||||
|
if(message && room){
|
||||||
|
socket.emit("family", { message:{...message}, room });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
socket.on("receive_message", (data) => {
|
||||||
|
// setSocketMsgReceived(data.message);
|
||||||
|
dispatch(tableReload({type:'CHATMESSAGELIST'}))
|
||||||
|
});
|
||||||
|
socket.on("received_refreshmarket_jobs", (data) => {
|
||||||
|
// setSocketMsgReceived(data.message);
|
||||||
|
dispatch(tableReload({type:'MARKETTABLELIST'}))
|
||||||
|
});
|
||||||
|
socket.on("family_actions", (data) => {
|
||||||
|
// setSocketMsgReceived(data.message);
|
||||||
|
let user_uid = userDetails.account_type == 'FULL' ? userDetails.uid : sessionStorage.getItem('family_uid')
|
||||||
|
let {message} = data
|
||||||
|
if(message.action == "REFRESH_OFFER" && message.family_uid == user_uid && message.audience == "MEMBER"){
|
||||||
|
dispatch(tableReload({type:'FAMILYOFFERLIST'}))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, [socket]);
|
||||||
|
|
||||||
|
let values = {
|
||||||
|
socket,
|
||||||
|
sendMessage,
|
||||||
|
joinRoom,
|
||||||
|
setSocketMsgReceived,
|
||||||
|
marketUpdate,
|
||||||
|
parentAssignJobToKid,
|
||||||
|
socketMsgReceived,
|
||||||
|
// room,
|
||||||
|
// setRoom,
|
||||||
|
// message,
|
||||||
|
// setMessage,
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<SocketIOContext.Provider value={values}>
|
||||||
|
{children}
|
||||||
|
</SocketIOContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const SocketValues = () => {
|
||||||
|
return useContext(SocketIOContext)
|
||||||
|
}
|
||||||
@@ -1,16 +1,11 @@
|
|||||||
import React, { Suspense, useMemo, useState } from "react";
|
import React, { Suspense } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import usersService from "../../services/UsersService";
|
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
||||||
import Layout from "../Partials/Layout";
|
import Layout from "../Partials/Layout";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import FamilyTableNew from "./FamilyTableNew";
|
import FamilyTableNew from "./FamilyTableNew";
|
||||||
|
|
||||||
export default function FamilyActivities() {
|
export default function FamilyActivities() {
|
||||||
const [familyList, setFamilyList] = useState({});
|
|
||||||
const [loader, setLoader] = useState(false);
|
|
||||||
|
|
||||||
const apiCall = useMemo(() => new usersService(), []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
{/*<CommonHead />*/}
|
{/*<CommonHead />*/}
|
||||||
@@ -19,11 +14,26 @@ export default function FamilyActivities() {
|
|||||||
{/* 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">
|
<CustomBreadcrumb
|
||||||
<span className={``}>Tasks & Chores</span>
|
title={"Tasks & Chores"}
|
||||||
</h1>
|
breadcrumb={[
|
||||||
|
{ link: "/", title: "Home" },
|
||||||
|
{
|
||||||
|
link: "/acc-family",
|
||||||
|
title: "Family Account",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
link: "/acc-family/activities",
|
||||||
|
title: "Tasks & Chores",
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Link className="flex items-center gap-2" to="/acc-family">
|
<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
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
fill="none"
|
fill="none"
|
||||||
@@ -43,11 +53,7 @@ export default function FamilyActivities() {
|
|||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<Suspense fallback={<LoadingSpinner color="sky-blue" size="16" />}>
|
<Suspense fallback={<LoadingSpinner color="sky-blue" size="16" />}>
|
||||||
<FamilyTableNew
|
<FamilyTableNew />
|
||||||
familyList={familyList?.result_list}
|
|
||||||
loader={loader}
|
|
||||||
imageServer={familyList?.session_image_server}
|
|
||||||
/>
|
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ export default function FamilyManageTabs({
|
|||||||
familyData={details.familyWaitList.data}
|
familyData={details.familyWaitList.data}
|
||||||
accountDetails={accountDetails}
|
accountDetails={accountDetails}
|
||||||
loader={details.familyWaitList.loading}
|
loader={details.familyWaitList.loading}
|
||||||
|
setUpdatePage={setUpdatePage}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
Pending: (
|
Pending: (
|
||||||
|
|||||||
@@ -4,39 +4,29 @@ import MyOffersFamilyTable from '../MyTasks/MyOffersFamilyTable'
|
|||||||
import LoadingSpinner from '../Spinners/LoadingSpinner';
|
import LoadingSpinner from '../Spinners/LoadingSpinner';
|
||||||
import usersService from '../../services/UsersService';
|
import usersService from '../../services/UsersService';
|
||||||
import CustomBreadcrumb from '../Breadcrumb/CustomBreadcrumb';
|
import CustomBreadcrumb from '../Breadcrumb/CustomBreadcrumb';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
export default function FamilyPendingOffer() {
|
export default function FamilyPendingOffer() {
|
||||||
const userApi = new usersService();
|
const userApi = new usersService();
|
||||||
|
|
||||||
|
const {familyOfferList} = useSelector((state) => state.tableReload)
|
||||||
|
|
||||||
const [myOffersList, setMyOffersList] = useState({loading: true, data: []});
|
const [myOffersList, setMyOffersList] = useState({loading: true, data: []});
|
||||||
|
|
||||||
const getMyOffersList = async () => {
|
const getMyOffersList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await userApi.getOffersList();
|
const res = await userApi.getOffersList();
|
||||||
setMyOffersList({loading:false, data:res.data});
|
setMyOffersList({loading:false, data:res.data});
|
||||||
console.log('SAME', res.data)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setMyOffersList({loading:false, data:[]});
|
setMyOffersList({loading:false, data:[]});
|
||||||
console.log("Error getting offers", error);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
getMyOffersList()
|
getMyOffersList()
|
||||||
},[])
|
},[familyOfferList])
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<div className="mb-5">
|
|
||||||
<CustomBreadcrumb
|
|
||||||
title = {'Ready to Start'}
|
|
||||||
breadcrumb={
|
|
||||||
[
|
|
||||||
{ link: "/", title: "Home" },
|
|
||||||
{ link: "/pending", title: "Pending", active: true},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{myOffersList.loading ?
|
{myOffersList.loading ?
|
||||||
<div className='w-full flex justify-center items-center rounded-2xl bg-white'>
|
<div className='w-full flex justify-center items-center rounded-2xl bg-white'>
|
||||||
<LoadingSpinner size='10' color='sky-blue' height='h-[20rem]' />
|
<LoadingSpinner size='10' color='sky-blue' height='h-[20rem]' />
|
||||||
@@ -49,9 +39,22 @@ export default function FamilyPendingOffer() {
|
|||||||
className="mb-10"
|
className="mb-10"
|
||||||
/>
|
/>
|
||||||
:
|
:
|
||||||
|
<>
|
||||||
|
<div className="mb-6">
|
||||||
|
<CustomBreadcrumb
|
||||||
|
title = {'Ready to Start'}
|
||||||
|
breadcrumb={
|
||||||
|
[
|
||||||
|
{ link: "/", title: "Home" },
|
||||||
|
{ link: "/pending", title: "Pending", active: true},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<div className='w-full h-[30rem] bg-white dark:bg-dark-white flex justify-center items-center rounded-2xl'>
|
<div className='w-full h-[30rem] bg-white dark:bg-dark-white flex justify-center items-center rounded-2xl'>
|
||||||
<p className='text-black dark:text-white'>No Record Found!</p>
|
<p className='text-black dark:text-white'>No Record Found!</p>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
</Layout>
|
</Layout>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,15 +1,16 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
import usersService from "../../../services/UsersService";
|
import usersService from "../../../services/UsersService";
|
||||||
|
import { tableReload } from "../../../store/TableReloads";
|
||||||
import ModalCom from "../../Helpers/ModalCom";
|
import ModalCom from "../../Helpers/ModalCom";
|
||||||
import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||||
import Detail from "../../jobPopout/popoutcomponent/Detail";
|
import Detail from "../../jobPopout/popoutcomponent/Detail";
|
||||||
import { NewTasks } from "./forms";
|
import { NewTasks } from "./forms";
|
||||||
import { tableReload } from "../../../store/TableReloads";
|
import { SocketValues } from "../../Contexts/SocketIOContext";
|
||||||
import { useDispatch } from "react-redux";
|
|
||||||
|
|
||||||
const AssignTaskPopout = React.memo(
|
const AssignTaskPopout = ({
|
||||||
({
|
|
||||||
action,
|
action,
|
||||||
details,
|
details,
|
||||||
situation,
|
situation,
|
||||||
@@ -17,11 +18,32 @@ const AssignTaskPopout = React.memo(
|
|||||||
familyTask,
|
familyTask,
|
||||||
activeTask,
|
activeTask,
|
||||||
setActiveTask,
|
setActiveTask,
|
||||||
setUpdatePage
|
setUpdatePage,
|
||||||
}) => {
|
assignTaskChecker,
|
||||||
const apiCall = new usersService();
|
|
||||||
|
|
||||||
const dispatch = useDispatch()
|
}) => {
|
||||||
|
const {parentAssignJobToKid} = SocketValues()
|
||||||
|
const apiCall = new usersService();
|
||||||
|
let { pathname, state } = useLocation();
|
||||||
|
|
||||||
|
const {userDetails} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||||
|
|
||||||
|
const [selectedFamilyUid, setSelectedFamilyUid] = useState('');
|
||||||
|
|
||||||
|
const handleFamChange = (event) => {
|
||||||
|
setSelectedFamilyUid(event.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
|
const getFamilySession = JSON.parse(sessionStorage.getItem("family_list"));
|
||||||
|
|
||||||
|
const familyList = getFamilySession?.map((member) => (
|
||||||
|
<option key={member?.family_uid} value={member?.family_uid}>
|
||||||
|
{member?.firstname} {member?.lastname}
|
||||||
|
</option>
|
||||||
|
));
|
||||||
|
|
||||||
let [requestStatus, setRequestStatus] = useState({
|
let [requestStatus, setRequestStatus] = useState({
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -56,6 +78,14 @@ const AssignTaskPopout = React.memo(
|
|||||||
|
|
||||||
const assignFamilyTask = () => {
|
const assignFamilyTask = () => {
|
||||||
setRequestStatus({ loading: true, status: false, message: "" });
|
setRequestStatus({ loading: true, status: false, message: "" });
|
||||||
|
|
||||||
|
if(!selectedFamilyUid){ // If no family found, throw error
|
||||||
|
setRequestStatus({ loading: false, status: false, message: "Please Select Family Member" });
|
||||||
|
return setTimeout(() => {
|
||||||
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
let reqData = {};
|
let reqData = {};
|
||||||
if (taskType == "select") {
|
if (taskType == "select") {
|
||||||
// RUNS HERE IF TASK TYPE IS SELECT
|
// RUNS HERE IF TASK TYPE IS SELECT
|
||||||
@@ -73,7 +103,9 @@ const AssignTaskPopout = React.memo(
|
|||||||
// API PAYLOADS
|
// API PAYLOADS
|
||||||
job_id: activeTask.data?.job_id,
|
job_id: activeTask.data?.job_id,
|
||||||
job_uid: activeTask.data?.job_uid,
|
job_uid: activeTask.data?.job_uid,
|
||||||
family_uid: familyDetailsData?.uid || details?.family_uid,
|
family_uid: selectedFamilyUid
|
||||||
|
? selectedFamilyUid
|
||||||
|
: familyDetailsData?.uid || details?.family_uid,
|
||||||
job_description: activeTask.data?.description,
|
job_description: activeTask.data?.description,
|
||||||
assign_mode: 110011,
|
assign_mode: 110011,
|
||||||
};
|
};
|
||||||
@@ -96,7 +128,7 @@ const AssignTaskPopout = React.memo(
|
|||||||
// category,
|
// category,
|
||||||
currency: country,
|
currency: country,
|
||||||
description,
|
description,
|
||||||
'job detail':job_detail,
|
"job detail": job_detail,
|
||||||
price,
|
price,
|
||||||
timeline: timeline_days,
|
timeline: timeline_days,
|
||||||
title,
|
title,
|
||||||
@@ -108,7 +140,9 @@ const AssignTaskPopout = React.memo(
|
|||||||
setRequestStatus({
|
setRequestStatus({
|
||||||
loading: false,
|
loading: false,
|
||||||
status: false,
|
status: false,
|
||||||
message: `${field[0].toUpperCase()+field.slice(1).toLowerCase()} is empty`,
|
message: `${
|
||||||
|
field[0].toUpperCase() + field.slice(1).toLowerCase()
|
||||||
|
} is empty`,
|
||||||
});
|
});
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
setRequestStatus({ loading: false, status: false, message: "" });
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
@@ -126,7 +160,9 @@ const AssignTaskPopout = React.memo(
|
|||||||
timeline_days,
|
timeline_days,
|
||||||
title,
|
title,
|
||||||
assign_mode: 110055,
|
assign_mode: 110055,
|
||||||
family_uid: details?.family_uid || familyDetailsData?.uid,
|
family_uid: selectedFamilyUid
|
||||||
|
? selectedFamilyUid
|
||||||
|
: familyDetailsData?.uid || details?.family_uid,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,21 +175,38 @@ const AssignTaskPopout = React.memo(
|
|||||||
status: false,
|
status: false,
|
||||||
message: "failed to assign task",
|
message: "failed to assign task",
|
||||||
});
|
});
|
||||||
|
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
setRequestStatus({ loading: false, status: false, message: "" });
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
if (res.status === 200) {
|
||||||
|
|
||||||
setRequestStatus({
|
setRequestStatus({
|
||||||
loading: false,
|
loading: false,
|
||||||
status: true,
|
status: true,
|
||||||
message: "action successful",
|
message: "action successful",
|
||||||
});
|
});
|
||||||
setUpdatePage(prev => !prev) // Updates family task page by calling the useeffect hook
|
|
||||||
|
setUpdatePage(prev => !prev); // Updates family task page by calling the useeffect hook
|
||||||
|
|
||||||
dispatch(tableReload({ type: "WALLETTABLE" })); // RELOADS USER WALLET
|
dispatch(tableReload({ type: "WALLETTABLE" })); // RELOADS USER WALLET
|
||||||
|
|
||||||
|
//SENDS MESSAGE TO SOCKET TO UPDATE CHILD ACCOUNT
|
||||||
|
// message, room
|
||||||
|
let socketMsg = {
|
||||||
|
"audience": "MEMBER",
|
||||||
|
"action": "REFRESH_OFFER",
|
||||||
|
"family_uid": reqData.family_uid,
|
||||||
|
}
|
||||||
|
let socketRoom = `FAMILY-${userDetails.uid}`
|
||||||
|
parentAssignJobToKid(socketMsg, socketRoom) //SENDS MESSAGE TO SOCKET TO UPDATE CHILD ACCOUNT
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setRequestStatus({ loading: false, status: false, message: "" });
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
action(); // FUNCTION THAT CLOSES THE MODAL BOX
|
action(); // FUNCTION THAT CLOSES THE MODAL BOX
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
setRequestStatus({
|
setRequestStatus({
|
||||||
@@ -161,27 +214,56 @@ const AssignTaskPopout = React.memo(
|
|||||||
status: false,
|
status: false,
|
||||||
message: "An Error occured, try again",
|
message: "An Error occured, try again",
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setRequestStatus({ loading: false, status: false, message: "" });
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
}, 5000);
|
}, 5000);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(()=>{ // effect to update family UID when components mounts
|
||||||
|
if(familyDetailsData?.uid){
|
||||||
|
setSelectedFamilyUid(familyDetailsData?.uid)
|
||||||
|
}else if(details?.family_uid){
|
||||||
|
setSelectedFamilyUid(details?.family_uid)
|
||||||
|
}else{
|
||||||
|
setSelectedFamilyUid('')
|
||||||
|
}
|
||||||
|
},[])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ModalCom
|
<ModalCom action={action} situation={situation}>
|
||||||
action={action}
|
|
||||||
situation={situation}
|
|
||||||
>
|
|
||||||
<div className="w-11/12 lg:w-[700px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
<div className="w-11/12 lg:w-[700px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||||
<div className="w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
|
<div className="w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] bg-sky-blue/50 border-b dark:border-[#5356fb29] border-light-purple">
|
||||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide flex items-center">
|
||||||
Assign task to{" "}
|
{details ? (
|
||||||
{familyDetailsData?.firstname || details?.firstName}
|
` Assign ${details?.firstname}'s Task`
|
||||||
|
) : familyDetailsData ? (
|
||||||
|
` Assign ${familyDetailsData.firstname}'s Task`
|
||||||
|
) : (
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span className="text-black">Assign task to{" "}</span>
|
||||||
|
<div className="w-[270px] h-[40px] flex items-center relative after:absolute after:content-['▼'] active:after:rotate-180 after:transition-all after:duration-300 after:z-20 after:right-2 after:top-1/2 after:-translate-y-1/2 after:text-white after:text-lg">
|
||||||
|
<select
|
||||||
|
name=""
|
||||||
|
id=""
|
||||||
|
className="relative z-10 appearance-none text-lg text-white px-2 tracking-wide font-semibold transition-all cursor-pointer bg-blue-900 focus:outline-none border border-gray-200 rounded-full w-full h-full"
|
||||||
|
onChange={handleFamChange}
|
||||||
|
value={selectedFamilyUid}
|
||||||
|
>
|
||||||
|
<option value="" className="">
|
||||||
|
Select a kid
|
||||||
|
</option>
|
||||||
|
{familyList}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</h1>
|
</h1>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="text-[#374557] dark:text-red-500"
|
className="text-[#000] dark:text-red-500"
|
||||||
onClick={action}
|
onClick={action}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@@ -249,9 +331,7 @@ const AssignTaskPopout = React.memo(
|
|||||||
<div
|
<div
|
||||||
key={item.job_uid}
|
key={item.job_uid}
|
||||||
className="mb-2 flex justify-start items-center gap-2 text-sky-blue text-base cursor-pointer"
|
className="mb-2 flex justify-start items-center gap-2 text-sky-blue text-base cursor-pointer"
|
||||||
onClick={() =>
|
onClick={() => handleActiveTask(item.job_uid, item)}
|
||||||
handleActiveTask(item.job_uid, item)
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -304,7 +384,7 @@ const AssignTaskPopout = React.memo(
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<div className="my-3 w-full flex items-center gap-1">
|
<div className="my-3 w-full flex items-center gap-1">
|
||||||
<label className="text-slate-900 dark:text-white tracking-wide font-semibold">
|
<label className="job-label">
|
||||||
Price
|
Price
|
||||||
</label>
|
</label>
|
||||||
<p className="p-1 text-sm text-slate-900 dark:text-white">
|
<p className="p-1 text-sm text-slate-900 dark:text-white">
|
||||||
@@ -317,22 +397,23 @@ const AssignTaskPopout = React.memo(
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="my-3 w-full flex items-center gap-1">
|
<div className="my-3 w-full flex items-center gap-1">
|
||||||
<label className="text-slate-900 dark:text-white tracking-wide font-semibold">
|
<label className="job-label">
|
||||||
Timeline
|
Timeline
|
||||||
</label>
|
</label>
|
||||||
<p className="p-1 text-sm text-slate-900 dark:text-white">{`${activeTask?.data?.timeline_days} day(s)`}</p>
|
<p className="p-1 text-sm text-slate-900 dark:text-white">{`${activeTask?.data?.timeline_days} day(s)`}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="my-3 sm:flex items-center">
|
{/* Dummy, no value found for created! thus commented*/}
|
||||||
|
{/* <div className="my-3 sm:flex items-center">
|
||||||
<Detail
|
<Detail
|
||||||
label="Created"
|
label="Created"
|
||||||
value={`Dummy, no value found for created!`}
|
value={`Dummy, no value found for created!`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<div className="my-3">
|
<div className="my-3">
|
||||||
<label className="w-full text-slate-900 dark:text-white tracking-wide font-semibold">
|
<label className="w-full job-label">
|
||||||
Delivery Detail
|
Delivery Detail
|
||||||
</label>
|
</label>
|
||||||
<textarea
|
<textarea
|
||||||
@@ -376,7 +457,7 @@ const AssignTaskPopout = React.memo(
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* End of error or success display */}
|
{/* End of error or success display */}
|
||||||
<div className="w-auto h-auto flex items-center gap-3">
|
<div className="w-auto h-auto flex items-center gap-20">
|
||||||
<button
|
<button
|
||||||
disabled={requestStatus.loading}
|
disabled={requestStatus.loading}
|
||||||
onClick={action}
|
onClick={action}
|
||||||
@@ -388,7 +469,7 @@ const AssignTaskPopout = React.memo(
|
|||||||
<div className="">
|
<div className="">
|
||||||
{requestStatus.loading ? (
|
{requestStatus.loading ? (
|
||||||
<LoadingSpinner color="sky-blue" size="8" />
|
<LoadingSpinner color="sky-blue" size="8" />
|
||||||
) : taskType == "select" ? (
|
) : (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
disabled={requestStatus.loading}
|
disabled={requestStatus.loading}
|
||||||
@@ -397,18 +478,22 @@ const AssignTaskPopout = React.memo(
|
|||||||
>
|
>
|
||||||
Assign
|
Assign
|
||||||
</button>
|
</button>
|
||||||
) : (
|
)
|
||||||
<button
|
// : (
|
||||||
type="button"
|
// <button
|
||||||
disabled={requestStatus.loading}
|
// type="button"
|
||||||
onClick={assignFamilyTask}
|
// disabled={requestStatus.loading}
|
||||||
className="px-1 w-40 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white cursor-pointer"
|
// onClick={assignFamilyTask}
|
||||||
>
|
// className="px-1 w-40 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white cursor-pointer"
|
||||||
{`Assign to ${
|
// >
|
||||||
familyDetailsData?.firstname || details?.firstName
|
// {details
|
||||||
}`}
|
// ? `Assign task to ${details?.firstname}`
|
||||||
</button>
|
// : familyDetailsData
|
||||||
)}
|
// ? `Assign task to ${familyDetailsData.firstname}`
|
||||||
|
// : "Assign"}
|
||||||
|
// </button>
|
||||||
|
// )
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -418,7 +503,6 @@ const AssignTaskPopout = React.memo(
|
|||||||
</ModalCom>
|
</ModalCom>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
);
|
|
||||||
|
|
||||||
export default AssignTaskPopout;
|
export default AssignTaskPopout;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ export default function NewTasks({ formState, setFormState }) {
|
|||||||
<div className="field w-full mb-6 xl:mb-0">
|
<div className="field w-full mb-6 xl:mb-0">
|
||||||
<label
|
<label
|
||||||
htmlFor="country"
|
htmlFor="country"
|
||||||
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex item-center gap-1"
|
className="job-label"
|
||||||
>
|
>
|
||||||
Currency
|
Currency
|
||||||
{/* {props.errors.country && props.touched.country && <span className="text-[12px] text-red-500">{props.errors.country}</span>} */}
|
{/* {props.errors.country && props.touched.country && <span className="text-[12px] text-red-500">{props.errors.country}</span>} */}
|
||||||
@@ -98,10 +98,11 @@ export default function NewTasks({ formState, setFormState }) {
|
|||||||
|
|
||||||
{/* Price */}
|
{/* Price */}
|
||||||
<div className="field w-full">
|
<div className="field w-full">
|
||||||
|
<label htmlFor="price" className="job-label">Price</label>
|
||||||
<InputCom
|
<InputCom
|
||||||
fieldClass="px-6 text-right"
|
fieldClass="px-6 text-right"
|
||||||
label="Price"
|
// label="Price"
|
||||||
labelClass="tracking-wide"
|
// labelClass="tracking-wide"
|
||||||
inputBg="bg-slate-100"
|
inputBg="bg-slate-100"
|
||||||
type="number"
|
type="number"
|
||||||
name="price"
|
name="price"
|
||||||
@@ -117,7 +118,7 @@ export default function NewTasks({ formState, setFormState }) {
|
|||||||
<div className="field w-full mb-6 xl:mb-0">
|
<div className="field w-full mb-6 xl:mb-0">
|
||||||
<label
|
<label
|
||||||
htmlFor="timeline_days"
|
htmlFor="timeline_days"
|
||||||
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex item-center gap-1"
|
className="job-label"
|
||||||
>
|
>
|
||||||
Timeline
|
Timeline
|
||||||
{/* {props.errors.country && props.touched.country && <span className="text-[12px] text-red-500">{props.errors.country}</span>} */}
|
{/* {props.errors.country && props.touched.country && <span className="text-[12px] text-red-500">{props.errors.country}</span>} */}
|
||||||
@@ -151,10 +152,11 @@ export default function NewTasks({ formState, setFormState }) {
|
|||||||
|
|
||||||
{/* Title */}
|
{/* Title */}
|
||||||
<div className="field w-full mb-[5px]">
|
<div className="field w-full mb-[5px]">
|
||||||
|
<label htmlFor="title" className="job-label">Title</label>
|
||||||
<InputCom
|
<InputCom
|
||||||
fieldClass="px-6"
|
fieldClass="px-6"
|
||||||
label="Title"
|
// label="Title"
|
||||||
labelClass="tracking-wide"
|
// labelClass="tracking-wide"
|
||||||
inputBg="bg-slate-100"
|
inputBg="bg-slate-100"
|
||||||
type="text"
|
type="text"
|
||||||
name="title"
|
name="title"
|
||||||
@@ -167,10 +169,11 @@ export default function NewTasks({ formState, setFormState }) {
|
|||||||
|
|
||||||
{/* Description */}
|
{/* Description */}
|
||||||
<div className="field w-full mb-[5px]">
|
<div className="field w-full mb-[5px]">
|
||||||
|
<label htmlFor="description" className="job-label">Description</label>
|
||||||
<InputCom
|
<InputCom
|
||||||
fieldClass="px-6"
|
fieldClass="px-6"
|
||||||
label="Description"
|
// label="Description"
|
||||||
labelClass="tracking-wide"
|
// labelClass="tracking-wide"
|
||||||
inputBg="bg-slate-100"
|
inputBg="bg-slate-100"
|
||||||
type="text"
|
type="text"
|
||||||
name="description"
|
name="description"
|
||||||
@@ -186,7 +189,7 @@ export default function NewTasks({ formState, setFormState }) {
|
|||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<label
|
<label
|
||||||
htmlFor="Job Delivery Details"
|
htmlFor="Job Delivery Details"
|
||||||
className='className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1'
|
className='job-label'
|
||||||
>
|
>
|
||||||
Job Delivery Details
|
Job Delivery Details
|
||||||
{/* {props.errors.job_detail && props.touched.job_detail && <span className="text-[12px] text-red-500">{props.errors.job_detail}</span>} */}
|
{/* {props.errors.job_detail && props.touched.job_detail && <span className="text-[12px] text-red-500">{props.errors.job_detail}</span>} */}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { Link, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
|
import CustomBreadcrumb from "../../Breadcrumb/CustomBreadcrumb";
|
||||||
import Icons from "../../Helpers/Icons";
|
import Icons from "../../Helpers/Icons";
|
||||||
import Layout from "../../Partials/Layout";
|
import Layout from "../../Partials/Layout";
|
||||||
import { AddFamily, FamilyBanner, Relatives } from "./Tabs";
|
import { AddFamily, FamilyBanner, Relatives } from "./Tabs";
|
||||||
|
|
||||||
const FamilySettings = () => {
|
const FamilySettings = () => {
|
||||||
let {state} = useLocation()
|
let { state } = useLocation();
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
@@ -58,15 +59,42 @@ const FamilySettings = () => {
|
|||||||
{/* 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">
|
<CustomBreadcrumb
|
||||||
<span className={``}>Family Settings</span>
|
title={"Family Settings"}
|
||||||
</h1>
|
breadcrumb={[
|
||||||
|
{ link: "/", title: "Home" },
|
||||||
|
{
|
||||||
|
link: "/acc-family",
|
||||||
|
title: "Family Account",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
link: "/familysettings",
|
||||||
|
title: "Family Settings",
|
||||||
|
active: true,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Link to="/acc-family" className="flex gap-2 items-center text-dark-gray dark:text-white">
|
<Link
|
||||||
<svg className="w-5 h-5 rtl:rotate-180" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth="1.5" stroke="currentColor">
|
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%)]"
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" d="M6.75 15.75L3 12m0 0l3.75-3.75M3 12h18" />
|
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>
|
</svg>
|
||||||
Family
|
|
||||||
|
<span>Family</span>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,27 @@
|
|||||||
import React, {
|
import React, { Suspense, lazy, useEffect, useMemo, useState } from "react";
|
||||||
Suspense,
|
import { useLocation } from "react-router-dom";
|
||||||
lazy,
|
import { apiConst } from "../../lib/apiConst";
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from "react";
|
|
||||||
import { useReactToPrint } from "react-to-print";
|
|
||||||
import localImgLoad from "../../lib/localImgLoad";
|
|
||||||
import usersService from "../../services/UsersService";
|
import usersService from "../../services/UsersService";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import AssignTaskPopout from "./FamilyPopout/AssignTaskPopout";
|
import AssignTaskPopout from "./FamilyPopout/AssignTaskPopout";
|
||||||
import FamilyWallet from "./Tabs/FamilyWallet";
|
|
||||||
import { apiConst } from "../../lib/apiConst";
|
|
||||||
|
|
||||||
// Lazy Imports for components
|
// Lazy Imports for components
|
||||||
const FamilyWaitlist = lazy(() => import("./Tabs/FamilyWaitlist"));
|
const FamilyWaitlist = lazy(() => import("./Tabs/FamilyNewWaitlist"));
|
||||||
const FamilyAccount = lazy(() => import("./Tabs/FamilyAccount"));
|
const FamilyTasks = lazy(() => import("./Tabs/FamilyNewTasks"));
|
||||||
const FamilyProfile = lazy(() => import("./Tabs/FamilyProfile"));
|
const FamilyPending = lazy(() => import("./Tabs/FamilyNewPending"));
|
||||||
const FamilyTasks = lazy(() => import("./Tabs/FamilyTasks"));
|
|
||||||
const FamilyPending = lazy(() => import("./Tabs/FamilyPending"));
|
export default function FamilyTableNew() {
|
||||||
|
let { pathname } = useLocation();
|
||||||
|
|
||||||
export default function FamilyTableNew({
|
|
||||||
className,
|
|
||||||
accountDetails,
|
|
||||||
listReload,
|
|
||||||
loader,
|
|
||||||
}) {
|
|
||||||
// Initial state for family details
|
// Initial state for family details
|
||||||
const initialDetailState = {
|
const initialDetailState = {
|
||||||
loading: false,
|
loading: false,
|
||||||
data: null,
|
data: null,
|
||||||
|
link: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [assignTaskChecker, setAssignTaskChecker] = useState(false);
|
||||||
|
|
||||||
// console.log('accountDetails',accountDetails)
|
// console.log('accountDetails',accountDetails)
|
||||||
// State for family details, tasks, waitlist, and pending
|
// State for family details, tasks, waitlist, and pending
|
||||||
const [details, setDetails] = useState({
|
const [details, setDetails] = useState({
|
||||||
@@ -51,7 +41,7 @@ import React, {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const [updatePage, setUpdatePage] = useState(false) // State to determine when to update the page
|
const [updatePage, setUpdatePage] = useState(false); // State to determine when to update the page
|
||||||
|
|
||||||
// State for family task data
|
// State for family task data
|
||||||
const [familyTask, setFamilyTask] = useState({ loading: false, data: [] });
|
const [familyTask, setFamilyTask] = useState({ loading: false, data: [] });
|
||||||
@@ -73,15 +63,6 @@ import React, {
|
|||||||
setFamilyTaskPopout((prev) => !prev);
|
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
|
// Array of tab names
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{ id: 1, name: "Tasks" },
|
{ id: 1, name: "Tasks" },
|
||||||
@@ -101,47 +82,31 @@ import React, {
|
|||||||
const tabComponents = {
|
const tabComponents = {
|
||||||
Tasks: (
|
Tasks: (
|
||||||
<FamilyTasks
|
<FamilyTasks
|
||||||
className={className}
|
image_link={details.familyTasks.link}
|
||||||
loader={details.familyTasks.loading}
|
loader={details.familyTasks.loading}
|
||||||
familyData={details.familyTasks.data}
|
familyData={details.familyTasks.data}
|
||||||
accountDetails={accountDetails}
|
action={familyPopUpHandler}
|
||||||
|
setAssignTaskChecker={setAssignTaskChecker}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
Waiting: (
|
Waiting: (
|
||||||
<FamilyWaitlist
|
<FamilyWaitlist
|
||||||
|
image_link={details.familyWaitList.link}
|
||||||
familyData={details.familyWaitList.data}
|
familyData={details.familyWaitList.data}
|
||||||
accountDetails={accountDetails}
|
|
||||||
loader={details.familyWaitList.loading}
|
loader={details.familyWaitList.loading}
|
||||||
|
setUpdatePage={setUpdatePage}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
Pending: (
|
Pending: (
|
||||||
<FamilyPending
|
<FamilyPending
|
||||||
|
image_link={details.familyPending.link}
|
||||||
familyData={details.familyPending.data}
|
familyData={details.familyPending.data}
|
||||||
accountDetails={accountDetails}
|
|
||||||
loader={details.familyPending.loading}
|
loader={details.familyPending.loading}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
Account: (
|
|
||||||
<FamilyAccount
|
|
||||||
familyData={details.familyDetails.data}
|
|
||||||
myRef={accountRef}
|
|
||||||
loader={details.familyDetails.loading}
|
|
||||||
handlePrint={useHandlePrint}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
Profile: <FamilyProfile familyData={details.familyDetails.data} />,
|
|
||||||
wallet: <FamilyWallet familyData={details.familyDetails.data} />,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Default tab component
|
const defaultTabComponent = tabComponents.Tasks;
|
||||||
const defaultTabComponent = (
|
|
||||||
<FamilyTasks
|
|
||||||
className={className}
|
|
||||||
loader={details.familyTasks.loading}
|
|
||||||
familyData={details.familyTasks.data}
|
|
||||||
accountDetails={accountDetails}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
|
|
||||||
// Selected tab component based on the current 'tab'
|
// Selected tab component based on the current 'tab'
|
||||||
const selectedTabComponent = tabComponents[tab] || defaultTabComponent;
|
const selectedTabComponent = tabComponents[tab] || defaultTabComponent;
|
||||||
@@ -153,45 +118,55 @@ import React, {
|
|||||||
resetDetails();
|
resetDetails();
|
||||||
|
|
||||||
setDetails({
|
setDetails({
|
||||||
familyDetails: { loading: true },
|
|
||||||
familyTasks: { loading: true },
|
familyTasks: { loading: true },
|
||||||
familyWaitList: { loading: true },
|
familyWaitList: { loading: true },
|
||||||
familyPending: { loading: true },
|
familyPending: { loading: true },
|
||||||
});
|
});
|
||||||
|
|
||||||
const { family_uid } = accountDetails;
|
// const { family_uid } = accountDetails;
|
||||||
const reqData = { family_uid };
|
// const reqData = { family_uid };
|
||||||
|
|
||||||
const [familyRes, tasksRes, familyWaitRes, familyPending] =
|
const [familyTasksData, familyWaitingRes, familyPendingRes] =
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
apiCall.ManageFamily(reqData),
|
apiCall.getMyActiveJobList(),
|
||||||
apiCall.ManageTasks(reqData),
|
apiCall.ManageFamilyNewWaitlist(),
|
||||||
apiCall.ManageFamilyWaitlist(),
|
|
||||||
apiCall.ManageFamilyPending(),
|
apiCall.ManageFamilyPending(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const familyData = familyRes.data;
|
let tasksData = familyTasksData?.data?.result_list;
|
||||||
const tasksData = tasksRes.data;
|
let _familyWaitData = familyWaitingRes?.data?.result_list;
|
||||||
const familyWaitData = familyWaitRes.data;
|
let familyPendingData = familyPendingRes?.data?.result_list;
|
||||||
const familyPendingData = familyPending.data;
|
|
||||||
|
// Getting the image server link
|
||||||
|
let imageServerLink = familyWaitingRes.data?.session_image_server;
|
||||||
|
|
||||||
// Function to check for errors in data
|
// Function to check for errors in data
|
||||||
const checkDataError = (data) => data?.internal_return < 0;
|
const checkDataError = (data) => data?.internal_return < 0;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
checkDataError(familyData) ||
|
|
||||||
checkDataError(tasksData) ||
|
checkDataError(tasksData) ||
|
||||||
checkDataError(familyWaitData) ||
|
checkDataError(_familyWaitData) ||
|
||||||
checkDataError(familyPendingData)
|
checkDataError(familyPendingData)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setDetails({
|
setDetails({
|
||||||
familyDetails: { loading: false, data: familyData },
|
familyTasks: {
|
||||||
familyTasks: { loading: false, data: tasksData },
|
loading: false,
|
||||||
familyWaitList: { loading: false, data: familyWaitData },
|
data: tasksData,
|
||||||
familyPending: { loading: false, data: familyPendingData },
|
link: imageServerLink,
|
||||||
|
},
|
||||||
|
familyWaitList: {
|
||||||
|
loading: false,
|
||||||
|
data: _familyWaitData,
|
||||||
|
link: imageServerLink,
|
||||||
|
},
|
||||||
|
familyPending: {
|
||||||
|
loading: false,
|
||||||
|
data: familyPendingData,
|
||||||
|
link: imageServerLink,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
resetDetails();
|
resetDetails();
|
||||||
@@ -239,11 +214,11 @@ import React, {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// console.log(updatePage);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={`w-full bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow h-full ${
|
className={`w-full bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow h-full`}
|
||||||
className || ""
|
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<div className="relative w-full sm:rounded-lg overflow-x-auto">
|
<div className="relative w-full sm:rounded-lg overflow-x-auto">
|
||||||
<Suspense
|
<Suspense
|
||||||
@@ -304,11 +279,12 @@ import React, {
|
|||||||
setFamilyTask={setFamilyTask}
|
setFamilyTask={setFamilyTask}
|
||||||
setActiveTask={setActiveTask}
|
setActiveTask={setActiveTask}
|
||||||
activeTask={activeTask}
|
activeTask={activeTask}
|
||||||
familyDetailsData={details.familyDetails.data}
|
|
||||||
setUpdatePage={setUpdatePage}
|
setUpdatePage={setUpdatePage}
|
||||||
|
// updateFamilyPendingTable={updateFamilyPendingTable}
|
||||||
|
pathname={pathname}
|
||||||
|
assignTaskChecker={assignTaskChecker}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
import { useMemo, useState } from "react";
|
||||||
|
import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||||
|
import { PaginatedList, handlePagingFunc } from "../../Pagination";
|
||||||
|
import PendingJobsPopout from "../../jobPopout/PendingJobsPopout";
|
||||||
|
|
||||||
|
export default function FamilyPending({ familyData, image_link, loader }) {
|
||||||
|
let [jobPopout, setJobPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
||||||
|
|
||||||
|
let filteredFamilyData = useMemo(
|
||||||
|
() => familyData?.filter((data) => data.family_uid !== ""),
|
||||||
|
[familyData]
|
||||||
|
);
|
||||||
|
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(image_link);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`update-table w-full p-3 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow lg:min-h-[538px]`}
|
||||||
|
>
|
||||||
|
{familyData && (
|
||||||
|
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between h-full">
|
||||||
|
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||||
|
<tbody>
|
||||||
|
{
|
||||||
|
<>
|
||||||
|
{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 = `${image_link}${localStorage.getItem(
|
||||||
|
"session_token"
|
||||||
|
)}/job/${value.job_uid}`;
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={index}
|
||||||
|
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||||
|
>
|
||||||
|
<td className=" py-4">
|
||||||
|
<div className="flex space-x-2 items-center w-full">
|
||||||
|
<div className="w-[60px] h-[60px] p-2 bg-alice-blue rounded-full overflow-hidden flex justify-center items-center">
|
||||||
|
<img
|
||||||
|
src={image}
|
||||||
|
alt="data"
|
||||||
|
className="w-full h-full rounded-full"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col flex-[0.9]">
|
||||||
|
<h1 className="font-bold text-xl text-dark-gray dark:text-white">
|
||||||
|
{value.title}
|
||||||
|
</h1>
|
||||||
|
<div>{value.description}</div>
|
||||||
|
<span className="text-sm text-thin-light-gray flex items-start gap-1">
|
||||||
|
Price:{" "}
|
||||||
|
<span className="text-purple">
|
||||||
|
{thePrice}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
|
<span className="text-sm text-thin-light-gray">
|
||||||
|
Duration:{" "}
|
||||||
|
<span className="text-purple">
|
||||||
|
{" "}
|
||||||
|
{value.timeline_days} day(s)
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="text-sm text-thin-light-gray">
|
||||||
|
Expire:{" "}
|
||||||
|
<span className="text-purple">
|
||||||
|
{" "}
|
||||||
|
{deliveryDate}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="text-sm text-thin-light-gray">
|
||||||
|
Sent to:{" "}
|
||||||
|
<span className="text-purple">
|
||||||
|
{" "}
|
||||||
|
{value.job_to}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td className="text-right py-4 px-2 flex justify-end items-center">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
setJobPopout({ show: true, data: value });
|
||||||
|
}}
|
||||||
|
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
) : (
|
||||||
|
<tr>
|
||||||
|
<td className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap text-center py-4 px-2">
|
||||||
|
No Pending Task!
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{/* PAGINATION BUTTON */}
|
||||||
|
<PaginatedList
|
||||||
|
onClick={handlePagination}
|
||||||
|
prev={currentPage == 0}
|
||||||
|
next={currentPage + itemsPerPage >= filteredFamilyData.length}
|
||||||
|
data={filteredFamilyData}
|
||||||
|
start={indexOfFirstItem}
|
||||||
|
stop={indexOfLastItem}
|
||||||
|
/>
|
||||||
|
{/* END OF PAGINATION BUTTON */}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Active Job Popout */}
|
||||||
|
{jobPopout.show && (
|
||||||
|
<PendingJobsPopout
|
||||||
|
details={jobPopout.data}
|
||||||
|
onClose={() => {
|
||||||
|
setJobPopout({ show: false, data: {} });
|
||||||
|
}}
|
||||||
|
situation={jobPopout.show}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{/* End of Active Job Popout */}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,171 @@
|
|||||||
|
import React, { useMemo, useState } from "react";
|
||||||
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
|
import Icons from "../../Helpers/Icons";
|
||||||
|
import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||||
|
import { handlePagingFunc } from "../../Pagination/HandlePagination";
|
||||||
|
import PaginatedList from "../../Pagination/PaginatedList";
|
||||||
|
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||||
|
|
||||||
|
export default function FamilyNewTasks({
|
||||||
|
familyData,
|
||||||
|
className,
|
||||||
|
loader,
|
||||||
|
action,
|
||||||
|
image_link,
|
||||||
|
}) {
|
||||||
|
let navigate = useNavigate();
|
||||||
|
let { pathname } = useLocation();
|
||||||
|
|
||||||
|
// ...
|
||||||
|
let filteredFamilyData = useMemo(
|
||||||
|
() => familyData?.filter((data) => data.family_uid !== ""),
|
||||||
|
[familyData]
|
||||||
|
);
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
|
const indexOfFirstItem = Number(currentPage);
|
||||||
|
const indexOfLastItem =
|
||||||
|
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||||
|
const currentTasks = filteredFamilyData?.slice(
|
||||||
|
indexOfFirstItem,
|
||||||
|
indexOfLastItem
|
||||||
|
);
|
||||||
|
|
||||||
|
const handlePagination = (e) => handlePagingFunc(e, setCurrentPage);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`update-table w-full bg-white dark:bg-dark-white h-full lg:min-h-[538px] overflow-hidden rounded-2xl section-shadow p-3 ${
|
||||||
|
familyData?.length <= 0 && "flex items-center justify-center"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{loader ? (
|
||||||
|
<div className="w-full h-full flex justify-center items-center lg:min-h-[470px]">
|
||||||
|
<LoadingSpinner size={16} color="sky-blue" />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{familyData && (
|
||||||
|
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between h-full">
|
||||||
|
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||||
|
<tbody>
|
||||||
|
{
|
||||||
|
<>
|
||||||
|
{familyData?.length <= 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td
|
||||||
|
colSpan="2"
|
||||||
|
className="text-center py-4 font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap flex items-center justify-center gap-1"
|
||||||
|
>
|
||||||
|
You currently have no active tasks{" "}
|
||||||
|
<span
|
||||||
|
className="text-blue-400 cursor-pointer hover:underline transition duration-150"
|
||||||
|
onClick={action}
|
||||||
|
>
|
||||||
|
add new
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
currentTasks.map((value, index) => {
|
||||||
|
// find due date
|
||||||
|
const dueDate = value?.delivery_date.split(" ")[0];
|
||||||
|
// the price
|
||||||
|
let thePrice = PriceFormatter(
|
||||||
|
value?.price * 0.01,
|
||||||
|
value?.currency_code,
|
||||||
|
value?.currency
|
||||||
|
);
|
||||||
|
let image = `${image_link}${localStorage.getItem(
|
||||||
|
"session_token"
|
||||||
|
)}/job/${value.job_uid}`;
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={index}
|
||||||
|
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||||
|
>
|
||||||
|
<td className=" py-4">
|
||||||
|
<div className="flex space-x-2 items-center w-full">
|
||||||
|
<div className="w-[60px] h-[60px] p-2 bg-alice-blue rounded-full overflow-hidden flex justify-center items-center">
|
||||||
|
<img
|
||||||
|
src={image}
|
||||||
|
alt="data"
|
||||||
|
className="w-full h-full rounded-full"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col flex-[0.9]">
|
||||||
|
<h1 className="font-bold text-xl text-dark-gray dark:text-white">
|
||||||
|
{value.title}
|
||||||
|
</h1>
|
||||||
|
<div className="flex flex-col sm:flex-row items-start gap-1 md:gap-4 md:items-center">
|
||||||
|
<span className="text-sm text-thin-light-gray flex flex-start gap-1">
|
||||||
|
Price:{" "}
|
||||||
|
<span className="text-purple">
|
||||||
|
{thePrice}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="text-sm text-thin-light-gray">
|
||||||
|
Duration:{" "}
|
||||||
|
<span className="text-purple">
|
||||||
|
{" "}
|
||||||
|
{value.timeline_days} day(s)
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<span className="text-sm text-thin-light-gray">
|
||||||
|
Due Date:{" "}
|
||||||
|
<span className="text-purple">
|
||||||
|
{" "}
|
||||||
|
{dueDate}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td className="text-right py-4 px-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
navigate("/manage-active-job", {
|
||||||
|
state: {
|
||||||
|
...value,
|
||||||
|
pathname,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
<Icons name="right-arrow" />
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{/* PAGINATION BUTTON */}
|
||||||
|
<PaginatedList
|
||||||
|
onClick={handlePagination}
|
||||||
|
prev={currentPage == 0 ? true : false}
|
||||||
|
next={
|
||||||
|
currentPage + Number(process.env.REACT_APP_ITEM_PER_PAGE) >=
|
||||||
|
filteredFamilyData?.length
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
data={filteredFamilyData}
|
||||||
|
start={indexOfFirstItem}
|
||||||
|
stop={indexOfLastItem}
|
||||||
|
/>
|
||||||
|
{/* END OF PAGINATION BUTTON */}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
import { useState } from "react";
|
||||||
|
import SuggestTask from "../../FamilyPopup/SuggestTask";
|
||||||
|
import { PaginatedList, handlePagingFunc } from "../../Pagination";
|
||||||
|
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||||
|
import AssignTaskPopout from "../FamilyPopout/AssignTaskPopout";
|
||||||
|
import Icons from "../../Helpers/Icons";
|
||||||
|
|
||||||
|
const FamilyNewWaitlist = ({
|
||||||
|
familyData,
|
||||||
|
className,
|
||||||
|
accountDetails,
|
||||||
|
loader,
|
||||||
|
setUpdatePage
|
||||||
|
}) => {
|
||||||
|
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?.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: {} });
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log("Check this >>",continueTaskPopup)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`update-table w-full bg-white dark:bg-dark-white h-full lg:min-h-[538px] p-3 overflow-hidden rounded-2xl section-shadow ${
|
||||||
|
className || ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{loader ? (
|
||||||
|
<div className="w-full h-full flex justify-center items-center lg:min-h-[470px]">
|
||||||
|
<LoadingSpinner size={16} color="sky-blue" />
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
{familyData && (
|
||||||
|
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between h-full">
|
||||||
|
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||||
|
<tbody>
|
||||||
|
{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 (
|
||||||
|
<tr
|
||||||
|
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||||
|
key={value.uid}
|
||||||
|
>
|
||||||
|
<td className="py-4">
|
||||||
|
<div className="w-full flex justify-between items-center">
|
||||||
|
<div className="account-name flex space-x-4 items-center">
|
||||||
|
<div className="icon w-14 h-14 flex justify-center items-center">
|
||||||
|
<img
|
||||||
|
src={selectedImage}
|
||||||
|
alt="task_img"
|
||||||
|
className="w-full object-cover"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="">
|
||||||
|
<p className="text-xl font-bold text-dark-gray dark:text-white mb-2 capitalize line-clamp-1">
|
||||||
|
{value.title}
|
||||||
|
</p>
|
||||||
|
<p className="text-sm text-thin-light-gray font-medium">
|
||||||
|
{value.description}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="px-2 flex flex-col items-center justify-center">
|
||||||
|
<p className="text-sm font-bold text-dark-gray dark:text-white">
|
||||||
|
{addedDate}
|
||||||
|
</p>
|
||||||
|
<p className="text-xs py-1.5 w-[70px] cursor-default tracking-wide rounded-full bg-gold text-white flex justify-center items-center">
|
||||||
|
{value.firstname}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="text-right py-4 px-2 flex justify-end">
|
||||||
|
<button
|
||||||
|
onClick={() => openPopUp(value)}
|
||||||
|
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
{/* View */}
|
||||||
|
<Icons name="right-arrow" />
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<PaginatedList
|
||||||
|
onClick={handlePagination}
|
||||||
|
prev={currentPage === 0}
|
||||||
|
next={currentPage + itemsPerPage >= familyData?.length}
|
||||||
|
data={familyData}
|
||||||
|
start={indexOfFirstItem}
|
||||||
|
stop={indexOfLastItem}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{popUp.show && (
|
||||||
|
<SuggestTask
|
||||||
|
details={popUp.data}
|
||||||
|
onClose={closePopUp}
|
||||||
|
continuePopupData={openContinueTaskPopup}
|
||||||
|
situation={popUp.show}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{continueTaskPopup.show && (
|
||||||
|
<AssignTaskPopout
|
||||||
|
details={continueTaskPopup.data}
|
||||||
|
action={closeContinueTaskPopup}
|
||||||
|
situation={continueTaskPopup.show}
|
||||||
|
setUpdatePage={setUpdatePage}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default FamilyNewWaitlist;
|
||||||
@@ -5,7 +5,7 @@ import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
|||||||
import AssignTaskPopout from "../FamilyPopout/AssignTaskPopout";
|
import AssignTaskPopout from "../FamilyPopout/AssignTaskPopout";
|
||||||
|
|
||||||
const FamilyWaitlist = memo(
|
const FamilyWaitlist = memo(
|
||||||
({ familyData, className, accountDetails, loader }) => {
|
({ familyData, className, accountDetails, loader, setUpdatePage }) => {
|
||||||
const [popUp, setPopUp] = useState({ show: false, data: {} });
|
const [popUp, setPopUp] = useState({ show: false, data: {} });
|
||||||
const [continueTaskPopup, setContinueTaskPopup] = useState({
|
const [continueTaskPopup, setContinueTaskPopup] = useState({
|
||||||
show: false,
|
show: false,
|
||||||
@@ -144,6 +144,7 @@ const FamilyWaitlist = memo(
|
|||||||
details={continueTaskPopup.data}
|
details={continueTaskPopup.data}
|
||||||
action={closeContinueTaskPopup}
|
action={closeContinueTaskPopup}
|
||||||
situation={continueTaskPopup.show}
|
situation={continueTaskPopup.show}
|
||||||
|
setUpdatePage={setUpdatePage}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ export default function FamilyAcc() {
|
|||||||
if (data?.internal_return >= 0 && data?.status === "OK") {
|
if (data?.internal_return >= 0 && data?.status === "OK") {
|
||||||
const { result_list, session_image_server } = data;
|
const { result_list, session_image_server } = data;
|
||||||
setFamilyList({ result_list, session_image_server });
|
setFamilyList({ result_list, session_image_server });
|
||||||
|
sessionStorage.setItem("family_list", JSON.stringify(result_list))
|
||||||
setLoader(false);
|
setLoader(false);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -145,7 +146,7 @@ export default function FamilyAcc() {
|
|||||||
breadcrumb={
|
breadcrumb={
|
||||||
[
|
[
|
||||||
{ link: "/", title: "Home" },
|
{ link: "/", title: "Home" },
|
||||||
{ link: "/acc-family", title: "Family-acc", active: true},
|
{ link: "/acc-family", title: "Family Account", active: true},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@@ -164,13 +165,13 @@ export default function FamilyAcc() {
|
|||||||
</h1>
|
</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-2 items-center">
|
<div className="flex gap-4 items-center">
|
||||||
<Link to="/acc-family/activities" className={`nav-item flex items-center `}>
|
<Link state={familyList} to="/acc-family/activities" className={`nav-item flex items-center rounded-md shadow-sm justify-center cursor-pointer dark:bg-[linear-gradient(134.38deg,#f539f8_0%,#c342f9_43.55%,#5356fb_104.51%)] bg-[#76a5df] text-white px-2 gap-2`}>
|
||||||
<span className="item-icon group-hover:bg-purple group-hover:text-white w-8 h-8 flex justify-center items-center transition-all duration-300 ease-in-out bg-light-purple dark:bg-dark-light-purple rounded-full text-dark-gray dark:text-white dark:text-lighter-gray">
|
<span className="item-icon group-hover:bg-purple group-hover:text-white w-8 h-8 flex justify-center items-center transition-all duration-300 ease-in-out bg-light-purple dark:bg-dark-light-purple rounded-full text-dark-gray dark:text-white dark:text-lighter-gray">
|
||||||
<Icons name="pending-job" />
|
<Icons name="pending-job" />
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className={`item-content relative group-hover:text-purple text-[18px] transition-all duration-300 ease-in-out text-lighter-gray font-medium`}
|
className={`item-content relative text-[18px] transition-all duration-300 ease-in-out font-medium dark:text-white h-12 flex items-center`}
|
||||||
>
|
>
|
||||||
Activities
|
Activities
|
||||||
</span>
|
</span>
|
||||||
@@ -178,7 +179,7 @@ export default function FamilyAcc() {
|
|||||||
<Link
|
<Link
|
||||||
to={`/familysettings`}
|
to={`/familysettings`}
|
||||||
state={{ imageServer: familyList?.session_image_server }}
|
state={{ imageServer: familyList?.session_image_server }}
|
||||||
className="slider-btns flex space-x-4 w-12 h-12 rounded-md shadow-sm justify-center items-center cursor-pointer dark:bg-[linear-gradient(134.38deg,#f539f8_0%,#c342f9_43.55%,#5356fb_104.51%)]"
|
className="slider-btns flex space-x-4 w-12 h-12 rounded-md shadow-sm justify-center items-center cursor-pointer dark:bg-[linear-gradient(134.38deg,#f539f8_0%,#c342f9_43.55%,#5356fb_104.51%)] bg-[#76a5df] text-white"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
import { Form, Formik } from "formik";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
import ModalCom from "../Helpers/ModalCom";
|
|
||||||
import { Form, Formik } from "formik";
|
|
||||||
import InputCom from "../Helpers/Inputs/InputCom";
|
|
||||||
import usersService from "../../services/UsersService";
|
import usersService from "../../services/UsersService";
|
||||||
import Icons from "../Helpers/Icons";
|
import InputCom from "../Helpers/Inputs/InputCom";
|
||||||
|
import ModalCom from "../Helpers/ModalCom";
|
||||||
|
|
||||||
const DEFAULT_IMAGE = require("../../assets/images/family/default.jpg");
|
const DEFAULT_IMAGE = require("../../assets/images/family/default.jpg");
|
||||||
const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
||||||
@@ -51,21 +50,47 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleParentSuggestion = (values) => {
|
const handleParentSuggestion = (values) => {
|
||||||
if (suggestedNextStep == "Send Task") {
|
if (suggestedNextStep === "Send Task") {
|
||||||
let firstName = state?.firstname;
|
let firstname = state?.firstname || details?.firstname;
|
||||||
let family_uid = state?.family_uid;
|
let family_uid = state?.family_uid || details?.family_uid;
|
||||||
continuePopupData({ ...details, firstName, family_uid });
|
continuePopupData({
|
||||||
|
...details,
|
||||||
|
firstname,
|
||||||
|
family_uid,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isActivitiesPage = pathname === "/acc-family/activities";
|
||||||
|
const isManageFamilyPage = pathname === "/manage-family";
|
||||||
|
|
||||||
|
const getButtonText = () => {
|
||||||
|
if (isActivitiesPage) {
|
||||||
|
return suggestedNextStep === "Send Task" ? "Continue" : "Complete";
|
||||||
|
} else {
|
||||||
|
if (!isManageFamilyPage) {
|
||||||
|
if (submitTask.loading) return "Submitting Task";
|
||||||
|
if (submitTask.state === "success") return "Task Submitted";
|
||||||
|
if (submitTask.state === "bad") return "An Error Occurred";
|
||||||
|
return "Send to Parents";
|
||||||
|
} else {
|
||||||
|
return suggestedNextStep === "Send Task" ? "Continue" : "Complete";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(details);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalCom action={onClose} situation={situation}>
|
<ModalCom action={onClose} situation={situation}>
|
||||||
<div className="logout-modal-wrapper lw-[90%] md:w-[768px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
<div className="logout-modal-wrapper lw-[90%] md:w-[48rem] h-full lg:h-[627px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||||
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
|
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[1.875rem] py-[1.4375rem] border-b dark:border-[#5356fb29] border-light-purple">
|
||||||
<h1 className="text-base md:text-lg font-bold text-dark-gray dark:text-white tracking-wide">
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||||
{pathname === "/manage-family"
|
{isManageFamilyPage
|
||||||
? `${state?.firstname}'s Suggested Task`
|
? `${state?.firstname}'s Suggested Task`
|
||||||
|
: isActivitiesPage
|
||||||
|
? `${details?.firstname}'s Suggested Task`
|
||||||
: "Suggest to Parent"}
|
: "Suggest to Parent"}
|
||||||
</h1>
|
</h1>
|
||||||
<button
|
<button
|
||||||
@@ -97,19 +122,21 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
<Formik
|
<Formik
|
||||||
initialValues={initialValues}
|
initialValues={initialValues}
|
||||||
onSubmit={
|
onSubmit={
|
||||||
pathname !== "/manage-family"
|
isActivitiesPage
|
||||||
? handleSuggestedTask
|
? handleParentSuggestion
|
||||||
: handleParentSuggestion
|
: isManageFamilyPage
|
||||||
|
? handleParentSuggestion
|
||||||
|
: handleSuggestedTask
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{(props) => {
|
{(props) => {
|
||||||
return (
|
return (
|
||||||
<Form>
|
<Form className="h-[33.875rem] flex flex-col">
|
||||||
<div className="p-5 w-full bg-white rounded-md flex justify-between">
|
<div className="px-5 w-full bg-white rounded-md flex justify-between items-center h-full">
|
||||||
{/* Image Section */}
|
{/* Image Section */}
|
||||||
<div className="p-4 w-full md:w-2/4 md:border-r-2">
|
<div className="p-4 w-full md:w-2/4 md:border-r-2 h-full flex items-center">
|
||||||
<div
|
<div
|
||||||
className="w-full h-[236px] p-6 bg-gray-400 rounded-xl overflow-hidden"
|
className="w-full h-[14.75rem] p-6 bg-gray-400 rounded-xl overflow-hidden"
|
||||||
style={{
|
style={{
|
||||||
background: `url(${selectedImage}) center / contain no-repeat`,
|
background: `url(${selectedImage}) center / contain no-repeat`,
|
||||||
}}
|
}}
|
||||||
@@ -117,17 +144,22 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* ACTION SECTION */}
|
{/* ACTION SECTION */}
|
||||||
<div className="p-4 w-full md:w-2/4 h-full">
|
<div className="p-4 w-full md:w-2/4 h-full flex flex-col justify-between">
|
||||||
{/* Title */}
|
{/* Title */}
|
||||||
<div className="field w-full mb-[15px]">
|
<div className="field w-full mb-[.9375rem]">
|
||||||
<InputCom
|
<InputCom
|
||||||
fieldClass={
|
fieldClass={
|
||||||
pathname === "/manage-family" ? "px-2" : "px-6"
|
pathname === "/manage-family" ||
|
||||||
|
pathname === "/acc-family/activities"
|
||||||
|
? "px-2"
|
||||||
|
: "px-6"
|
||||||
}
|
}
|
||||||
label="Title"
|
label="Title"
|
||||||
|
labalClass="text-[1.125rem]"
|
||||||
labelClass="tracking-wide"
|
labelClass="tracking-wide"
|
||||||
inputBg={
|
inputBg={
|
||||||
pathname === "/manage-family"
|
pathname === "/manage-family" ||
|
||||||
|
pathname === "/acc-family/activities"
|
||||||
? "bg-white"
|
? "bg-white"
|
||||||
: "bg-slate-100"
|
: "bg-slate-100"
|
||||||
}
|
}
|
||||||
@@ -147,15 +179,15 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Description */}
|
{/* Description */}
|
||||||
<div className="field w-full mb-[5px]">
|
<div className="field w-full mb-[.3125rem]">
|
||||||
<label
|
<label
|
||||||
htmlFor="description"
|
htmlFor="description"
|
||||||
className='className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1'
|
className='input-label text-[#181c32] dark:text-white text-[1.125rem] leading-[1.3102rem] font-semibold flex items-center gap-1'
|
||||||
>
|
>
|
||||||
Description
|
Description
|
||||||
{props.errors.description &&
|
{props.errors.description &&
|
||||||
props.touched.description && (
|
props.touched.description && (
|
||||||
<span className="text-[12px] text-red-500">
|
<span className="text-[.75rem] text-red-500">
|
||||||
{props.errors.description}
|
{props.errors.description}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
@@ -164,9 +196,10 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
id="description"
|
id="description"
|
||||||
rows="5"
|
rows="5"
|
||||||
className={`input-field pt-2 placeholder:text-base text-dark-gray dark:text-white w-full ${
|
className={`input-field pt-2 placeholder:text-base text-dark-gray dark:text-white w-full ${
|
||||||
pathname === "/manage-family"
|
pathname === "/manage-family" ||
|
||||||
? "px-2 h-[110px]"
|
pathname === "/acc-family/activities"
|
||||||
: "bg-slate-100 px-3 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px] h-[130px]"
|
? "px-2 h-[6.875rem]"
|
||||||
|
: "bg-slate-100 px-3 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[.625rem] h-[8.125rem]"
|
||||||
}`}
|
}`}
|
||||||
style={{ resize: "none" }}
|
style={{ resize: "none" }}
|
||||||
name="description"
|
name="description"
|
||||||
@@ -177,8 +210,9 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Radio buttons for family */}
|
{/* Radio buttons for family */}
|
||||||
{pathname === "/manage-family" ? (
|
{pathname === "/manage-family" ||
|
||||||
<div className="h-[20px] w-full border-t dark:border-[#5356fb29] border-light-purple relative">
|
pathname === "/acc-family/activities" ? (
|
||||||
|
<div className="h-[3.75rem] w-full border-t dark:border-[#5356fb29] border-light-purple relative">
|
||||||
<div id="my-radio-group" className="sr-only">
|
<div id="my-radio-group" className="sr-only">
|
||||||
Parent suggested next step
|
Parent suggested next step
|
||||||
</div>
|
</div>
|
||||||
@@ -196,7 +230,7 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
role="group"
|
role="group"
|
||||||
key={idx}
|
key={idx}
|
||||||
htmlFor={`parent-suggested-${idx}`}
|
htmlFor={`parent-suggested-${idx}`}
|
||||||
className={`transition duration-150 ease-in-out parent-suggest group cursor-pointer`}
|
className={`transition duration-150 ease-in-out parent-suggest group cursor-pointer flex items-center`}
|
||||||
onClick={() => setSuggestedNextStep(title)}
|
onClick={() => setSuggestedNextStep(title)}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
@@ -205,19 +239,19 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
value={title}
|
value={title}
|
||||||
checked={suggestedNextStep === title}
|
checked={suggestedNextStep === title}
|
||||||
onChange={switchNextStep}
|
onChange={switchNextStep}
|
||||||
className={`transition duration-150 ease-in-out parent-suggest pointer-events-none`}
|
className={`transition duration-150 ease-in-out parent-suggest pointer-events-none w-[1.125rem] h-[1.125rem]`}
|
||||||
/>
|
/>
|
||||||
<span
|
<span
|
||||||
onClick={() => setSuggestedNextStep(title)}
|
onClick={() => setSuggestedNextStep(title)}
|
||||||
id={`parent-suggested-${idx}`}
|
id={`parent-suggested-${idx}`}
|
||||||
name="parent-suggested"
|
name="parent-suggested"
|
||||||
className={`ml-1 ${
|
className={`ml-1 ${
|
||||||
title == "Not Now"
|
title === "Not Now"
|
||||||
? "text-red-500"
|
? "text-red-500"
|
||||||
: title == "Duplicate"
|
: title === "Duplicate"
|
||||||
? "text-purple"
|
? "text-purple"
|
||||||
: "text-black"
|
: "text-black"
|
||||||
} font-semibold`}
|
} font-semibold text-[1.125rem]`}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</span>
|
</span>
|
||||||
@@ -229,7 +263,7 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="w-full h-[70px] border-t border-light-purple dark:border-[#5356fb29] flex justify-end items-center">
|
<div className="w-full h-[4.375rem] border-t border-light-purple dark:border-[#5356fb29] flex justify-end items-center">
|
||||||
<div className="flex items-center space-x-4 mr-9">
|
<div className="flex items-center space-x-4 mr-9">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -243,19 +277,31 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
disabled={props.isSubmitting}
|
disabled={props.isSubmitting}
|
||||||
className="text-white primary-gradient text-18 tracking-wide px-4 py-3 rounded-full transition duration-150 ease-in-out flex items-center"
|
className="text-white primary-gradient text-18 tracking-wide px-4 py-3 rounded-full transition duration-150 ease-in-out flex items-center"
|
||||||
>
|
>
|
||||||
|
{/* {pathname === "/acc-family/activities" ? (
|
||||||
|
<>
|
||||||
|
{suggestedNextStep === "Send Task" ? (
|
||||||
|
<>
|
||||||
|
Continue <Icons name="chevron-right" />
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
"Complete"
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
{pathname !== "/manage-family" ? (
|
{pathname !== "/manage-family" ? (
|
||||||
<>
|
<>
|
||||||
{submitTask.loading
|
{submitTask.loading
|
||||||
? "Submitting Task"
|
? "Submitting Task"
|
||||||
: submitTask.state == "success"
|
: submitTask.state === "success"
|
||||||
? "Task Submitted"
|
? "Task Submitted"
|
||||||
: submitTask.state == "bad"
|
: submitTask.state === "bad"
|
||||||
? "An Error Occurred"
|
? "An Error Occurred"
|
||||||
: "Send to Parents"}
|
: "Send to Parents"}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{suggestedNextStep == "Send Task" ? (
|
{suggestedNextStep === "Send Task" ? (
|
||||||
<>
|
<>
|
||||||
Continue <Icons name="chevron-right" />
|
Continue <Icons name="chevron-right" />
|
||||||
</>
|
</>
|
||||||
@@ -264,6 +310,9 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)} */}
|
||||||
|
{getButtonText()}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ import IndexJobActions from "./JobActions/IndexJobActions";
|
|||||||
|
|
||||||
import usersService from "../../services/UsersService";
|
import usersService from "../../services/UsersService";
|
||||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
|
import { SocketValues } from "../Contexts/SocketIOContext";
|
||||||
|
|
||||||
function ActiveJobs(props) {
|
function ActiveJobs(props) {
|
||||||
|
let {sendMessage, joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
|
||||||
|
|
||||||
const ApiCall = new usersService();
|
const ApiCall = new usersService();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
@@ -139,6 +142,9 @@ function ActiveJobs(props) {
|
|||||||
status: true,
|
status: true,
|
||||||
message: "Message Sent Successfully",
|
message: "Message Sent Successfully",
|
||||||
});
|
});
|
||||||
|
// function to trigger socket to emit 'send_message'
|
||||||
|
sendMessage(messageToSend, `${props.details.contract}-${props.details.contract_uid}`)
|
||||||
|
|
||||||
props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||||
setMessageToSend(""); // SENDS MESSAGE TO SEND BACK TO EMPTY STRINGS
|
setMessageToSend(""); // SENDS MESSAGE TO SEND BACK TO EMPTY STRINGS
|
||||||
})
|
})
|
||||||
@@ -255,6 +261,12 @@ function ActiveJobs(props) {
|
|||||||
props.details?.currency
|
props.details?.currency
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
// calls function to add user to a room
|
||||||
|
joinRoom(`${props.details.contract}-${props.details.contract_uid}`)
|
||||||
|
},[props.details.contract, props.details.contract_uid])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<div className="py-[20px] bg-white dark:bg-black dark:text-white px-4 rounded-2xl shadow-md md:flex justify-between items-start gap-16">
|
<div className="py-[20px] bg-white dark:bg-black dark:text-white px-4 rounded-2xl shadow-md md:flex justify-between items-start gap-16">
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import OfferCard from "../Cards/OfferCard";
|
|||||||
import Icons from "../Helpers/Icons";
|
import Icons from "../Helpers/Icons";
|
||||||
import SliderCom from "../Helpers/SliderCom";
|
import SliderCom from "../Helpers/SliderCom";
|
||||||
import FamilyOfferJobPopout from "../jobPopout/FamilyOfferJobPopout";
|
import FamilyOfferJobPopout from "../jobPopout/FamilyOfferJobPopout";
|
||||||
|
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
||||||
|
|
||||||
export default function MyOffersFamilyTable({ className, familyOffers, image_server }) {
|
export default function MyOffersFamilyTable({ className, familyOffers, image_server }) {
|
||||||
let [offerPopout, setOfferPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
let [offerPopout, setOfferPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
||||||
@@ -60,10 +61,21 @@ export default function MyOffersFamilyTable({ className, familyOffers, image_ser
|
|||||||
>
|
>
|
||||||
{/* heading */}
|
{/* heading */}
|
||||||
<div className="flex justify-between items-center mb-6">
|
<div className="flex justify-between items-center mb-6">
|
||||||
<div>
|
{/* <div>
|
||||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
|
||||||
Ready to Start?
|
Ready to Start?
|
||||||
</h1>
|
</h1>
|
||||||
|
</div> */}
|
||||||
|
<div className="">
|
||||||
|
<CustomBreadcrumb
|
||||||
|
title = {'Ready to Start'}
|
||||||
|
breadcrumb={
|
||||||
|
[
|
||||||
|
{ link: "/", title: "Home" },
|
||||||
|
{ link: "/pending", title: "Pending", active: true},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="slider-btns flex space-x-3">
|
<div className="slider-btns flex space-x-3">
|
||||||
<button onClick={nextHandler} type="button">
|
<button onClick={nextHandler} type="button">
|
||||||
|
|||||||
@@ -2,33 +2,109 @@ import { useSelector } from "react-redux";
|
|||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import WalletItemCard from "./WalletItemCard";
|
import WalletItemCard from "./WalletItemCard";
|
||||||
import WalletItemCardFamily from "./WalletItemCardFamily";
|
import WalletItemCardFamily from "./WalletItemCardFamily";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
|
import SearchCom from "../Helpers/SearchCom";
|
||||||
|
import { localImgLoad } from "../../lib";
|
||||||
|
import background from "../../assets/images/bg-sky-blue.jpg";
|
||||||
|
import FamilyWalletRedeemOptions from "./FamilyWalletRedeemOptions";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders a list of wallet items or a loading spinner depending on the state of the `wallet` object.
|
* Renders a list of wallet items or a loading spinner depending on the state of the `wallet` object.
|
||||||
*/
|
*/
|
||||||
export default function FamilyWalletBox({ wallet, payment, countries }) {
|
export default function FamilyWalletBox({ wallet, payment }) {
|
||||||
const { loading, data } = wallet;
|
// const { loading, data } = wallet;
|
||||||
|
|
||||||
const { userDetails } = useSelector((state) => state.userDetails);
|
// const { userDetails } = useSelector((state) => state.userDetails);
|
||||||
const accountType = userDetails?.account_type === "FAMILY";
|
// const accountType = userDetails?.account_type === "FAMILY";
|
||||||
|
|
||||||
|
const [selectedWallet, setSelectedWallet] = useState('')
|
||||||
|
|
||||||
|
const [activeWalletBtn, setActiveWalletBtn] = useState('')
|
||||||
|
|
||||||
|
const handleChangeWallet = ({target:{name}}) => { // FUNCTION TO SWITCH WALLET IF USER HAS MORE THAN TWO WALLETS
|
||||||
|
const currentWalletSelected = wallet?.data?.filter((item) => item.code == name);
|
||||||
|
setSelectedWallet(currentWalletSelected[0])
|
||||||
|
setActiveWalletBtn(name)
|
||||||
|
// console.log(name, currentWalletSelected)
|
||||||
|
}
|
||||||
|
|
||||||
|
const image = selectedWallet?.code
|
||||||
|
? `${selectedWallet?.code.toLowerCase()}.svg`
|
||||||
|
: "default.png";
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
setSelectedWallet(wallet.data[0])
|
||||||
|
setActiveWalletBtn(wallet?.data[0]?.code)
|
||||||
|
},[wallet])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="my-wallet-wrapper w-full mb-10">
|
<div className="w-full">
|
||||||
<div className="main-wrapper w-full">
|
<div className="my-wallet-wrapper w-full">
|
||||||
<div className="balance-inquery w-auto grid sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-[repeat(auto-fill,_minmax(354px,_1fr))] min-[1440px]:grid-cols-[repeat(auto-fill,_minmax(415px,_1fr))] gap-5 mb-11 h-auto">
|
<div className="main-wrapper w-full mb-10">
|
||||||
{loading ? (
|
<div className="w-full mb-10 sm:grid grid-cols-2 gap-4">
|
||||||
|
<div className="w-full mb-4 sm:mb-0 rounded-2xl bg-white dark:bg-dark-white overflow-hidden">
|
||||||
|
{wallet?.loading ?
|
||||||
<div className="w-full h-full flex items-center justify-center bg-white">
|
<div className="w-full h-full flex items-center justify-center bg-white">
|
||||||
<LoadingSpinner size="16" color="sky-blue" height='h-[30rem]' />
|
<LoadingSpinner size="16" color="sky-blue" height='min-h-[240px]' />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
: wallet?.data.length > 0 ?
|
||||||
data.length > 0 && data.map((item) => (
|
<>
|
||||||
<div key={item.wallet_uid} className="lg:w-full h-full mb-10 lg:mb-0">
|
{wallet?.data?.length > 1 &&
|
||||||
<WalletItemCardFamily walletItem={item} payment={payment} countries={countries} />
|
<div className="wal-selection px-5 py-2 text-black dark:text-white flex items-center gap-2">
|
||||||
|
{wallet?.data?.map(item =>(
|
||||||
|
<button
|
||||||
|
className={`py-0.5 px-1 mb-1 rounded-lg border border-orange-500 ${activeWalletBtn == item?.code && 'bg-orange-500'}`}
|
||||||
|
key={item?.wallet_uid}
|
||||||
|
name={item?.code}
|
||||||
|
onClick={handleChangeWallet}
|
||||||
|
>
|
||||||
|
{item?.description}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
))
|
}
|
||||||
)}
|
<div className="p-5 bg-white-opacity min-h-[240px]"
|
||||||
|
style={{
|
||||||
|
background: `url(${background}) 0% 0% / cover no-repeat`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* image */}
|
||||||
|
<div className="min-w-[100px] min-h-[100px] max-w-min md:max-w-[100px] max-h-min md:max-h-[100px] rounded-full bg-[#e3e3e3] flex justify-center items-center">
|
||||||
|
<img
|
||||||
|
src={localImgLoad(`images/currency/${image}`)}
|
||||||
|
className="w-full h-full"
|
||||||
|
alt="currency-icon"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p className="text-base sm:text-lg text-white opacity-[70%] tracking-wide my-3">Current Balance</p>
|
||||||
|
<p className="text-[44px] lg:text-[62px] font-bold text-white tracking-wide leading-10">
|
||||||
|
{PriceFormatter(selectedWallet?.amount/100, selectedWallet?.code, undefined, "text-[2rem]")}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
:
|
||||||
|
<div className="w-full h-full flex justify-center items-center rounded-2xl bg-white">
|
||||||
|
<p>No Wallet Record Found</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div className="p-5 w-full rounded-2xl bg-white dark:bg-dark-white text-black dark:text-white h-full min-h-[240px] max-h-96">
|
||||||
|
<h1 className="text-xl font-bold text-black dark:text-white">Recent Activities</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="w-full">
|
||||||
|
<FamilyWalletRedeemOptions />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// data.length>0 && data.map((item) => (
|
||||||
|
// <div key={item.wallet_uid} className="w-full h-full mb-10 ">
|
||||||
|
// {/* <WalletItemCardFamily walletItem={item} payment={payment} countries={countries} /> */}
|
||||||
|
// </div>
|
||||||
|
// ))
|
||||||
|
|||||||
+22
-36
@@ -6,9 +6,9 @@ import LoadingSpinner from "../Spinners/LoadingSpinner";
|
|||||||
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
||||||
const FamilyWalletBox = lazy(() => import("./FamilyWalletBox"));
|
const FamilyWalletBox = lazy(() => import("./FamilyWalletBox"));
|
||||||
|
|
||||||
const FamilyWallet = () => {
|
const FamilyWalletCon = () => {
|
||||||
const apiCall = new usersService();
|
const apiCall = new usersService();
|
||||||
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
// const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||||
const { walletTable } = useSelector((state) => state.tableReload);
|
const { walletTable } = useSelector((state) => state.tableReload);
|
||||||
|
|
||||||
const [paymentHistory, setPaymentHistory] = useState({
|
const [paymentHistory, setPaymentHistory] = useState({
|
||||||
@@ -16,12 +16,20 @@ const FamilyWallet = () => {
|
|||||||
data: [],
|
data: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
const [allCountries, setAllCountries] = useState({
|
const [familyWalletBal, setFamilyWalletBal] = useState({
|
||||||
// STATE TO HOLD LIST OF COUNTRIES
|
|
||||||
loading: true,
|
loading: true,
|
||||||
data: [],
|
data: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const getFamilyWalletBal = () => {
|
||||||
|
setFamilyWalletBal({loading:true, data: []})
|
||||||
|
apiCall.getFamilyWallet({family_uid: localStorage.getItem("uid")}).then(res => {
|
||||||
|
setFamilyWalletBal({loading:false, data: res?.data?.result_list})
|
||||||
|
}).catch(error => {
|
||||||
|
setFamilyWalletBal({loading:false, data: []})
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
const getPaymentHistory = () => {
|
const getPaymentHistory = () => {
|
||||||
apiCall
|
apiCall
|
||||||
.getPaymentHx()
|
.getPaymentHx()
|
||||||
@@ -30,6 +38,7 @@ const FamilyWallet = () => {
|
|||||||
setPaymentHistory({ loading: false, data: [] });
|
setPaymentHistory({ loading: false, data: [] });
|
||||||
} else {
|
} else {
|
||||||
setPaymentHistory({ loading: false, data: res.data?.result_list });
|
setPaymentHistory({ loading: false, data: res.data?.result_list });
|
||||||
|
// console.log('Hist', res.data?.result_list)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
@@ -37,37 +46,11 @@ const FamilyWallet = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// FUNCTION TO GET COUNTRIES
|
|
||||||
const getCountry = () => {
|
|
||||||
apiCall
|
|
||||||
.getSignupCountryData()
|
|
||||||
.then((res) => {
|
|
||||||
if (res?.data?.internal_return < 0) {
|
|
||||||
setAllCountries((prev) => ({ loading: false, data: [] }));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setAllCountries((prev) => ({
|
|
||||||
loading: false,
|
|
||||||
data: res?.data?.result_list,
|
|
||||||
}));
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
setAllCountries((prev) => ({ loading: false, data: [] }));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getCountry();
|
|
||||||
getPaymentHistory();
|
getPaymentHistory();
|
||||||
|
getFamilyWalletBal()
|
||||||
}, [walletTable]);
|
}, [walletTable]);
|
||||||
|
|
||||||
console.log(
|
|
||||||
"Testing all country: ",
|
|
||||||
allCountries,
|
|
||||||
"Testing wallet: ",
|
|
||||||
walletDetails
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<div className='mb-4'>
|
<div className='mb-4'>
|
||||||
@@ -81,15 +64,18 @@ const FamilyWallet = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Suspense fallback={<LoadingSpinner size="16" color="sky-blue" />}>
|
<Suspense fallback={
|
||||||
|
<div className="bg-white rounded-2xl">
|
||||||
|
<LoadingSpinner size="16" color="sky-blue" height='h-[30rem]' />
|
||||||
|
</div>
|
||||||
|
}>
|
||||||
<FamilyWalletBox
|
<FamilyWalletBox
|
||||||
wallet={walletDetails}
|
wallet={familyWalletBal}
|
||||||
payment={paymentHistory}
|
payment={paymentHistory}
|
||||||
countries={allCountries.data}
|
|
||||||
/>
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default FamilyWallet;
|
export default FamilyWalletCon;
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
import React, { useEffect, useState } from 'react'
|
||||||
|
import SearchCom from '../Helpers/SearchCom'
|
||||||
|
import LoadingSpinner from '../Spinners/LoadingSpinner';
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
|
export default function FamilyWalletRedeemOptions() {
|
||||||
|
|
||||||
|
const { familyWalletRedeemOptList } = useSelector((state) => state.familyWalletRedeemOptList); // FAMILY WALLET REDDEM OPTIONS LIST
|
||||||
|
|
||||||
|
const [filteredRedeemData, setFilteredRedeemData] = useState({value: '', data:{}}) // State to hold filtered redeem banner option
|
||||||
|
|
||||||
|
const handleFilterRedeemData = ({target}) => {
|
||||||
|
// thiskey01
|
||||||
|
let filterWord = target.value
|
||||||
|
let filteredData = {}
|
||||||
|
if(!filterWord){
|
||||||
|
filteredData = {...familyWalletRedeemOptList?.data}
|
||||||
|
}else{
|
||||||
|
let matchedData = Object.keys(familyWalletRedeemOptList?.data)?.filter(item => (item.toLowerCase().startsWith(filterWord.toLowerCase())))
|
||||||
|
filteredData = matchedData.map(item => familyWalletRedeemOptList.data[item])
|
||||||
|
}
|
||||||
|
setFilteredRedeemData({value:target.value, data: {...filteredData}})
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
setFilteredRedeemData(prev => ({...prev, data:{...familyWalletRedeemOptList?.data}}))
|
||||||
|
}, [familyWalletRedeemOptList.image])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="w-full">
|
||||||
|
<div className="w-full sm:flex items-center gap-4">
|
||||||
|
<h1 className="text-2xl font-bold text-black dark:text-white">Redeem Options</h1>
|
||||||
|
<div className="sm:w-1/2 w-full sm:pr-20 pr-0 mb-5 sm:mb-0">
|
||||||
|
<SearchCom
|
||||||
|
placeholder='Search...'
|
||||||
|
value={filteredRedeemData.value}
|
||||||
|
handleSearch={handleFilterRedeemData}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* redeem options */}
|
||||||
|
{familyWalletRedeemOptList.loading ?
|
||||||
|
<div className='mt-5 w-full h-[20rem] rounded-2xl bg-white dark:bg-dark-white text-black dark:text-white flex justify-center items-center'>
|
||||||
|
<LoadingSpinner size='10' color='sky-blue' height='h-[30rem]' />
|
||||||
|
</div>
|
||||||
|
: familyWalletRedeemOptList?.data && Object.keys(familyWalletRedeemOptList?.data)?.length > 0 ?
|
||||||
|
Object.keys(filteredRedeemData?.data)?.length ?
|
||||||
|
<div className="mt-5 grid sm:grid-cols-2 lg:grid-cols-3 xxl:grid-cols-4 gap-4">
|
||||||
|
{ Object.keys(filteredRedeemData?.data)?.map((item)=>{
|
||||||
|
// text, image, description, action
|
||||||
|
let newData = filteredRedeemData?.data[item].banner
|
||||||
|
let bgImage = `url(${newData?.image})`
|
||||||
|
return (
|
||||||
|
<Link to={''} key={item}>
|
||||||
|
<div className={`group relative h-60 text-black dark:text-white rounded-2xl shadow-lg hover:shadow-md transition-all duration-300 overflow-hidden`}
|
||||||
|
style={{
|
||||||
|
// background: `#ffffff ${bgImage} no-repeat center center / cover`
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<img src={newData?.image} alt='Redeem Image' className='w-full h-full bg-cover rounded-2xl group-hover:scale-110 transition-all duration-300' />
|
||||||
|
<div className='absolute bottom-0 mb-1 left-1/2 -translate-x-1/2 p-2 bg-white/80 rounded-2xl w-[90%] flex flex-col justify-center items-center gap-2'>
|
||||||
|
<h1 className='text-lg font-bold text-[#083e21]'>{newData.text}</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
:
|
||||||
|
<div className='mt-5 w-full h-[20rem] rounded-2xl bg-white dark:bg-dark-white text-black dark:text-white flex justify-center items-center'>
|
||||||
|
<p>Search Item not Found!</p>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
|
<div className='mt-5 w-full h-[20rem] rounded-2xl bg-white dark:bg-dark-white text-black dark:text-white flex justify-center items-center'>
|
||||||
|
<p>No Redeem Options Found!</p>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ import background from "../../assets/images/bg-sky-blue.jpg"; //shape/balance-bg
|
|||||||
import localImgLoad from "../../lib/localImgLoad";
|
import localImgLoad from "../../lib/localImgLoad";
|
||||||
import { tableReload } from "../../store/TableReloads";
|
import { tableReload } from "../../store/TableReloads";
|
||||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
import CreditPopup from "./Popup/CreditPopup";
|
|
||||||
import WalletAction from "./WalletAction";
|
import WalletAction from "./WalletAction";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,26 +12,15 @@ import WalletAction from "./WalletAction";
|
|||||||
export default function WalletItemCardFamily({ walletItem, payment, countries }) {
|
export default function WalletItemCardFamily({ walletItem, payment, countries }) {
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [creditPopup, setCreditPopup] = useState({ show: false, data: {} });
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the credit popup.
|
* Opens the credit popup.
|
||||||
* @param {Object} value - The value object.
|
* @param {Object} value - The value object.
|
||||||
*/
|
*/
|
||||||
const openPopUp = (value) => {
|
|
||||||
setCreditPopup({
|
|
||||||
show: true,
|
|
||||||
data: { ...value },
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the credit popup and dispatches a table reload action.
|
* Closes the credit popup and dispatches a table reload action.
|
||||||
*/
|
*/
|
||||||
const closePopUp = () => {
|
|
||||||
setCreditPopup({ show: false, data: {} });
|
|
||||||
dispatch(tableReload({ type: "WALLETTABLE" }));
|
|
||||||
};
|
|
||||||
|
|
||||||
const currentWalletCurrency = countries?.filter((country) => country.code === walletItem.country);
|
const currentWalletCurrency = countries?.filter((country) => country.code === walletItem.country);
|
||||||
|
|
||||||
@@ -43,10 +31,10 @@ export default function WalletItemCardFamily({ walletItem, payment, countries })
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
className="current-balance-widget w-full h-full rounded-2xl overflow-hidden flex flex-col items-center gap-2 p-8 justify-between"
|
className="current-balance-widget w-full h-full rounded-2xl overflow-hidden flex flex-col items-center gap-2 p-8 justify-between bg-family-header-bg"
|
||||||
style={{
|
// style={{
|
||||||
background: `url(${background}) 0% 0% / cover no-repeat`,
|
// background: `url(${background}) 0% 0% / cover no-repeat`,
|
||||||
}}
|
// }}
|
||||||
>
|
>
|
||||||
<div className="wallet w-full flex justify-between items-center gap-3">
|
<div className="wallet w-full flex justify-between items-center gap-3">
|
||||||
<div className="min-w-[100px] min-h-[100px] max-w-min md:max-w-[150px] max-h-min md:max-h-[150px] rounded-full bg-[#e3e3e3] flex justify-center items-center">
|
<div className="min-w-[100px] min-h-[100px] max-w-min md:max-w-[150px] max-h-min md:max-h-[150px] rounded-full bg-[#e3e3e3] flex justify-center items-center">
|
||||||
@@ -72,24 +60,7 @@ export default function WalletItemCardFamily({ walletItem, payment, countries })
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="my-2 w-full h-[1px] bg-white"></div>
|
|
||||||
|
|
||||||
{/* <WalletAction
|
|
||||||
walletItem={{ ...walletItem, walletCountry: currentWalletCurrency }}
|
|
||||||
payment={payment}
|
|
||||||
openPopUp={openPopUp}
|
|
||||||
/> */}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{creditPopup.show && (
|
|
||||||
<CreditPopup
|
|
||||||
details={creditPopup.data}
|
|
||||||
walletItem={walletItem}
|
|
||||||
onClose={closePopUp}
|
|
||||||
situation={openPopUp}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,7 @@ export default function Layout({ children }) {
|
|||||||
};
|
};
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const logOut = () => {
|
const logOut = () => {
|
||||||
localStorage.removeItem("session_token");
|
sessionStorage.clear();
|
||||||
localStorage.removeItem("member_id");
|
|
||||||
localStorage.removeItem("uid");
|
|
||||||
sessionStorage.removeItem("family_uid");
|
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
// toast.success("Come Back Soon", {
|
// toast.success("Come Back Soon", {
|
||||||
// icon: `🙂`,
|
// icon: `🙂`,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import InputCom from "../Helpers/Inputs/InputCom/index";
|
|||||||
import ModalCom from "../Helpers/ModalCom";
|
import ModalCom from "../Helpers/ModalCom";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import Detail from "./popoutcomponent/Detail";
|
import Detail from "./popoutcomponent/Detail";
|
||||||
|
import { SocketValues } from "../Contexts/SocketIOContext";
|
||||||
|
|
||||||
const validationSchema = Yup.object().shape({
|
const validationSchema = Yup.object().shape({
|
||||||
family: Yup.string().required("This is required "),
|
family: Yup.string().required("This is required "),
|
||||||
@@ -29,6 +30,9 @@ function JobListPopout({
|
|||||||
openWallet,
|
openWallet,
|
||||||
setWalletItem,
|
setWalletItem,
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
|
let {marketUpdate} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
|
||||||
|
|
||||||
const [selectedTab, setSelectedTab] = useState("public");
|
const [selectedTab, setSelectedTab] = useState("public");
|
||||||
const tabs = ["public", "individual", "group"];
|
const tabs = ["public", "individual", "group"];
|
||||||
|
|
||||||
@@ -201,7 +205,9 @@ function JobListPopout({
|
|||||||
setRequestStatus({ message: "", status: false });
|
setRequestStatus({ message: "", status: false });
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
dispatch(tableReload({ type: "JOBTABLE" }));
|
marketUpdate('market', 'full-markets-jobs') // sends an event to the socket to update market lists
|
||||||
|
dispatch(tableReload({ type: "JOBTABLE" })); // reloads my job page
|
||||||
|
dispatch(tableReload({ type: "MARKETTABLELIST" })); // reloads market page
|
||||||
setRequestStatus({ message: data?.status_msg ? data?.status_msg : "Offer Assigned Successful", status: true });
|
setRequestStatus({ message: data?.status_msg ? data?.status_msg : "Offer Assigned Successful", status: true });
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setLoader({ jobFields: false });
|
setLoader({ jobFields: false });
|
||||||
@@ -224,6 +230,12 @@ function JobListPopout({
|
|||||||
members: [],
|
members: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const DetailsSection = ({ label, value }) => (
|
||||||
|
<div className="my-3 md:flex">
|
||||||
|
<Detail label={label} value={value} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
// FUNCTION TO POPULATE USER GROUP LIST
|
// FUNCTION TO POPULATE USER GROUP LIST
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// setGroupList({loading: true, groups: [], members: []})
|
// setGroupList({loading: true, groups: [], members: []})
|
||||||
@@ -250,12 +262,6 @@ function JobListPopout({
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const DetailsSection = ({ label, value }) => (
|
|
||||||
<div className="my-3 md:flex">
|
|
||||||
<Detail label={label} value={value} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const DetailsComponent = () => {
|
const DetailsComponent = () => {
|
||||||
const detailsArray = [
|
const detailsArray = [
|
||||||
{ label: "Description", value: details.description },
|
{ label: "Description", value: details.description },
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import React from 'react'
|
|||||||
function Detail({label, value, bg,}) {
|
function Detail({label, value, bg,}) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<label className='w-full md:w-1/4 text-slate-900 dark:text-white tracking-wide font-semibold'>{label}</label>
|
<label className='job-label w-full md:w-1/4'>{label}</label>
|
||||||
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white ${bg ? bg : null}`}>{value}</p>
|
<p className={`p-1 w-full md:w-3/4 text-sm text-slate-900 dark:text-white ${bg ? bg : null}`}>{value}</p>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -152,6 +152,12 @@
|
|||||||
--toastify-color-success: #f539f8;
|
--toastify-color-success: #f539f8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@layer components{
|
||||||
|
.job-label{
|
||||||
|
@apply text-slate-900 dark:text-white tracking-wide font-semibold
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ===================== EXTRA ===================== */
|
/* ===================== EXTRA ===================== */
|
||||||
.bottomMargin {
|
.bottomMargin {
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
|
|||||||
@@ -13,8 +13,13 @@ import { updateUserJobList } from "../store/userJobList";
|
|||||||
import { updateWalletDetails } from "../store/walletDetails";
|
import { updateWalletDetails } from "../store/walletDetails";
|
||||||
import { familyBannersList } from "../store/FamilyBannerList";
|
import { familyBannersList } from "../store/FamilyBannerList";
|
||||||
import { familyResources } from "../store/FamilyResources";
|
import { familyResources } from "../store/FamilyResources";
|
||||||
|
import {familyWalletRedeemOptList} from '../store/FamilyWalletRedeemOpt'
|
||||||
|
import { SocketValues } from "../components/Contexts/SocketIOContext";
|
||||||
|
|
||||||
const AuthRoute = ({ redirectPath = "/login", children }) => {
|
const AuthRoute = ({ redirectPath = "/login", children }) => {
|
||||||
|
|
||||||
|
let {joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
|
||||||
|
|
||||||
const apiCall = useMemo(() => new usersService(), []);
|
const apiCall = useMemo(() => new usersService(), []);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const [lastActivityTime, setLastActivityTime] = useState(Date.now());
|
const [lastActivityTime, setLastActivityTime] = useState(Date.now());
|
||||||
@@ -22,12 +27,12 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
const [loadProfileDetails, setLoadProfileDetails] = useState([]);
|
const [loadProfileDetails, setLoadProfileDetails] = useState([]);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { jobListTable, walletTable, familyBannersListTable } = useSelector(
|
const { jobListTable, marketTableList, walletTable, familyBannersListTable } = useSelector(
|
||||||
(state) => state.tableReload
|
(state) => state.tableReload
|
||||||
);
|
);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
userDetails: { username, uid, session, account_type },
|
userDetails: { username, uid, session, account_type, parent_uid },
|
||||||
} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||||
|
|
||||||
let loggedIn = username && session && uid ? true : false; // variable to determine if user is logged in
|
let loggedIn = username && session && uid ? true : false; // variable to determine if user is logged in
|
||||||
@@ -35,10 +40,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//Removing Data stored at localStorage after session expires
|
//Removing Data stored at localStorage after session expires
|
||||||
const expireSession = () => {
|
const expireSession = () => {
|
||||||
localStorage.removeItem("uid");
|
sessionStorage.clear();
|
||||||
localStorage.removeItem("member_id");
|
|
||||||
localStorage.removeItem("session_token");
|
|
||||||
sessionStorage.removeItem("family_uid");
|
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
navigate("/login", { replace: true }); // redirects user to login page after session expires
|
navigate("/login", { replace: true }); // redirects user to login page after session expires
|
||||||
};
|
};
|
||||||
@@ -104,6 +106,8 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
loadProfile();
|
loadProfile();
|
||||||
|
}else{
|
||||||
|
setIsLogin({ loading: false, status: true });
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -188,6 +192,9 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
}, [jobListTable, isLogin.status]);
|
}, [jobListTable, isLogin.status]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
|
||||||
|
return
|
||||||
|
}
|
||||||
const getMyWalletList = async () => {
|
const getMyWalletList = async () => {
|
||||||
dispatch(updateWalletDetails({ loading: true, data: [] }));
|
dispatch(updateWalletDetails({ loading: true, data: [] }));
|
||||||
try {
|
try {
|
||||||
@@ -202,7 +209,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
getMyWalletList();
|
getMyWalletList();
|
||||||
}, [walletTable]);
|
}, [walletTable, isLogin.status]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
|
if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
|
||||||
@@ -218,7 +225,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
getMarketActiveJobList();
|
getMarketActiveJobList();
|
||||||
}, [apiCall, dispatch, jobListTable, isLogin.status]);
|
}, [apiCall, dispatch, marketTableList, isLogin.status]);
|
||||||
|
|
||||||
//FUNCTION TO GET COMMON HEAD DATA
|
//FUNCTION TO GET COMMON HEAD DATA
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -228,7 +235,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
apiCall
|
apiCall
|
||||||
.getHeroJBanners()
|
.getHeroJBanners()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data.internal_return < 0) {
|
if (res.data?.internal_return < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dispatch(commonHeadBanner(res.data));
|
dispatch(commonHeadBanner(res.data));
|
||||||
@@ -240,6 +247,9 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
|
|
||||||
//FUNCTION TO GET COMMON HEAD DATA
|
//FUNCTION TO GET COMMON HEAD DATA
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY
|
||||||
|
return
|
||||||
|
}
|
||||||
apiCall
|
apiCall
|
||||||
.getRecentActivitiedData()
|
.getRecentActivitiedData()
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -252,7 +262,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log("ERROR ", error);
|
console.log("ERROR ", error);
|
||||||
});
|
});
|
||||||
}, []);
|
}, [isLogin.status]);
|
||||||
|
|
||||||
|
|
||||||
//FUNCTION TO GET FAMILY BANNERS
|
//FUNCTION TO GET FAMILY BANNERS
|
||||||
@@ -291,6 +301,34 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
}, [isLogin.status]);
|
}, [isLogin.status]);
|
||||||
|
|
||||||
|
|
||||||
|
//FUNCTION TO GET FAMILY WALLET REDEEM OPTIONS
|
||||||
|
useEffect(() => {
|
||||||
|
if((!loggedIn && !isLogin.status) || account_type == 'FULL'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FULL
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const familyWalletRedeemOptions = async () => { // FUNCTION TO GET FAMILY WALLET REDDEM OPTIONS
|
||||||
|
dispatch(familyWalletRedeemOptList({loading: true, image: '', data:{}}))
|
||||||
|
apiCall.getFamilyWalletRedeemOptions().then((res)=>{
|
||||||
|
dispatch(familyWalletRedeemOptList({loading: false, image: res?.data?.session_image_server, data:res?.data?.result_list}))
|
||||||
|
}).catch((err)=>{
|
||||||
|
console.log(err)
|
||||||
|
dispatch(familyWalletRedeemOptList({loading: false, image: '', data:{}}))
|
||||||
|
})
|
||||||
|
};
|
||||||
|
familyWalletRedeemOptions()
|
||||||
|
}, [isLogin.status]);
|
||||||
|
|
||||||
|
useEffect(()=>{ // sends an event to the socket to enable user join a room to be able to receive update when jobs enters the market
|
||||||
|
joinRoom('full-markets-jobs')
|
||||||
|
},[isLogin.status])
|
||||||
|
|
||||||
|
useEffect(()=>{ // sends an event to the socket to enable user join a room to be able to receive update for parent child job assign
|
||||||
|
if(loggedIn || isLogin.status){
|
||||||
|
joinRoom(`FAMILY-${account_type == 'FULL' ? uid : sessionStorage.getItem('parent_uid')}`)
|
||||||
|
console.log(`Room joined for parent child task assign as ${account_type} with ${account_type == 'FULL' ? uid : sessionStorage.getItem('parent_uid')}}`)
|
||||||
|
}
|
||||||
|
},[isLogin.status])
|
||||||
|
|
||||||
// RENDER PAGE
|
// RENDER PAGE
|
||||||
return isLogin.loading && !loggedIn ? (
|
return isLogin.loading && !loggedIn ? (
|
||||||
<LoadingSpinner size="32" color="sky-blue" height="h-screen" />
|
<LoadingSpinner size="32" color="sky-blue" height="h-screen" />
|
||||||
|
|||||||
@@ -388,13 +388,26 @@ class usersService {
|
|||||||
uid: localStorage.getItem("uid"),
|
uid: localStorage.getItem("uid"),
|
||||||
member_id: localStorage.getItem("member_id"),
|
member_id: localStorage.getItem("member_id"),
|
||||||
sessionid: localStorage.getItem("session_token"),
|
sessionid: localStorage.getItem("session_token"),
|
||||||
action: apiConst.WRENCHBOARD_JOB_CREATEJOB,
|
action: apiConst.WRENCHBOARD_JOB_CREATEJOB || apiConst.WRENCHBOARD_FAMILY_LIST,
|
||||||
limit: 30,
|
limit: 30,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
};
|
};
|
||||||
return this.postAuxEnd("/familywaitingtasks", postData);
|
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() {
|
ManageFamilyPending() {
|
||||||
var postData = {
|
var postData = {
|
||||||
uuid: localStorage.getItem("uid"),
|
uuid: localStorage.getItem("uid"),
|
||||||
@@ -1293,6 +1306,19 @@ class usersService {
|
|||||||
return this.postAuxEnd("/blogdata", postData);
|
return this.postAuxEnd("/blogdata", postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// API FUNCTION FOR FAMILY WALLET REDEEM OPTIONS
|
||||||
|
getFamilyWalletRedeemOptions() {
|
||||||
|
var postData = {
|
||||||
|
uuid: localStorage.getItem("uid"),
|
||||||
|
member_id: localStorage.getItem("member_id"),
|
||||||
|
sessionid: localStorage.getItem("session_token"),
|
||||||
|
action: apiConst.WRENCHBOARD_JOB_ACTIVE,
|
||||||
|
offset: 0,
|
||||||
|
limit: 30,
|
||||||
|
};
|
||||||
|
return this.postAuxEnd("/familywallet/redeem/options", postData);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
|
|
||||||
|
const initialState = {
|
||||||
|
familyWalletRedeemOptList: {loading: true, image: '', data: {}}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const familyWalletRedeemOptListSlice = createSlice({
|
||||||
|
name: "familyWalletRedeemOptList",
|
||||||
|
initialState,
|
||||||
|
reducers: {
|
||||||
|
familyWalletRedeemOptList: (state,action) => {
|
||||||
|
state.familyWalletRedeemOptList = {...action.payload}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Action creators are generated for each case reducer function
|
||||||
|
export const { familyWalletRedeemOptList } = familyWalletRedeemOptListSlice.actions;
|
||||||
|
|
||||||
|
export default familyWalletRedeemOptListSlice.reducer;
|
||||||
@@ -9,6 +9,9 @@ const initialState = {
|
|||||||
walletTable: false,
|
walletTable: false,
|
||||||
uploadsTable: false,
|
uploadsTable: false,
|
||||||
familyBannersListTable: false,
|
familyBannersListTable: false,
|
||||||
|
chatMessageList: false,
|
||||||
|
marketTableList: false,
|
||||||
|
familyOfferList: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tableReloadSlice = createSlice({
|
export const tableReloadSlice = createSlice({
|
||||||
@@ -41,6 +44,15 @@ export const tableReloadSlice = createSlice({
|
|||||||
case "FAMILYBANNERSLIST":
|
case "FAMILYBANNERSLIST":
|
||||||
state.familyBannersListTable = !state.familyBannersListTable;
|
state.familyBannersListTable = !state.familyBannersListTable;
|
||||||
return;
|
return;
|
||||||
|
case "CHATMESSAGELIST":
|
||||||
|
state.chatMessageList = !state.chatMessageList;
|
||||||
|
return;
|
||||||
|
case "MARKETTABLELIST":
|
||||||
|
state.marketTableList = !state.marketTableList;
|
||||||
|
return;
|
||||||
|
case "FAMILYOFFERLIST":
|
||||||
|
state.familyOfferList = !state.familyOfferList;
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -10,6 +10,7 @@ import userJobListReducer from "./userJobList";
|
|||||||
import walletDetails from "./walletDetails";
|
import walletDetails from "./walletDetails";
|
||||||
import familyBannerListReducer from "./FamilyBannerList"
|
import familyBannerListReducer from "./FamilyBannerList"
|
||||||
import familyResourcesReducer from './FamilyResources'
|
import familyResourcesReducer from './FamilyResources'
|
||||||
|
import familyWalletRedeemOptListReducer from './FamilyWalletRedeemOpt'
|
||||||
|
|
||||||
export default configureStore({
|
export default configureStore({
|
||||||
reducer: {
|
reducer: {
|
||||||
@@ -22,6 +23,7 @@ export default configureStore({
|
|||||||
notifications: notificationsReducer,
|
notifications: notificationsReducer,
|
||||||
walletDetails: walletDetails,
|
walletDetails: walletDetails,
|
||||||
familyBannersList: familyBannerListReducer,
|
familyBannersList: familyBannerListReducer,
|
||||||
familyResources: familyResourcesReducer
|
familyResources: familyResourcesReducer,
|
||||||
|
familyWalletRedeemOptList: familyWalletRedeemOptListReducer
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import FamilyWallet from "../components/MyWallet/FamilyWallet";
|
import FamilyWalletCon from "../components/MyWallet/FamilyWalletCon";
|
||||||
|
|
||||||
export default function FamilyWalletPage() {
|
export default function FamilyWalletPage() {
|
||||||
return <FamilyWallet />;
|
return <FamilyWalletCon />;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,17 @@ import React, { useEffect, useState } from "react";
|
|||||||
import { useLocation, useNavigate } from "react-router-dom";
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
import ActiveJobs from "../components/MyActiveJobs/ActiveJobs";
|
import ActiveJobs from "../components/MyActiveJobs/ActiveJobs";
|
||||||
import usersService from "../services/UsersService";
|
import usersService from "../services/UsersService";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This code defines a React functional component called `ManageActiveJobs`.
|
* This code defines a React functional component called `ManageActiveJobs`.
|
||||||
* It fetches a list of active job messages and renders the `ActiveJobs` component with the necessary props.
|
* It fetches a list of active job messages and renders the `ActiveJobs` component with the necessary props.
|
||||||
*/
|
*/
|
||||||
function ManageActiveJobs() {
|
function ManageActiveJobs() {
|
||||||
|
const { chatMessageList } = useSelector(
|
||||||
|
(state) => state.tableReload
|
||||||
|
);
|
||||||
|
|
||||||
const ApiCall = new usersService();
|
const ApiCall = new usersService();
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -54,7 +59,7 @@ function ManageActiveJobs() {
|
|||||||
}
|
}
|
||||||
setDetails(state);
|
setDetails(state);
|
||||||
getActiveJobMesList();
|
getActiveJobMesList();
|
||||||
}, [activeJobMesListReload]);
|
}, [activeJobMesListReload, chatMessageList]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActiveJobs
|
<ActiveJobs
|
||||||
|
|||||||
Reference in New Issue
Block a user