Merge branch 'enable-and-active-jobs' of WrenchBoard/Users-Wrench into master
This commit is contained in:
@@ -9,7 +9,7 @@ import usersService from "../../../services/UsersService";
|
|||||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||||
import AuthLayout from "../AuthLayout";
|
import AuthLayout from "../AuthLayout";
|
||||||
// import { GoogleOAuthProvider } from '@react-oauth/google';
|
// import { GoogleOAuthProvider } from '@react-oauth/google';
|
||||||
import { googleLogout, useGoogleLogin } from '@react-oauth/google';
|
import { googleLogout, useGoogleLogin } from "@react-oauth/google";
|
||||||
|
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { updateUserDetails } from "../../../store/UserDetails";
|
import { updateUserDetails } from "../../../store/UserDetails";
|
||||||
@@ -35,7 +35,7 @@ export default function Login() {
|
|||||||
const handleLoginType = ({ target: { name } }) => {
|
const handleLoginType = ({ target: { name } }) => {
|
||||||
if (name == "full") {
|
if (name == "full") {
|
||||||
setLoginType({ [name]: true, family: false });
|
setLoginType({ [name]: true, family: false });
|
||||||
} else if(name='family') {
|
} else if ((name = "family")) {
|
||||||
setLoginType({ [name]: false, family: true });
|
setLoginType({ [name]: false, family: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -56,7 +56,7 @@ export default function Login() {
|
|||||||
// FUNCTION TO HANDLE USER LOGIN
|
// FUNCTION TO HANDLE USER LOGIN
|
||||||
const doLogin = ({ target: { name } }) => {
|
const doLogin = ({ target: { name } }) => {
|
||||||
setMsgError("");
|
setMsgError("");
|
||||||
setLoginError(false)
|
setLoginError(false);
|
||||||
setLoginLoading(true);
|
setLoginLoading(true);
|
||||||
let postData; // Post Data for API
|
let postData; // Post Data for API
|
||||||
if (!email || !password) {
|
if (!email || !password) {
|
||||||
@@ -68,7 +68,8 @@ export default function Login() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name == "loginfull") { // Post Data Info for normal Login
|
if (name == "loginfull") {
|
||||||
|
// Post Data Info for normal Login
|
||||||
postData = {
|
postData = {
|
||||||
username: email,
|
username: email,
|
||||||
password: password,
|
password: password,
|
||||||
@@ -76,7 +77,8 @@ export default function Login() {
|
|||||||
login_mode: 1100,
|
login_mode: 1100,
|
||||||
action: 11025,
|
action: 11025,
|
||||||
};
|
};
|
||||||
} else if (name == "loginfamily") { // Post Data Info for family Login
|
} else if (name == "loginfamily") {
|
||||||
|
// Post Data Info for family Login
|
||||||
postData = {
|
postData = {
|
||||||
username: email,
|
username: email,
|
||||||
pin: password,
|
pin: password,
|
||||||
@@ -84,7 +86,7 @@ export default function Login() {
|
|||||||
login_mode: 1105,
|
login_mode: 1105,
|
||||||
action: 11025,
|
action: 11025,
|
||||||
};
|
};
|
||||||
}else{
|
} else {
|
||||||
setLoginLoading(false);
|
setLoginLoading(false);
|
||||||
setMsgError("Invalid Login Type. Consider refreshing the page");
|
setMsgError("Invalid Login Type. Consider refreshing the page");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -92,7 +94,9 @@ export default function Login() {
|
|||||||
}, Number(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT));
|
}, Number(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
userApi.logInUser(postData).then((res) => {
|
userApi
|
||||||
|
.logInUser(postData)
|
||||||
|
.then((res) => {
|
||||||
if (res.status != 200 || res.data.internal_return < 0) {
|
if (res.status != 200 || res.data.internal_return < 0) {
|
||||||
// setMsgError("Wrong, email/password");
|
// setMsgError("Wrong, email/password");
|
||||||
setLoginError(true);
|
setLoginError(true);
|
||||||
@@ -108,13 +112,15 @@ export default function Login() {
|
|||||||
navigate("/", { replace: true });
|
navigate("/", { replace: true });
|
||||||
setLoginLoading(false);
|
setLoginLoading(false);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}).catch((error) => {
|
})
|
||||||
|
.catch((error) => {
|
||||||
setMsgError("Unable to login, try again");
|
setMsgError("Unable to login, try again");
|
||||||
setLoginLoading(false);
|
setLoginLoading(false);
|
||||||
}).finally(() => {
|
})
|
||||||
|
.finally(() => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setLoginError(false);
|
setLoginError(false);
|
||||||
setMsgError('');
|
setMsgError("");
|
||||||
setLoginLoading(false);
|
setLoginLoading(false);
|
||||||
}, Number(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT));
|
}, Number(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT));
|
||||||
});
|
});
|
||||||
@@ -132,14 +138,14 @@ export default function Login() {
|
|||||||
// );
|
// );
|
||||||
// console.log(userInfo);
|
// console.log(userInfo);
|
||||||
},
|
},
|
||||||
onError: errorResponse => console.log(errorResponse),
|
onError: (errorResponse) => console.log(errorResponse),
|
||||||
});
|
});
|
||||||
console.log(process.env.REACT_APP_GOOGLE_CLIENT_ID, process.env.REACT_APP_GOOGLE_REDIRECT_URL)
|
console.log(process.env.REACT_APP_GOOGLE_CLIENT_ID, process.env.REACT_APP_GOOGLE_REDIRECT_URL)
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(() => {
|
||||||
setMail('')
|
setMail("");
|
||||||
setPassword('')
|
setPassword("");
|
||||||
},[loginType.full, loginType.family])
|
}, [loginType.full, loginType.family]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -198,7 +204,7 @@ export default function Login() {
|
|||||||
{/* for login component */}
|
{/* for login component */}
|
||||||
{
|
{
|
||||||
loginType.full ? (
|
loginType.full ? (
|
||||||
//user login compoenent
|
//user login component
|
||||||
<div className="p-2 input-area border-2 border-[#4687ba]">
|
<div className="p-2 input-area border-2 border-[#4687ba]">
|
||||||
<div className="input-item mb-5">
|
<div className="input-item mb-5">
|
||||||
<InputCom
|
<InputCom
|
||||||
@@ -262,7 +268,12 @@ export default function Login() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="sm:flex sm:justify-between sm:items-center sm:space-x-2">
|
<div className="sm:flex sm:justify-between sm:items-center sm:space-x-2">
|
||||||
<BrandBtn link="#" imgSrc={googleLogo} brand="Google" onClick={googleLogin} />
|
<BrandBtn
|
||||||
|
link="#"
|
||||||
|
imgSrc={googleLogo}
|
||||||
|
brand="Google"
|
||||||
|
onClick={googleLogin}
|
||||||
|
/>
|
||||||
<BrandBtn link="#" imgSrc={appleLogo} brand="Apple" />
|
<BrandBtn link="#" imgSrc={appleLogo} brand="Apple" />
|
||||||
</div>
|
</div>
|
||||||
<div className="sm:flex sm:justify-between sm:items-center sm:space-x-2">
|
<div className="sm:flex sm:justify-between sm:items-center sm:space-x-2">
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export default function MyJobs(props) {
|
|||||||
const filterHandler = (value) => {
|
const filterHandler = (value) => {
|
||||||
setValue(value);
|
setValue(value);
|
||||||
};
|
};
|
||||||
console.log("AMEYE LOC1", props.MyJobList);
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<CommonHead
|
<CommonHead
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from "react";
|
||||||
import Detail from './popoutcomponent/Detail'
|
import Detail from "./popoutcomponent/Detail";
|
||||||
import ModalCom from '../Helpers/ModalCom'
|
import ModalCom from "../Helpers/ModalCom";
|
||||||
import InputCom from '../Helpers/Inputs/InputCom/index'
|
import InputCom from "../Helpers/Inputs/InputCom/index";
|
||||||
|
|
||||||
|
function JobListPopout({ details, onClose, situation }) {
|
||||||
|
let [inputs, setInputs] = useState({
|
||||||
|
family: "",
|
||||||
|
public: "",
|
||||||
|
individual: "",
|
||||||
|
group: "",
|
||||||
|
});
|
||||||
|
|
||||||
function JobListPopout({details, onClose, situation}) {
|
const handleInputChange = ({ target: { name, value } }) => {
|
||||||
let [inputs, setInputs] = useState({
|
setInputs((prev) => ({ ...prev, [name]: value }));
|
||||||
public: '',
|
};
|
||||||
individual: '',
|
|
||||||
group: '',
|
|
||||||
})
|
|
||||||
|
|
||||||
const handleInputChange = ({target:{name, value}}) => {
|
|
||||||
setInputs(prev => ({...prev, [name]:value}))
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalCom action={onClose} situation={situation}>
|
<ModalCom action={onClose} situation={situation} className="edit-popup">
|
||||||
<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-[768px] h-full lg:h-auto 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-[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">
|
<h1 className="text-base md:text-lg font-bold text-dark-gray dark:text-white tracking-wide">
|
||||||
{details.title}
|
{details.title}
|
||||||
</h1>
|
</h1>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@@ -48,130 +48,112 @@ function JobListPopout({details, onClose, situation}) {
|
|||||||
</svg>
|
</svg>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className='md:flex bg-white rounded-lg shadow-lg'>
|
<div className="md:flex bg-white rounded-lg shadow-lg">
|
||||||
<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">
|
||||||
{/* <p className='text-lg font-semibold text-slate-900 tracking-wide'>{details.title}</p> */}
|
{/* <p className='text-lg font-semibold text-slate-900 tracking-wide'>{details.title}</p> */}
|
||||||
|
|
||||||
{/* INPUT SECTION */}
|
{/* INPUT SECTION */}
|
||||||
<div className='my-3 md:flex'>
|
<div className="my-3 md:flex">
|
||||||
|
<Detail label="Description" value={details.description} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="my-3 md:flex">
|
||||||
|
<Detail label="Price" value={`${details.price * 0.01} Naira`} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="my-3 md:flex">
|
||||||
<Detail
|
<Detail
|
||||||
label='Description'
|
label="Timeline"
|
||||||
value={details.description}
|
value={`${details.timeline_days} day(s)`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='my-3 md:flex'>
|
<div className="my-3 md:flex">
|
||||||
<Detail
|
<Detail
|
||||||
label='Price'
|
label="Created"
|
||||||
value={`${details.price*0.01} Naira`}
|
value={`Dummy, no value found for created!`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='my-3 md:flex'>
|
<div className="my-3">
|
||||||
<Detail
|
<label className="w-full text-slate-900 tracking-wide font-semibold">
|
||||||
label='Timeline'
|
Delivery Detail
|
||||||
value={`${details.timeline_days} day(s)`}
|
</label>
|
||||||
|
<textarea
|
||||||
|
className={`p-1 w-full text-sm text-slate-900 outline-none border border-slate-300 rounded-md`}
|
||||||
|
rows="5"
|
||||||
|
name="details"
|
||||||
|
style={{ resize: "none" }}
|
||||||
|
value={details.job_detail}
|
||||||
|
onChange={handleInputChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='my-3 md:flex'>
|
|
||||||
<Detail
|
|
||||||
label='Created'
|
|
||||||
value={`Dummy, no value found for created!`}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className='my-3'>
|
|
||||||
<label className='w-full text-slate-900 tracking-wide font-semibold'>Delivery Detail</label>
|
|
||||||
<textarea
|
|
||||||
className={`p-1 w-full text-sm text-slate-900 outline-none border border-slate-300 rounded-md`}
|
|
||||||
rows='5'
|
|
||||||
name='details'
|
|
||||||
style={{resize: 'none'}}
|
|
||||||
value={details.job_detail}
|
|
||||||
onChange={handleInputChange}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</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">
|
||||||
|
{/* Assign to Family */}
|
||||||
|
<JobFieldInput
|
||||||
|
label="Assign to family"
|
||||||
|
inputName="family"
|
||||||
|
inputHandler={handleInputChange}
|
||||||
|
value={inputs.family}
|
||||||
|
btnText="Assign to family"
|
||||||
|
/>
|
||||||
|
|
||||||
{/* Offer this job to public input */}
|
{/* Offer this job to public input */}
|
||||||
<div className="field w-full p-3 mb-6 bg-red-50 rounded-md">
|
<JobFieldInput
|
||||||
<InputCom
|
label="Offer this job to public"
|
||||||
fieldClass="px-6"
|
inputName="public"
|
||||||
label="Offer this job to public"
|
inputHandler={handleInputChange}
|
||||||
labelClass='tracking-wide'
|
value={inputs.public}
|
||||||
type="text"
|
btnText="Show Task to Public"
|
||||||
name="public"
|
/>
|
||||||
placeholder=""
|
|
||||||
value={inputs.public}
|
|
||||||
inputHandler={handleInputChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* btn */}
|
|
||||||
<div className='my-1 flex justify-end items-center'>
|
|
||||||
<button className='px-2 py-1 text-sm text-white btn-gradient tracking-wide rounded-md'>Show Task to Public</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Offer this job to individual input */}
|
{/* Offer this job to individual input */}
|
||||||
<div className="field w-full p-3 mb-6 bg-red-50 rounded-md">
|
<JobFieldInput
|
||||||
<InputCom
|
label="Offer this job to individual"
|
||||||
fieldClass="px-6"
|
inputName="individual"
|
||||||
label="Offer this job to individual"
|
inputHandler={handleInputChange}
|
||||||
labelClass='tracking-wide'
|
value={inputs.individual}
|
||||||
type="text"
|
btnText="Send Offer to Individual"
|
||||||
name="individual"
|
/>
|
||||||
placeholder=""
|
|
||||||
value={inputs.individual}
|
|
||||||
inputHandler={handleInputChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* btn */}
|
|
||||||
<div className='my-1 flex justify-end items-center'>
|
|
||||||
<button className='px-2 py-1 text-sm text-white btn-gradient tracking-wide rounded-md'>Send Offer to Individual</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Offer this job to your group input */}
|
{/* Offer this job to your group input */}
|
||||||
<div className="field w-full p-3 mb-6 bg-red-50 rounded-md">
|
<JobFieldInput
|
||||||
<InputCom
|
label="Offer this job to your Group"
|
||||||
fieldClass="px-6"
|
inputName="group"
|
||||||
label="Offer this job to your Group"
|
inputHandler={handleInputChange}
|
||||||
labelClass='tracking-wide'
|
value={inputs.group}
|
||||||
type="text"
|
btnText="Send Order to Group"
|
||||||
name="group"
|
/>
|
||||||
placeholder=""
|
|
||||||
value={inputs.group}
|
|
||||||
inputHandler={handleInputChange}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* btn */}
|
|
||||||
<div className='my-1 flex justify-end items-center'>
|
|
||||||
<button className='px-2 py-1 text-sm text-white btn-gradient tracking-wide rounded-md'>Send Order to Group</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{/* END OF ACTION SECTION */}
|
{/* END OF ACTION SECTION */}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
{/* close button */}
|
</ModalCom>
|
||||||
{/* <div className="p-6 flex justify-center">
|
);
|
||||||
<button
|
|
||||||
onClick={onClose}
|
|
||||||
type="button"
|
|
||||||
className=" border-gradient text-18 tracking-wide px-2 py-2 rounded-full"
|
|
||||||
>
|
|
||||||
<span className="text-gradient">Close</span>
|
|
||||||
</button>
|
|
||||||
</div> */}
|
|
||||||
{/* end of close button */}
|
|
||||||
</div>
|
|
||||||
</ModalCom>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default JobListPopout
|
export default JobListPopout;
|
||||||
|
|
||||||
|
const JobFieldInput = ({ value, inputHandler, inputName, label, btnText }) => (
|
||||||
|
<div className="field w-full p-3 mb-6 bg-red-50 rounded-md">
|
||||||
|
<InputCom
|
||||||
|
fieldClass="px-6"
|
||||||
|
label={label}
|
||||||
|
labelClass="tracking-wide"
|
||||||
|
type="text"
|
||||||
|
name={inputName}
|
||||||
|
placeholder=""
|
||||||
|
value={value}
|
||||||
|
inputHandler={inputHandler}
|
||||||
|
/>
|
||||||
|
{/* btn */}
|
||||||
|
<div className="my-1 flex justify-end items-center">
|
||||||
|
<button className="px-2 py-1 text-sm text-white btn-gradient tracking-wide rounded-md">
|
||||||
|
{btnText}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
@@ -78,7 +78,6 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
const getMarketActiveJobList = async () => {
|
const getMarketActiveJobList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await apiCall.getActiveJobList();
|
const res = await apiCall.getActiveJobList();
|
||||||
console.log('Checking job data from auth', res)
|
|
||||||
dispatch(updateJobs(res.data));
|
dispatch(updateJobs(res.data));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log("Error getting mode");
|
console.log("Error getting mode");
|
||||||
|
|||||||
Reference in New Issue
Block a user