.
This commit was merged in pull request #190.
This commit is contained in:
@@ -60,11 +60,13 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
|||||||
getCountryList();
|
getCountryList();
|
||||||
}, [getCountryList]);
|
}, [getCountryList]);
|
||||||
|
|
||||||
|
// Handle Pagination
|
||||||
const [currentPage, setCurrentPage] = useState(0);
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
const indexOfFirstItem = Number(currentPage);
|
const indexOfFirstItem = Number(currentPage);
|
||||||
const indexOfLastItem =
|
const indexOfLastItem =
|
||||||
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||||
|
|
||||||
|
// Handle Filter Job List
|
||||||
const filterJobList = () => {
|
const filterJobList = () => {
|
||||||
if (selectedCategory === "All") return MyJobList?.data?.result_list;
|
if (selectedCategory === "All") return MyJobList?.data?.result_list;
|
||||||
else
|
else
|
||||||
@@ -75,6 +77,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
|||||||
|
|
||||||
const currentJobList = filterJobList();
|
const currentJobList = filterJobList();
|
||||||
|
|
||||||
|
// Handling Filter Pagination
|
||||||
const filteredCurrentJobList = currentJobList?.slice(
|
const filteredCurrentJobList = currentJobList?.slice(
|
||||||
indexOfFirstItem,
|
indexOfFirstItem,
|
||||||
indexOfLastItem
|
indexOfLastItem
|
||||||
@@ -84,6 +87,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
|||||||
handlePagingFunc(e, setCurrentPage);
|
handlePagingFunc(e, setCurrentPage);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Handles the category selection
|
||||||
const handleSetCategory = (value) => {
|
const handleSetCategory = (value) => {
|
||||||
setCurrentPage(0);
|
setCurrentPage(0);
|
||||||
for (let i in filterCategories) {
|
for (let i in filterCategories) {
|
||||||
@@ -135,7 +139,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setDeleteJobPopout({
|
setDeleteJobPopout({
|
||||||
show: true,
|
show: true,
|
||||||
data: {thePrice, ...value}
|
data: { thePrice, ...value },
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -148,7 +152,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
setEditJob({
|
setEditJob({
|
||||||
show: true,
|
show: true,
|
||||||
data: {thePrice, ...value}
|
data: { thePrice, ...value },
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useEffect, useState } from "react";
|
|
||||||
import MyJobs from "../components/MyJobs";
|
import MyJobs from "../components/MyJobs";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user