Fixed bugs in market popup and made changes to Add/edit

This commit was merged in pull request #216.
This commit is contained in:
2023-06-27 21:57:39 +01:00
parent b282295924
commit 498966dd23
5 changed files with 118 additions and 153 deletions
@@ -1,17 +1,13 @@
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { useState } from "react";
import dataImage2 from "../../assets/images/data-table-user-2.png";
import { handlePagingFunc } from "../Pagination/HandlePagination";
import PaginatedList from "../Pagination/PaginatedList";
import PendingJobsPopout from "../jobPopout/PendingJobsPopout";
import { PriceFormatter } from "../Helpers/PriceFormatter";
import MarketPopUp from "../MarketPlace/PopUp/MarketPopUp";
import usersService from "../../services/UsersService";
import { useNavigate } from "react-router-dom";
export default function MyWaitingJobTable({ MyJobList, className }) {
let [jobPopout, setJobPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
const [manageInt, setManageInt] = useState(null);
const [currentPage, setCurrentPage] = useState(0);
const indexOfFirstItem = Number(currentPage);
const indexOfLastItem =
@@ -25,31 +21,6 @@ export default function MyWaitingJobTable({ MyJobList, className }) {
handlePagingFunc(e, setCurrentPage);
};
let navigate = useNavigate();
const apiCall = useMemo(() => new usersService(), []);
const marketInterestData = useCallback(async () => {
let { offer_code } = MyJobList;
let reqData = { offer_code };
try {
const manageInt = await apiCall.MarketInterest(reqData);
const manageIntRes = await manageInt?.data;
setManageInt(manageIntRes);
} catch (error) {
throw new Error(error);
}
}, [apiCall, MyJobList]);
useEffect(() => {
if (!MyJobList) {
navigate("/pend-interest", { replace: true });
}
marketInterestData();
}, []);
return (
<div
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow min-h-[520px] ${
@@ -66,7 +37,7 @@ export default function MyWaitingJobTable({ MyJobList, className }) {
MyJobList?.result_list &&
MyJobList.result_list.length > 0 ? (
currentActiveJobList.map((value, index) => {
let deliveryDate = value?.expire?.split(" ")[0];
// let deliveryDate = value?.expire?.split(" ")[0];
let thePrice = PriceFormatter(
value?.price * 0.01,
value?.currency_code,
@@ -102,21 +73,21 @@ export default function MyWaitingJobTable({ MyJobList, className }) {
Duration:{" "}
<span className="text-purple">
{" "}
{value.timeline_days} day(s)
{value?.timeline_days} day(s)
</span>
</span>
<span className="text-sm text-thin-light-gray">
Expire:{" "}
<span className="text-purple">
{" "}
{deliveryDate}
{value?.expire}
</span>
</span>
<span className="text-sm text-thin-light-gray">
Sent :{" "}
<span className="text-purple">
{" "}
{value.sent}
{value?.sent}
</span>
</span>
</div>
@@ -172,7 +143,6 @@ export default function MyWaitingJobTable({ MyJobList, className }) {
onClose={() => {
setJobPopout({ show: false, data: {} });
}}
marketInt={manageInt}
situation={jobPopout.show}
/>
)}