Compare commits
31 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 |
+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:
|
||||||
|
|||||||
@@ -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,12 +1,14 @@
|
|||||||
import React, { createContext, useContext, useEffect, useState } from "react";
|
import React, { createContext, useContext, useEffect, useState } from "react";
|
||||||
import { tableReload } from "../../store/TableReloads";
|
import { tableReload } from "../../store/TableReloads";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
import io from "socket.io-client";
|
import io from "socket.io-client";
|
||||||
|
|
||||||
let SocketIOContext = createContext({})
|
let SocketIOContext = createContext({})
|
||||||
|
|
||||||
export default function SocketIOContextProvider({children}) {
|
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 dispatch = useDispatch()
|
||||||
|
|
||||||
const socket = io.connect(process.env.REACT_APP_PRIMARY_SOCKET);
|
const socket = io.connect(process.env.REACT_APP_PRIMARY_SOCKET);
|
||||||
@@ -30,11 +32,35 @@ export default function SocketIOContextProvider({children}) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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(() => {
|
useEffect(() => {
|
||||||
socket.on("receive_message", (data) => {
|
socket.on("receive_message", (data) => {
|
||||||
// setSocketMsgReceived(data.message);
|
// setSocketMsgReceived(data.message);
|
||||||
dispatch(tableReload({type:'CHATMESSAGELIST'}))
|
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]);
|
}, [socket]);
|
||||||
|
|
||||||
let values = {
|
let values = {
|
||||||
@@ -42,6 +68,8 @@ export default function SocketIOContextProvider({children}) {
|
|||||||
sendMessage,
|
sendMessage,
|
||||||
joinRoom,
|
joinRoom,
|
||||||
setSocketMsgReceived,
|
setSocketMsgReceived,
|
||||||
|
marketUpdate,
|
||||||
|
parentAssignJobToKid,
|
||||||
socketMsgReceived,
|
socketMsgReceived,
|
||||||
// room,
|
// room,
|
||||||
// setRoom,
|
// setRoom,
|
||||||
|
|||||||
@@ -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,26 +4,27 @@ 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>
|
||||||
{myOffersList.loading ?
|
{myOffersList.loading ?
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
import usersService from "../../../services/UsersService";
|
import usersService from "../../../services/UsersService";
|
||||||
import { tableReload } from "../../../store/TableReloads";
|
import { tableReload } from "../../../store/TableReloads";
|
||||||
@@ -8,456 +8,501 @@ 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 { SocketValues } from "../../Contexts/SocketIOContext";
|
||||||
|
|
||||||
const AssignTaskPopout = React.memo(
|
const AssignTaskPopout = ({
|
||||||
({
|
action,
|
||||||
action,
|
details,
|
||||||
details,
|
situation,
|
||||||
situation,
|
familyDetailsData,
|
||||||
familyDetailsData,
|
familyTask,
|
||||||
familyTask,
|
activeTask,
|
||||||
activeTask,
|
setActiveTask,
|
||||||
setActiveTask,
|
setUpdatePage,
|
||||||
setUpdatePage,
|
assignTaskChecker,
|
||||||
assignTaskChecker,
|
|
||||||
}) => {
|
}) => {
|
||||||
const apiCall = new usersService();
|
const {parentAssignJobToKid} = SocketValues()
|
||||||
let { pathname, state } = useLocation();
|
const apiCall = new usersService();
|
||||||
|
let { pathname, state } = useLocation();
|
||||||
|
|
||||||
const [selectedFamilyUid, setSelectedFamilyUid] = useState(null);
|
const {userDetails} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||||
|
|
||||||
const handleFamChange = (event) => {
|
const [selectedFamilyUid, setSelectedFamilyUid] = useState('');
|
||||||
setSelectedFamilyUid(event.target.value);
|
|
||||||
};
|
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const handleFamChange = (event) => {
|
||||||
|
setSelectedFamilyUid(event.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
const getFamilySession = JSON.parse(sessionStorage.getItem("family_list"));
|
|
||||||
|
|
||||||
const familyList = getFamilySession?.map((member) => (
|
const dispatch = useDispatch();
|
||||||
<option key={member?.family_uid} value={member?.family_uid}>
|
|
||||||
{member?.firstname} {member?.lastname}
|
|
||||||
</option>
|
|
||||||
));
|
|
||||||
|
|
||||||
let [requestStatus, setRequestStatus] = useState({
|
const getFamilySession = JSON.parse(sessionStorage.getItem("family_list"));
|
||||||
loading: false,
|
|
||||||
status: false,
|
|
||||||
message: "",
|
|
||||||
}); // HOLDS RESPONSE FOR SENDING API REQUEST
|
|
||||||
|
|
||||||
let [taskType, setTaskType] = useState(details ? "new" : "select"); // SWITCHES BTW SELECT TASK AND NEW TASK
|
const familyList = getFamilySession?.map((member) => (
|
||||||
|
<option key={member?.family_uid} value={member?.family_uid}>
|
||||||
|
{member?.firstname} {member?.lastname}
|
||||||
|
</option>
|
||||||
|
));
|
||||||
|
|
||||||
const switchTaskType = ({ target: { value } }) => {
|
let [requestStatus, setRequestStatus] = useState({
|
||||||
// FUNCTION TO CHANGE SELECTED ACTIVE TASK
|
loading: false,
|
||||||
setTaskType(value);
|
status: false,
|
||||||
};
|
message: "",
|
||||||
|
}); // HOLDS RESPONSE FOR SENDING API REQUEST
|
||||||
|
|
||||||
const handleActiveTask = (id = 0, data = {}) => {
|
let [taskType, setTaskType] = useState(details ? "new" : "select"); // SWITCHES BTW SELECT TASK AND NEW TASK
|
||||||
// FUNCTION TO CHANGE SELECTED ACTIVE TASK
|
|
||||||
setActiveTask({ id, data });
|
|
||||||
};
|
|
||||||
|
|
||||||
// New Task
|
const switchTaskType = ({ target: { value } }) => {
|
||||||
const [formState, setFormState] = useState({
|
// FUNCTION TO CHANGE SELECTED ACTIVE TASK
|
||||||
// Initialize form state with desired fields
|
setTaskType(value);
|
||||||
banner: details?.banner || "default.jpg",
|
};
|
||||||
country: details?.country || "",
|
|
||||||
price: details?.price || "",
|
|
||||||
title: details?.title || "",
|
|
||||||
description: details?.description || "",
|
|
||||||
job_detail: details?.job_detail || "",
|
|
||||||
timeline_days: details?.timeline_days || "",
|
|
||||||
category: details?.category || "",
|
|
||||||
});
|
|
||||||
|
|
||||||
const assignFamilyTask = () => {
|
const handleActiveTask = (id = 0, data = {}) => {
|
||||||
setRequestStatus({ loading: true, status: false, message: "" });
|
// FUNCTION TO CHANGE SELECTED ACTIVE TASK
|
||||||
let reqData = {};
|
setActiveTask({ id, data });
|
||||||
if (taskType == "select") {
|
};
|
||||||
// RUNS HERE IF TASK TYPE IS SELECT
|
|
||||||
if (!Object.keys(activeTask.data).length) {
|
// New Task
|
||||||
|
const [formState, setFormState] = useState({
|
||||||
|
// Initialize form state with desired fields
|
||||||
|
banner: details?.banner || "default.jpg",
|
||||||
|
country: details?.country || "",
|
||||||
|
price: details?.price || "",
|
||||||
|
title: details?.title || "",
|
||||||
|
description: details?.description || "",
|
||||||
|
job_detail: details?.job_detail || "",
|
||||||
|
timeline_days: details?.timeline_days || "",
|
||||||
|
category: details?.category || "",
|
||||||
|
});
|
||||||
|
|
||||||
|
const assignFamilyTask = () => {
|
||||||
|
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 = {};
|
||||||
|
if (taskType == "select") {
|
||||||
|
// RUNS HERE IF TASK TYPE IS SELECT
|
||||||
|
if (!Object.keys(activeTask.data).length) {
|
||||||
|
setRequestStatus({
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
message: "No Task is seleted",
|
||||||
|
});
|
||||||
|
return setTimeout(() => {
|
||||||
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
|
}, 3000);
|
||||||
|
}
|
||||||
|
reqData = {
|
||||||
|
// API PAYLOADS
|
||||||
|
job_id: activeTask.data?.job_id,
|
||||||
|
job_uid: activeTask.data?.job_uid,
|
||||||
|
family_uid: selectedFamilyUid
|
||||||
|
? selectedFamilyUid
|
||||||
|
: familyDetailsData?.uid || details?.family_uid,
|
||||||
|
job_description: activeTask.data?.description,
|
||||||
|
assign_mode: 110011,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taskType === "new") {
|
||||||
|
const {
|
||||||
|
banner,
|
||||||
|
category,
|
||||||
|
country,
|
||||||
|
description,
|
||||||
|
job_detail,
|
||||||
|
price,
|
||||||
|
timeline_days,
|
||||||
|
title,
|
||||||
|
} = formState;
|
||||||
|
|
||||||
|
const requiredFields = {
|
||||||
|
banner,
|
||||||
|
// category,
|
||||||
|
currency: country,
|
||||||
|
description,
|
||||||
|
"job detail": job_detail,
|
||||||
|
price,
|
||||||
|
timeline: timeline_days,
|
||||||
|
title,
|
||||||
|
};
|
||||||
|
|
||||||
|
for (let field in requiredFields) {
|
||||||
|
if (requiredFields[field] == "") {
|
||||||
|
// let currencyErrMsg = field == "country" && "currency"
|
||||||
setRequestStatus({
|
setRequestStatus({
|
||||||
loading: false,
|
loading: false,
|
||||||
status: false,
|
status: false,
|
||||||
message: "No Task is seleted",
|
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: "" });
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
reqData = {
|
|
||||||
// API PAYLOADS
|
|
||||||
job_id: activeTask.data?.job_id,
|
|
||||||
job_uid: activeTask.data?.job_uid,
|
|
||||||
family_uid: selectedFamilyUid
|
|
||||||
? selectedFamilyUid
|
|
||||||
: familyDetailsData?.uid || details?.family_uid,
|
|
||||||
job_description: activeTask.data?.description,
|
|
||||||
assign_mode: 110011,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taskType === "new") {
|
reqData = {
|
||||||
const {
|
banner,
|
||||||
banner,
|
category,
|
||||||
category,
|
country,
|
||||||
country,
|
description,
|
||||||
description,
|
job_detail,
|
||||||
job_detail,
|
price: price * 100,
|
||||||
price,
|
timeline_days,
|
||||||
timeline_days,
|
title,
|
||||||
title,
|
assign_mode: 110055,
|
||||||
} = formState;
|
family_uid: selectedFamilyUid
|
||||||
|
? selectedFamilyUid
|
||||||
|
: familyDetailsData?.uid || details?.family_uid,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const requiredFields = {
|
apiCall
|
||||||
banner,
|
.assignFamilyTask(reqData)
|
||||||
// category,
|
.then((res) => {
|
||||||
currency: country,
|
if (res.status != 200 || res.data.internal_return < 0) {
|
||||||
description,
|
setRequestStatus({
|
||||||
"job detail": job_detail,
|
loading: false,
|
||||||
price,
|
status: false,
|
||||||
timeline: timeline_days,
|
message: "failed to assign task",
|
||||||
title,
|
});
|
||||||
};
|
|
||||||
|
|
||||||
for (let field in requiredFields) {
|
return setTimeout(() => {
|
||||||
if (requiredFields[field] == "") {
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
// let currencyErrMsg = field == "country" && "currency"
|
}, 5000);
|
||||||
setRequestStatus({
|
|
||||||
loading: false,
|
|
||||||
status: false,
|
|
||||||
message: `${
|
|
||||||
field[0].toUpperCase() + field.slice(1).toLowerCase()
|
|
||||||
} is empty`,
|
|
||||||
});
|
|
||||||
return setTimeout(() => {
|
|
||||||
setRequestStatus({ loading: false, status: false, message: "" });
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (res.status === 200) {
|
||||||
|
|
||||||
reqData = {
|
|
||||||
banner,
|
|
||||||
category,
|
|
||||||
country,
|
|
||||||
description,
|
|
||||||
job_detail,
|
|
||||||
price: price * 100,
|
|
||||||
timeline_days,
|
|
||||||
title,
|
|
||||||
assign_mode: 110055,
|
|
||||||
family_uid: details?.family_uid || familyDetailsData?.uid,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
apiCall
|
|
||||||
.assignFamilyTask(reqData)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.status != 200 || res.data.internal_return < 0) {
|
|
||||||
setRequestStatus({
|
|
||||||
loading: false,
|
|
||||||
status: false,
|
|
||||||
message: "failed to assign task",
|
|
||||||
});
|
|
||||||
return setTimeout(() => {
|
|
||||||
setRequestStatus({ loading: false, status: false, message: "" });
|
|
||||||
}, 5000);
|
|
||||||
}
|
|
||||||
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) => {
|
})
|
||||||
setRequestStatus({
|
.catch((err) => {
|
||||||
loading: false,
|
setRequestStatus({
|
||||||
status: false,
|
loading: false,
|
||||||
message: "An Error occured, try again",
|
status: false,
|
||||||
});
|
message: "An Error occured, try again",
|
||||||
setTimeout(() => {
|
|
||||||
setRequestStatus({ loading: false, status: false, message: "" });
|
|
||||||
}, 5000);
|
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
||||||
console.log(details);
|
setTimeout(() => {
|
||||||
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
useEffect(()=>{ // effect to update family UID when components mounts
|
||||||
<>
|
if(familyDetailsData?.uid){
|
||||||
<ModalCom action={action} situation={situation}>
|
setSelectedFamilyUid(familyDetailsData?.uid)
|
||||||
<div className="w-11/12 lg:w-[700px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
}else if(details?.family_uid){
|
||||||
<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">
|
setSelectedFamilyUid(details?.family_uid)
|
||||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide flex items-center">
|
}else{
|
||||||
<>
|
setSelectedFamilyUid('')
|
||||||
Assign task to{" "}
|
}
|
||||||
{pathname === "/acc-family/activities" ? (
|
},[])
|
||||||
<div className="w-[270px] h-[40px] ml-2">
|
|
||||||
<select
|
return (
|
||||||
name=""
|
<>
|
||||||
id=""
|
<ModalCom action={action} situation={situation}>
|
||||||
className="text-black/70 bg-transparent px-2 transition-all cursor-pointer focus:outline-none border border-gray-200 rounded-lg w-full h-full py-1"
|
<div className="w-11/12 lg:w-[700px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||||
onChange={handleFamChange}
|
<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">
|
||||||
value={selectedFamilyUid}
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide flex items-center">
|
||||||
>
|
{details ? (
|
||||||
<option value="" disabled selected>
|
` Assign ${details?.firstname}'s Task`
|
||||||
Select a member
|
) : familyDetailsData ? (
|
||||||
</option>
|
` Assign ${familyDetailsData.firstname}'s Task`
|
||||||
{familyList}
|
) : (
|
||||||
</select>
|
<div className="flex items-center gap-2">
|
||||||
</div>
|
<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">
|
||||||
<>{familyDetailsData?.firstname || details?.firstName}</>
|
<select
|
||||||
)}
|
name=""
|
||||||
</>
|
id=""
|
||||||
</h1>
|
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"
|
||||||
<button
|
onChange={handleFamChange}
|
||||||
type="button"
|
value={selectedFamilyUid}
|
||||||
className="text-[#374557] dark:text-red-500"
|
>
|
||||||
onClick={action}
|
<option value="" className="">
|
||||||
|
Select a kid
|
||||||
|
</option>
|
||||||
|
{familyList}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</h1>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="text-[#000] dark:text-red-500"
|
||||||
|
onClick={action}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="36"
|
||||||
|
height="36"
|
||||||
|
viewBox="0 0 36 36"
|
||||||
|
fill="none"
|
||||||
|
className="fill-current"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
<svg
|
<path
|
||||||
width="36"
|
d="M36 16.16C36 17.4399 36 18.7199 36 20.0001C35.7911 20.0709 35.8636 20.2554 35.8385 20.4001C34.5321 27.9453 30.246 32.9248 22.9603 35.2822C21.9006 35.6251 20.7753 35.7657 19.6802 35.9997C18.4003 35.9997 17.1204 35.9997 15.8401 35.9997C15.5896 35.7086 15.2189 35.7732 14.9034 35.7093C7.77231 34.2621 3.08728 30.0725 0.769671 23.187C0.435002 22.1926 0.445997 21.1199 0 20.1599C0 18.7198 0 17.2798 0 15.8398C0.291376 15.6195 0.214408 15.2656 0.270759 14.9808C1.71321 7.69774 6.02611 2.99691 13.0428 0.700951C14.0118 0.383805 15.0509 0.386897 15.9999 0C17.2265 0 18.4532 0 19.6799 0C19.7156 0.124041 19.8125 0.136067 19.9225 0.146719C27.3 0.868973 33.5322 6.21922 35.3801 13.427C35.6121 14.3313 35.7945 15.2484 36 16.16ZM33.011 18.0787C33.0433 9.77105 26.3423 3.00309 18.077 2.9945C9.78479 2.98626 3.00344 9.658 2.98523 17.8426C2.96667 26.1633 9.58859 32.9601 17.7602 33.0079C26.197 33.0577 32.9787 26.4186 33.011 18.0787Z"
|
||||||
height="36"
|
fill=""
|
||||||
viewBox="0 0 36 36"
|
fillOpacity="0.6"
|
||||||
fill="none"
|
/>
|
||||||
className="fill-current"
|
<path
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
d="M15.9309 18.023C13.9329 16.037 12.007 14.1207 10.0787 12.2072C9.60071 11.733 9.26398 11.2162 9.51996 10.506C9.945 9.32677 11.1954 9.0811 12.1437 10.0174C13.9067 11.7585 15.6766 13.494 17.385 15.2879C17.9108 15.8401 18.1633 15.7487 18.6375 15.258C20.3586 13.4761 22.1199 11.7327 23.8822 9.99096C24.8175 9.06632 26.1095 9.33639 26.4967 10.517C26.7286 11.2241 26.3919 11.7413 25.9133 12.2178C24.1757 13.9472 22.4477 15.6855 20.7104 17.4148C20.5228 17.6018 20.2964 17.7495 20.0466 17.9485C22.0831 19.974 24.0372 21.8992 25.9689 23.8468C26.9262 24.8119 26.6489 26.1101 25.4336 26.4987C24.712 26.7292 24.2131 26.3441 23.7455 25.8757C21.9945 24.1227 20.2232 22.3892 18.5045 20.6049C18.0698 20.1534 17.8716 20.2269 17.4802 20.6282C15.732 22.4215 13.9493 24.1807 12.1777 25.951C11.7022 26.4262 11.193 26.7471 10.4738 26.4537C9.31345 25.9798 9.06881 24.8398 9.98589 23.8952C11.285 22.5576 12.6138 21.2484 13.9387 19.9355C14.5792 19.3005 15.2399 18.6852 15.9309 18.023Z"
|
||||||
>
|
fill="#"
|
||||||
<path
|
fillOpacity="0.6"
|
||||||
d="M36 16.16C36 17.4399 36 18.7199 36 20.0001C35.7911 20.0709 35.8636 20.2554 35.8385 20.4001C34.5321 27.9453 30.246 32.9248 22.9603 35.2822C21.9006 35.6251 20.7753 35.7657 19.6802 35.9997C18.4003 35.9997 17.1204 35.9997 15.8401 35.9997C15.5896 35.7086 15.2189 35.7732 14.9034 35.7093C7.77231 34.2621 3.08728 30.0725 0.769671 23.187C0.435002 22.1926 0.445997 21.1199 0 20.1599C0 18.7198 0 17.2798 0 15.8398C0.291376 15.6195 0.214408 15.2656 0.270759 14.9808C1.71321 7.69774 6.02611 2.99691 13.0428 0.700951C14.0118 0.383805 15.0509 0.386897 15.9999 0C17.2265 0 18.4532 0 19.6799 0C19.7156 0.124041 19.8125 0.136067 19.9225 0.146719C27.3 0.868973 33.5322 6.21922 35.3801 13.427C35.6121 14.3313 35.7945 15.2484 36 16.16ZM33.011 18.0787C33.0433 9.77105 26.3423 3.00309 18.077 2.9945C9.78479 2.98626 3.00344 9.658 2.98523 17.8426C2.96667 26.1633 9.58859 32.9601 17.7602 33.0079C26.197 33.0577 32.9787 26.4186 33.011 18.0787Z"
|
/>
|
||||||
fill=""
|
</svg>
|
||||||
fillOpacity="0.6"
|
</button>
|
||||||
/>
|
</div>
|
||||||
<path
|
{familyTask?.loading ? (
|
||||||
d="M15.9309 18.023C13.9329 16.037 12.007 14.1207 10.0787 12.2072C9.60071 11.733 9.26398 11.2162 9.51996 10.506C9.945 9.32677 11.1954 9.0811 12.1437 10.0174C13.9067 11.7585 15.6766 13.494 17.385 15.2879C17.9108 15.8401 18.1633 15.7487 18.6375 15.258C20.3586 13.4761 22.1199 11.7327 23.8822 9.99096C24.8175 9.06632 26.1095 9.33639 26.4967 10.517C26.7286 11.2241 26.3919 11.7413 25.9133 12.2178C24.1757 13.9472 22.4477 15.6855 20.7104 17.4148C20.5228 17.6018 20.2964 17.7495 20.0466 17.9485C22.0831 19.974 24.0372 21.8992 25.9689 23.8468C26.9262 24.8119 26.6489 26.1101 25.4336 26.4987C24.712 26.7292 24.2131 26.3441 23.7455 25.8757C21.9945 24.1227 20.2232 22.3892 18.5045 20.6049C18.0698 20.1534 17.8716 20.2269 17.4802 20.6282C15.732 22.4215 13.9493 24.1807 12.1777 25.951C11.7022 26.4262 11.193 26.7471 10.4738 26.4537C9.31345 25.9798 9.06881 24.8398 9.98589 23.8952C11.285 22.5576 12.6138 21.2484 13.9387 19.9355C14.5792 19.3005 15.2399 18.6852 15.9309 18.023Z"
|
<div className="h-[100px] w-full flex justify-center items-center">
|
||||||
fill="#"
|
<LoadingSpinner color="sky-blue" size="16" />
|
||||||
fillOpacity="0.6"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
{familyTask?.loading ? (
|
) : (
|
||||||
<div className="h-[100px] w-full flex justify-center items-center">
|
<>
|
||||||
<LoadingSpinner color="sky-blue" size="16" />
|
<div
|
||||||
</div>
|
className={`job-action-modal-body w-full md:grid ${
|
||||||
) : (
|
taskType !== "new" ? "md:grid-cols-2" : "md:grid-cols-1"
|
||||||
<>
|
}`}
|
||||||
<div
|
>
|
||||||
className={`job-action-modal-body w-full md:grid ${
|
<div className="p-4">
|
||||||
taskType !== "new" ? "md:grid-cols-2" : "md:grid-cols-1"
|
<div className="mb-2 w-full flex items-center gap-4">
|
||||||
}`}
|
<div className="flex items-center gap-2 text-sky-blue text-base">
|
||||||
>
|
<input
|
||||||
<div className="p-4">
|
type="radio"
|
||||||
<div className="mb-2 w-full flex items-center gap-4">
|
name="task-type"
|
||||||
<div className="flex items-center gap-2 text-sky-blue text-base">
|
value="select"
|
||||||
<input
|
className="w-[20px] h-[20px] cursor-pointer"
|
||||||
type="radio"
|
checked={taskType == "select"}
|
||||||
name="task-type"
|
onChange={switchTaskType}
|
||||||
value="select"
|
/>
|
||||||
className="w-[20px] h-[20px] cursor-pointer"
|
<span>Select Task</span>
|
||||||
checked={taskType == "select"}
|
|
||||||
onChange={switchTaskType}
|
|
||||||
/>
|
|
||||||
<span>Select Task</span>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center gap-2 text-sky-blue text-base">
|
|
||||||
<input
|
|
||||||
type="radio"
|
|
||||||
name="task-type"
|
|
||||||
value="new"
|
|
||||||
className="w-[20px] h-[20px] cursor-pointer"
|
|
||||||
checked={taskType == "new"}
|
|
||||||
onChange={switchTaskType}
|
|
||||||
/>
|
|
||||||
<span>New Task</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/* Task Type === select */}
|
<div className="flex items-center gap-2 text-sky-blue text-base">
|
||||||
{taskType == "select" && (
|
<input
|
||||||
<div className="p-4 w-full h-[400px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
type="radio"
|
||||||
{familyTask?.data?.length ? (
|
name="task-type"
|
||||||
familyTask?.data?.map((item, index) => (
|
value="new"
|
||||||
<div
|
className="w-[20px] h-[20px] cursor-pointer"
|
||||||
key={item.job_uid}
|
checked={taskType == "new"}
|
||||||
className="mb-2 flex justify-start items-center gap-2 text-sky-blue text-base cursor-pointer"
|
onChange={switchTaskType}
|
||||||
onClick={() =>
|
/>
|
||||||
|
<span>New Task</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* Task Type === select */}
|
||||||
|
{taskType == "select" && (
|
||||||
|
<div className="p-4 w-full h-[400px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
||||||
|
{familyTask?.data?.length ? (
|
||||||
|
familyTask?.data?.map((item, index) => (
|
||||||
|
<div
|
||||||
|
key={item.job_uid}
|
||||||
|
className="mb-2 flex justify-start items-center gap-2 text-sky-blue text-base cursor-pointer"
|
||||||
|
onClick={() => handleActiveTask(item.job_uid, item)}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name="task-list"
|
||||||
|
checked={
|
||||||
|
activeTask.id == item.job_uid ||
|
||||||
|
(activeTask.id == index && true)
|
||||||
|
}
|
||||||
|
onChange={() =>
|
||||||
handleActiveTask(item.job_uid, item)
|
handleActiveTask(item.job_uid, item)
|
||||||
}
|
}
|
||||||
>
|
className="w-[15px] h-[15px] cursor-pointer"
|
||||||
<input
|
/>
|
||||||
type="radio"
|
<p className="w-full text-dark-gray dark:text-white tracking-wide">
|
||||||
name="task-list"
|
{item?.title}
|
||||||
checked={
|
|
||||||
activeTask.id == item.job_uid ||
|
|
||||||
(activeTask.id == index && true)
|
|
||||||
}
|
|
||||||
onChange={() =>
|
|
||||||
handleActiveTask(item.job_uid, item)
|
|
||||||
}
|
|
||||||
className="w-[15px] h-[15px] cursor-pointer"
|
|
||||||
/>
|
|
||||||
<p className="w-full text-dark-gray dark:text-white tracking-wide">
|
|
||||||
{item?.title}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
))
|
|
||||||
) : (
|
|
||||||
<p className="p-8 text-lg text-dark-gray dark:text-white tracking-wide text-center cursor-default">
|
|
||||||
No Task found!
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{taskType == "new" && (
|
|
||||||
<div className="p-4 w-full h-[400px]">
|
|
||||||
<NewTasks
|
|
||||||
formState={formState}
|
|
||||||
setFormState={setFormState}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/*Right Hand Side for details && Task Type === select */}
|
|
||||||
{taskType == "select" && (
|
|
||||||
<>
|
|
||||||
{familyTask?.data?.length > 0 ? (
|
|
||||||
<div className="p-4">
|
|
||||||
<div className="w-full">
|
|
||||||
<p className="text-lg font-bold text-dark-gray dark:text-white tracking-wide border-b-2">
|
|
||||||
{activeTask?.data?.title}
|
|
||||||
</p>
|
</p>
|
||||||
<div className="my-3">
|
|
||||||
<Detail
|
|
||||||
label="Description"
|
|
||||||
value={activeTask?.data?.description}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center">
|
|
||||||
<div className="my-3 w-full flex items-center gap-1">
|
|
||||||
<label className="text-slate-900 dark:text-white tracking-wide font-semibold">
|
|
||||||
Price
|
|
||||||
</label>
|
|
||||||
<p className="p-1 text-sm text-slate-900 dark:text-white">
|
|
||||||
{PriceFormatter(
|
|
||||||
activeTask?.data?.price * 0.01,
|
|
||||||
activeTask?.data?.currency,
|
|
||||||
activeTask?.data?.curreny_code
|
|
||||||
)}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="my-3 w-full flex items-center gap-1">
|
|
||||||
<label className="text-slate-900 dark:text-white tracking-wide font-semibold">
|
|
||||||
Timeline
|
|
||||||
</label>
|
|
||||||
<p className="p-1 text-sm text-slate-900 dark:text-white">{`${activeTask?.data?.timeline_days} day(s)`}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="my-3 sm:flex items-center">
|
|
||||||
<Detail
|
|
||||||
label="Created"
|
|
||||||
value={`Dummy, no value found for created!`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="my-3">
|
|
||||||
<label className="w-full text-slate-900 dark:text-white tracking-wide font-semibold">
|
|
||||||
Delivery Detail
|
|
||||||
</label>
|
|
||||||
<textarea
|
|
||||||
className={`p-1 w-full text-sm text-slate-900 dark:text-white bg-transparent outline-none border border-slate-300 rounded-md`}
|
|
||||||
rows="5"
|
|
||||||
style={{ resize: "none" }}
|
|
||||||
value={activeTask?.data?.job_detail}
|
|
||||||
readOnly
|
|
||||||
// onChange={handleInputChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
))
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<p className="p-8 text-lg text-dark-gray dark:text-white tracking-wide text-center cursor-default">
|
||||||
|
No Task found!
|
||||||
|
</p>
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
|
)}
|
||||||
|
{taskType == "new" && (
|
||||||
|
<div className="p-4 w-full h-[400px]">
|
||||||
|
<NewTasks
|
||||||
|
formState={formState}
|
||||||
|
setFormState={setFormState}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* BTN */}
|
{/*Right Hand Side for details && Task Type === select */}
|
||||||
<div className="py-2 px-4 border-t-2 flex justify-between items-center">
|
{taskType == "select" && (
|
||||||
{/* error or success display */}
|
<>
|
||||||
<div className="w-auto h-auto flex items-center">
|
{familyTask?.data?.length > 0 ? (
|
||||||
{requestStatus.message != "" &&
|
<div className="p-4">
|
||||||
(!requestStatus.status ? (
|
<div className="w-full">
|
||||||
|
<p className="text-lg font-bold text-dark-gray dark:text-white tracking-wide border-b-2">
|
||||||
|
{activeTask?.data?.title}
|
||||||
|
</p>
|
||||||
|
<div className="my-3">
|
||||||
|
<Detail
|
||||||
|
label="Description"
|
||||||
|
value={activeTask?.data?.description}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<div className="my-3 w-full flex items-center gap-1">
|
||||||
|
<label className="job-label">
|
||||||
|
Price
|
||||||
|
</label>
|
||||||
|
<p className="p-1 text-sm text-slate-900 dark:text-white">
|
||||||
|
{PriceFormatter(
|
||||||
|
activeTask?.data?.price * 0.01,
|
||||||
|
activeTask?.data?.currency,
|
||||||
|
activeTask?.data?.curreny_code
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="my-3 w-full flex items-center gap-1">
|
||||||
|
<label className="job-label">
|
||||||
|
Timeline
|
||||||
|
</label>
|
||||||
|
<p className="p-1 text-sm text-slate-900 dark:text-white">{`${activeTask?.data?.timeline_days} day(s)`}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Dummy, no value found for created! thus commented*/}
|
||||||
|
{/* <div className="my-3 sm:flex items-center">
|
||||||
|
<Detail
|
||||||
|
label="Created"
|
||||||
|
value={`Dummy, no value found for created!`}
|
||||||
|
/>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
|
<div className="my-3">
|
||||||
|
<label className="w-full job-label">
|
||||||
|
Delivery Detail
|
||||||
|
</label>
|
||||||
|
<textarea
|
||||||
|
className={`p-1 w-full text-sm text-slate-900 dark:text-white bg-transparent outline-none border border-slate-300 rounded-md`}
|
||||||
|
rows="5"
|
||||||
|
style={{ resize: "none" }}
|
||||||
|
value={activeTask?.data?.job_detail}
|
||||||
|
readOnly
|
||||||
|
// onChange={handleInputChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* BTN */}
|
||||||
|
<div className="py-2 px-4 border-t-2 flex justify-between items-center">
|
||||||
|
{/* error or success display */}
|
||||||
|
<div className="w-auto h-auto flex items-center">
|
||||||
|
{requestStatus.message != "" &&
|
||||||
|
(!requestStatus.status ? (
|
||||||
|
<div
|
||||||
|
className={`relative p-2 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px] self-start`}
|
||||||
|
>
|
||||||
|
{requestStatus.message}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
requestStatus.status && (
|
||||||
<div
|
<div
|
||||||
className={`relative p-2 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px] self-start`}
|
className={`relative p-2 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
>
|
>
|
||||||
{requestStatus.message}
|
{requestStatus.message}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
)
|
||||||
requestStatus.status && (
|
))}
|
||||||
<div
|
</div>
|
||||||
className={`relative p-2 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
|
||||||
>
|
|
||||||
{requestStatus.message}
|
|
||||||
</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}
|
||||||
type="button"
|
type="button"
|
||||||
className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white cursor-pointer"
|
className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white cursor-pointer"
|
||||||
>
|
>
|
||||||
<span className="text-gradient">Close</span>
|
<span className="text-gradient">Close</span>
|
||||||
</button>
|
</button>
|
||||||
<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}
|
||||||
onClick={assignFamilyTask}
|
onClick={assignFamilyTask}
|
||||||
className="px-1 w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white cursor-pointer"
|
className="px-1 w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white cursor-pointer"
|
||||||
>
|
>
|
||||||
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}`
|
||||||
</div>
|
// : "Assign"}
|
||||||
|
// </button>
|
||||||
|
// )
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</div>
|
||||||
)}
|
</>
|
||||||
</div>
|
)}
|
||||||
</ModalCom>
|
</div>
|
||||||
</>
|
</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>} */}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ export default function FamilyTableNew() {
|
|||||||
image_link={details.familyWaitList.link}
|
image_link={details.familyWaitList.link}
|
||||||
familyData={details.familyWaitList.data}
|
familyData={details.familyWaitList.data}
|
||||||
loader={details.familyWaitList.loading}
|
loader={details.familyWaitList.loading}
|
||||||
|
setUpdatePage={setUpdatePage}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
Pending: (
|
Pending: (
|
||||||
@@ -213,6 +214,8 @@ export default function FamilyTableNew() {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// 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`}
|
||||||
@@ -277,6 +280,7 @@ export default function FamilyTableNew() {
|
|||||||
setActiveTask={setActiveTask}
|
setActiveTask={setActiveTask}
|
||||||
activeTask={activeTask}
|
activeTask={activeTask}
|
||||||
setUpdatePage={setUpdatePage}
|
setUpdatePage={setUpdatePage}
|
||||||
|
// updateFamilyPendingTable={updateFamilyPendingTable}
|
||||||
pathname={pathname}
|
pathname={pathname}
|
||||||
assignTaskChecker={assignTaskChecker}
|
assignTaskChecker={assignTaskChecker}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const FamilyNewWaitlist = ({
|
|||||||
className,
|
className,
|
||||||
accountDetails,
|
accountDetails,
|
||||||
loader,
|
loader,
|
||||||
|
setUpdatePage
|
||||||
}) => {
|
}) => {
|
||||||
const [popUp, setPopUp] = useState({ show: false, data: {} });
|
const [popUp, setPopUp] = useState({ show: false, data: {} });
|
||||||
const [continueTaskPopup, setContinueTaskPopup] = useState({
|
const [continueTaskPopup, setContinueTaskPopup] = useState({
|
||||||
@@ -143,6 +144,7 @@ const FamilyNewWaitlist = ({
|
|||||||
details={continueTaskPopup.data}
|
details={continueTaskPopup.data}
|
||||||
action={closeContinueTaskPopup}
|
action={closeContinueTaskPopup}
|
||||||
situation={continueTaskPopup.show}
|
situation={continueTaskPopup.show}
|
||||||
|
setUpdatePage={setUpdatePage}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -84,9 +84,9 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
|
|
||||||
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">
|
||||||
{isManageFamilyPage
|
{isManageFamilyPage
|
||||||
? `${state?.firstname}'s Suggested Task`
|
? `${state?.firstname}'s Suggested Task`
|
||||||
: isActivitiesPage
|
: isActivitiesPage
|
||||||
@@ -131,12 +131,12 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
>
|
>
|
||||||
{(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`,
|
||||||
}}
|
}}
|
||||||
@@ -144,9 +144,9 @@ 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" ||
|
pathname === "/manage-family" ||
|
||||||
@@ -155,6 +155,7 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
: "px-6"
|
: "px-6"
|
||||||
}
|
}
|
||||||
label="Title"
|
label="Title"
|
||||||
|
labalClass="text-[1.125rem]"
|
||||||
labelClass="tracking-wide"
|
labelClass="tracking-wide"
|
||||||
inputBg={
|
inputBg={
|
||||||
pathname === "/manage-family" ||
|
pathname === "/manage-family" ||
|
||||||
@@ -178,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>
|
||||||
)}
|
)}
|
||||||
@@ -197,8 +198,8 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
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" ||
|
||||||
pathname === "/acc-family/activities"
|
pathname === "/acc-family/activities"
|
||||||
? "px-2 h-[110px]"
|
? "px-2 h-[6.875rem]"
|
||||||
: "bg-slate-100 px-3 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px] h-[130px]"
|
: "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"
|
||||||
@@ -211,7 +212,7 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
{/* Radio buttons for family */}
|
{/* Radio buttons for family */}
|
||||||
{pathname === "/manage-family" ||
|
{pathname === "/manage-family" ||
|
||||||
pathname === "/acc-family/activities" ? (
|
pathname === "/acc-family/activities" ? (
|
||||||
<div className="h-[20px] w-full border-t dark:border-[#5356fb29] border-light-purple relative">
|
<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>
|
||||||
@@ -229,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
|
||||||
@@ -238,7 +239,7 @@ 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)}
|
||||||
@@ -250,7 +251,7 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
|||||||
: title === "Duplicate"
|
: title === "Duplicate"
|
||||||
? "text-purple"
|
? "text-purple"
|
||||||
: "text-black"
|
: "text-black"
|
||||||
} font-semibold`}
|
} font-semibold text-[1.125rem]`}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</span>
|
</span>
|
||||||
@@ -262,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"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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 { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
import SearchCom from "../Helpers/SearchCom";
|
import SearchCom from "../Helpers/SearchCom";
|
||||||
import { localImgLoad } from "../../lib";
|
import { localImgLoad } from "../../lib";
|
||||||
@@ -13,17 +13,17 @@ 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 }) {
|
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(data[0])
|
const [selectedWallet, setSelectedWallet] = useState('')
|
||||||
|
|
||||||
const [activeWalletBtn, setActiveWalletBtn] = useState(data[0].code)
|
const [activeWalletBtn, setActiveWalletBtn] = useState('')
|
||||||
|
|
||||||
const handleChangeWallet = ({target:{name}}) => { // FUNCTION TO SWITCH WALLET IF USER HAS MORE THAN TWO WALLETS
|
const handleChangeWallet = ({target:{name}}) => { // FUNCTION TO SWITCH WALLET IF USER HAS MORE THAN TWO WALLETS
|
||||||
const currentWalletSelected = data?.filter((item) => item.code == name);
|
const currentWalletSelected = wallet?.data?.filter((item) => item.code == name);
|
||||||
setSelectedWallet(currentWalletSelected[0])
|
setSelectedWallet(currentWalletSelected[0])
|
||||||
setActiveWalletBtn(name)
|
setActiveWalletBtn(name)
|
||||||
// console.log(name, currentWalletSelected)
|
// console.log(name, currentWalletSelected)
|
||||||
@@ -33,63 +33,70 @@ export default function FamilyWalletBox({ wallet, payment }) {
|
|||||||
? `${selectedWallet?.code.toLowerCase()}.svg`
|
? `${selectedWallet?.code.toLowerCase()}.svg`
|
||||||
: "default.png";
|
: "default.png";
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
setSelectedWallet(wallet.data[0])
|
||||||
|
setActiveWalletBtn(wallet?.data[0]?.code)
|
||||||
|
},[wallet])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full">
|
<div className="w-full">
|
||||||
<div className="my-wallet-wrapper w-full mb-10">
|
<div className="my-wallet-wrapper w-full">
|
||||||
<div className="main-wrapper w-full">
|
<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 h-full flex items-center justify-center bg-white">
|
<div className="w-full mb-4 sm:mb-0 rounded-2xl bg-white dark:bg-dark-white overflow-hidden">
|
||||||
<LoadingSpinner size="16" color="sky-blue" height='h-[30rem]' />
|
{wallet?.loading ?
|
||||||
</div>
|
<div className="w-full h-full flex items-center justify-center bg-white">
|
||||||
|
<LoadingSpinner size="16" color="sky-blue" height='min-h-[240px]' />
|
||||||
: data.length > 0 ?
|
|
||||||
<div className="w-full mb-10 sm:grid grid-cols-2 gap-4">
|
|
||||||
<div className="w-full mb-4 sm:mb-0">
|
|
||||||
<div className="wal-selection text-black dark:text-white flex items-center gap-2">
|
|
||||||
{data.length > 1 && 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 className="p-5 rounded-2xl 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-[120px] max-h-min md:max-h-[120px] 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>
|
|
||||||
<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>
|
||||||
:
|
: wallet?.data.length > 0 ?
|
||||||
<div className="w-full h-32 flex justify-center items-center rounded-2xl bg-white">
|
<>
|
||||||
<p>No Wallet Record Found</p>
|
{wallet?.data?.length > 1 &&
|
||||||
|
<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 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>
|
||||||
}
|
<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 className="w-full">
|
|
||||||
<FamilyWalletRedeemOptions />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
+25
-5
@@ -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,6 +16,20 @@ const FamilyWallet = () => {
|
|||||||
data: [],
|
data: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const [familyWalletBal, setFamilyWalletBal] = useState({
|
||||||
|
loading: true,
|
||||||
|
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()
|
||||||
@@ -24,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(() => {
|
||||||
@@ -33,6 +48,7 @@ const FamilyWallet = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getPaymentHistory();
|
getPaymentHistory();
|
||||||
|
getFamilyWalletBal()
|
||||||
}, [walletTable]);
|
}, [walletTable]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -48,9 +64,13 @@ 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}
|
||||||
/>
|
/>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
@@ -58,4 +78,4 @@ const FamilyWallet = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default FamilyWallet;
|
export default FamilyWalletCon;
|
||||||
@@ -45,7 +45,7 @@ export default function FamilyWalletRedeemOptions() {
|
|||||||
<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'>
|
<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]' />
|
<LoadingSpinner size='10' color='sky-blue' height='h-[30rem]' />
|
||||||
</div>
|
</div>
|
||||||
: Object.keys(familyWalletRedeemOptList?.data)?.length > 0 ?
|
: familyWalletRedeemOptList?.data && Object.keys(familyWalletRedeemOptList?.data)?.length > 0 ?
|
||||||
Object.keys(filteredRedeemData?.data)?.length ?
|
Object.keys(filteredRedeemData?.data)?.length ?
|
||||||
<div className="mt-5 grid sm:grid-cols-2 lg:grid-cols-3 xxl:grid-cols-4 gap-4">
|
<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)=>{
|
{ Object.keys(filteredRedeemData?.data)?.map((item)=>{
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -14,8 +14,12 @@ 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 {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());
|
||||||
@@ -23,23 +27,20 @@ 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
|
||||||
|
|
||||||
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
|
||||||
};
|
};
|
||||||
@@ -105,6 +106,8 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
loadProfile();
|
loadProfile();
|
||||||
|
}else{
|
||||||
|
setIsLogin({ loading: false, status: true });
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@@ -189,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 {
|
||||||
@@ -203,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
|
||||||
@@ -219,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(() => {
|
||||||
@@ -241,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) => {
|
||||||
@@ -253,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
|
||||||
@@ -309,6 +318,16 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
familyWalletRedeemOptions()
|
familyWalletRedeemOptions()
|
||||||
}, [isLogin.status]);
|
}, [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 ? (
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ const initialState = {
|
|||||||
uploadsTable: false,
|
uploadsTable: false,
|
||||||
familyBannersListTable: false,
|
familyBannersListTable: false,
|
||||||
chatMessageList: false,
|
chatMessageList: false,
|
||||||
|
marketTableList: false,
|
||||||
|
familyOfferList: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tableReloadSlice = createSlice({
|
export const tableReloadSlice = createSlice({
|
||||||
@@ -45,6 +47,12 @@ export const tableReloadSlice = createSlice({
|
|||||||
case "CHATMESSAGELIST":
|
case "CHATMESSAGELIST":
|
||||||
state.chatMessageList = !state.chatMessageList;
|
state.chatMessageList = !state.chatMessageList;
|
||||||
return;
|
return;
|
||||||
|
case "MARKETTABLELIST":
|
||||||
|
state.marketTableList = !state.marketTableList;
|
||||||
|
return;
|
||||||
|
case "FAMILYOFFERLIST":
|
||||||
|
state.familyOfferList = !state.familyOfferList;
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 />;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user