Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 22bfcbf0c6 | |||
| 7975bd3d11 | |||
| 5475719e7e | |||
| 36420a4b47 | |||
| 6df489a0c2 | |||
| 15adddb0ed | |||
| 83e6cef40a | |||
| 4e275da916 | |||
| 610768f4a5 | |||
| 39e1b05461 | |||
| b89cf9a6bc | |||
| 549d61d81b | |||
| 0ba8bbd2e7 | |||
| 9bdde5376c | |||
| 8e35839ddf | |||
| 4abd8a911b | |||
| a2a9fb2842 | |||
| 9a2fd54bd5 | |||
| d7dbacc69e | |||
| 464969530d | |||
| 7074347289 | |||
| 6a79d6369f | |||
| 984cdeaa24 | |||
| 7946ab12a1 | |||
| 392e0394ed | |||
| a5d534f364 | |||
| 01416ff42c | |||
| 3818e05d2f | |||
| 9adc7eaf1a |
@@ -44,6 +44,7 @@ import MyPastDueJobsPage from "./views/MyPastDueJobsPage";
|
|||||||
import BlogPage from "./views/BlogPage";
|
import BlogPage from "./views/BlogPage";
|
||||||
import MyReviewDueJobsPage from "./views/MyReviewDueJobsPage";
|
import MyReviewDueJobsPage from "./views/MyReviewDueJobsPage";
|
||||||
import OffersInterestPage from "./views/OffersInterestPage";
|
import OffersInterestPage from "./views/OffersInterestPage";
|
||||||
|
import ManageInterestOfferPage from './views/ManageInterestOfferPage'
|
||||||
|
|
||||||
export default function Routers() {
|
export default function Routers() {
|
||||||
return (
|
return (
|
||||||
@@ -99,6 +100,7 @@ export default function Routers() {
|
|||||||
<Route exact path="/manage-active-job" element={<ManageActiveJobs />} />
|
<Route exact path="/manage-active-job" element={<ManageActiveJobs />} />
|
||||||
<Route exact path="/blog-page" element={<BlogPage />} />
|
<Route exact path="/blog-page" element={<BlogPage />} />
|
||||||
<Route exact path="/offer-interest" element={<OffersInterestPage />} />
|
<Route exact path="/offer-interest" element={<OffersInterestPage />} />
|
||||||
|
<Route exact path="/manage-offer" element={<ManageInterestOfferPage />} />
|
||||||
|
|
||||||
|
|
||||||
<Route
|
<Route
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export default function FamilyTable({ className, familyList, loader, popUpHandle
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="p-2 w-full md:w-1/2">
|
<div className="p-2 w-full md:w-1/2">
|
||||||
<img className='w-full' src={familyImage} alt="A Family" />
|
<img className='w-full' src={familyImage} alt="Add Family" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
export const PriceFormatter = (price, currency, currencyName) => {
|
||||||
|
const supportedCurrencies = ["USD", "EUR", "GBP"];
|
||||||
|
const symbolFormatter = supportedCurrencies.includes(currency)
|
||||||
|
? currency
|
||||||
|
: undefined;
|
||||||
|
|
||||||
|
const formatter = new Intl.NumberFormat("en", {
|
||||||
|
style: symbolFormatter,
|
||||||
|
currencyDisplay: "symbol",
|
||||||
|
minimumFractionDigits: 2,
|
||||||
|
});
|
||||||
|
|
||||||
|
const displayCurrencyName = symbolFormatter ? "" : currencyName;
|
||||||
|
|
||||||
|
return `${formatter.format(price)} ${displayCurrencyName}`;
|
||||||
|
};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, useRef, forwardRef } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import Layout from "../Partials/Layout";
|
import Layout from "../Partials/Layout";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
@@ -12,22 +12,28 @@ import { useReactToPrint } from "react-to-print";
|
|||||||
import usersService from "../../services/UsersService";
|
import usersService from "../../services/UsersService";
|
||||||
|
|
||||||
function ActiveJobs(props) {
|
function ActiveJobs(props) {
|
||||||
const ApiCall = new usersService()
|
const ApiCall = new usersService();
|
||||||
let navigate = useNavigate()
|
let navigate = useNavigate();
|
||||||
|
|
||||||
let { userDetails } = useSelector((state) => state.userDetails);
|
let { userDetails } = useSelector((state) => state.userDetails);
|
||||||
|
|
||||||
let [passDue, setPassDue] = useState(new Date() > new Date(props.details?.delivery_date)) // STATE TO KNOW IF TASK IS PASSED DUE TIME
|
let [passDue, setPassDue] = useState(
|
||||||
|
new Date() > new Date(props.details?.delivery_date)
|
||||||
|
); // STATE TO KNOW IF TASK IS PASSED DUE TIME
|
||||||
|
|
||||||
let [messageToSend, setMessageToSend] = useState('') // State to hold the value of message to be sent
|
let [messageToSend, setMessageToSend] = useState(""); // State to hold the value of message to be sent
|
||||||
|
|
||||||
let [filesToSend, setFilesToSend] = useState([]) // State to hold the value of files to be sent
|
let [filesToSend, setFilesToSend] = useState([]); // State to hold the value of files to be sent
|
||||||
|
|
||||||
let [tab, setTab] = useState('message')
|
let [tab, setTab] = useState("message");
|
||||||
|
|
||||||
let [requestStatus, setRequestStatus] = useState({loading: false, status: false, message: ''})
|
let [requestStatus, setRequestStatus] = useState({
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
message: "",
|
||||||
|
});
|
||||||
|
|
||||||
let [popUp, setPopUp] = useState(false) // STATE FOR POPOUT MODAL
|
let [popUp, setPopUp] = useState(false); // STATE FOR POPOUT MODAL
|
||||||
|
|
||||||
const printRef = useRef();
|
const printRef = useRef();
|
||||||
// to handle printing
|
// to handle printing
|
||||||
@@ -35,112 +41,164 @@ function ActiveJobs(props) {
|
|||||||
content: () => printRef.current,
|
content: () => printRef.current,
|
||||||
});
|
});
|
||||||
|
|
||||||
const popUpHandler = () => { // FUNCTION TO HANDLE POPOUT
|
const popUpHandler = () => {
|
||||||
setPopUp(prev => !prev)
|
// FUNCTION TO HANDLE POPOUT
|
||||||
}
|
setPopUp((prev) => !prev);
|
||||||
|
};
|
||||||
|
|
||||||
// FUNCTION TO HANDLE MESSAGE CHANGE
|
// FUNCTION TO HANDLE MESSAGE CHANGE
|
||||||
const handleMessageChange = ({ target: { value } }) => {
|
const handleMessageChange = ({ target: { value } }) => {
|
||||||
setMessageToSend(value)
|
setMessageToSend(value);
|
||||||
}
|
};
|
||||||
|
|
||||||
// FUNCTION TO HANDLE FILE UPlOAD CHANGE
|
// FUNCTION TO HANDLE FILE UPlOAD CHANGE
|
||||||
const handleFileChange = ({ target: { files } }) => {
|
const handleFileChange = ({ target: { files } }) => {
|
||||||
setRequestStatus({loading: false, status: false, message: ''}) // State to determine error state
|
setRequestStatus({ loading: false, status: false, message: "" }); // State to determine error state
|
||||||
|
|
||||||
if(!files[0]) { // IF NO FILE SELECTED RETURN
|
if (!files[0]) {
|
||||||
return
|
// IF NO FILE SELECTED RETURN
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) {
|
if (files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) {
|
||||||
setRequestStatus({loading: false, status: false, message: 'File must be <= 1mb'})
|
setRequestStatus({
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
message: "File must be <= 1mb",
|
||||||
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setRequestStatus({loading: false, status: false, message: ''})
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
}, 5000)
|
}, 5000);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (filesToSend.length >= Number(process.env.REACT_APP_TOTAL_NUM_FILE)) {
|
if (filesToSend.length >= Number(process.env.REACT_APP_TOTAL_NUM_FILE)) {
|
||||||
setRequestStatus({loading: false, status: false, message: `Total number of attachment is ${Number(process.env.REACT_APP_TOTAL_NUM_FILE)}`})
|
setRequestStatus({
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
message: `Total number of attachment is ${Number(
|
||||||
|
process.env.REACT_APP_TOTAL_NUM_FILE
|
||||||
|
)}`,
|
||||||
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setRequestStatus({loading: false, status: false, message: ''})
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
}, 5000)
|
}, 5000);
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
// INCLUDE FILE IF NO ERROR
|
// INCLUDE FILE IF NO ERROR
|
||||||
setFilesToSend(prev => ([...prev, files[0]]))
|
setFilesToSend((prev) => [...prev, files[0]]);
|
||||||
}
|
};
|
||||||
|
|
||||||
// FUNCTION TO CLEAR ALL TYPED MESSAGE OR FILES
|
// FUNCTION TO CLEAR ALL TYPED MESSAGE OR FILES
|
||||||
const handleClearAll = ({ target: { name } }) => {
|
const handleClearAll = ({ target: { name } }) => {
|
||||||
if(tab == 'message'){
|
if (tab == "message") {
|
||||||
setMessageToSend('')
|
setMessageToSend("");
|
||||||
}else if(tab=='files'){
|
} else if (tab == "files") {
|
||||||
setFilesToSend([])
|
setFilesToSend([]);
|
||||||
} else {
|
} else {
|
||||||
return
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// FUNCTION TO REMOVE AND IMAGE
|
// FUNCTION TO REMOVE AND IMAGE
|
||||||
const handleRemoveImage = (imageToDelete) => {
|
const handleRemoveImage = (imageToDelete) => {
|
||||||
setFilesToSend(prev => prev.filter(item => item.name != imageToDelete.name))
|
setFilesToSend((prev) =>
|
||||||
}
|
prev.filter((item) => item.name != imageToDelete.name)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
// FUNCTION TO SEND TASK MESSAGE
|
// FUNCTION TO SEND TASK MESSAGE
|
||||||
const sendTaskMessage = () => {
|
const sendTaskMessage = () => {
|
||||||
let reqData={message: messageToSend, msg_type: 'TEXT', contract:props.details.contract}
|
let reqData = {
|
||||||
|
message: messageToSend,
|
||||||
|
msg_type: "TEXT",
|
||||||
|
contract: props.details.contract,
|
||||||
|
};
|
||||||
if (!reqData.message) {
|
if (!reqData.message) {
|
||||||
setRequestStatus({loading: false, status: false, message: 'Message is empty'})
|
setRequestStatus({
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
message: "Message is empty",
|
||||||
|
});
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
setRequestStatus({loading: false, status: false, message: ''})
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
}, 5000)
|
}, 5000);
|
||||||
}
|
}
|
||||||
setRequestStatus({loading: true, status: false, message: ''})
|
setRequestStatus({ loading: true, status: false, message: "" });
|
||||||
ApiCall.sendTaskMessage(reqData).then((res)=>{
|
ApiCall.sendTaskMessage(reqData)
|
||||||
|
.then((res) => {
|
||||||
if (res.status != 200 || res.data.internal_return < 0) {
|
if (res.status != 200 || res.data.internal_return < 0) {
|
||||||
setRequestStatus({loading: false, status: false, message: 'Message could not be sent, try again later'})
|
setRequestStatus({
|
||||||
return
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
message: "Message could not be sent, try again later",
|
||||||
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
setRequestStatus({loading: false, status: true, message: 'Message Sent Successfully'})
|
setRequestStatus({
|
||||||
props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
loading: false,
|
||||||
setMessageToSend('') // SENDS MESSAGE TO SEND BACK TO EMPTY STRINGS
|
status: true,
|
||||||
}).catch(error => {
|
message: "Message Sent Successfully",
|
||||||
setRequestStatus({loading: false, status: false, message: 'Opps! something went wrong'})
|
});
|
||||||
}).finally(()=>{
|
props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||||
setTimeout(()=>{
|
setMessageToSend(""); // SENDS MESSAGE TO SEND BACK TO EMPTY STRINGS
|
||||||
setRequestStatus({loading: false, status: false, message: ''})
|
|
||||||
}, 5000)
|
|
||||||
})
|
})
|
||||||
}
|
.catch((error) => {
|
||||||
|
setRequestStatus({
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
message: "Opps! something went wrong",
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// FUNCTION TO SEND FILES
|
// FUNCTION TO SEND FILES
|
||||||
const sendFile = async () => {
|
const sendFile = async () => {
|
||||||
setRequestStatus({loading: true, status: false, message: ''})
|
setRequestStatus({ loading: true, status: false, message: "" });
|
||||||
|
|
||||||
if(!filesToSend.length){ // checks if file to send is empty
|
if (!filesToSend.length) {
|
||||||
setRequestStatus({loading: false, status: false, message: 'No File(s) selected'})
|
// checks if file to send is empty
|
||||||
|
setRequestStatus({
|
||||||
|
loading: false,
|
||||||
|
status: false,
|
||||||
|
message: "No File(s) selected",
|
||||||
|
});
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
setRequestStatus({loading: false, status: false, message: ''})
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
}, 5000)
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i=0; i<=filesToSend.length-1; i++){ // Loops through files to send array and trigger upload API call
|
for (let i = 0; i <= filesToSend.length - 1; i++) {
|
||||||
|
// Loops through files to send array and trigger upload API call
|
||||||
|
|
||||||
const fileToBase64 = async () =>{ // Converts file data to base64 string
|
const fileToBase64 = async () => {
|
||||||
|
// Converts file data to base64 string
|
||||||
try {
|
try {
|
||||||
const base64String = await convertFileToBase64(filesToSend[i]);
|
const base64String = await convertFileToBase64(filesToSend[i]);
|
||||||
return base64String;
|
return base64String;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// if(await !fileToBase64()){
|
// if(await !fileToBase64()){
|
||||||
// return
|
// return
|
||||||
// }
|
// }
|
||||||
|
|
||||||
let reqData={file_name: filesToSend[i].name, file_size: filesToSend[i].size, file_type: 'image/png', file_data: await fileToBase64(), msg_type: 'FILE', contract:props.details.contract}
|
let reqData = {
|
||||||
|
file_name: filesToSend[i].name,
|
||||||
|
file_size: filesToSend[i].size,
|
||||||
|
file_type: "image/png",
|
||||||
|
file_data: await fileToBase64(),
|
||||||
|
msg_type: "FILE",
|
||||||
|
contract: props.details.contract,
|
||||||
|
};
|
||||||
|
|
||||||
ApiCall.sendFiles(reqData).then((res)=>{
|
ApiCall.sendFiles(reqData)
|
||||||
|
.then((res) => {
|
||||||
// if(res.status != 200 || res.data.internal_return < 0){
|
// if(res.status != 200 || res.data.internal_return < 0){
|
||||||
// setRequestStatus({loading: false, status: false, message: 'Files(s) could not be sent, try again later'})
|
// setRequestStatus({loading: false, status: false, message: 'Files(s) could not be sent, try again later'})
|
||||||
// return
|
// return
|
||||||
@@ -148,47 +206,50 @@ function ActiveJobs(props) {
|
|||||||
// setRequestStatus({loading: false, status: true, message: 'File(s) Uploaded Successfully'})
|
// setRequestStatus({loading: false, status: true, message: 'File(s) Uploaded Successfully'})
|
||||||
// props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
// props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||||
// setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
// setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||||
}).catch(error => {
|
|
||||||
// setRequestStatus({loading: false, status: false, message: 'Opps! something went wrong'})
|
|
||||||
}).finally(()=>{
|
|
||||||
if(i==filesToSend.length-1){
|
|
||||||
setRequestStatus({loading: false, status: true, message: 'File(s) Uploaded Successfully'})
|
|
||||||
setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
|
||||||
props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
|
||||||
setTimeout(()=>{
|
|
||||||
setRequestStatus({loading: false, status: false, message: ''})
|
|
||||||
}, 5000)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
// setRequestStatus({loading: false, status: false, message: 'Opps! something went wrong'})
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
if (i == filesToSend.length - 1) {
|
||||||
|
setRequestStatus({
|
||||||
|
loading: false,
|
||||||
|
status: true,
|
||||||
|
message: "File(s) Uploaded Successfully",
|
||||||
|
});
|
||||||
|
setFilesToSend([]); // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||||
|
props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||||
|
setTimeout(() => {
|
||||||
|
setRequestStatus({ loading: false, status: false, message: "" });
|
||||||
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// FUNCTION TO CHECK IF TASK PASS DUE IS REACHED
|
// FUNCTION TO CHECK IF TASK PASS DUE IS REACHED
|
||||||
let isPassedDue = () => {
|
let isPassedDue = () => {
|
||||||
// console.log('TESTING',new Date() > new Date(props.details?.delivery_date) )
|
// console.log('TESTING',new Date() > new Date(props.details?.delivery_date) )
|
||||||
if (new Date() > new Date(props.details?.delivery_date)) {
|
if (new Date() > new Date(props.details?.delivery_date)) {
|
||||||
setPassDue(true)
|
setPassDue(true);
|
||||||
} else {
|
} else {
|
||||||
setPassDue(false)
|
setPassDue(false);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!passDue) {
|
if (!passDue) {
|
||||||
let passDueInterval = setInterval(() => {
|
let passDueInterval = setInterval(() => {
|
||||||
isPassedDue()
|
isPassedDue();
|
||||||
},1000)
|
}, 1000);
|
||||||
return () => {
|
return () => {
|
||||||
clearInterval(passDueInterval)
|
clearInterval(passDueInterval);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}, [passDue]);
|
||||||
},[passDue])
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
|
|
||||||
<div className="py-[20px] bg-white px-4 rounded-2xl shadow-md md:flex justify-between items-start gap-16">
|
<div className="py-[20px] bg-white px-4 rounded-2xl shadow-md md:flex justify-between items-start gap-16">
|
||||||
{/* job title */}
|
{/* job title */}
|
||||||
<div className="w-full md:w-8/12">
|
<div className="w-full md:w-8/12">
|
||||||
@@ -196,7 +257,9 @@ function ActiveJobs(props) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="min-w-[45px] h-auto text-[#374557] border border-sky-blue p-1 rounded-full"
|
className="min-w-[45px] h-auto text-[#374557] border border-sky-blue p-1 rounded-full"
|
||||||
onClick={() => navigate(props.details.pathname, {replace: true})}
|
onClick={() =>
|
||||||
|
navigate(props.details.pathname, { replace: true })
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@@ -215,11 +278,13 @@ function ActiveJobs(props) {
|
|||||||
|
|
||||||
<div className="w-full my-2">
|
<div className="w-full my-2">
|
||||||
<p className="w-full text-base text-right text-sky-blue">
|
<p className="w-full text-base text-right text-sky-blue">
|
||||||
{userDetails.firstname && userDetails.firstname}
|
{props.details.job_to && props.details.job_to}
|
||||||
</p>
|
</p>
|
||||||
<div className="text-base text-slate-700 dark:text-black tracking-wide">
|
<div className="text-base text-slate-700 dark:text-black tracking-wide">
|
||||||
<p className="font-semibold text-black">Description: </p>
|
<p className="font-semibold text-black">Description: </p>
|
||||||
<p className="p-2 border border-sky-blue">{props.details?.description && props.details.description}</p>
|
<p className="p-2 border border-sky-blue">
|
||||||
|
{props.details?.description && props.details.description}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -228,8 +293,7 @@ function ActiveJobs(props) {
|
|||||||
{/* job details */}
|
{/* job details */}
|
||||||
<div className="w-full md:w-4/12">
|
<div className="w-full md:w-4/12">
|
||||||
<p className="text-base text-sky-blue">Delivery Detail</p>
|
<p className="text-base text-sky-blue">Delivery Detail</p>
|
||||||
{passDue ?
|
{passDue ? (
|
||||||
(
|
|
||||||
<div className="my-1">
|
<div className="my-1">
|
||||||
<p className="text-base text-slate-700 dark:text-black">
|
<p className="text-base text-slate-700 dark:text-black">
|
||||||
<span className="font-semibold">Due: </span>
|
<span className="font-semibold">Due: </span>
|
||||||
@@ -241,9 +305,7 @@ function ActiveJobs(props) {
|
|||||||
props.details.delivery_date.split(" ")[1]}
|
props.details.delivery_date.split(" ")[1]}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
) : (
|
||||||
:
|
|
||||||
(
|
|
||||||
<div className="my-1 flex items-start gap-3">
|
<div className="my-1 flex items-start gap-3">
|
||||||
<p className="font-semibold">Due: </p>
|
<p className="font-semibold">Due: </p>
|
||||||
<div className="flex flex-col justify-between">
|
<div className="flex flex-col justify-between">
|
||||||
@@ -257,16 +319,20 @@ function ActiveJobs(props) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)}
|
||||||
}
|
|
||||||
|
|
||||||
<div className="my-1 text-base text-slate-700 dark:text-black tracking-wide flex items-center gap-3">
|
<div className="my-1 text-base text-slate-700 dark:text-black tracking-wide flex items-center gap-3">
|
||||||
<span className="font-semibold text-black">Duration: </span>
|
<span className="font-semibold text-black">Duration: </span>
|
||||||
<span className="">{props.details?.timeline_days && props.details.timeline_days} day(s)</span>
|
<span className="">
|
||||||
|
{props.details?.timeline_days && props.details.timeline_days}{" "}
|
||||||
|
day(s)
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="my-1 text-base text-slate-700 dark:text-black tracking-wide flex items-center gap-3">
|
<div className="my-1 text-base text-slate-700 dark:text-black tracking-wide flex items-center gap-3">
|
||||||
<span className="font-semibold text-black">No: </span>
|
<span className="font-semibold text-black">No: </span>
|
||||||
<span className="">{props.details?.contract && props.details.contract}</span>
|
<span className="">
|
||||||
|
{props.details?.contract && props.details.contract}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* end of job details */}
|
{/* end of job details */}
|
||||||
@@ -275,7 +341,9 @@ function ActiveJobs(props) {
|
|||||||
<div className="my-4 py-[20px] bg-white px-4 rounded-2xl shadow-md lg:flex justify-between items-start space-y-4 lg:space-x-4 lg:space-y-0">
|
<div className="my-4 py-[20px] bg-white px-4 rounded-2xl shadow-md lg:flex justify-between items-start space-y-4 lg:space-x-4 lg:space-y-0">
|
||||||
<div className="w-full lg:w-1/2">
|
<div className="w-full lg:w-1/2">
|
||||||
<div className="">
|
<div className="">
|
||||||
<h1 className="text-lg font-bold text-dark-gray dark:text-white tracking-wide">Actions</h1>
|
<h1 className="text-lg font-bold text-dark-gray dark:text-white tracking-wide">
|
||||||
|
Actions
|
||||||
|
</h1>
|
||||||
{/* <p className="my-3 py-1 text-base">
|
{/* <p className="my-3 py-1 text-base">
|
||||||
Waiting for the completion message from the client before you can approve.
|
Waiting for the completion message from the client before you can approve.
|
||||||
</p> */}
|
</p> */}
|
||||||
@@ -288,47 +356,67 @@ function ActiveJobs(props) {
|
|||||||
{/* <p className="relative py-2 my-2 text-lg font-bold text-slate-600 dark:text-black border-b-2 border-slate-300 tracking-wide after:absolute after:-bottom-0.5 after:content-[''] after:w-[100px] after:h-[2px] after:bg-sky-blue after:left-0">Message(s)</p> */}
|
{/* <p className="relative py-2 my-2 text-lg font-bold text-slate-600 dark:text-black border-b-2 border-slate-300 tracking-wide after:absolute after:-bottom-0.5 after:content-[''] after:w-[100px] after:h-[2px] after:bg-sky-blue after:left-0">Message(s)</p> */}
|
||||||
<div className="my-2 flex items-center border-b border-slate-300">
|
<div className="my-2 flex items-center border-b border-slate-300">
|
||||||
<button
|
<button
|
||||||
name='message'
|
name="message"
|
||||||
onClick={(e) => setTab(e.target.name)}
|
onClick={(e) => setTab(e.target.name)}
|
||||||
className={`p-2 text-lg font-bold text-slate-600 dark:text-black border ${tab == 'message'? 'border-sky-blue':'border-slate-300'} tracking-wide transition duration-200`}>
|
className={`p-2 text-lg font-bold text-slate-600 dark:text-black border ${
|
||||||
|
tab == "message" ? "border-sky-blue" : "border-slate-300"
|
||||||
|
} tracking-wide transition duration-200`}
|
||||||
|
>
|
||||||
Send Message
|
Send Message
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
name='files'
|
name="files"
|
||||||
onClick={(e) => setTab(e.target.name)}
|
onClick={(e) => setTab(e.target.name)}
|
||||||
className={`p-2 text-lg font-bold text-slate-600 dark:text-black border ${tab == 'files'? 'border-sky-blue':'border-slate-300'} tracking-wide transition duration-200`}>
|
className={`p-2 text-lg font-bold text-slate-600 dark:text-black border ${
|
||||||
|
tab == "files" ? "border-sky-blue" : "border-slate-300"
|
||||||
|
} tracking-wide transition duration-200`}
|
||||||
|
>
|
||||||
Send Files
|
Send Files
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{tab == 'message' ?
|
{tab == "message" ? (
|
||||||
(
|
|
||||||
<textarea
|
<textarea
|
||||||
className="p-4 w-full h-[300px] text-base text-slate-600 border border-slate-300 outline-none"
|
className="p-4 w-full h-[300px] text-base text-slate-600 border border-slate-300 outline-none"
|
||||||
// rows="10"
|
// rows="10"
|
||||||
style={{ resize: "none" }}
|
style={{ resize: "none" }}
|
||||||
name='message'
|
name="message"
|
||||||
onChange={handleMessageChange}
|
onChange={handleMessageChange}
|
||||||
value={messageToSend}
|
value={messageToSend}
|
||||||
/>
|
/>
|
||||||
)
|
) : (
|
||||||
:
|
|
||||||
<div className="p-4 w-full h-[300px] text-base text-slate-600 border border-slate-300">
|
<div className="p-4 w-full h-[300px] text-base text-slate-600 border border-slate-300">
|
||||||
<div className="files">
|
<div className="files">
|
||||||
<label htmlFor="file" className="h-20 btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer">Select Files to Upload</label>
|
<label
|
||||||
<input type="file" id='file' accept="image/*" style={{display: 'none'}} onChange={handleFileChange}/>
|
htmlFor="file"
|
||||||
|
className="h-20 btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer"
|
||||||
|
>
|
||||||
|
Select Files to Upload
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="file"
|
||||||
|
id="file"
|
||||||
|
accept="image/*"
|
||||||
|
style={{ display: "none" }}
|
||||||
|
onChange={handleFileChange}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="selected_file my-2">
|
<div className="selected_file my-2">
|
||||||
{filesToSend.length > 0 &&
|
{filesToSend.length > 0 &&
|
||||||
filesToSend.map((item, index) => (
|
filesToSend.map((item, index) => (
|
||||||
<p key={index} className="flex items-center space-x-2">
|
<p key={index} className="flex items-center space-x-2">
|
||||||
<span>{item.name}</span>
|
<span>{item.name}</span>
|
||||||
<button name='remove' onClick={()=>handleRemoveImage(item)} className="px-2 flex justify-center items-center rounded-full border border-red-500 text-red-500">x</button>
|
<button
|
||||||
|
name="remove"
|
||||||
|
onClick={() => handleRemoveImage(item)}
|
||||||
|
className="px-2 flex justify-center items-center rounded-full border border-red-500 text-red-500"
|
||||||
|
>
|
||||||
|
x
|
||||||
|
</button>
|
||||||
</p>
|
</p>
|
||||||
))
|
))}
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
||||||
@@ -363,44 +451,44 @@ function ActiveJobs(props) {
|
|||||||
>
|
>
|
||||||
<span className="text-gradient">Clear</span>
|
<span className="text-gradient">Clear</span>
|
||||||
</button>
|
</button>
|
||||||
{tab == 'files' ?
|
{tab == "files" ? (
|
||||||
(
|
|
||||||
<button
|
<button
|
||||||
onClick={sendFile}
|
onClick={sendFile}
|
||||||
type="button"
|
type="button"
|
||||||
className="btn-gradient text-base tracking-wide px-4 py-3 rounded-full flex justify-center items-center"
|
className="btn-gradient text-base tracking-wide px-4 py-3 rounded-full flex justify-center items-center"
|
||||||
>
|
>
|
||||||
{requestStatus.loading ?
|
{requestStatus.loading ? (
|
||||||
<LoadingSpinner size='6' color='sky-blue' />
|
<LoadingSpinner size="6" color="sky-blue" />
|
||||||
:
|
) : (
|
||||||
<>
|
<>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" fill='white'>
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
fill="white"
|
||||||
|
>
|
||||||
<path d="M12 2L2 12h3v8h14v-8h3L12 2zm0 16v-6h-2v6H7l5-5 5 5h-3z" />
|
<path d="M12 2L2 12h3v8h14v-8h3L12 2zm0 16v-6h-2v6H7l5-5 5 5h-3z" />
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<span className="text-white">Upload Files</span>
|
<span className="text-white">Upload Files</span>
|
||||||
</>
|
</>
|
||||||
}
|
)}
|
||||||
</button>
|
</button>
|
||||||
)
|
) : (
|
||||||
:
|
|
||||||
(
|
|
||||||
<button
|
<button
|
||||||
onClick={sendTaskMessage}
|
onClick={sendTaskMessage}
|
||||||
type="button"
|
type="button"
|
||||||
className="btn-gradient text-base text-white tracking-wide px-4 py-3 rounded-full"
|
className="btn-gradient text-base text-white tracking-wide px-4 py-3 rounded-full"
|
||||||
>
|
>
|
||||||
{requestStatus.loading ?
|
{requestStatus.loading ? (
|
||||||
<LoadingSpinner size='6' color='sky-blue' />
|
<LoadingSpinner size="6" color="sky-blue" />
|
||||||
:
|
) : (
|
||||||
<span className="text-white">Send</span>
|
<span className="text-white">Send</span>
|
||||||
}
|
)}
|
||||||
</button>
|
</button>
|
||||||
)
|
)}
|
||||||
}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{/* end of Buttons Sections */}
|
{/* end of Buttons Sections */}
|
||||||
</div>
|
</div>
|
||||||
@@ -410,43 +498,54 @@ function ActiveJobs(props) {
|
|||||||
{/* MESSAGE SECTION */}
|
{/* MESSAGE SECTION */}
|
||||||
<div className="w-full lg:w-1/2">
|
<div className="w-full lg:w-1/2">
|
||||||
<div className="flex justify-between items-center gap-5">
|
<div className="flex justify-between items-center gap-5">
|
||||||
<p className="text-lg font-bold text-dark-gray dark:text-black tracking-wide">Message</p>
|
<p className="text-lg font-bold text-dark-gray dark:text-black tracking-wide">
|
||||||
<button type="button" onClick={popUpHandler} className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
Message
|
||||||
|
</p>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={popUpHandler}
|
||||||
|
className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
view all
|
view all
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{props.activeJobMesList.loading ?
|
{props.activeJobMesList.loading ? (
|
||||||
<LoadingSpinner size='16' color='sky-blue' />
|
<LoadingSpinner size="16" color="sky-blue" />
|
||||||
:
|
) : (
|
||||||
<ActiveJobMessage activeJobMesList={props.activeJobMesList} />
|
<ActiveJobMessage activeJobMesList={props.activeJobMesList} />
|
||||||
}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{/* END OF MESSAGE */}
|
{/* END OF MESSAGE */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* POPOUT SECTION */}
|
{/* POPOUT SECTION */}
|
||||||
{popUp &&
|
{popUp && (
|
||||||
<PopModal popUpHandler={popUpHandler} popUp={popUp} details={props.details} activeJobMesList={props.activeJobMesList} handlePrint={handlePrint} myRef={printRef} />
|
<PopModal
|
||||||
}
|
popUpHandler={popUpHandler}
|
||||||
|
popUp={popUp}
|
||||||
|
details={props.details}
|
||||||
|
activeJobMesList={props.activeJobMesList}
|
||||||
|
handlePrint={handlePrint}
|
||||||
|
myRef={printRef}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{/* END OF POPOUT SECTION */}
|
{/* END OF POPOUT SECTION */}
|
||||||
|
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ActiveJobs;
|
export default ActiveJobs;
|
||||||
|
|
||||||
|
|
||||||
function convertFileToBase64(file) {
|
function convertFileToBase64(file) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
|
|
||||||
reader.onload = () => {
|
reader.onload = () => {
|
||||||
const base64String = reader.result.split(',')[1];
|
const base64String = reader.result.split(",")[1];
|
||||||
resolve(base64String);
|
resolve(base64String);
|
||||||
};
|
};
|
||||||
|
|
||||||
reader.onerror = error => {
|
reader.onerror = (error) => {
|
||||||
reject(error);
|
reject(error);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -455,10 +554,20 @@ function convertFileToBase64(file) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//POPOUT COMPONENT FUNCTION
|
//POPOUT COMPONENT FUNCTION
|
||||||
const PopModal = ({popUpHandler, popUp, details, activeJobMesList, handlePrint, myRef}) => {
|
const PopModal = ({
|
||||||
|
popUpHandler,
|
||||||
|
popUp,
|
||||||
|
details,
|
||||||
|
activeJobMesList,
|
||||||
|
handlePrint,
|
||||||
|
myRef,
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<ModalCom action={popUpHandler} situation={popUp} className="edit-popup">
|
<ModalCom action={popUpHandler} situation={popUp} className="edit-popup">
|
||||||
<div ref={myRef} className="message-modal-wrapper min-w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
|
<div
|
||||||
|
ref={myRef}
|
||||||
|
className="message-modal-wrapper min-w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl"
|
||||||
|
>
|
||||||
<div className="message-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
|
<div className="message-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 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">
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||||
{details?.contract}
|
{details?.contract}
|
||||||
@@ -491,67 +600,79 @@ const PopModal = ({popUpHandler, popUp, details, activeJobMesList, handlePrint,
|
|||||||
</div>
|
</div>
|
||||||
<div className="job-action-modal-body w-full px-10 py-8 gap-4">
|
<div className="job-action-modal-body w-full px-10 py-8 gap-4">
|
||||||
<div className="w-full flex flex-col items-center">
|
<div className="w-full flex flex-col items-center">
|
||||||
{activeJobMesList.loading ?
|
{activeJobMesList.loading ? (
|
||||||
<LoadingSpinner size='16' color='sky-blue' />
|
<LoadingSpinner size="16" color="sky-blue" />
|
||||||
:
|
) : (
|
||||||
<div className="message-table h-[500px] overflow-y-auto">
|
<div className="message-table h-[500px] overflow-y-auto">
|
||||||
<table className="wallet-activity w-full table-auto border-collapse text-left">
|
<table className="wallet-activity w-full table-auto border-collapse text-left">
|
||||||
<thead className='border-b-2'>
|
<thead className="border-b-2">
|
||||||
<tr className='text-slate-600'>
|
<tr className="text-slate-600">
|
||||||
<th className="p-2"></th>
|
<th className="p-2"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{activeJobMesList?.data?.length ?
|
{activeJobMesList?.data?.length ? (
|
||||||
(
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{activeJobMesList?.data?.map((item, index) => (
|
{activeJobMesList?.data?.map((item, index) => (
|
||||||
<tr key={index} className='text-slate-500'>
|
<tr key={index} className="text-slate-500">
|
||||||
<td>
|
<td>
|
||||||
<div className="msg_box">
|
<div className="msg_box">
|
||||||
<div className="msg_header">{item.msg_date} {item.msg_firstname}</div>
|
<div className="msg_header">
|
||||||
<span className="p-2" dangerouslySetInnerHTML={{__html: item.message}}></span>
|
{item.msg_date} {item.msg_firstname}
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
className="p-2"
|
||||||
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: item.message,
|
||||||
|
}}
|
||||||
|
></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
)
|
) : activeJobMesList.error ? (
|
||||||
:
|
|
||||||
activeJobMesList.error ?
|
|
||||||
(
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr className='text-slate-500'>
|
<tr className="text-slate-500">
|
||||||
<td className="p-2" colSpan={4}>Opps! an error occurred. Please try again!</td>
|
<td className="p-2" colSpan={4}>
|
||||||
|
Opps! an error occurred. Please try again!
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
)
|
) : (
|
||||||
:
|
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr className='text-slate-500'>
|
<tr className="text-slate-500">
|
||||||
<td className="p-2" colSpan={4}>No Message Found!</td>
|
<td className="p-2" colSpan={4}>
|
||||||
|
No Message Found!
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
}
|
)}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* btn */}
|
{/* btn */}
|
||||||
<div className='flex justify-end items-center'>
|
<div className="flex justify-end items-center">
|
||||||
<div className="py-3 w-full lg:w-1/2 flex justify-between items-center">
|
<div className="py-3 w-full lg:w-1/2 flex justify-between items-center">
|
||||||
<button onClick={handlePrint} type="button" className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
<button
|
||||||
<span className='text-white'>Print</span>
|
onClick={handlePrint}
|
||||||
|
type="button"
|
||||||
|
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
<span className="text-white">Print</span>
|
||||||
</button>
|
</button>
|
||||||
<button onClick={popUpHandler} type="button" className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white">
|
<button
|
||||||
<span className='text-gradient'>Cancel</span>
|
onClick={popUpHandler}
|
||||||
|
type="button"
|
||||||
|
className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
<span className="text-gradient">Cancel</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ModalCom>
|
</ModalCom>
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function CurrentTaskAction({jobDetails}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// API CALL TO MARK TASK AS COMPLETED BY WORKER
|
// API CALL TO MARK TASK AS COMPLETED BY WORKER
|
||||||
apiCall.taskCompleted(reqData).then((res)=>{
|
apiCall.workerJobAction(reqData).then((res)=>{
|
||||||
if(res.status != 200 || res.data.internal_return < 0){
|
if(res.status != 200 || res.data.internal_return < 0){
|
||||||
setReqStatus({loading:false, status: false, message: 'unable to complete request. Try again'})
|
setReqStatus({loading:false, status: false, message: 'unable to complete request. Try again'})
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,6 +1,105 @@
|
|||||||
import React from 'react'
|
import React,{useState} from 'react'
|
||||||
|
import ModalCom from '../../Helpers/ModalCom'
|
||||||
|
import LoadingSpinner from '../../Spinners/LoadingSpinner'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import usersService from '../../../services/UsersService'
|
||||||
|
|
||||||
|
function PastDueJobAction({jobDetails}) {
|
||||||
|
|
||||||
|
const apiCall = new usersService()
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
const [checked, setChecked] = useState(false)
|
||||||
|
|
||||||
|
const [extendedTime, setExtendedTime] = useState('') // VALUE OF NEW EXTENDED TIME
|
||||||
|
|
||||||
|
const [action, setAction] = useState('') // VALUE OF NEW EXTENDED TIME
|
||||||
|
|
||||||
|
const [reqStatus, setReqStatus] = useState({loading:false, status: false, message: ''})
|
||||||
|
|
||||||
|
let [popUp, setPopUp] = useState(false)
|
||||||
|
|
||||||
|
const popUpHandler = () => {
|
||||||
|
if(popUp){
|
||||||
|
setChecked(false)
|
||||||
|
}
|
||||||
|
setPopUp(prev => !prev)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO HANDLE WHEN OWNER CANCELS JOB
|
||||||
|
const cancelTask = () => {
|
||||||
|
setAction('cancel')
|
||||||
|
setReqStatus({loading:true, status: false, message: ''})
|
||||||
|
|
||||||
|
let reqData = { // API PAYLOADS
|
||||||
|
contract: jobDetails.contract,
|
||||||
|
contract_uid: jobDetails.contract_uid,
|
||||||
|
job_action: 'REQUEST_CANCEL',
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!checked){ // CHECKS IF CHECKBOX IS SELECTED
|
||||||
|
setReqStatus({loading:false, status: false, message: 'Please check the box above'})
|
||||||
|
return setTimeout(()=>{
|
||||||
|
setReqStatus({loading:false, status: false, message: ''})
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
|
// API CALL TO ACCEPT COMPLETION BY OWNER
|
||||||
|
apiCall.ownerJobAction(reqData).then((res)=>{
|
||||||
|
if(res.status != 200 || res.data.internal_return < 0){
|
||||||
|
setReqStatus({loading:false, status: false, message: 'unable to complete request. Try again'})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setReqStatus({loading:false, status: true, message: 'job cancelled successfully'})
|
||||||
|
setTimeout(()=>{ // Sets popout to false and navigates user to /my-pastdue-jobs after 3 seconds
|
||||||
|
popUpHandler()
|
||||||
|
navigate('/my-pastdue-jobs', {replace: true})
|
||||||
|
}, 3000)
|
||||||
|
}).catch(err => {
|
||||||
|
setReqStatus({loading:false, status: false, message: 'Opps! Network error. Try again'})
|
||||||
|
}).finally(()=>{
|
||||||
|
setTimeout(()=>{
|
||||||
|
setReqStatus({loading:false, status: false, message: ''})
|
||||||
|
}, 3000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO HANDLE WHEN USER/OWNER CLICKS ON EXTEND TIMELINE FOR A JOB
|
||||||
|
const extendTime = () => {
|
||||||
|
setAction('extend')
|
||||||
|
setReqStatus({loading:true, status: false, message: ''}) // Sets loading spinner active
|
||||||
|
let reqData = {
|
||||||
|
contract: jobDetails.contract,
|
||||||
|
contract_uid: jobDetails.contract_uid,
|
||||||
|
job_action: 'EXTEND_TIMELINE',
|
||||||
|
extension: Number(extendedTime)
|
||||||
|
}
|
||||||
|
if(!extendedTime){ // checks that timeline duration is selected
|
||||||
|
setReqStatus({loading:false, status: false, message: 'Please select timeline duration'})
|
||||||
|
return setTimeout(()=>{
|
||||||
|
setReqStatus({loading:false, status: false, message: ''})
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
|
|
||||||
|
// API CALL EXTEND TIMELINE BY OWNER
|
||||||
|
apiCall.ownerJobAction(reqData).then((res)=>{
|
||||||
|
if(res.status != 200 || res.data.internal_return < 0){
|
||||||
|
setReqStatus({loading:false, status: false, message: 'unable to complete request. Try again'})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setReqStatus({loading:false, status: true, message: 'Timeline extended successfully'})
|
||||||
|
setTimeout(()=>{ // Sets popout to false and navigates user to /my-pastdue-jobs after 3 seconds
|
||||||
|
popUpHandler()
|
||||||
|
navigate('/my-pastdue-jobs', {replace: true})
|
||||||
|
}, 3000)
|
||||||
|
}).catch(err => {
|
||||||
|
setReqStatus({loading:false, status: false, message: 'Opps! Network error. Try again'})
|
||||||
|
}).finally(()=>{
|
||||||
|
setTimeout(()=>{
|
||||||
|
setReqStatus({loading:false, status: false, message: ''})
|
||||||
|
}, 3000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function PastDueJobAction() {
|
|
||||||
return (
|
return (
|
||||||
<div className='job-action'>
|
<div className='job-action'>
|
||||||
|
|
||||||
@@ -20,7 +119,7 @@ function PastDueJobAction() {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div className="flex justify-center items-center">
|
<div className="flex justify-center items-center">
|
||||||
<button type="button" className="w-120 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
<button type="button" onClick={popUpHandler} className="w-120 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
||||||
Cancel or Extend Timeline
|
Cancel or Extend Timeline
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,6 +127,118 @@ function PastDueJobAction() {
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
{popUp && (
|
||||||
|
<ModalCom action={popUpHandler} situation={popUp}>
|
||||||
|
<div className="logout-modal-wrapper lg:w-[460px] h-full lg:h-auto 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 dark:border-[#5356fb29] border-light-purple">
|
||||||
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||||
|
Past Due Task
|
||||||
|
</h1>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="text-[#374557] dark:text-red-500"
|
||||||
|
onClick={popUpHandler}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="36"
|
||||||
|
height="36"
|
||||||
|
viewBox="0 0 36 36"
|
||||||
|
fill="none"
|
||||||
|
className="fill-current"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M36 16.16C36 17.4399 36 18.7199 36 20.0001C35.7911 20.0709 35.8636 20.2554 35.8385 20.4001C34.5321 27.9453 30.246 32.9248 22.9603 35.2822C21.9006 35.6251 20.7753 35.7657 19.6802 35.9997C18.4003 35.9997 17.1204 35.9997 15.8401 35.9997C15.5896 35.7086 15.2189 35.7732 14.9034 35.7093C7.77231 34.2621 3.08728 30.0725 0.769671 23.187C0.435002 22.1926 0.445997 21.1199 0 20.1599C0 18.7198 0 17.2798 0 15.8398C0.291376 15.6195 0.214408 15.2656 0.270759 14.9808C1.71321 7.69774 6.02611 2.99691 13.0428 0.700951C14.0118 0.383805 15.0509 0.386897 15.9999 0C17.2265 0 18.4532 0 19.6799 0C19.7156 0.124041 19.8125 0.136067 19.9225 0.146719C27.3 0.868973 33.5322 6.21922 35.3801 13.427C35.6121 14.3313 35.7945 15.2484 36 16.16ZM33.011 18.0787C33.0433 9.77105 26.3423 3.00309 18.077 2.9945C9.78479 2.98626 3.00344 9.658 2.98523 17.8426C2.96667 26.1633 9.58859 32.9601 17.7602 33.0079C26.197 33.0577 32.9787 26.4186 33.011 18.0787Z"
|
||||||
|
fill=""
|
||||||
|
fillOpacity="0.6"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M15.9309 18.023C13.9329 16.037 12.007 14.1207 10.0787 12.2072C9.60071 11.733 9.26398 11.2162 9.51996 10.506C9.945 9.32677 11.1954 9.0811 12.1437 10.0174C13.9067 11.7585 15.6766 13.494 17.385 15.2879C17.9108 15.8401 18.1633 15.7487 18.6375 15.258C20.3586 13.4761 22.1199 11.7327 23.8822 9.99096C24.8175 9.06632 26.1095 9.33639 26.4967 10.517C26.7286 11.2241 26.3919 11.7413 25.9133 12.2178C24.1757 13.9472 22.4477 15.6855 20.7104 17.4148C20.5228 17.6018 20.2964 17.7495 20.0466 17.9485C22.0831 19.974 24.0372 21.8992 25.9689 23.8468C26.9262 24.8119 26.6489 26.1101 25.4336 26.4987C24.712 26.7292 24.2131 26.3441 23.7455 25.8757C21.9945 24.1227 20.2232 22.3892 18.5045 20.6049C18.0698 20.1534 17.8716 20.2269 17.4802 20.6282C15.732 22.4215 13.9493 24.1807 12.1777 25.951C11.7022 26.4262 11.193 26.7471 10.4738 26.4537C9.31345 25.9798 9.06881 24.8398 9.98589 23.8952C11.285 22.5576 12.6138 21.2484 13.9387 19.9355C14.5792 19.3005 15.2399 18.6852 15.9309 18.023Z"
|
||||||
|
fill="#"
|
||||||
|
fillOpacity="0.6"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="job-action-modal-body w-full px-10 py-8 gap-4">
|
||||||
|
<div className="w-full flex flex-col items-center">
|
||||||
|
<div className="mb-5 flex justify-center items-center gap-2">
|
||||||
|
<input
|
||||||
|
type='checkbox'
|
||||||
|
checked={checked}
|
||||||
|
onChange={()=>{setChecked(prev => !prev)}}
|
||||||
|
className='w-6 h-6 text-sky-blue bg-gray-100 focus:ring-sky-blue'
|
||||||
|
/>
|
||||||
|
<p className='font-bold text-base tracking-wide text-dark-gray dark:text-white'>I am ready to cancel this task</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-5 flex justify-center items-center">
|
||||||
|
{reqStatus.loading && action=='cancel'?
|
||||||
|
<LoadingSpinner color='sky-blue' size='10' />
|
||||||
|
:
|
||||||
|
<button disabled={reqStatus.loading} onClick={cancelTask} type="button" className="px-2 py-1 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white">
|
||||||
|
<span className='text-gradient'>Cancel this task</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* EXTEND TIMELINE SECTION */}
|
||||||
|
<div className='w-full my-3 py-3 border-y flex flex-col items-center'>
|
||||||
|
<div className='mb-5 flex items-center gap-2'>
|
||||||
|
<p className='font-bold text-base tracking-wide text-dark-gray dark:text-white'>Extend the timeline by:</p>
|
||||||
|
<select
|
||||||
|
onChange={({target})=>{setExtendedTime(target.value)}}
|
||||||
|
className='text-base p-2 text-dark-gray dark:text-white rounded-md border border-slate-300 outline-0'
|
||||||
|
>
|
||||||
|
<option className='text-slate-500 text-lg' value=''>select</option>
|
||||||
|
<option className='text-slate-500 text-lg' value='2'>1 days</option>
|
||||||
|
<option className='text-slate-500 text-lg' value='3'>3 days</option>
|
||||||
|
<option className='text-slate-500 text-lg' value='5'>5 days</option>
|
||||||
|
<option className='text-slate-500 text-lg' value='7'>1 week</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
{reqStatus.loading && action=='extend' ?
|
||||||
|
<LoadingSpinner color='sky-blue' size='10' />
|
||||||
|
:
|
||||||
|
<button disabled={reqStatus.loading} type="button" onClick={extendTime} className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
||||||
|
Extend Timeline
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* FOR SUCCESS/ERROR DISPLAY SECTION*/}
|
||||||
|
<div className="w-full">
|
||||||
|
{reqStatus.message != "" &&
|
||||||
|
(!reqStatus.status ? (
|
||||||
|
<div
|
||||||
|
className={`relative p-4 my-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
|
>
|
||||||
|
{reqStatus.message}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
reqStatus.status && (
|
||||||
|
<div
|
||||||
|
className={`relative p-4 my-4 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
|
>
|
||||||
|
{reqStatus.message}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
{/* END OF FOR SUCCESS/ERROR DISPLAY SECTION*/}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* cancel btn */}
|
||||||
|
<div className='flex justify-end items-center'>
|
||||||
|
<button onClick={popUpHandler} type="button" className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white">
|
||||||
|
<span className='text-gradient'>Cancel</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ModalCom>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,97 @@
|
|||||||
import React from 'react'
|
import React,{useState} from 'react'
|
||||||
|
import ModalCom from '../../Helpers/ModalCom'
|
||||||
|
import LoadingSpinner from '../../Spinners/LoadingSpinner'
|
||||||
|
import { useNavigate } from 'react-router-dom'
|
||||||
|
import usersService from '../../../services/UsersService'
|
||||||
|
|
||||||
function ReviewJobAction() {
|
function ReviewJobAction({jobDetails}) {
|
||||||
|
|
||||||
|
const apiCall = new usersService()
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
const [checked, setChecked] = useState(false)
|
||||||
|
|
||||||
|
const [action, setAction] = useState('') // VALUE OF NEW EXTENDED TIME
|
||||||
|
|
||||||
|
const [reqStatus, setReqStatus] = useState({loading:false, status: false, message: ''})
|
||||||
|
|
||||||
|
let [popUp, setPopUp] = useState(false)
|
||||||
|
|
||||||
|
const popUpHandler = () => {
|
||||||
|
if(popUp){
|
||||||
|
setChecked(false)
|
||||||
|
}
|
||||||
|
setPopUp(prev => !prev)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO HANDLE WHEN OWNER ACCEPTS COMPLETION OF JOB
|
||||||
|
const acceptCompletion = () => {
|
||||||
|
setAction('accept')
|
||||||
|
setReqStatus({loading:true, status: false, message: ''})
|
||||||
|
|
||||||
|
let reqData = { // API PAYLOADS
|
||||||
|
contract: jobDetails.contract,
|
||||||
|
contract_uid: jobDetails.contract_uid,
|
||||||
|
job_action: 'ACCEPT_COMPLETE',
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!checked){ // CHECKS IF CHECKBOX IS SELECTED
|
||||||
|
setReqStatus({loading:false, status: false, message: 'Please check the box above'})
|
||||||
|
return setTimeout(()=>{
|
||||||
|
setReqStatus({loading:false, status: false, message: ''})
|
||||||
|
}, 3000)
|
||||||
|
}
|
||||||
|
// API CALL TO ACCEPT COMPLETION BY OWNER
|
||||||
|
apiCall.ownerJobAction(reqData).then((res)=>{
|
||||||
|
if(res.status != 200 || res.data.internal_return < 0){
|
||||||
|
setReqStatus({loading:false, status: false, message: 'unable to complete request. Try again'})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setReqStatus({loading:false, status: true, message: 'job completion accepted successfully'})
|
||||||
|
setTimeout(()=>{ // Sets popout to false and navigates user to /my-review-jobs after 3 seconds
|
||||||
|
popUpHandler()
|
||||||
|
navigate('/my-review-jobs', {replace: true})
|
||||||
|
}, 3000)
|
||||||
|
}).catch(err => {
|
||||||
|
setReqStatus({loading:false, status: false, message: 'Opps! Network error. Try again'})
|
||||||
|
}).finally(()=>{
|
||||||
|
setTimeout(()=>{
|
||||||
|
setReqStatus({loading:false, status: false, message: ''})
|
||||||
|
}, 3000)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO HANDLE WHEN USER/OWNER CLICKS ON REJECT COMPLETION OF JOB
|
||||||
|
const rejectCompletion = () => {
|
||||||
|
setAction('reject')
|
||||||
|
setReqStatus({loading:true, status: false, message: ''}) // Sets loading spinner active
|
||||||
|
let reqData = { // API PAYLOADS
|
||||||
|
contract: jobDetails.contract,
|
||||||
|
contract_uid: jobDetails.contract_uid,
|
||||||
|
job_action: 'REJECT_COMPLETE',
|
||||||
|
}
|
||||||
|
// API CALL TO REJECT COMPLETION BY OWNER
|
||||||
|
apiCall.ownerJobAction(reqData).then((res)=>{
|
||||||
|
if(res.status != 200 || res.data.internal_return < 0){
|
||||||
|
setReqStatus({loading:false, status: false, message: 'unable to complete request. Try again'})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setReqStatus({loading:false, status: true, message: 'job completion rejected successfully'})
|
||||||
|
setTimeout(()=>{ // Sets popout to false and navigates user to /my-review-jobs after 3 seconds
|
||||||
|
popUpHandler()
|
||||||
|
navigate('/my-review-jobs', {replace: true})
|
||||||
|
}, 3000)
|
||||||
|
}).catch(err => {
|
||||||
|
setReqStatus({loading:false, status: false, message: 'Opps! Network error. Try again'})
|
||||||
|
}).finally(()=>{
|
||||||
|
setTimeout(()=>{
|
||||||
|
setReqStatus({loading:false, status: false, message: ''})
|
||||||
|
}, 3000)
|
||||||
|
})
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className='job-action'>
|
<div className='job-action'>
|
||||||
<p className="my-3 py-1 text-base">
|
<div className="my-3 py-1 text-base">
|
||||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 review-owner">
|
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 review-owner">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -20,7 +108,7 @@ function ReviewJobAction() {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div className="flex justify-center items-center">
|
<div className="flex justify-center items-center">
|
||||||
<button type="button" className="w-120 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
<button type="button" onClick={popUpHandler} className="w-120 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
||||||
Reject or Accept
|
Reject or Accept
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -28,7 +116,109 @@ function ReviewJobAction() {
|
|||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</p>
|
</div>
|
||||||
|
|
||||||
|
{popUp && (
|
||||||
|
<ModalCom action={popUpHandler} situation={popUp}>
|
||||||
|
<div className="logout-modal-wrapper lg:w-[460px] h-full lg:h-auto 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 dark:border-[#5356fb29] border-light-purple">
|
||||||
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||||
|
Completion
|
||||||
|
</h1>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="text-[#374557] dark:text-red-500"
|
||||||
|
onClick={popUpHandler}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="36"
|
||||||
|
height="36"
|
||||||
|
viewBox="0 0 36 36"
|
||||||
|
fill="none"
|
||||||
|
className="fill-current"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M36 16.16C36 17.4399 36 18.7199 36 20.0001C35.7911 20.0709 35.8636 20.2554 35.8385 20.4001C34.5321 27.9453 30.246 32.9248 22.9603 35.2822C21.9006 35.6251 20.7753 35.7657 19.6802 35.9997C18.4003 35.9997 17.1204 35.9997 15.8401 35.9997C15.5896 35.7086 15.2189 35.7732 14.9034 35.7093C7.77231 34.2621 3.08728 30.0725 0.769671 23.187C0.435002 22.1926 0.445997 21.1199 0 20.1599C0 18.7198 0 17.2798 0 15.8398C0.291376 15.6195 0.214408 15.2656 0.270759 14.9808C1.71321 7.69774 6.02611 2.99691 13.0428 0.700951C14.0118 0.383805 15.0509 0.386897 15.9999 0C17.2265 0 18.4532 0 19.6799 0C19.7156 0.124041 19.8125 0.136067 19.9225 0.146719C27.3 0.868973 33.5322 6.21922 35.3801 13.427C35.6121 14.3313 35.7945 15.2484 36 16.16ZM33.011 18.0787C33.0433 9.77105 26.3423 3.00309 18.077 2.9945C9.78479 2.98626 3.00344 9.658 2.98523 17.8426C2.96667 26.1633 9.58859 32.9601 17.7602 33.0079C26.197 33.0577 32.9787 26.4186 33.011 18.0787Z"
|
||||||
|
fill=""
|
||||||
|
fillOpacity="0.6"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M15.9309 18.023C13.9329 16.037 12.007 14.1207 10.0787 12.2072C9.60071 11.733 9.26398 11.2162 9.51996 10.506C9.945 9.32677 11.1954 9.0811 12.1437 10.0174C13.9067 11.7585 15.6766 13.494 17.385 15.2879C17.9108 15.8401 18.1633 15.7487 18.6375 15.258C20.3586 13.4761 22.1199 11.7327 23.8822 9.99096C24.8175 9.06632 26.1095 9.33639 26.4967 10.517C26.7286 11.2241 26.3919 11.7413 25.9133 12.2178C24.1757 13.9472 22.4477 15.6855 20.7104 17.4148C20.5228 17.6018 20.2964 17.7495 20.0466 17.9485C22.0831 19.974 24.0372 21.8992 25.9689 23.8468C26.9262 24.8119 26.6489 26.1101 25.4336 26.4987C24.712 26.7292 24.2131 26.3441 23.7455 25.8757C21.9945 24.1227 20.2232 22.3892 18.5045 20.6049C18.0698 20.1534 17.8716 20.2269 17.4802 20.6282C15.732 22.4215 13.9493 24.1807 12.1777 25.951C11.7022 26.4262 11.193 26.7471 10.4738 26.4537C9.31345 25.9798 9.06881 24.8398 9.98589 23.8952C11.285 22.5576 12.6138 21.2484 13.9387 19.9355C14.5792 19.3005 15.2399 18.6852 15.9309 18.023Z"
|
||||||
|
fill="#"
|
||||||
|
fillOpacity="0.6"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="job-action-modal-body w-full px-10 py-8 gap-4">
|
||||||
|
<div className="w-full flex flex-col items-center">
|
||||||
|
<div className="mb-5 flex justify-center items-center gap-2">
|
||||||
|
<input
|
||||||
|
type='checkbox'
|
||||||
|
checked={checked}
|
||||||
|
onChange={()=>{setChecked(prev => !prev)}}
|
||||||
|
className='w-6 h-6 text-sky-blue bg-gray-100 focus:ring-sky-blue'
|
||||||
|
/>
|
||||||
|
<p className='font-bold text-base tracking-wide text-dark-gray dark:text-white'>I am ready to accept completion</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="mb-5 flex justify-center items-center">
|
||||||
|
{reqStatus.loading && action=='accept'?
|
||||||
|
<LoadingSpinner color='sky-blue' size='10' />
|
||||||
|
:
|
||||||
|
<button disabled={reqStatus.loading} onClick={acceptCompletion} type="button" className="px-2 py-1 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white">
|
||||||
|
<span className='text-gradient'>Accept Completion</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* EXTEND TIMELINE SECTION */}
|
||||||
|
<div className='w-full my-3 py-3 border-y flex flex-col items-center'>
|
||||||
|
<div className='mb-5 flex items-center gap-2'>
|
||||||
|
<p className='font-bold text-base tracking-wide text-dark-gray dark:text-white'>I am not ready to accept completion of task</p>
|
||||||
|
</div>
|
||||||
|
{reqStatus.loading && action=='reject' ?
|
||||||
|
<LoadingSpinner color='sky-blue' size='10' />
|
||||||
|
:
|
||||||
|
<button disabled={reqStatus.loading} type="button" onClick={rejectCompletion} className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
||||||
|
Reject Completion
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* FOR SUCCESS/ERROR DISPLAY SECTION*/}
|
||||||
|
<div className="w-full">
|
||||||
|
{reqStatus.message != "" &&
|
||||||
|
(!reqStatus.status ? (
|
||||||
|
<div
|
||||||
|
className={`relative p-4 my-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
|
>
|
||||||
|
{reqStatus.message}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
reqStatus.status && (
|
||||||
|
<div
|
||||||
|
className={`relative p-4 my-4 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||||
|
>
|
||||||
|
{reqStatus.message}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
{/* END OF FOR SUCCESS/ERROR DISPLAY SECTION*/}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* cancel btn */}
|
||||||
|
<div className='flex justify-end items-center'>
|
||||||
|
<button onClick={popUpHandler} type="button" className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white">
|
||||||
|
<span className='text-gradient'>Cancel</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ModalCom>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
import dataImage2 from "../../assets/images/data-table-user-2.png";
|
import dataImage2 from "../../assets/images/data-table-user-2.png";
|
||||||
|
|
||||||
import { useNavigate, useLocation } from "react-router-dom";
|
|
||||||
|
|
||||||
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||||
import PaginatedList from "../Pagination/PaginatedList";
|
import PaginatedList from "../Pagination/PaginatedList";
|
||||||
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
|
|
||||||
export default function MyActiveJobTable({ MyJobList, className }) {
|
export default function MyActiveJobTable({ MyJobList, className }) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
let {pathname} = useLocation()
|
let { pathname } = useLocation();
|
||||||
|
|
||||||
const filterCategories = ["All Categories", "Explore", "Featured"];
|
|
||||||
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(0);
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
const indexOfFirstItem = Number(currentPage);
|
const indexOfFirstItem = Number(currentPage);
|
||||||
@@ -45,8 +41,15 @@ export default function MyActiveJobTable({ MyJobList, className }) {
|
|||||||
<>
|
<>
|
||||||
{MyJobList &&
|
{MyJobList &&
|
||||||
MyJobList?.result_list &&
|
MyJobList?.result_list &&
|
||||||
MyJobList.result_list.length > 0 ?
|
MyJobList.result_list.length > 0 ? (
|
||||||
currentActiveJobList.map((value, index) => (
|
currentActiveJobList.map((value, index) => {
|
||||||
|
let deliveryDate = value?.delivery_date?.split(" ")[0];
|
||||||
|
let thePrice = PriceFormatter(
|
||||||
|
value?.price * 0.01,
|
||||||
|
value?.currency_code,
|
||||||
|
value?.currency
|
||||||
|
);
|
||||||
|
return (
|
||||||
<tr
|
<tr
|
||||||
key={index}
|
key={index}
|
||||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||||
@@ -68,9 +71,10 @@ export default function MyActiveJobTable({ MyJobList, className }) {
|
|||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Price:{" "}
|
Price:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
{value.price * 0.01}
|
{thePrice}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<div className="flex gap-4 items-center">
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Duration:{" "}
|
Duration:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
@@ -79,21 +83,24 @@ export default function MyActiveJobTable({ MyJobList, className }) {
|
|||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Expire:{" "}
|
Due:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
{" "}
|
{" "}
|
||||||
{value.expire}
|
{deliveryDate}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Send to:{" "}
|
Sent to:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
{" "}
|
{" "}
|
||||||
{value.job_to}
|
{value.job_to === null
|
||||||
|
? "public"
|
||||||
|
: value.job_to}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td className="text-right py-4 px-2">
|
<td className="text-right py-4 px-2">
|
||||||
@@ -112,14 +119,13 @@ export default function MyActiveJobTable({ MyJobList, className }) {
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))
|
);
|
||||||
:
|
})
|
||||||
|
) : (
|
||||||
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
||||||
<td className="p-2">
|
<td className="p-2">No Active Task!</td>
|
||||||
No Active Task!
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
}
|
)}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ export default function MyPastDueJobs(props) {
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<CommonHead
|
<CommonHead commonHeadData={props.commonHeadData} />
|
||||||
commonHeadData={props.commonHeadData}
|
|
||||||
/>
|
|
||||||
<div className="notification-page w-full mb-10">
|
<div className="notification-page w-full mb-10">
|
||||||
<div className="notification-wrapper w-full">
|
<div className="notification-wrapper w-full">
|
||||||
{/* heading */}
|
{/* heading */}
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ export default function MyActiveJobs(props) {
|
|||||||
console.log("AMEYE LOC1", props.MyJobList);
|
console.log("AMEYE LOC1", props.MyJobList);
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout>
|
||||||
<CommonHead
|
<CommonHead commonHeadData={props.commonHeadData} />
|
||||||
commonHeadData={props.commonHeadData}
|
|
||||||
/>
|
|
||||||
<div className="notification-page w-full mb-10">
|
<div className="notification-page w-full mb-10">
|
||||||
<div className="notification-wrapper w-full">
|
<div className="notification-wrapper w-full">
|
||||||
{/* heading */}
|
{/* heading */}
|
||||||
|
|||||||
@@ -1,6 +1,44 @@
|
|||||||
|
import { useMemo, useState } from "react";
|
||||||
|
import { toast } from "react-toastify";
|
||||||
|
import usersService from "../../services/UsersService";
|
||||||
|
|
||||||
const CouponPopup = ({ popUpHandler, data }) => {
|
const CouponPopup = ({ popUpHandler, data }) => {
|
||||||
|
const [loader, setLoader] = useState(false);
|
||||||
|
const apiCall = useMemo(() => new usersService(), []);
|
||||||
|
|
||||||
|
const redeemCouponHandler = async () => {
|
||||||
|
setLoader(true);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { code, coupon_id } = data;
|
||||||
|
const reqData = { code_id: Number(coupon_id), code };
|
||||||
|
|
||||||
|
const res = await apiCall.getCouponRedeem(reqData);
|
||||||
|
if (res.statusText === "OK") {
|
||||||
|
toast.success("Great news! Your coupon has been redeemed.", {
|
||||||
|
autoClose: 3000,
|
||||||
|
hideProgressBar: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
popUpHandler();
|
||||||
|
setLoader(false);
|
||||||
|
}, 3000);
|
||||||
|
throw new Response(res);
|
||||||
|
} catch (error) {
|
||||||
|
// error &&
|
||||||
|
// toast.warn("An error occurred while processing your coupon.", {
|
||||||
|
// autoClose: 3000,
|
||||||
|
// hideProgressBar: true,
|
||||||
|
// });
|
||||||
|
setLoader(false);
|
||||||
|
console.log(error);
|
||||||
|
return;
|
||||||
|
// throw new Error(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="logout-modal-wrapper lg:w-[460px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
|
<div className="logout-modal-wrapper lg:w-[460px] h-full lg:h-auto 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 dark:border-[#5356fb29] border-light-purple">
|
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
|
||||||
@@ -45,14 +83,17 @@ const CouponPopup = ({ popUpHandler, data }) => {
|
|||||||
<div className="signin-area w-full">
|
<div className="signin-area w-full">
|
||||||
<div className="flex justify-end">
|
<div className="flex justify-end">
|
||||||
<button
|
<button
|
||||||
// type="button"
|
type="button"
|
||||||
className="text-white btn-gradient text-lg tracking-wide px-6 py-2 rounded-full"
|
onClick={redeemCouponHandler}
|
||||||
|
className="text-white lg:w-[167px] btn-gradient flex justify-center items-center text-lg tracking-wide px-6 py-2 rounded-full"
|
||||||
>
|
>
|
||||||
{/* {loader ? (
|
{loader ? (
|
||||||
<div className="signup btn-loader"></div>
|
<div className="signup btn-loader"></div>
|
||||||
) : (
|
) : (
|
||||||
)} */}
|
<span className="font-semibold tracking-wider">
|
||||||
<span className="font-semibold tracking-wider">Redeem Now!</span>
|
Redeem Now!
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import dataImage2 from "../../assets/images/data-table-user-2.png";
|
import dataImage2 from "../../assets/images/data-table-user-2.png";
|
||||||
import PendingJobsPopout from "../jobPopout/PendingJobsPopout";
|
|
||||||
|
|
||||||
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||||
import PaginatedList from "../Pagination/PaginatedList";
|
import PaginatedList from "../Pagination/PaginatedList";
|
||||||
|
import PendingJobsPopout from "../jobPopout/PendingJobsPopout";
|
||||||
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
|
|
||||||
export default function MyPendingJobTable({ MyJobList, className }) {
|
export default function MyPendingJobTable({ MyJobList, className }) {
|
||||||
const filterCategories = ["All Categories", "Explore", "Featured"];
|
|
||||||
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
|
||||||
let [jobPopout, setJobPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
let [jobPopout, setJobPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(0);
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
@@ -42,8 +40,15 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
<>
|
<>
|
||||||
{MyJobList &&
|
{MyJobList &&
|
||||||
MyJobList?.result_list &&
|
MyJobList?.result_list &&
|
||||||
MyJobList.result_list.length > 0 ?
|
MyJobList.result_list.length > 0 ? (
|
||||||
currentActiveJobList.map((value, index) => (
|
currentActiveJobList.map((value, index) => {
|
||||||
|
let deliveryDate = value?.expire?.split(" ")[0];
|
||||||
|
let thePrice = PriceFormatter(
|
||||||
|
value?.price * 0.01,
|
||||||
|
value?.currency_code,
|
||||||
|
value?.currency
|
||||||
|
);
|
||||||
|
return (
|
||||||
<tr
|
<tr
|
||||||
key={index}
|
key={index}
|
||||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||||
@@ -65,9 +70,10 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Price:{" "}
|
Price:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
{value.price * 0.01}
|
{thePrice}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Duration:{" "}
|
Duration:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
@@ -79,11 +85,11 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
Expire:{" "}
|
Expire:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
{" "}
|
{" "}
|
||||||
{value.expire}
|
{deliveryDate}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Send to:{" "}
|
Sent to:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
{" "}
|
{" "}
|
||||||
{value.job_to}
|
{value.job_to}
|
||||||
@@ -91,6 +97,7 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td className="text-right py-4 px-2">
|
<td className="text-right py-4 px-2">
|
||||||
@@ -105,14 +112,13 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))
|
);
|
||||||
:
|
})
|
||||||
|
) : (
|
||||||
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
||||||
<td className="p-2">
|
<td className="p-2">No Pending Task!</td>
|
||||||
No Pending Task!
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
}
|
)}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import PaginatedList from "../Pagination/PaginatedList";
|
|||||||
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
import { useNavigate, useLocation } from "react-router-dom";
|
import { useNavigate, useLocation } from "react-router-dom";
|
||||||
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
|
|
||||||
const noTasksBg = require("../../assets/images/no-task-background.jpg");
|
const noTasksBg = require("../../assets/images/no-task-background.jpg");
|
||||||
|
|
||||||
@@ -45,18 +46,26 @@ export default function MyJobTable({ className, ActiveJobList }) {
|
|||||||
: "none",
|
: "none",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
{/* Adding this dark overlay in order to see the texts properly */}
|
||||||
{!ActiveJobList?.data.length && (
|
{!ActiveJobList?.data.length && (
|
||||||
<div class="absolute inset-0 bg-black opacity-30"></div>
|
<div class="absolute inset-0 bg-black opacity-30"></div>
|
||||||
)}
|
)}
|
||||||
{ActiveJobList.loading ? (
|
{ActiveJobList?.data.length > 0 && ActiveJobList.loading && (
|
||||||
<div className="w-full h-[520px] flex items-center justify-center">
|
<div className="w-full h-[520px] flex items-center justify-center">
|
||||||
<LoadingSpinner size="16" color="sky-blue" />
|
<LoadingSpinner size="16" color="sky-blue" />
|
||||||
</div>
|
</div>
|
||||||
) : (
|
)}
|
||||||
|
|
||||||
<div className="relative w-full sm:rounded-lg">
|
<div className="relative w-full sm:rounded-lg">
|
||||||
<div className="h-auto w-full">
|
<div className="h-auto w-full">
|
||||||
{ActiveJobList?.data?.length > 0 ? (
|
{ActiveJobList?.data?.length > 0 &&
|
||||||
currentTask?.map((task, idx) => (
|
currentTask?.map((task, idx) => {
|
||||||
|
let thePrice = PriceFormatter(
|
||||||
|
task?.price * 0.01,
|
||||||
|
task?.currency_code,
|
||||||
|
task?.currency
|
||||||
|
);
|
||||||
|
return (
|
||||||
<div
|
<div
|
||||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] w-full flex justify-between items-center hover:bg-gray-50"
|
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] w-full flex justify-between items-center hover:bg-gray-50"
|
||||||
key={idx}
|
key={idx}
|
||||||
@@ -79,10 +88,9 @@ export default function MyJobTable({ className, ActiveJobList }) {
|
|||||||
</span>
|
</span>
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Price:
|
Price:
|
||||||
<span className="text-purple ml-1">
|
<span className="text-purple ml-1">{thePrice}</span>
|
||||||
{Number(task?.price) * 0.01}
|
|
||||||
</span>
|
|
||||||
</span>
|
</span>
|
||||||
|
<div className="flex gap-4 items-center">
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Duration:
|
Duration:
|
||||||
<span className="text-purple ml-1">
|
<span className="text-purple ml-1">
|
||||||
@@ -106,6 +114,7 @@ export default function MyJobTable({ className, ActiveJobList }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="flex justify-center items-center py-4 px-2">
|
<div className="flex justify-center items-center py-4 px-2">
|
||||||
<button
|
<button
|
||||||
@@ -121,8 +130,10 @@ export default function MyJobTable({ className, ActiveJobList }) {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))
|
);
|
||||||
) : ActiveJobList.status ? (
|
})}
|
||||||
|
|
||||||
|
{ActiveJobList?.data?.length <= 0 && (
|
||||||
<div className="flex flex-col items-center justify-center gap-9 my-5">
|
<div className="flex flex-col items-center justify-center gap-9 my-5">
|
||||||
<div className="p-2 font-bold text-3xl text-white whitespace-nowrap">
|
<div className="p-2 font-bold text-3xl text-white whitespace-nowrap">
|
||||||
You currently have "0" task
|
You currently have "0" task
|
||||||
@@ -138,7 +149,8 @@ export default function MyJobTable({ className, ActiveJobList }) {
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
)}
|
||||||
|
{ActiveJobList?.internal_return < 0 && (
|
||||||
<div className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
<div className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
||||||
<p className="p-2">Error Occurred! Unable to display Tasks!</p>
|
<p className="p-2">Error Occurred! Unable to display Tasks!</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -161,7 +173,6 @@ export default function MyJobTable({ className, ActiveJobList }) {
|
|||||||
/>
|
/>
|
||||||
{/* END OF PAGINATION BUTTON */}
|
{/* END OF PAGINATION BUTTON */}
|
||||||
</div>
|
</div>
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import top4 from "../../assets/images/top-buyer-4.png";
|
|||||||
import Icons from "../Helpers/Icons";
|
import Icons from "../Helpers/Icons";
|
||||||
import SliderCom from "../Helpers/SliderCom";
|
import SliderCom from "../Helpers/SliderCom";
|
||||||
|
|
||||||
import OfferJobPopout from '../jobPopout/OfferJobPopout'
|
import OfferJobPopout from "../jobPopout/OfferJobPopout";
|
||||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
|
|
||||||
export default function MyOffersTable({ className, MyActiveOffersList }) {
|
export default function MyOffersTable({ className, MyActiveOffersList }) {
|
||||||
let [offerPopout, setOfferPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
let [offerPopout, setOfferPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
||||||
@@ -52,7 +52,7 @@ export default function MyOffersTable({ className, MyActiveOffersList}) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!MyActiveOffersList || MyActiveOffersList?.result_list?.length == 0) {
|
if (!MyActiveOffersList || MyActiveOffersList?.result_list?.length == 0) {
|
||||||
return(''); // want blank or no appear when no items
|
return ""; // want blank or no appear when no items
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -114,9 +114,15 @@ export default function MyOffersTable({ className, MyActiveOffersList}) {
|
|||||||
</div>
|
</div>
|
||||||
<div className="slider-content">
|
<div className="slider-content">
|
||||||
<SliderCom settings={settings} selector={sellSlider}>
|
<SliderCom settings={settings} selector={sellSlider}>
|
||||||
{
|
{MyActiveOffersList &&
|
||||||
MyActiveOffersList && MyActiveOffersList?.result_list?.length > 0 &&
|
MyActiveOffersList?.result_list?.length > 0 &&
|
||||||
MyActiveOffersList?.result_list?.map((value, index) => (
|
MyActiveOffersList?.result_list?.map((value, index) => {
|
||||||
|
let thePrice = PriceFormatter(
|
||||||
|
value?.price * 0.01,
|
||||||
|
value?.currency_code,
|
||||||
|
value?.currency
|
||||||
|
);
|
||||||
|
return (
|
||||||
<div className="item" key={index}>
|
<div className="item" key={index}>
|
||||||
<div className="offer-slide-item flex flex-col justify-between items-center">
|
<div className="offer-slide-item flex flex-col justify-between items-center">
|
||||||
{/* title */}
|
{/* title */}
|
||||||
@@ -131,15 +137,9 @@ export default function MyOffersTable({ className, MyActiveOffersList}) {
|
|||||||
{value.timeline_days} Days
|
{value.timeline_days} Days
|
||||||
</p>
|
</p>
|
||||||
<div className="my-2 flex space-x-1 items-center text-purple text-xs">
|
<div className="my-2 flex space-x-1 items-center text-purple text-xs">
|
||||||
<span>{value.price*0.01} {value.currency}</span>
|
<span>{thePrice}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/* items */}
|
|
||||||
{/* <div className="flex justify-center">
|
|
||||||
<div className="flex space-x-1 items-center text-purple text-xs">
|
|
||||||
<span>{value.price*0.01} {value.currency}</span>
|
|
||||||
</div>
|
|
||||||
</div> */}
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -149,14 +149,10 @@ export default function MyOffersTable({ className, MyActiveOffersList}) {
|
|||||||
>
|
>
|
||||||
Start Task
|
Start Task
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
))
|
);
|
||||||
}
|
})}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{/* <div className="item">*/}
|
{/* <div className="item">*/}
|
||||||
{/* /!* img *!/*/}
|
{/* /!* img *!/*/}
|
||||||
@@ -411,7 +407,6 @@ export default function MyOffersTable({ className, MyActiveOffersList}) {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{/* End of Offer Job Popout */}
|
{/* End of Offer Job Popout */}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,210 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import Layout from "../Partials/Layout";
|
||||||
|
import CommonHead from "../UserHeader/CommonHead";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||||
|
import PaginatedList from "../Pagination/PaginatedList";
|
||||||
|
|
||||||
|
import OthersInterestedTable from "./OthersInterestedTable";
|
||||||
|
|
||||||
|
export default function ManageInterestOffer(props) {
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
const messageList = {data: [1,2,3,4,5,6]} // TO BE REMOVED AND REPLACE WITH REAL MESSAGE FROM API CALL
|
||||||
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
|
const indexOfFirstItem = Number(currentPage);
|
||||||
|
const indexOfLastItem = Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||||
|
const currentMessageList = messageList?.data?.slice(indexOfFirstItem, indexOfLastItem);
|
||||||
|
|
||||||
|
const handlePagination = (e) => {
|
||||||
|
handlePagingFunc(e, setCurrentPage);
|
||||||
|
};
|
||||||
|
|
||||||
|
const [selectTab, setValue] = useState("today");
|
||||||
|
const filterHandler = (value) => {
|
||||||
|
setValue(value);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<CommonHead
|
||||||
|
commonHeadData={props.commonHeadData}
|
||||||
|
/>
|
||||||
|
<div className="notification-page w-full mb-10">
|
||||||
|
<div className="notification-wrapper w-full">
|
||||||
|
{/* heading */}
|
||||||
|
<div className="sm:flex justify-between items-center mb-6">
|
||||||
|
<div className="mb-5 sm:mb-0">
|
||||||
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
|
||||||
|
<span className={`${selectTab === "today" ? "block" : "hidden"}`}>Manage Offer Interest</span>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* manage offer section */}
|
||||||
|
<div className="w-full mb-8 p-8 bg-white dark:bg-dark-white rounded-2xl section-shadow">
|
||||||
|
{/* <div className="w-full flex justify-start space-x-3 items-center">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="min-w-[45px] h-auto text-[#374557] border border-sky-blue p-1 rounded-full"
|
||||||
|
onClick={() =>
|
||||||
|
navigate(props.offerDetails.pathname, { replace: true })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="35"
|
||||||
|
height="35"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="skyblue"
|
||||||
|
>
|
||||||
|
<path d="M19 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H19v-2z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<h1 className="text-sm lg:text-xl font-bold text-sky-blue dark:text-white tracking-wide">
|
||||||
|
{props.offerDetails?.offer_code && props.offerDetails.offer_code}
|
||||||
|
</h1>
|
||||||
|
</div> */}
|
||||||
|
|
||||||
|
<div className="my-2 w-full md:grid gap-5 grid-cols-3">
|
||||||
|
{/* Detail section */}
|
||||||
|
<div className="w-full mb-5 lg:mb-0 col-span-2">
|
||||||
|
<div className="w-full flex justify-start space-x-3 items-center">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="min-w-[45px] h-auto text-[#374557] border border-sky-blue p-1 rounded-full"
|
||||||
|
onClick={() =>
|
||||||
|
navigate(props.offerDetails.pathname, { replace: true })
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="35"
|
||||||
|
height="35"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="skyblue"
|
||||||
|
>
|
||||||
|
<path d="M19 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H19v-2z" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<h1 className="text-sm lg:text-xl font-bold text-sky-blue dark:text-white tracking-wide">
|
||||||
|
{props.offerDetails?.offer_code && props.offerDetails.offer_code}
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<h1 className="my-5 text-xl lg:text-2xl font-bold text-dark-gray dark:text-white tracking-wide border">
|
||||||
|
{props.offerDetails?.title}
|
||||||
|
</h1>
|
||||||
|
<div className="flex items-center">
|
||||||
|
<div className="w-3/4">
|
||||||
|
<div className="my-5 flex items-center gap-1">
|
||||||
|
<span className="w-[150px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Name</span>
|
||||||
|
<span className="text-sm font-bold text-dark-gray dark:text-white tracking-wide">Dummy name</span>
|
||||||
|
</div>
|
||||||
|
<div className="my-5 flex items-center gap-1">
|
||||||
|
<span className="w-[150px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Member Since</span>
|
||||||
|
<span className="text-sm font-bold text-dark-gray dark:text-white tracking-wide">Dummy Date</span>
|
||||||
|
</div>
|
||||||
|
<div className="my-5 flex items-center gap-1">
|
||||||
|
<span className="w-[150px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Jobs completed</span>
|
||||||
|
<span className="text-sm font-bold text-dark-gray dark:text-white tracking-wide">Dummy number</span>
|
||||||
|
</div>
|
||||||
|
<div className="my-5 flex items-center gap-1">
|
||||||
|
<span className="w-[150px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Jobs active</span>
|
||||||
|
<span className="text-sm font-bold text-dark-gray dark:text-white tracking-wide">Dummy number</span>
|
||||||
|
</div>
|
||||||
|
<div className="my-5 flex items-center gap-1">
|
||||||
|
<span className="w-[150px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Jobs uncompleted</span>
|
||||||
|
<span className="text-sm font-bold text-dark-gray dark:text-white tracking-wide">Dummy number</span>
|
||||||
|
</div>
|
||||||
|
<div className="my-5 flex items-center gap-1">
|
||||||
|
<span className="w-[150px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Pending Offers</span>
|
||||||
|
<span className="text-sm font-bold text-dark-gray dark:text-white tracking-wide">Dummy number</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<span className="w-[150px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">% completion</span>
|
||||||
|
<span className="text-sm font-bold text-dark-gray dark:text-white tracking-wide">Dummy number</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-1/4 flex flex-col justify-center items-center gap-10">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
<span className="text-white">Accept</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="px-2 py-1 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
<span className="text-gradient">Reject</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* END OF Detail section */}
|
||||||
|
|
||||||
|
{/* message section */}
|
||||||
|
<div className="p-4 w-full min-h-full bg-sky-100 dark:bg-dark-gray col-span-1">
|
||||||
|
<p className="text-base font-bold text-dark-gray dark:text-white tracking-wide">Message to dummy name</p>
|
||||||
|
<div className="my-4 w-full">
|
||||||
|
<textarea rows={5} className="p-4 text-base font-bold text-dark-gray dark:text-white tracking-wide w-full resize-none rounded-md outline-none" />
|
||||||
|
<div className="w-full flex justify-end items-center">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
<span className="text-white">Send</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* message list */}
|
||||||
|
{currentMessageList.map((item, index)=>(
|
||||||
|
<div className="my-3 w-full">
|
||||||
|
<p className="text-base font-bold text-dark-gray dark:text-white tracking-wide">2023-04-06-from { }<span className="font-normal">Dummy name</span></p>
|
||||||
|
<p className="text-base font-bold text-dark-gray dark:text-white tracking-wide">I am testing message</p>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{/* PAGINATION BUTTON */}
|
||||||
|
<PaginatedList
|
||||||
|
onClick={handlePagination}
|
||||||
|
prev={currentPage == 0 ? true : false}
|
||||||
|
next={
|
||||||
|
currentPage + Number(process.env.REACT_APP_ITEM_PER_PAGE) >=
|
||||||
|
messageList?.data?.length
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
data={messageList?.data}
|
||||||
|
start={indexOfFirstItem}
|
||||||
|
stop={indexOfLastItem}
|
||||||
|
/>
|
||||||
|
{/* END OF PAGINATION BUTTON */}
|
||||||
|
</div>
|
||||||
|
{/* END of message section */}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* END OF manage offer section */}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="w-full overflow-x-auto">
|
||||||
|
<div className="notification-page w-full mb-10">
|
||||||
|
<div className="notification-wrapper w-full">
|
||||||
|
{/* heading */}
|
||||||
|
<div className="sm:flex justify-between items-center mb-6">
|
||||||
|
<div className="mb-5 sm:mb-0">
|
||||||
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
|
||||||
|
<span className={`${selectTab === "today" ? "block" : "hidden"}`}>Others interested in this Task</span>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<OthersInterestedTable othersInterestedList={props.othersInterestedList} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import dataImage1 from "../../assets/images/data-table-user-1.png";
|
||||||
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
|
import { useNavigate, useLocation, Link } from "react-router-dom";
|
||||||
|
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||||
|
import PaginatedList from "../Pagination/PaginatedList";
|
||||||
|
|
||||||
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
|
|
||||||
|
import familyImage from '../../assets/images/no-family-side.png'
|
||||||
|
|
||||||
|
export default function OffersInterestTable({offerInterestList, className}) {
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
let { pathname } = useLocation();
|
||||||
|
|
||||||
|
const filterCategories = ["All Categories", "Explore", "Featured"];
|
||||||
|
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
|
const indexOfFirstItem = Number(currentPage);
|
||||||
|
const indexOfLastItem =
|
||||||
|
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||||
|
const currentOfferInterestList = offerInterestList?.data?.slice(indexOfFirstItem, indexOfLastItem);
|
||||||
|
|
||||||
|
const handlePagination = (e) => {
|
||||||
|
handlePagingFunc(e, setCurrentPage);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`update-table w-full p-8 bg-white dark:bg-dark-white rounded-2xl section-shadow min-h-[520px] ${
|
||||||
|
className || ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
|
||||||
|
{offerInterestList?.loading ? (
|
||||||
|
<div className="min-h-[520px] w-full flex flex-col justify-center items-center">
|
||||||
|
<LoadingSpinner size="16" color="sky-blue" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
:
|
||||||
|
offerInterestList?.data?.length > 0 ?
|
||||||
|
(
|
||||||
|
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 relative">
|
||||||
|
<thead className="sticky top-0">
|
||||||
|
{/* <tr className="text-base text-thin-light-gray whitespace-nowrap border-b dark:border-[#5356fb29] default-border-bottom ">
|
||||||
|
<th className="py-4">Name</th>
|
||||||
|
<th className="py-4 text-center">Last Login</th>
|
||||||
|
<th className="py-4 text-center">No of Tasks</th>
|
||||||
|
<th className="py-4 text-right"></th>
|
||||||
|
</tr> */}
|
||||||
|
</thead>
|
||||||
|
<tbody className="h-full">
|
||||||
|
{currentOfferInterestList?.map((item, idx) => {
|
||||||
|
return (
|
||||||
|
<tr key={item?.offer_uid} className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50">
|
||||||
|
<td className=" py-4">
|
||||||
|
<div className="flex space-x-2 items-center">
|
||||||
|
<div className="min-w-[60px] min-h-[60px] rounded-full overflow-hidden flex justify-center items-center">
|
||||||
|
<img
|
||||||
|
src={dataImage1}
|
||||||
|
alt="data"
|
||||||
|
className="w-full h-full"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<h1 className="font-bold text-xl text-dark-gray dark:text-white">
|
||||||
|
{item?.title}
|
||||||
|
</h1>
|
||||||
|
<span className="text-sm text-thin-light-gray">{item?.expire}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="text-center py-4 px-2">
|
||||||
|
<div className="flex space-x-1 items-center justify-center">
|
||||||
|
<p className="font-bold text-x text-dark-gray dark:text-white">{item?.client_name}</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="text-center py-4 px-2">
|
||||||
|
<div className="flex space-x-1 items-center justify-center">
|
||||||
|
{/* <span className="font-bold text-x text-dark-gray dark:text-white">{formatNumber(item?.price * 0.01)}</span> */}
|
||||||
|
<span className="font-bold text-x text-dark-gray dark:text-white">{PriceFormatter(item?.price * 0.01,item?.currency_code,item?.currency)}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td className="text-right py-4">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
navigate("/manage-offer", {
|
||||||
|
state: { ...item, pathname },
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
<div className="font-bold text-center text-xl md:text-2xl lg:text-4xl text-dark-gray md:flex items-center justify-between">
|
||||||
|
<div className="p-2 w-full md:w-1/2">
|
||||||
|
<p className="mb-4 p-3 md:p-16">No Offer list avaliable.</p>
|
||||||
|
<button
|
||||||
|
onClick={()=>{navigate('/market', {replace: true})}}
|
||||||
|
type="button"
|
||||||
|
className="text-white btn-gradient text-lg tracking-wide px-5 py-2 rounded-full"
|
||||||
|
>
|
||||||
|
Goto Market
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="p-2 w-full md:w-1/2">
|
||||||
|
<img className='w-full' src={familyImage && familyImage} alt="Add Family" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
{/* PAGINATION BUTTON */}
|
||||||
|
<PaginatedList
|
||||||
|
onClick={handlePagination}
|
||||||
|
prev={currentPage == 0 ? true : false}
|
||||||
|
next={
|
||||||
|
currentPage + Number(process.env.REACT_APP_ITEM_PER_PAGE) >=
|
||||||
|
offerInterestList?.data?.length
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
data={offerInterestList?.data}
|
||||||
|
start={indexOfFirstItem}
|
||||||
|
stop={indexOfLastItem}
|
||||||
|
/>
|
||||||
|
{/* END OF PAGINATION BUTTON */}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Function to format number to two(2) decimal places
|
||||||
|
// function formatNumber(number) {
|
||||||
|
// // Convert the number to a string
|
||||||
|
// let numStr = String(number);
|
||||||
|
|
||||||
|
// // Split the string into integer and decimal parts
|
||||||
|
// let parts = numStr.split('.');
|
||||||
|
// let integerPart = parts[0];
|
||||||
|
// let decimalPart = parts[1] || '';
|
||||||
|
|
||||||
|
// // Add thousands separators to the integer part
|
||||||
|
// let formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
|
|
||||||
|
// // Truncate or pad the decimal part to two decimal points
|
||||||
|
// let formattedDecimal = decimalPart.slice(0, 2).padEnd(2, '0');
|
||||||
|
|
||||||
|
// // Combine the formatted integer and decimal parts
|
||||||
|
// let formattedNumber = formattedInteger + '.' + formattedDecimal;
|
||||||
|
|
||||||
|
// return formattedNumber;
|
||||||
|
// }
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import dataImage1 from "../../assets/images/data-table-user-1.png";
|
||||||
|
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||||
|
import { useNavigate, useLocation, Link } from "react-router-dom";
|
||||||
|
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||||
|
import PaginatedList from "../Pagination/PaginatedList";
|
||||||
|
|
||||||
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
|
|
||||||
|
import familyImage from '../../assets/images/no-family-side.png'
|
||||||
|
|
||||||
|
export default function OthersInterestTable({othersInterestedList, className}) {
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
let { pathname } = useLocation();
|
||||||
|
|
||||||
|
const filterCategories = ["All Categories", "Explore", "Featured"];
|
||||||
|
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
|
const indexOfFirstItem = Number(currentPage);
|
||||||
|
const indexOfLastItem =
|
||||||
|
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||||
|
const currentOthersInterestedList = othersInterestedList?.data?.slice(indexOfFirstItem, indexOfLastItem);
|
||||||
|
|
||||||
|
const handlePagination = (e) => {
|
||||||
|
handlePagingFunc(e, setCurrentPage);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={`update-table w-full p-8 bg-white dark:bg-dark-white rounded-2xl section-shadow min-h-[520px] ${
|
||||||
|
className || ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
|
||||||
|
{othersInterestedList?.loading ? (
|
||||||
|
<div className="min-h-[520px] w-full flex flex-col justify-center items-center">
|
||||||
|
<LoadingSpinner size="16" color="sky-blue" />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
:
|
||||||
|
othersInterestedList?.data?.length > 0 ?
|
||||||
|
(
|
||||||
|
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 relative">
|
||||||
|
<thead className="sticky top-0">
|
||||||
|
{/* <tr className="text-base text-thin-light-gray whitespace-nowrap border-b dark:border-[#5356fb29] default-border-bottom ">
|
||||||
|
<th className="py-4">Name</th>
|
||||||
|
<th className="py-4 text-center">Last Login</th>
|
||||||
|
<th className="py-4 text-center">No of Tasks</th>
|
||||||
|
<th className="py-4 text-right"></th>
|
||||||
|
</tr> */}
|
||||||
|
</thead>
|
||||||
|
<tbody className="h-full">
|
||||||
|
{currentOthersInterestedList?.map((item, idx) => {
|
||||||
|
return (
|
||||||
|
<tr key={item?.offer_uid} className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50">
|
||||||
|
<td className=" py-4">
|
||||||
|
<div className="flex space-x-2 items-center">
|
||||||
|
<div className="min-w-[60px] min-h-[60px] rounded-full overflow-hidden flex justify-center items-center">
|
||||||
|
<img
|
||||||
|
src={dataImage1}
|
||||||
|
alt="data"
|
||||||
|
className="w-full h-full"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col">
|
||||||
|
<h1 className="font-bold text-xl text-dark-gray dark:text-white">
|
||||||
|
{item?.title}
|
||||||
|
</h1>
|
||||||
|
<span className="text-sm text-thin-light-gray">{item?.expire}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="text-center py-4 px-2">
|
||||||
|
<div className="flex space-x-1 items-center justify-center">
|
||||||
|
<p className="font-bold text-x text-dark-gray dark:text-white">{item?.client_name}</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td className="text-center py-4 px-2">
|
||||||
|
<div className="flex space-x-1 items-center justify-center">
|
||||||
|
{/* <span className="font-bold text-x text-dark-gray dark:text-white">{formatNumber(item?.price * 0.01)}</span> */}
|
||||||
|
<span className="font-bold text-x text-dark-gray dark:text-white">{PriceFormatter(item?.price * 0.01,item?.currency_code,item?.currency)}</span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td className="text-right py-4">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
navigate("/manage-offer", {
|
||||||
|
state: { ...item, pathname },
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
)
|
||||||
|
:
|
||||||
|
(
|
||||||
|
<div className="font-bold text-center text-xl md:text-2xl lg:text-4xl text-dark-gray md:flex items-center justify-between">
|
||||||
|
<div className="p-2 w-full md:w-1/2">
|
||||||
|
<p className="mb-4 p-3 md:p-16">No Offer list avaliable.</p>
|
||||||
|
<button
|
||||||
|
onClick={()=>{navigate('/market', {replace: true})}}
|
||||||
|
type="button"
|
||||||
|
className="text-white btn-gradient text-lg tracking-wide px-5 py-2 rounded-full"
|
||||||
|
>
|
||||||
|
Goto Market
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div className="p-2 w-full md:w-1/2">
|
||||||
|
<img className='w-full' src={familyImage && familyImage} alt="Add Family" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
{/* PAGINATION BUTTON */}
|
||||||
|
<PaginatedList
|
||||||
|
onClick={handlePagination}
|
||||||
|
prev={currentPage == 0 ? true : false}
|
||||||
|
next={
|
||||||
|
currentPage + Number(process.env.REACT_APP_ITEM_PER_PAGE) >=
|
||||||
|
othersInterestedList?.data?.length
|
||||||
|
? true
|
||||||
|
: false
|
||||||
|
}
|
||||||
|
data={othersInterestedList?.data}
|
||||||
|
start={indexOfFirstItem}
|
||||||
|
stop={indexOfLastItem}
|
||||||
|
/>
|
||||||
|
{/* END OF PAGINATION BUTTON */}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import React, { useState } from "react";
|
||||||
|
import { Link } from "react-router-dom";
|
||||||
|
import Layout from "../Partials/Layout";
|
||||||
|
import CommonHead from "../UserHeader/CommonHead";
|
||||||
|
import OffersInterestTable from './OffersInterestTable'
|
||||||
|
|
||||||
|
export default function OffersInterest(props) {
|
||||||
|
const [selectTab, setValue] = useState("today");
|
||||||
|
const filterHandler = (value) => {
|
||||||
|
setValue(value);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<Layout>
|
||||||
|
<CommonHead
|
||||||
|
commonHeadData={props.commonHeadData}
|
||||||
|
/>
|
||||||
|
<div className="notification-page w-full mb-10">
|
||||||
|
<div className="notification-wrapper w-full">
|
||||||
|
{/* heading */}
|
||||||
|
<div className="sm:flex justify-between items-center mb-6">
|
||||||
|
<div className="mb-5 sm:mb-0">
|
||||||
|
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
|
||||||
|
<span className={`${selectTab === "today" ? "block" : "hidden"}`}>Offer Interest</span>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<OffersInterestTable offerInterestList={props.offerInterestList} />
|
||||||
|
</Layout>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -53,6 +53,8 @@
|
|||||||
|
|
||||||
.short_style{
|
.short_style{
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
border-color: #a2d7f1;
|
||||||
|
border-width: 3px;
|
||||||
}
|
}
|
||||||
.lr{
|
.lr{
|
||||||
background-color: #e1cace;
|
background-color: #e1cace;
|
||||||
|
|||||||
@@ -455,13 +455,13 @@ class usersService {
|
|||||||
return this.postAuxEnd("/stepresetpass", reqData);
|
return this.postAuxEnd("/stepresetpass", reqData);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCouponRedeem() {
|
getCouponRedeem(reqData) {
|
||||||
var postData = {
|
var postData = {
|
||||||
uuid: localStorage.getItem("uid"),
|
uuid: localStorage.getItem("uid"),
|
||||||
member_id: localStorage.getItem("member_id"),
|
member_id: localStorage.getItem("member_id"),
|
||||||
sessionid: localStorage.getItem("session_token"),
|
sessionid: localStorage.getItem("session_token"),
|
||||||
page: 0,
|
action: 85020,
|
||||||
limit: 100,
|
...reqData
|
||||||
};
|
};
|
||||||
return this.postAuxEnd("/couponredeem", postData);
|
return this.postAuxEnd("/couponredeem", postData);
|
||||||
}
|
}
|
||||||
@@ -653,8 +653,21 @@ class usersService {
|
|||||||
return this.postAuxEnd("/offersresponse", postData);
|
return this.postAuxEnd("/offersresponse", postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// END POINT FOR OFFERS INTEREST LIST
|
||||||
|
offersInterestList() {
|
||||||
|
var postData = {
|
||||||
|
uid: localStorage.getItem("uid"),
|
||||||
|
member_id: localStorage.getItem("member_id"),
|
||||||
|
sessionid: localStorage.getItem("session_token"),
|
||||||
|
action: 13024,
|
||||||
|
limit: 30,
|
||||||
|
offset: 0
|
||||||
|
};
|
||||||
|
return this.postAuxEnd("/offersinterestlist", postData);
|
||||||
|
}
|
||||||
|
|
||||||
// END POINT FOR WORKER TO MARK TASK AS COMPLETED
|
// END POINT FOR WORKER TO MARK TASK AS COMPLETED
|
||||||
taskCompleted(reqData) {
|
workerJobAction(reqData) {
|
||||||
var postData = {
|
var postData = {
|
||||||
uid: localStorage.getItem("uid"),
|
uid: localStorage.getItem("uid"),
|
||||||
member_id: localStorage.getItem("member_id"),
|
member_id: localStorage.getItem("member_id"),
|
||||||
@@ -665,6 +678,18 @@ class usersService {
|
|||||||
return this.postAuxEnd("/activetaskstatus", postData);
|
return this.postAuxEnd("/activetaskstatus", postData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// END POINT FOR OWNER JOB ACTION
|
||||||
|
ownerJobAction(reqData) {
|
||||||
|
var postData = {
|
||||||
|
uid: localStorage.getItem("uid"),
|
||||||
|
member_id: localStorage.getItem("member_id"),
|
||||||
|
sessionid: localStorage.getItem("session_token"),
|
||||||
|
action: 14015,
|
||||||
|
...reqData,
|
||||||
|
};
|
||||||
|
return this.postAuxEnd("/activejobstatus ", postData);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
|
||||||
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import React, { useContext,useState, useEffect } from "react";
|
||||||
|
import usersService from "../services/UsersService";
|
||||||
|
import ManageInterestOffer from "../components/OffersInterest/ManageInterestOffer";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import { useLocation, useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
|
export default function MyReviewDueJobsPage() {
|
||||||
|
const {state} = useLocation()
|
||||||
|
let navigate = useNavigate()
|
||||||
|
|
||||||
|
let {commonHeadBanner} = useSelector(state => state.commonHeadBanner)
|
||||||
|
|
||||||
|
const apiCall = new usersService();
|
||||||
|
const [othersInterestedList, setOthersInterestedList] = useState({loading: true, data: []})
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if(!state){
|
||||||
|
navigate('/', {replace: true})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
apiCall.offersInterestList().then(res => {
|
||||||
|
setOthersInterestedList({loading: false, data: res.data.result_list})
|
||||||
|
}).catch(err => {
|
||||||
|
setOthersInterestedList({loading: false, data: []})
|
||||||
|
console.log('Error: ', err)
|
||||||
|
})
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
// debugger;
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ManageInterestOffer
|
||||||
|
othersInterestedList={othersInterestedList}
|
||||||
|
commonHeadData={commonHeadBanner.result_list}
|
||||||
|
offerDetails={state}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
import React, { useContext, useState, useEffect } from "react";
|
import React, { useContext, useState, useEffect } from "react";
|
||||||
import usersService from "../services/UsersService";
|
import usersService from "../services/UsersService";
|
||||||
//import MyJobs from "../components/MyJobs";
|
|
||||||
import MyActiveJobs from "../components/MyActiveJobs";
|
|
||||||
import MyPendingJobs from "../components/MyPendingJobs";
|
import MyPendingJobs from "../components/MyPendingJobs";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function MyPendingJobsPage() {
|
export default function MyPendingJobsPage() {
|
||||||
let {commonHeadBanner} = useSelector(state => state.commonHeadBanner)
|
let { commonHeadBanner } = useSelector((state) => state.commonHeadBanner);
|
||||||
const [MyJobList, setMyJobList] = useState([]);
|
const [MyJobList, setMyJobList] = useState([]);
|
||||||
const api = new usersService();
|
const api = new usersService();
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,29 @@
|
|||||||
import React, { useContext, useState, useEffect } from "react";
|
import React, { useContext, useState, useEffect } from "react";
|
||||||
import BlogItem from "../components/Blogs";
|
// import BlogItem from "../components/Blogs";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
import OffersInterest from "../components/OffersInterest";
|
||||||
|
|
||||||
|
import usersService from "../services/UsersService";
|
||||||
|
|
||||||
export default function OffersInterestPage() {
|
export default function OffersInterestPage() {
|
||||||
|
const apiCall = new usersService()
|
||||||
|
|
||||||
let {commonHeadBanner} = useSelector(state => state.commonHeadBanner)
|
let {commonHeadBanner} = useSelector(state => state.commonHeadBanner)
|
||||||
|
|
||||||
|
let [offerInterestList, setOfferInterestList] = useState({loading: true, data: []})
|
||||||
|
|
||||||
|
useEffect(()=>{
|
||||||
|
apiCall.offersInterestList().then(res => {
|
||||||
|
setOfferInterestList({loading: false, data: res.data.result_list})
|
||||||
|
}).catch(err => {
|
||||||
|
setOfferInterestList({loading: false, data: []})
|
||||||
|
console.log('Error: ', err)
|
||||||
|
})
|
||||||
|
},[])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BlogItem commonHeadData={commonHeadBanner.result_list} />
|
<OffersInterest commonHeadData={commonHeadBanner.result_list} offerInterestList={offerInterestList} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user