Merge branch 'market-list-reload' of WrenchBoard/Users-Wrench into master
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||||
import MarketPopUp from "../MarketPlace/PopUp/MarketPopUp";
|
import MarketPopUp from "../MarketPlace/PopUp/MarketPopUp";
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
import PendingJobsPopout from "../jobPopout/PendingJobsPopout";
|
||||||
|
|
||||||
export default function AvailableJobsCard({
|
export default function AvailableJobsCard({
|
||||||
className,
|
className,
|
||||||
@@ -11,8 +13,15 @@ export default function AvailableJobsCard({
|
|||||||
}) {
|
}) {
|
||||||
//debugger;
|
//debugger;
|
||||||
const [marketPopUp, setMarketPopUp] = useState({ show: false, data: {} });
|
const [marketPopUp, setMarketPopUp] = useState({ show: false, data: {} });
|
||||||
|
const [jobPopout, setJobPopout] = useState({ show: false, data: {} });
|
||||||
|
|
||||||
const [imageUrl, setImageUrl] = useState("");
|
const [imageUrl, setImageUrl] = useState("");
|
||||||
|
|
||||||
|
const {
|
||||||
|
userDetails: { uid },
|
||||||
|
} = useSelector((state) => state?.userDetails); // GETS USER DETAILS
|
||||||
|
|
||||||
|
|
||||||
let thePrice = PriceFormatter(
|
let thePrice = PriceFormatter(
|
||||||
datas?.price * 0.01,
|
datas?.price * 0.01,
|
||||||
datas?.currency_code,
|
datas?.currency_code,
|
||||||
@@ -40,7 +49,7 @@ export default function AvailableJobsCard({
|
|||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMarketPopUp({ show: true, data: datas });
|
datas.market_uid != uid ? setMarketPopUp({ show: true, data: datas }) :setJobPopout({ show: true, data: datas });
|
||||||
}}
|
}}
|
||||||
className="flex flex-col gap-2 justify-between w-full h-full"
|
className="flex flex-col gap-2 justify-between w-full h-full"
|
||||||
>
|
>
|
||||||
@@ -80,7 +89,7 @@ export default function AvailableJobsCard({
|
|||||||
</div>
|
</div>
|
||||||
<div className="thumbnail-area w-full">
|
<div className="thumbnail-area w-full">
|
||||||
<div
|
<div
|
||||||
className="w-full h-[236px] rounded-xl overflow-y-auto bg-center bg-cover bg-no-repeat"
|
className="w-full p-1 h-[150px] rounded-xl overflow-y-auto bg-center bg-cover bg-no-repeat"
|
||||||
// style={{
|
// style={{
|
||||||
// backgroundImage: `url('${image}')`,
|
// backgroundImage: `url('${image}')`,
|
||||||
// }}
|
// }}
|
||||||
@@ -108,15 +117,27 @@ export default function AvailableJobsCard({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button
|
{datas.market_uid != uid ?
|
||||||
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
|
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
|
||||||
|
onClick={() => {
|
||||||
|
setMarketPopUp({ show: true, data: datas });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
View
|
||||||
|
</button>
|
||||||
|
:
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="px-4 py-2.5 text-white text-sm bg-yellow-500 rounded-full tracking-wide"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMarketPopUp({ show: true, data: datas });
|
setJobPopout({ show: true, data: datas });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
View
|
Manage
|
||||||
</button>
|
</button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -131,7 +152,7 @@ export default function AvailableJobsCard({
|
|||||||
<div className="flex flex-col flex-[0.9]">
|
<div className="flex flex-col flex-[0.9]">
|
||||||
<h1
|
<h1
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMarketPopUp({ show: true, data: datas });
|
datas.market_uid != uid ? setMarketPopUp({ show: true, data: datas }) :setJobPopout({ show: true, data: datas })
|
||||||
}}
|
}}
|
||||||
className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize"
|
className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize"
|
||||||
>
|
>
|
||||||
@@ -140,7 +161,7 @@ export default function AvailableJobsCard({
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMarketPopUp({ show: true, data: datas });
|
datas.market_uid != uid ? setMarketPopUp({ show: true, data: datas }) :setJobPopout({ show: true, data: datas })
|
||||||
}}
|
}}
|
||||||
className="my-2"
|
className="my-2"
|
||||||
>
|
>
|
||||||
@@ -168,8 +189,9 @@ export default function AvailableJobsCard({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="">
|
<div className="">
|
||||||
|
{datas.market_uid != uid ?
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
|
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMarketPopUp({ show: true, data: datas });
|
setMarketPopUp({ show: true, data: datas });
|
||||||
@@ -177,6 +199,17 @@ export default function AvailableJobsCard({
|
|||||||
>
|
>
|
||||||
View
|
View
|
||||||
</button>
|
</button>
|
||||||
|
:
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="px-4 py-2.5 text-white text-sm bg-yellow-500 rounded-full tracking-wide"
|
||||||
|
onClick={() => {
|
||||||
|
setJobPopout({ show: true, data: datas });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Manage
|
||||||
|
</button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -189,6 +222,18 @@ export default function AvailableJobsCard({
|
|||||||
situation={marketPopUp.show}
|
situation={marketPopUp.show}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* Active Job Popout */}
|
||||||
|
{jobPopout.show && (
|
||||||
|
<PendingJobsPopout
|
||||||
|
details={datas}
|
||||||
|
onClose={() => {
|
||||||
|
setJobPopout({ show: false, data: {} });
|
||||||
|
}}
|
||||||
|
situation={jobPopout.show}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{/* End of Active Job Popout */}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -173,11 +173,12 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
|
|||||||
{name}
|
{name}
|
||||||
</label>
|
</label>
|
||||||
<div
|
<div
|
||||||
className={`w-full md:w-3/4 text-slate-900 dark:text-white market-pop ${
|
className={`w-full p-2 md:w-3/4 text-slate-900 dark:text-white market-pop ${
|
||||||
name !== "Delivery Detail"
|
name == "Description"
|
||||||
? " h-full flex items-center"
|
? "max-h-28 h-full overflow-y-auto break-words"
|
||||||
: " overflow-y-auto max-h-[80px]"
|
: name == "Delivery Detail" ? " overflow-y-auto h-full max-h-28"
|
||||||
} ${name === "Description" && "max-h-14 h-full overflow-auto"}`}
|
: "h-full flex items-center"
|
||||||
|
}`}
|
||||||
>
|
>
|
||||||
{danger ? (
|
{danger ? (
|
||||||
<p
|
<p
|
||||||
@@ -193,12 +194,14 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
|
|||||||
{typeof content !== "object" ? content : null}
|
{typeof content !== "object" ? content : null}
|
||||||
{typeof content === "object" && (
|
{typeof content === "object" && (
|
||||||
<>
|
<>
|
||||||
<hr className="mb-1" />
|
{/* <hr className="mb-1" /> */}
|
||||||
|
<span className='flex w-full mb-1 h-[1px] bg-slate-500'></span>
|
||||||
<span className="flex items-center gap-2 dark:text-white">
|
<span className="flex items-center gap-2 dark:text-white">
|
||||||
{content?.text}
|
{content?.text}
|
||||||
<strong>{thePrice}</strong>
|
<strong>{thePrice}</strong>
|
||||||
</span>
|
</span>
|
||||||
<hr className="mt-1" />
|
<span className='flex w-full mt-1 h-[1px] bg-slate-500'></span>
|
||||||
|
{/* <hr className="mt-1" /> */}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -99,6 +99,7 @@ function PendingJobsPopout({ details, onClose, situation }) {
|
|||||||
onClose();
|
onClose();
|
||||||
dispatch(tableReload({ type: "PENDINGTABLE" }));
|
dispatch(tableReload({ type: "PENDINGTABLE" }));
|
||||||
dispatch(tableReload({ type: "JOBTABLE" }));
|
dispatch(tableReload({ type: "JOBTABLE" }));
|
||||||
|
dispatch(tableReload({ type: "MARKETTABLELIST" }));
|
||||||
}, 4000);
|
}, 4000);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
|||||||
@@ -217,6 +217,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
|
|||||||
}
|
}
|
||||||
// Getting market data
|
// Getting market data
|
||||||
const getMarketActiveJobList = async () => {
|
const getMarketActiveJobList = async () => {
|
||||||
|
dispatch(updateJobs({loading: true}));
|
||||||
try {
|
try {
|
||||||
const res = await apiCall.getActiveJobList();
|
const res = await apiCall.getActiveJobList();
|
||||||
dispatch(updateJobs({loading: false, ...res.data}));
|
dispatch(updateJobs({loading: false, ...res.data}));
|
||||||
|
|||||||
Reference in New Issue
Block a user