diff --git a/src/assets/images/family-no-task-background.jpg b/src/assets/images/family-no-task-background.jpg new file mode 100644 index 0000000..db53ad4 Binary files /dev/null and b/src/assets/images/family-no-task-background.jpg differ diff --git a/src/assets/images/kids-waiting.jpg b/src/assets/images/kids-waiting.jpg new file mode 100644 index 0000000..4e47ef2 Binary files /dev/null and b/src/assets/images/kids-waiting.jpg differ diff --git a/src/components/FamilyAcc/FamilyPopout/AssignTaskPopout.jsx b/src/components/FamilyAcc/FamilyPopout/AssignTaskPopout.jsx index 6a9162b..9357b3f 100644 --- a/src/components/FamilyAcc/FamilyPopout/AssignTaskPopout.jsx +++ b/src/components/FamilyAcc/FamilyPopout/AssignTaskPopout.jsx @@ -7,15 +7,66 @@ import { PriceFormatter } from '../../Helpers/PriceFormatter' function AssignTaskPopout({action, situation, familyDetails}) { const apiCall = new usersService() + + let [requestStatus, setRequestStatus] = useState({loading: false, status: false, message: ''}) // HOLDS RESPONSE FOR SENDING API REQUEST let [familyTask, setFamilyTask] = useState({loading: true, data: []}) - let [activeTask, setActiveTask] = useState({id: 0, data: {}}) -console.log('TESTING',activeTask.data) - const handleActiveTask = (id=0, data={}) => { + let [taskType, setTaskType] = useState('select') // SWITCHES BTW SELECT TASK AND NEW TASK + + let [activeTask, setActiveTask] = useState({id: 0, data: {}}) // HOLDS SELECTED TASK + + const switchTaskType = ({target:{value}}) => { // FUNCTION TO CHANGE SELECTED ACTIVE TASK + setTaskType(value) + } + + const handleActiveTask = (id=0, data={}) => { // FUNCTION TO CHANGE SELECTED ACTIVE TASK setActiveTask({id, data}) } + const assignFamilyTask = () => { + setRequestStatus({loading: true, status: false, message: ''}) + 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: familyDetails.uid, + job_description: activeTask.data?.description, + assign_mode: 110011, + } + + 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({loading: false, status: true, message: 'action successful'}) + setTimeout(()=>{ + setRequestStatus({loading: false, status: false, message: ''}) + action() // FUNCTION THAT CLOSES THE MODAL BOX + }, 5000) + }).catch(err => { + setRequestStatus({loading: false, status: false, message: 'An Error occured, try again'}) + setTimeout(()=>{ + setRequestStatus({loading: false, status: false, message: ''}) + }, 5000) + }) + } + + if(taskType == 'new'){ // RUNS HERE IF TASK TYPE IS NEW TASK + console.log('TESTING') + } + } + useEffect(()=>{ const reqData = { limit: 30, @@ -25,7 +76,9 @@ console.log('TESTING',activeTask.data) } apiCall.getMyJobList(reqData).then(res => { setFamilyTask({loading: false, data: res?.data?.result_list}) - setActiveTask(prev => ({...prev, data:res?.data?.result_list[0]})) + if(res?.data?.result_list?.length){ + setActiveTask(prev => ({...prev, data:res?.data?.result_list[0]})) + } }).catch(err => { setFamilyTask({loading: false, data: []}) console.log('Error', err) @@ -37,7 +90,7 @@ console.log('TESTING',activeTask.data) action={action} situation={situation} > -
+

Assign task to {familyDetails?.firstname} @@ -69,55 +122,64 @@ console.log('TESTING',activeTask.data)

{familyTask.loading ? -
+
: - familyTask.data.length ? <>
- Select Task + + Select Task
- New Task + + New Task
- {familyTask?.data?.map((item, index)=>( -
handleActiveTask(item.job_uid, item)}> - handleActiveTask(item.job_uid, item)} - className="w-[15px] h-[15px] cursor-pointer" - /> -

{item?.title}

-
- )) + { + taskType == 'select' ? + familyTask?.data?.length ? + familyTask?.data?.map((item, index)=>( +
handleActiveTask(item.job_uid, item)}> + handleActiveTask(item.job_uid, item)} + className="w-[15px] h-[15px] cursor-pointer" + /> +

{item?.title}

+
+ )) + : +

