Compare commits

..

15 Commits

Author SHA1 Message Date
victorAnumudu 944fd134f6 added image to assign task popout 2024-03-20 18:02:47 +01:00
ameye a910ab177f Merge branch 'modal-change' of WrenchBoard/Users-Wrench into master 2024-03-19 23:33:19 +00:00
victorAnumudu 4e741f587c added color to modal and made the labels same font 2024-03-19 22:42:52 +01:00
tokslaw f779529cc6 Merge branch 'kid-accepts-task' of WrenchBoard/Users-Wrench into master 2024-03-19 20:17:00 +00:00
victorAnumudu 44cedf2f65 Made parent family task list refresh when child accepts task 2024-03-19 20:27:29 +01:00
ameye fbcba191b0 Merge branch 'rounded-select' of WrenchBoard/Users-Wrench into master 2024-03-19 14:51:37 +00:00
victorAnumudu c64d372193 assign job rounded select tag 2024-03-19 14:33:42 +01:00
ameye abff42e0a8 Merge branch 'parent-assign-job-bug' of WrenchBoard/Users-Wrench into master 2024-03-19 12:13:06 +00:00
victorAnumudu d5c342a57a made socket to trigger for refresh for only the child the parent assigns a job to 2024-03-19 13:09:06 +01:00
victorAnumudu 60d6629526 made socket to trigger for refresh for only the child the parent assigns a job to 2024-03-19 11:45:18 +01:00
tokslaw b1fbf89f10 Merge branch 'parent-assign-job' of WrenchBoard/Users-Wrench into master 2024-03-18 21:02:02 +00:00
victorAnumudu ae346d5ac5 parent assign job triggers update in child account 2024-03-18 21:38:41 +01:00
victorAnumudu 75b5102766 Merge master into parent-assign-job 2024-03-18 19:31:01 +01:00
victorAnumudu 9b12ffe0cd initial commit 2024-03-18 19:29:35 +01:00
tokslaw 408165e718 Merge branch 'assign-modal' of WrenchBoard/Users-Wrench into master 2024-03-18 15:35:33 +00:00
19 changed files with 219 additions and 103 deletions
+13 -13
View File
@@ -89,9 +89,9 @@ function AddJob({ popUpHandler, categories }) {
<div className="field w-full mb-6 xl:mb-0">
<label
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 job-label-flex"
>
Currency
<span>Currency</span>
{props.errors.country && props.touched.country && (
<span className="text-[12px] text-red-500">
{props.errors.country}
@@ -136,9 +136,9 @@ function AddJob({ popUpHandler, categories }) {
{/* Price */}
<div className="field w-full">
<InputCom
fieldClass="px-6 text-right"
fieldClass="px-6 text-right flex"
label="Price"
labelClass="tracking-wide"
labelClass=""
type="number"
name="price"
placeholder="0"
@@ -159,7 +159,7 @@ function AddJob({ popUpHandler, categories }) {
<InputCom
fieldClass="px-6"
label="Title"
labelClass="tracking-wide"
labelClass=""
type="text"
name="title"
value={props.values.title}
@@ -178,7 +178,7 @@ function AddJob({ popUpHandler, categories }) {
<InputCom
fieldClass="px-6"
label="Description"
labelClass="tracking-wide"
labelClass=""
type="text"
name="description"
value={props.values.description}
@@ -197,7 +197,7 @@ function AddJob({ popUpHandler, categories }) {
<div className="sm:w-[60%] w-full">
<label
htmlFor="Job Delivery Details"
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-label-flex"
>
Job Delivery Details
{props.errors.job_detail &&
@@ -220,13 +220,13 @@ function AddJob({ popUpHandler, categories }) {
</div>
<div className="sm:w-[35%] w-full">
<div
<label
htmlFor="Job Categories"
className='className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block"'
className='job-label'
id="checked-group"
>
Categories
</div>
</label>
<div
className="sm:flex-col flex flex-wrap px-3 mt-3"
role="group"
@@ -266,7 +266,7 @@ function AddJob({ popUpHandler, categories }) {
<div className="field w-full mb-[5px]">
<div className={`flex items-center justify-between mb-2.5`}>
<label
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block"
className="job-label"
htmlFor="timeline_days"
>
Timeline
@@ -328,10 +328,10 @@ function AddJob({ popUpHandler, categories }) {
<div className="flex items-center space-x-4 mr-9">
<button
type="button"
className="text-18 text-light-red tracking-wide "
className="text-18 tracking-wide h-11 flex justify-center items-center border border-light-red text-base rounded-full text-light-red cursor-pointer"
>
<span
className="border-b dark:border-[#5356fb29] border-light-red"
className="px-2"
onClick={popUpHandler}
>
{" "}
+2 -1
View File
@@ -145,8 +145,9 @@ export default function Login() {
localStorage.setItem("member_id", `${res.data.member_id}`);
localStorage.setItem("uid", `${res.data.uid}`);
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("parent_uid", res.data?.parent_uid);
}
// localStorage.setItem("session", `${res.data.session}`);
dispatch(updateUserDetails({ ...res.data }));
+27 -4
View File
@@ -1,12 +1,14 @@
import React, { createContext, useContext, useEffect, useState } from "react";
import { tableReload } from "../../store/TableReloads";
import { useDispatch } from "react-redux";
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);
@@ -36,14 +38,34 @@ export default function SocketIOContextProvider({children}) {
}
};
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'}))
dispatch(tableReload({type:'CHATMESSAGELIST'})) // dispatches to update chat message sending from owner to worker and vice versa
});
socket.on("received_refreshmarket_jobs", (data) => {
// setSocketMsgReceived(data.message);
dispatch(tableReload({type:'MARKETTABLELIST'}))
dispatch(tableReload({type:'MARKETTABLELIST'})) // dispatches to update market list on full account
});
socket.on("family_actions", (data) => {
// setSocketMsgReceived(data.message);
let user_uid = userDetails.account_type == 'FULL' ? userDetails.uid : sessionStorage.getItem('family_uid') // gets user UID
let {message} = data
if(message.action == "REFRESH_OFFER" && message.family_uid == user_uid && message.audience == "MEMBER"){ // for refreshing child account when parent assigns a job
dispatch(tableReload({type:'FAMILYOFFERLIST'})) // dispatches to update family pending/offer list on family side
}
if(message.action == "REFRESH_TASK" && message.audience == "PARENT"){ // for refreshing parent account when child accepts or rejects a job
dispatch(tableReload({type:'PARENTFAMILYTASKLIST'})) // dispatches to update parent family task list on parent side
}
// console.log('DATA', data)
});
}, [socket]);
@@ -52,8 +74,9 @@ export default function SocketIOContextProvider({children}) {
sendMessage,
joinRoom,
setSocketMsgReceived,
socketMsgReceived,
marketUpdate,
parentAssignJobToKid,
socketMsgReceived,
// room,
// setRoom,
// message,
@@ -52,7 +52,13 @@ export default function FamilyActivities() {
<span>Family</span>
</Link>
</div>
<Suspense fallback={<LoadingSpinner color="sky-blue" size="16" />}>
<Suspense
fallback={
<div className="bg-white">
<LoadingSpinner color="sky-blue" size="16" height='h-[30rem]' />
</div>
}
>
<FamilyTableNew />
</Suspense>
</div>
@@ -4,26 +4,27 @@ import MyOffersFamilyTable from '../MyTasks/MyOffersFamilyTable'
import LoadingSpinner from '../Spinners/LoadingSpinner';
import usersService from '../../services/UsersService';
import CustomBreadcrumb from '../Breadcrumb/CustomBreadcrumb';
import { useSelector } from 'react-redux';
export default function FamilyPendingOffer() {
const userApi = new usersService();
const {familyOfferList} = useSelector((state) => state.tableReload)
const [myOffersList, setMyOffersList] = useState({loading: true, data: []});
const getMyOffersList = async () => {
try {
const res = await userApi.getOffersList();
setMyOffersList({loading:false, data:res.data});
console.log('SAME', res.data)
} catch (error) {
setMyOffersList({loading:false, data:[]});
console.log("Error getting offers", error);
}
};
useEffect(()=>{
getMyOffersList()
},[])
},[familyOfferList])
return (
<Layout>
{myOffersList.loading ?
@@ -1,5 +1,5 @@
import React, { useEffect, useState } from "react";
import { useDispatch } from "react-redux";
import React, { Suspense, useEffect, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { useLocation } from "react-router-dom";
import usersService from "../../../services/UsersService";
import { tableReload } from "../../../store/TableReloads";
@@ -8,6 +8,7 @@ import { PriceFormatter } from "../../Helpers/PriceFormatter";
import LoadingSpinner from "../../Spinners/LoadingSpinner";
import Detail from "../../jobPopout/popoutcomponent/Detail";
import { NewTasks } from "./forms";
import { SocketValues } from "../../Contexts/SocketIOContext";
const AssignTaskPopout = ({
action,
@@ -21,9 +22,14 @@ const AssignTaskPopout = ({
assignTaskChecker,
}) => {
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) => {
@@ -76,7 +82,7 @@ const AssignTaskPopout = ({
setRequestStatus({ loading: true, status: false, message: "" });
if(!selectedFamilyUid){ // If no family found, throw error
setRequestStatus({ loading: false, status: false, message: "Please Select Family Member" });
setRequestStatus({ loading: false, status: false, message: "Please Select a Kid" });
return setTimeout(() => {
setRequestStatus({ loading: false, status: false, message: "" });
}, 3000);
@@ -188,6 +194,16 @@ const AssignTaskPopout = ({
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(() => {
setRequestStatus({ loading: false, status: false, message: "" });
action(); // FUNCTION THAT CLOSES THE MODAL BOX
@@ -205,7 +221,10 @@ const AssignTaskPopout = ({
setRequestStatus({ loading: false, status: false, message: "" });
}, 5000);
});
};
};
let imageSrc = (localStorage.getItem("session_token")
? `${userDetails?.session_image_server}${localStorage.getItem("session_token")}/job/${activeTask.data.job_uid}` : ""); // FOR GETTING JOB IMAGE
useEffect(()=>{ // effect to update family UID when components mounts
if(familyDetailsData?.uid){
@@ -217,28 +236,29 @@ const AssignTaskPopout = ({
}
},[])
return (
<>
<ModalCom 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-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 flex items-center">
<div className="modal-header-con">
<h1 className="modal-title">
{details ? (
` Assign ${details?.firstname}'s Task`
) : familyDetailsData ? (
` Assign ${familyDetailsData.firstname}'s Task`
) : (
<div className="flex items-center">
<div className="flex items-center gap-2">
<span className="text-black">Assign task to{" "}</span>
<div className="w-[270px] h-[40px] ml-2">
<div className="w-[270px] h-[40px] flex items-center">
<select
name=""
id=""
className="text-white px-2 transition-all cursor-pointer bg-blue-900 focus:outline-none border border-gray-200 rounded-lg w-full h-full py-1"
className="text-lg text-black/80 px-2 tracking-wide font-semibold transition-all cursor-pointer bg-white focus:outline-none border border-gray-200 rounded-full w-full h-full"
onChange={handleFamChange}
value={selectedFamilyUid}
>
<option value="">
<option value="" className="">
Select a kid
</option>
{familyList}
@@ -249,7 +269,7 @@ const AssignTaskPopout = ({
</h1>
<button
type="button"
className="text-[#000] dark:text-red-500"
className="modal-close-btn"
onClick={action}
>
<svg
@@ -368,25 +388,37 @@ const AssignTaskPopout = ({
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="grid grid-cols-2">
<div className="w-full">
<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 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>
<div className="w-full flex items-center justify-center">
<div className="w-28 h-28 rounded-2xl flex items-center justify-center">
<img
className="w-full h-auto"
loading="lazy"
src={imageSrc}
alt='job image'
/>
</div>
</div>
</div>
+20 -9
View File
@@ -4,6 +4,7 @@ import { apiConst } from "../../lib/apiConst";
import usersService from "../../services/UsersService";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import AssignTaskPopout from "./FamilyPopout/AssignTaskPopout";
import { useSelector } from "react-redux";
// Lazy Imports for components
const FamilyWaitlist = lazy(() => import("./Tabs/FamilyNewWaitlist"));
@@ -11,11 +12,15 @@ const FamilyTasks = lazy(() => import("./Tabs/FamilyNewTasks"));
const FamilyPending = lazy(() => import("./Tabs/FamilyNewPending"));
export default function FamilyTableNew() {
const { parentFamilyTaskList } = useSelector((state) => state.tableReload);
console.log('parentFamilyTaskList', parentFamilyTaskList)
let { pathname } = useLocation();
// Initial state for family details
const initialDetailState = {
loading: false,
loading: true,
data: null,
link: "",
};
@@ -115,13 +120,13 @@ export default function FamilyTableNew() {
useEffect(() => {
const manageFamily = async () => {
try {
resetDetails();
// resetDetails();
setDetails({
familyTasks: { loading: true },
familyWaitList: { loading: true },
familyPending: { loading: true },
});
// setDetails({
// familyTasks: { loading: true },
// familyWaitList: { loading: true },
// familyPending: { loading: true },
// });
// const { family_uid } = accountDetails;
// const reqData = { family_uid };
@@ -169,7 +174,13 @@ export default function FamilyTableNew() {
},
});
} catch (error) {
resetDetails();
// resetDetails();
setDetails({
familyDetails: { ...initialDetailState, loading: false, },
familyTasks: { ...initialDetailState, loading: false, },
familyWaitList: { ...initialDetailState, loading: false,},
familyPending: { ...initialDetailState, loading: false, },
})
setErrMsg("An error occurred");
throw new Error(error);
}
@@ -177,7 +188,7 @@ export default function FamilyTableNew() {
// Invoke the manageFamily function when the component mounts
manageFamily();
}, [updatePage]);
}, [updatePage, parentFamilyTaskList]);
// Effect to manage family tasks
useEffect(() => {
+6 -6
View File
@@ -84,9 +84,9 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
return (
<ModalCom action={onClose} situation={situation}>
<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-[1.875rem] py-[1.4375rem] border-b dark:border-[#5356fb29] border-light-purple">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
<div className="logout-modal-wrapper lw-[90%] md:w-[48rem] min-h-[500px] bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="modal-header-con">
<h1 className="modal-title">
{isManageFamilyPage
? `${state?.firstname}'s Suggested Task`
: isActivitiesPage
@@ -95,7 +95,7 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
className="modal-close-btn"
onClick={onClose}
>
<svg
@@ -179,10 +179,10 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
</div>
{/* Description */}
<div className="field w-full mb-[.3125rem]">
<div className="w-full mb-[.3125rem]">
<label
htmlFor="description"
className='input-label text-[#181c32] dark:text-white text-[1.125rem] leading-[1.3102rem] font-semibold flex items-center gap-1'
className='job-label'
>
Description
{props.errors.description &&
@@ -54,7 +54,7 @@ export default function InputCom({
<div className={`flex items-center justify-between mb-2.5 ${labelClass}`}>
{label && (
<label
className={`input-label text-[#181c32] text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1 ${labalClass}`}
className={`job-label ${error && 'job-label-flex'} ${labalClass}`}
htmlFor={name}
>
{label}
+1 -4
View File
@@ -20,10 +20,7 @@ export default function Layout({ children }) {
};
const navigate = useNavigate();
const logOut = () => {
localStorage.removeItem("session_token");
localStorage.removeItem("member_id");
localStorage.removeItem("uid");
sessionStorage.removeItem("family_uid");
sessionStorage.clear();
localStorage.clear();
// toast.success("Come Back Soon", {
// icon: `🙂`,
+5 -5
View File
@@ -64,13 +64,13 @@ function DeleteJobPopout({ details, onClose, situation }) {
return (
<ModalCom action={onClose} situation={situation}>
<div className="logout-modal-wrapper lg:w-[600px] bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b border-light-purple dark:border-[#5356fb29] ">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
<div className="modal-header-con">
<h1 className="modal-title">
Delete Job
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
className="modal-close-btn"
onClick={onClose}
>
<svg
@@ -119,10 +119,10 @@ function DeleteJobPopout({ details, onClose, situation }) {
{details.title}
</p>
<p className="text-lg tracking-wide text-dark-gray dark:text-white flex items-start gap-1">
Price: {details.thePrice}
<span className="job-label">Price: </span>{details.thePrice}
</p>
<p className="text-lg tracking-wide text-dark-gray dark:text-white">
Duration: {details.timeline_days} day(s)
<span className="job-label">Duration: </span>{details.timeline_days} day(s)
</p>
</div>
<div className="flex space-x-2.5">
+7 -7
View File
@@ -212,13 +212,13 @@ const EditJobPopOut = ({
return (
<ModalCom action={onClose} situation={situation}>
<div className="logout-modal-wrapper w-11/12 lg:w-[600px] bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b border-light-purple dark:border-[#5356fb29] ">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
<div className="modal-header-con">
<h1 className="modal-title">
Edit Job
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
className="modal-close-btn"
onClick={onClose}
>
<svg
@@ -328,8 +328,8 @@ const EditJobPopOut = ({
<div className="field flex flex-col sm:flex-row w-full mb-[5px] gap-2">
<div className="sm:w-[60%] w-full">
<label
htmlFor="Job Delivery Details"
className='className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block"'
htmlFor="job-label"
className='job-label'
>
Job Delivery Details
</label>
@@ -352,7 +352,7 @@ const EditJobPopOut = ({
<div className="sm:w-[35%] w-full">
<div
htmlFor="Job Categories"
className='className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block"'
className='job-label'
id="checked-group"
>
Categories
@@ -422,7 +422,7 @@ const EditJobPopOut = ({
<div className="field w-1/2">
<div className={`flex items-center justify-between`}>
<label
className="w-full input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex flex-col"
className="job-label flex flex-col"
htmlFor="timeline_days"
>
Timeline -
@@ -10,7 +10,12 @@ import localImgLoad from "../../lib/localImgLoad";
import { tableReload } from "../../store/TableReloads";
import { useDispatch } from "react-redux";
import { SocketValues } from "../Contexts/SocketIOContext";
function FamilyOfferJobPopout({ details, onClose, situation }) {
const {parentAssignJobToKid} = SocketValues()
const apiUrl = new usersService();
const navigate = useNavigate();
const dispatch = useDispatch();
@@ -69,6 +74,18 @@ function FamilyOfferJobPopout({ details, onClose, situation }) {
message: `Offer ${name}ed Successfully`,
trigger: "",
});
// trigger socket event to refresh parent side
//SENDS MESSAGE TO SOCKET TO UPDATE PARENT ACCOUNT WHEN CHILD ACCEPTS OR REJECTS A JOB ASSIGNED BY PARENT
// message, room
let socketMsg = {
"audience": "PARENT",
"action": "REFRESH_TASK",
"family_uid": sessionStorage.getItem('family_uid'),
}
let socketRoom = `FAMILY-${sessionStorage.getItem('parent_uid')}`
parentAssignJobToKid(socketMsg, socketRoom) //SENDS MESSAGE TO SOCKET TO UPDATE CHILD ACCOUNT
// end of socket event trigger
setTimeout(() => {
onClose();
dispatch(tableReload({ type: "MYTASKTABLE" }));
+3 -3
View File
@@ -303,13 +303,13 @@ function JobListPopout({
return (
<ModalCom action={onClose} situation={situation} className="">
<div className="logout-modal-wrapper w-[90%] md:w-[768px] 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">
<h1 className="text-base md:text-lg font-bold text-dark-gray dark:text-white tracking-wide">
<div className="modal-header-con">
<h1 className="modal-title">
{details.title}
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
className="modal-close-btn"
onClick={onClose}
>
<svg
@@ -135,13 +135,13 @@ function PendingJobsPopout({ details, onClose, situation }) {
return (
<ModalCom action={onClose} situation={situation}>
<div className="logout-modal-wrapper w-[90%] md:w-[768px] 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">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
<div className="modal-header-con">
<h1 className="modal-title">
Manage Pending Item
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
className="modal-close-btn"
onClick={onClose}
>
<svg
@@ -170,7 +170,7 @@ function PendingJobsPopout({ details, onClose, situation }) {
<p className="text-base font-semibold text-slate-900 dark:text-white tracking-wide">
{details.title}
</p>
<div className="my-2 p-2 flex justify-start items-center space-x-2 bg-red-100 border-2 border-red-300">
<div className="my-2 p-2 flex justify-start items-center space-x-2 bg-red-100 border-2 border-red-300 rounded-2xl">
<span className="w-8 h-8 text-center text-sm rounded-full flex justify-center items-center text-red-300 bg-yellow-100">
!
</span>
@@ -236,7 +236,7 @@ function PendingJobsPopout({ details, onClose, situation }) {
{/* ACTION SECTION */}
<div className="p-4 w-full md:w-1/4 h-full">
<p className="mb-6 text-sm dark:text-white">Actions</p>
<p className="job-label mb-6 dark:text-white">Actions</p>
<div className="mb-3">
<p className="px-2 py-1 text-sm bg-slate-100">
+16 -1
View File
@@ -154,8 +154,23 @@
@layer components{
.job-label{
@apply text-slate-900 dark:text-white tracking-wide font-semibold
@apply text-base text-slate-900 dark:text-white tracking-wide font-semibold
}
.job-label-flex{
@apply flex items-center gap-2
}
/* style for all modal header */
.modal-header-con{
@apply 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
}
.modal-title{
@apply text-2xl leading-8 font-bold text-dark-gray dark:text-white tracking-wide flex items-center
}
.modal-close-btn{
@apply text-[#000] dark:text-red-500
}
/* end of style for all modal header */
}
/* ===================== EXTRA ===================== */
+11 -6
View File
@@ -32,18 +32,15 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
);
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
let loggedIn = username && session && uid ? true : false; // variable to determine if user is logged in
useEffect(() => {
//Removing Data stored at localStorage after session expires
const expireSession = () => {
localStorage.removeItem("uid");
localStorage.removeItem("member_id");
localStorage.removeItem("session_token");
sessionStorage.removeItem("family_uid");
sessionStorage.clear();
localStorage.clear();
navigate("/login", { replace: true }); // redirects user to login page after session expires
};
@@ -109,6 +106,8 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
});
};
loadProfile();
}else{
setIsLogin({ loading: false, status: true });
}
}, []);
@@ -323,6 +322,12 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
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
return isLogin.loading && !loggedIn ? (
+8
View File
@@ -11,6 +11,8 @@ const initialState = {
familyBannersListTable: false,
chatMessageList: false,
marketTableList: false,
familyOfferList: false,
parentFamilyTaskList: false,
};
export const tableReloadSlice = createSlice({
@@ -49,6 +51,12 @@ export const tableReloadSlice = createSlice({
case "MARKETTABLELIST":
state.marketTableList = !state.marketTableList;
return;
case "FAMILYOFFERLIST":
state.familyOfferList = !state.familyOfferList;
return;
case "PARENTFAMILYTASKLIST": // reloads list of active family task on parent side
state.parentFamilyTaskList = !state.parentFamilyTaskList;
return;
default:
return state;
}
+5 -5
View File
@@ -6,13 +6,13 @@ function AddJobPage({ action, situation, categories }) {
return (
<ModalCom action={action} situation={situation}>
<div className="lg:w-[600px] w-11/12 lg:overflow-hidden lg:rounded-2xl bg-white dark:bg-dark-white dark:text-white">
<div className="heading flex justify-between items-center py-6 md:px-[30px] px-[23px] border-b border-light-purple dark:border-[#5356fb29] ">
<p className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
Create New Job
</p>
<div className="modal-header-con">
<h1 className="modal-title">
New Job
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
className="modal-close-btn"
onClick={action}
>
<svg