diff --git a/src/Routers.jsx b/src/Routers.jsx
index 45d669c..4354c41 100644
--- a/src/Routers.jsx
+++ b/src/Routers.jsx
@@ -34,6 +34,7 @@ import VerifyLinkPages from "./views/VerifyLinkPages";
import MyActiveJobsPage from "./views/MyActiveJobsPage";
import FamilyAccPage from "./views/FamilyAccPage";
import StartJob from "./components/MyJobs/StartJob";
+import AddJobPage from "./views/AddJobPage";
export default function Routers() {
return (
@@ -76,6 +77,7 @@ export default function Routers() {
} />
} />
} />
+ } />
} />
} />
} />
diff --git a/src/components/AddJob/AddJob.jsx b/src/components/AddJob/AddJob.jsx
new file mode 100644
index 0000000..270036b
--- /dev/null
+++ b/src/components/AddJob/AddJob.jsx
@@ -0,0 +1,340 @@
+import React, {useState, useEffect} from 'react'
+import { Link, useNavigate } from 'react-router-dom';
+import InputCom from '../Helpers/Inputs/InputCom';
+import LoadingSpinner from '../Spinners/LoadingSpinner';
+import usersService from '../../services/UsersService';
+
+import { Form, Formik } from "formik";
+import * as Yup from "yup";
+
+const validationSchema = Yup.object().shape({
+ country: Yup.string()
+ .min(1, "Minimum 3 characters")
+ .max(25, "Maximum 25 characters")
+ .required("Country is required"),
+ price: Yup.number()
+ .typeError("you must specify a number")
+ .min(1, "Price must be greater than 0")
+ .required("Price is required"),
+ title: Yup.string()
+ .min(3, "Minimum 3 characters")
+ .max(100, "Maximum 25 characters")
+ .required("Title is required"),
+ description: Yup.string()
+ .min(3, "Minimum 3 characters")
+ .max(250, "Maximum 250 characters")
+ .required("Description is required"),
+ job_detail: Yup.string()
+ .min(3, "Minimum 3 characters")
+ .max(250, "Maximum 250 characters")
+ .required("Details is required"),
+ timeline_days: Yup.number()
+ .typeError("you must specify a number")
+ .min(1, "Price must be greater than 0")
+ .required("Price is required"),
+ });
+
+ let initialValues = { // initial values for formik
+ country: '',
+ price: '',
+ title: '',
+ description: '',
+ job_detail: '',
+ timeline_days: ''
+}
+
+function AddJob() {
+ const ApiCall = new usersService()
+ const navigate = useNavigate()
+
+ let [pageLoading, setPageLoading] = useState(true) // State used for knowing when the page is mounting
+
+ let [country, setCountry] = useState({loading: false, status: false, data:[]}) // To Hold the array of country getUserCountry returns
+
+ let [requestStatus, setRequestStatus] = useState({loading: false, status: false, message:''}) // Holds state when submit button is pressed
+
+ // FUNCTION TO GET COUNTRY
+ const getUserCountry = () =>{
+ setCountry(prev => ({...prev, loading:true}))
+ ApiCall.getSignupCountryData().then(res => {
+ if(res.data.internal_return < 1){
+ setCountry({loading: false, status: true, data:[]})
+ return
+ }
+ setCountry({loading: false, status: true, data:res.data.signup_country})
+ }).catch(err => {
+ setCountry({loading: false, status: false, data:[]})
+ })
+ }
+
+ // FUNCTION TO HANDLE ADD JOB FORM
+ const handleAddJob = (values, helpers) => {
+ console.log(values)
+ setRequestStatus({loading: true, status: false, message:''})
+ ApiCall.jobManagerCreateJob(values).then(res => {
+ if(res.data.internal_return < 1){
+ setRequestStatus({loading: false, status: false, message:'Could not complete your request at the moment'})
+ return
+ }
+ setRequestStatus({loading: false, status: true, message:'Job Added Successfully'})
+ setTimeout(()=>{
+ navigate('/myjobs', {replace: true})
+ },1000)
+
+ }).catch(err => {
+ setRequestStatus({loading: false, status: false, message:'Opps! soemthing went wrong. Try Again'})
+ })
+ }
+
+ useEffect(()=>{
+ setPageLoading(false)
+ getUserCountry()
+ },[])
+
+ return pageLoading.loading ? (
+
+ ) : (
+
+
+ {(props) => {
+ return (
+
+ );
+ }}
+
+
+ )
+}
+
+export default AddJob
\ No newline at end of file
diff --git a/src/components/Helpers/Inputs/InputCom/index.jsx b/src/components/Helpers/Inputs/InputCom/index.jsx
index eec3eb3..f39da7b 100644
--- a/src/components/Helpers/Inputs/InputCom/index.jsx
+++ b/src/components/Helpers/Inputs/InputCom/index.jsx
@@ -19,6 +19,8 @@ export default function InputCom({
onClick,
disable,
blurHandler,
+ spanTag,
+ inputBg
}) {
const inputRef = useRef(null);
// Entry Validation
@@ -138,8 +140,9 @@ export default function InputCom({
)}
{forgotPassword && (
@@ -158,7 +161,7 @@ export default function InputCom({
placeholder={placeholder}
value={value}
onChange={inputHandler}
- className={`input-field placeholder:text-base text-dark-gray dark:text-white w-full h-full bg-[#FAFAFA] dark:bg-[#11131F] focus:ring-0 focus:outline-none ${fieldClass}`}
+ className={`input-field placeholder:text-base text-dark-gray dark:text-white w-full h-full ${inputBg ? inputBg: 'bg-[#FAFAFA]'} dark:bg-[#11131F] focus:ring-0 focus:outline-none ${fieldClass}`}
type={type}
id={name}
name={name}
diff --git a/src/components/MyJobs/index.jsx b/src/components/MyJobs/index.jsx
index 6d4e29f..a370474 100644
--- a/src/components/MyJobs/index.jsx
+++ b/src/components/MyJobs/index.jsx
@@ -18,13 +18,16 @@ export default function MyJobs(props) {
{/* heading */}
-
-
- My Jobs
-
+
+
+ My Jobs
+
+
+ Add Job
+
diff --git a/src/components/Partials/MobileSideBar.jsx b/src/components/Partials/MobileSideBar.jsx
index 52c9ec2..ff17901 100644
--- a/src/components/Partials/MobileSideBar.jsx
+++ b/src/components/Partials/MobileSideBar.jsx
@@ -174,6 +174,8 @@ export default function MobileSidebar({ sidebar, action, logoutModalHandler }) {
:
+ jobLists?.result_list?.length ?
+ (
My Jobs
@@ -222,6 +224,32 @@ export default function MobileSidebar({ sidebar, action, logoutModalHandler }) {
+ )
+ :
+ (
+
+
+
My Jobs
+
+
+
+ -
+
+
+
+
+
+ My Jobs
+
+
+
+
+
+
+ )
}
{/* signout area */}
diff --git a/src/components/Partials/Sidebar.jsx b/src/components/Partials/Sidebar.jsx
index e229d36..0d396b7 100644
--- a/src/components/Partials/Sidebar.jsx
+++ b/src/components/Partials/Sidebar.jsx
@@ -249,115 +249,150 @@ export default function Sidebar({ sidebar, action, logoutModalHandler }) {
:
-
-
-
My Jobs
-
-
-
- -
- (navData.isActive ? "active" : ""),
- sidebar ? "justify-start space-x-3.5" : "justify-center")
- }`}
- >
-
-
-
-
- List
-
-
-
- -
- (navData.isActive ? "active" : ""),
- sidebar ? "justify-start space-x-3.5" : "justify-center")
- }`}
- >
-
-
-
-
- Pending
-
-
-
- -
- (navData.isActive ? "active" : ""),
- sidebar ? "justify-start space-x-3.5" : "justify-center")
- }`}
- >
-
-
-
-
- Active
-
-
-
- {/*- */}
- {/* (navData.isActive ? "active" : ""),*/}
- {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/}
- {/* }`}*/}
- {/* >*/}
- {/* */}
- {/* */}
- {/* */}
- {/* */}
- {/* My Profile*/}
- {/* */}
- {/* */}
- {/*
*/}
- {/*- */}
- {/* (navData.isActive ? "active" : ""),*/}
- {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/}
- {/* }`}*/}
- {/* >*/}
- {/* */}
- {/* */}
- {/* */}
- {/* */}
- {/* Settings*/}
- {/* */}
- {/* */}
- {/*
*/}
-
-
-
+ jobLists?.result_list?.length ?
+ (
+
+
+
My Jobs
+
+
+
+ -
+ (navData.isActive ? "active" : ""),
+ sidebar ? "justify-start space-x-3.5" : "justify-center")
+ }`}
+ >
+
+
+
+
+ List
+
+
+
+ -
+ (navData.isActive ? "active" : ""),
+ sidebar ? "justify-start space-x-3.5" : "justify-center")
+ }`}
+ >
+
+
+
+
+ Pending
+
+
+
+ -
+ (navData.isActive ? "active" : ""),
+ sidebar ? "justify-start space-x-3.5" : "justify-center")
+ }`}
+ >
+
+
+
+
+ Active
+
+
+
+ {/*- */}
+ {/* (navData.isActive ? "active" : ""),*/}
+ {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/}
+ {/* }`}*/}
+ {/* >*/}
+ {/* */}
+ {/* */}
+ {/* */}
+ {/* */}
+ {/* My Profile*/}
+ {/* */}
+ {/* */}
+ {/*
*/}
+ {/*- */}
+ {/* (navData.isActive ? "active" : ""),*/}
+ {/* sidebar ? "justify-start space-x-3.5" : "justify-center")*/}
+ {/* }`}*/}
+ {/* >*/}
+ {/* */}
+ {/* */}
+ {/* */}
+ {/* */}
+ {/* Settings*/}
+ {/* */}
+ {/* */}
+ {/*
*/}
+
+
+
+ )
+ :
+ (
+
+
+
My Jobs
+
+
+
+ -
+ (navData.isActive ? "active" : ""),
+ sidebar ? "justify-start space-x-3.5" : "justify-center")
+ }`}
+ >
+
+
+
+
+ Add Job
+
+
+
+
+
+
+ )
}
diff --git a/src/components/jobPopout/JobListPopout.jsx b/src/components/jobPopout/JobListPopout.jsx
index e96fd48..4686368 100644
--- a/src/components/jobPopout/JobListPopout.jsx
+++ b/src/components/jobPopout/JobListPopout.jsx
@@ -9,7 +9,6 @@ function JobListPopout({details, onClose, situation}) {
public: '',
individual: '',
group: '',
- details: 'Some text here!'
})
const handleInputChange = ({target:{name, value}}) => {
@@ -89,7 +88,7 @@ function JobListPopout({details, onClose, situation}) {
rows='5'
name='details'
style={{resize: 'none'}}
- value={inputs.details}
+ value={details.job_detail}
onChange={handleInputChange}
/>
diff --git a/src/services/UsersService.js b/src/services/UsersService.js
index 60bd7fb..424e8c3 100644
--- a/src/services/UsersService.js
+++ b/src/services/UsersService.js
@@ -426,6 +426,18 @@ class usersService {
return this.postAuxEnd("/jobmanageragree", postData);
}
+ // END POINT TO TO CREATE A JOB
+ jobManagerCreateJob(reqData) {
+ var postData = {
+ uid: localStorage.getItem("uid"),
+ member_id: localStorage.getItem("member_id"),
+ sessionid: localStorage.getItem("session_token"),
+ action: 13010,
+ ...reqData
+ };
+ return this.postAuxEnd("/jobmanagercreatejob", postData);
+ }
+
verifyEmail(code) {
const reqData = {
verify_link: code,
diff --git a/src/views/AddJobPage.jsx b/src/views/AddJobPage.jsx
new file mode 100644
index 0000000..8cd8845
--- /dev/null
+++ b/src/views/AddJobPage.jsx
@@ -0,0 +1,14 @@
+import React from 'react'
+import AddJob from '../components/AddJob/AddJob'
+import Layout from '../components/Partials/Layout'
+
+
+function AddJobPage() {
+ return (
+
+
+
+ )
+}
+
+export default AddJobPage
\ No newline at end of file