No Task found!

+ : +

SPACE FOR NEW TASK

}
+ {familyTask?.data?.length > 0 ?

{activeTask?.data?.title}

-
+
+
+
+ +

{PriceFormatter(activeTask?.data?.price*0.01, activeTask?.data?.currency, activeTask?.data?.curreny_code)}

+
-
- -
- -
- +
+ +

{`${activeTask?.data?.timeline_days} day(s)`}

+
@@ -135,30 +197,62 @@ console.log('TESTING',activeTask.data) className={`p-1 w-full text-sm text-slate-900 outline-none border border-slate-300 rounded-md`} rows="5" style={{ resize: "none" }} - defaultValue={activeTask?.data?.job_detail} + value={activeTask?.data?.job_detail} + readOnly // onChange={handleInputChange} /> - {/*

{errMsg.deliveryDetail}

*/} + {/*

{}

*/}
-
+
+ : + <> + }
{/* BTN */}
- + {/* error or success display */} + {requestStatus.message != "" && + (!requestStatus.status ? ( +
+ {requestStatus.message} +
+ ) : ( + requestStatus.status && ( +
+ {requestStatus.message} +
+ ) + ))} + {/* End of error or success display */} + +
+ {requestStatus.loading ? + + : + } +
- : -

No Task found!

}
diff --git a/src/components/Home/FamilyDash.jsx b/src/components/Home/FamilyDash.jsx index f5d9602..05f16e0 100644 --- a/src/components/Home/FamilyDash.jsx +++ b/src/components/Home/FamilyDash.jsx @@ -3,7 +3,8 @@ import datas from "../../data/product_data.json"; import TopSellerTopBuyerSliderSection from "./TopSellerTopBuyerSliderSection"; import CommonHead from "../UserHeader/CommonHead"; import FamilyActiveLSlde from "./FamilyActiveLSlde"; - +import OverviewSection from "../ActiveBids/OverviewSection"; +import ParentWaiting from "../MyPendingJobs/ParentWaiting"; export default function FamilyDash(props) { @@ -18,7 +19,8 @@ export default function FamilyDash(props) { commonHeadData={props.commonHeadData} /> - + {/**/} +
); diff --git a/src/components/MyPendingJobs/ParentWaiting.jsx b/src/components/MyPendingJobs/ParentWaiting.jsx new file mode 100644 index 0000000..523e845 --- /dev/null +++ b/src/components/MyPendingJobs/ParentWaiting.jsx @@ -0,0 +1,67 @@ +import React, { useState } from "react"; +import { Link } from "react-router-dom"; +import { toast } from "react-toastify"; +import activeAidsBanner from "../../assets/images/kids-waiting.jpg"; +import HeroUser from "../../assets/images/hero-user.png"; +import CountDown from "../Helpers/CountDown"; +import ParentWaitingTable from "./ParentWaitingTable"; + +export default function ParentWaiting({ className }) { + const [addFavorite, setValue] = useState(false); + const favoriteHandler = () => { + if (!addFavorite) { + setValue(true); + toast.success("Added to Favorite List"); + } else { + setValue(false); + toast.warn("Remove to Favorite List"); + } + }; + return ( + <> +
+
+

Waiting for Parent to Get Started...

+
+
+
+ banner +
+ +
+ {} + + {/*
*/} + {/*

*/} + {/* Lock and Lob x Fiesta Spurs*/} + {/*

*/} + {/* */} + {/* ID : 2320382*/} + {/**/} + {/*
*/} + {/* /!* user *!/*/} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} + {/*

*/} + {/* Brokln Simons*/} + {/*

*/} + {/*

*/} + {/* @broklinslam_75*/} + {/*

*/} + {/*
*/} + {/*
*/} + +
+
+
+ + ); +} + diff --git a/src/components/MyPendingJobs/ParentWaitingTable.jsx b/src/components/MyPendingJobs/ParentWaitingTable.jsx new file mode 100644 index 0000000..db4cdc9 --- /dev/null +++ b/src/components/MyPendingJobs/ParentWaitingTable.jsx @@ -0,0 +1,339 @@ +import React, { useState } from "react"; +import transaction1 from "../../assets/images/recent-transation-1.png"; +import transaction2 from "../../assets/images/recent-transation-2.png"; +import transaction3 from "../../assets/images/recent-transation-3.png"; + +export default function ParentWaitingTable() { + const transationFilterData = [ + { + id: 1, + name: "all", + uniqueId: Math.random(), + }, + { + id: 2, + name: "send", + uniqueId: Math.random(), + }, + { + id: 3, + name: "recent", + uniqueId: Math.random(), + }, + ]; + const [filterActive, setValue] = useState(transationFilterData[0].id); + const filterHander = (value) => { + setValue(value); + }; + return ( +
+ {/* heading */} +
+ +
+
    + {transationFilterData.map((value) => ( +
  • filterHander(value.id)} + key={value.uniqueId} + className={`text-base text-thin-light-gray hover:text-purple border-b dark:border-[#5356fb29] border-transparent hover:border-purple uppercase ${ + filterActive === value.id ? "border-purple text-purple" : "" + }`} + > + {value.name} +
  • + ))} + {/*
  • + All +
  • +
  • + SEND +
  • +
  • + recent +
  • */} +
+
+
+ {/* content */} + + {filterActive === 2 ? ( +
+
    +
  • +
    +
    +
    + +
    +
    +
    +

    + Add ETH from MetaMask +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + +324.75 +

    +
    +
    +
  • +
  • +
    +
    +
    + +
    +
    +
    +

    + Add BTC from Coinbase Wallet +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + -824.78 +

    +
    +
    +
  • +
  • +
    +
    +
    + +
    +
    +
    +

    + Buy Nft art from LTC +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + -924.54 +

    +
    +
    +
  • +
+
+ ) : filterActive === 3 ? ( +
+
    +
  • +
    +
    +
    + +
    +
    +
    +

    + Add ETH from MetaMask +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + +324.75 +

    +
    +
    +
  • +
  • +
    +
    +
    + +
    +
    +
    +

    + Add BTC from Coinbase Wallet +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + -824.78 +

    +
    +
    +
  • +
+
+ ) : ( +
+
    +
  • +
    +
    +
    + +
    +
    +
    +

    + Add ETH from MetaMask +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + +324.75 +

    +
    +
    +
  • +
  • +
    +
    +
    + +
    +
    +
    +

    + Add BTC from Coinbase Wallet +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + -824.78 +

    +
    +
    +
  • +
  • +
    +
    +
    + +
    +
    +
    +

    + Buy Nft art from LTC +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + -924.54 +

    +
    +
    +
  • +
  • +
    +
    +
    + +
    +
    +
    +

    + Add ETH from MetaMask +

    +
    +
    +

    + 22 hours ago +

    +
    +
    +
    +
    +

    + $512.44 +

    +

    + +324.75 +

    +
    +
    +
  • +
+
+ )} +
+ ); +} diff --git a/src/services/UsersService.js b/src/services/UsersService.js index e926b19..6a1d5e9 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -787,6 +787,19 @@ class usersService { }; return this.postAuxEnd("/offerinterestlistmsg", postData); } + + // FUNCTION TO ASSIGN TASK TO FAMILY MEMBER + assignFamilyTask(reqData) { + var postData = { + uid: localStorage.getItem("uid"), + member_id: localStorage.getItem("member_id"), + sessionid: localStorage.getItem("session_token"), + action: 13025, + ...reqData + }; + return this.postAuxEnd("/assigntask", postData); + } + /* - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username) - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)