Changed my pending jobs to offers and changed its routes

This commit was merged in pull request #560.
This commit is contained in:
2024-01-26 17:44:24 +01:00
parent 7a6f43ad20
commit 1d86465812
13 changed files with 287 additions and 219 deletions
+6 -2
View File
@@ -1,5 +1,5 @@
import React from "react";
import ParentWaiting from "../MyPendingJobs/ParentWaiting";
import ParentWaiting from "../MyOffers/ParentWaiting";
import MyOffersFamilyTable from "../MyTasks/MyOffersFamilyTable";
import FamilyActiveLSlde from "./FamilyActiveLSlde";
@@ -19,7 +19,11 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) {
/>
)}
{trending && trending.length > 0 && (
<FamilyActiveLSlde trending={trending} className="mb-10" image_server={familyOffers?.session_image_server} />
<FamilyActiveLSlde
trending={trending}
className="mb-10"
image_server={familyOffers?.session_image_server}
/>
)}
{/*<TopSellerTopBuyerSliderSection className="mb-10" />*/}
@@ -1,11 +1,10 @@
import React, { useState } from "react";
import { Link } from "react-router-dom";
import Layout from "../Partials/Layout";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import CommonHead from "../UserHeader/CommonHead";
import MyPendingJobTable from "./MyPendingJobTable";
import LoadingSpinner from "../Spinners/LoadingSpinner";
export default function MyPendingJobs(props) {
export default function MyOffers(props) {
const [selectTab, setValue] = useState("today");
const filterHandler = (value) => {
setValue(value);
@@ -13,9 +12,7 @@ export default function MyPendingJobs(props) {
// console.log("AMEYE LOC1", props.MyJobList);
return (
<Layout>
<CommonHead
commonHeadData={props.commonHeadData}
/>
<CommonHead commonHeadData={props.commonHeadData} />
<div className="notification-page w-full mb-10">
<div className="notification-wrapper w-full">
{/* heading */}
@@ -25,7 +22,7 @@ export default function MyPendingJobs(props) {
<span
className={`${selectTab === "today" ? "block" : "hidden"}`}
>
Pending Job(s)
Pending Offers
</span>
</h1>
</div>
@@ -36,13 +33,17 @@ export default function MyPendingJobs(props) {
></div>
</div>
</div>
{props.MyJobList.loading ?
<div className="bg-white">
<LoadingSpinner size='16' color='sky-blue' height='min-h-[300px]' />
</div>
:
<MyPendingJobTable MyJobList={props.MyJobList.data} />
}
{props.MyJobList.loading ? (
<div className="bg-white">
<LoadingSpinner
size="16"
color="sky-blue"
height="min-h-[300px]"
/>
</div>
) : (
<MyPendingJobTable MyJobList={props.MyJobList.data} />
)}
</div>
</div>
</Layout>
+2 -2
View File
@@ -192,8 +192,8 @@ export default function MobileSidebar({
{[
{ name: "List", path: "/myjobs", iconName: "job-list" },
{
name: "Pending",
path: "/my-pending-jobs",
name: "Offers",
path: "/my-offers",
iconName: "pending-job",
},
{
+1 -1
View File
@@ -190,7 +190,7 @@ export default function RightSideBar({myJobList}) {
{/* name */}
<div>
<p className="text-thin-light-gray text-base font-medium">
<NavLink to="/my-review-jobs">Review Pending</NavLink>
<NavLink to="/my-review-jobs">Review</NavLink>
</p>
</div>
</div>
+4 -5
View File
@@ -8,14 +8,13 @@ import {
import DarkModeContext from "../Contexts/DarkModeContext";
import Icons from "../Helpers/Icons";
export default function Sidebar({
sidebar,
action,
logoutModalHandler,
myJobList,
}) {
const darkMode = useContext(DarkModeContext);
const darkMode = useContext(DarkModeContext);
let { userDetails } = useSelector((state) => state.userDetails);
//const jobLists = getJobList(); // pass from upper - we need in a lot of places
@@ -218,8 +217,8 @@ export default function Sidebar({
iconName: "job-list",
},
{
name: "Pending",
path: "/my-pending-jobs",
name: "Offers",
path: "/my-offers",
iconName: "pending-job",
},
{
@@ -291,7 +290,7 @@ export default function Sidebar({
className="signout-btn w-full flex items-center justify-center"
>
<span className="p-[1px] w-[40px] h-[40px] border border-purple rounded-full">
<Icons name='new-logout' />
<Icons name="new-logout" />
</span>
</button>
)}
+137 -108
View File
@@ -206,7 +206,7 @@ function JobListPopout({
setTimeout(() => {
setLoader({ jobFields: false });
onClose();
throw new Response(data);
// throw new Response(data);
}, 3000);
} catch (error) {
setRequestStatus({ message: "Unable to complete", status: false });
@@ -294,103 +294,6 @@ function JobListPopout({
);
};
const FormSection = ({
selectedTab,
initialValues,
validationSchema,
jobFieldHandler,
loader,
errorHandler,
errMsg,
}) => {
const renderForm = (props) => {
// Render the appropriate form based on the selected tab
switch (selectedTab) {
case "family":
return (
<JobFieldInput
label="Assign to family"
select={true}
inputName="family"
value={props?.values.family}
data={familyList}
btnText="Assign to family"
optionText="Select Family"
loader={loader?.jobFields?.family}
errorHandler={errorHandler}
parentClass="w-full flex flex-col gap-4"
/>
);
case "public":
return (
<JobFieldInput
label="Offer this job to public"
select={true}
inputName="public"
value={props?.values.public}
data={publicArray}
btnText="Show Task to Public"
optionText="Select Duration"
loader={loader?.jobFields?.public}
errorHandler={errorHandler}
parentClass="w-full flex flex-col gap-4"
/>
);
case "individual":
return (
<JobFieldInput
label="Offer this job to individual"
input={true}
inputName="individual"
value={props?.values.individual}
placeholder="Enter email of individual"
inputHandler={props?.handleChange}
btnText="Send Offer to Individual"
loader={loader?.jobFields?.individual}
errorHandler={errorHandler}
parentClass="w-full flex flex-col gap-4"
/>
);
case "group":
return (
<JobFieldInput
label="Offer this job to your Group"
select={true}
inputName="group"
value={props?.values.group}
btnText="Send Order to Group"
optionText="Select Group"
loader={loader?.jobFields?.group}
errorHandler={errorHandler}
data={groupList}
parentClass="w-full flex flex-col gap-4"
/>
);
default:
return null;
}
};
return (
<Formik
initialValues={initialValues}
validationSchema={validationSchema}
onSubmit={jobFieldHandler}
>
{(props) => (
<Form className="">
{renderForm(props)}
<p className="h-4 text-[13px] font-light italic text-red-600 tracking-wide">
{props?.values[selectedTab] === "" && (
<span>{errMsg?.jobFields[selectedTab]}</span>
)}
</p>{" "}
</Form>
)}
</Formik>
);
};
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">
@@ -424,7 +327,7 @@ function JobListPopout({
</svg>
</button>
</div>
<div className="md:grid grid-cols-2 bg-white dark:bg-dark-white rounded-lg shadow-lg">
<DetailsComponent />
@@ -447,16 +350,142 @@ function JobListPopout({
))}
</div>
<div className="grow flex flex-col bg-red-50 dark:bg-[#D85A5A] rounded-b-2xl">
<FormSection
selectedTab={selectedTab}
initialValues={initialValues}
validationSchema={validationSchema.fields[selectedTab]}
jobFieldHandler={jobFieldHandler}
loader={loader}
errorHandler={errorHandler}
errMsg={errMsg}
/>
{selectedTab == "family" && (
<Formik
initialValues={initialValues}
validationSchema={validationSchema.fields.family}
onSubmit={jobFieldHandler}
>
{(props) => {
return (
<Form className="hidden">
{/* Assign to Family */}
<JobFieldInput
label="Assign to family"
select={true}
inputName="family"
value={props?.values.family}
data={familyList}
btnText="Assign to family"
optionText="Select Family"
loader={loader?.jobFields?.family}
errorHandler={errorHandler}
parentClass="w-full flex flex-col gap-4"
/>
<p className="h-4 text-[13px] font-light italic text-red-600 tracking-wide">
{" "}
{props?.values?.family === "" && (
<span>{errMsg?.jobFields?.family}</span>
)}
</p>{" "}
</Form>
);
}}
</Formik>
)}
{selectedTab == "public" && (
<Formik
initialValues={initialValues}
validationSchema={validationSchema.fields.public}
onSubmit={jobFieldHandler}
>
{(props) => {
return (
<Form className="">
{/* Offer this job to public input */}
<JobFieldInput
label="Offer this job to public"
select={true}
inputName="public"
value={props?.values.public}
data={publicArray}
btnText="Show Task to Public"
optionText="Select Duration"
loader={loader?.jobFields?.public}
errorHandler={errorHandler}
parentClass="w-full flex flex-col gap-4"
/>
<p className="h-4 text-[13px] font-light italic text-red-600 tracking-wide">
{" "}
{props?.values.public === "" && (
<span>{errMsg?.jobFields?.public}</span>
)}
</p>{" "}
</Form>
);
}}
</Formik>
)}
{selectedTab == "individual" && (
<Formik
initialValues={initialValues}
validationSchema={validationSchema.fields.individual}
onSubmit={jobFieldHandler}
>
{(props) => {
return (
<Form className="">
{/* Offer this job to individual input */}
<JobFieldInput
label="Offer this job to individual"
input={true}
inputName="individual"
value={props?.values.individual}
placeholder="Enter email of individual"
inputHandler={props?.handleChange}
btnText="Send Offer to Individual"
loader={loader?.jobFields?.individual}
errorHandler={errorHandler}
parentClass="w-full flex flex-col gap-4"
/>
<p className="h-4 text-[13px] font-light italic text-red-600 tracking-wide">
{" "}
{props?.values.individual === "" && (
<span>{errMsg?.jobFields?.individual}</span>
)}
</p>{" "}
</Form>
);
}}
</Formik>
)}
{/* { process.env.REACT_APP_SHOW_OFFER_GROUP_JOB != 0 && } */}
{selectedTab == "group" && (
<Formik
initialValues={initialValues}
validationSchema={validationSchema.fields.group}
onSubmit={jobFieldHandler}
>
{(props) => {
return (
<Form className="">
{/* Offer this job to your group input */}
<JobFieldInput
label="Offer this job to your Group"
select={true}
inputName="group"
value={props?.values.group}
btnText="Send Order to Group"
optionText="Select Group"
loader={loader?.jobFields?.group}
errorHandler={errorHandler}
data={groupList}
parentClass="w-full flex flex-col gap-4"
/>
<p className="h-4 text-[13px] font-light italic text-red-600 tracking-wide">
{" "}
{props?.values.group === "" && (
<span>{errMsg?.jobFields?.group}</span>
)}
</p>
</Form>
);
}}
</Formik>
)}
<p
className={`text-center w-full text-lg ${
requestStatus.status