.
This commit was merged in pull request #190.
This commit is contained in:
@@ -14,7 +14,7 @@ import { PriceFormatter } from "../Helpers/PriceFormatter";
|
|||||||
export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
||||||
// Getting the categories
|
// Getting the categories
|
||||||
const currentJobCart = MyJobList?.data?.categories;
|
const currentJobCart = MyJobList?.data?.categories;
|
||||||
// DropDown Box
|
// DropDown Box
|
||||||
const filterCategories = { All: "All Categories", ...currentJobCart };
|
const filterCategories = { All: "All Categories", ...currentJobCart };
|
||||||
|
|
||||||
const [selectedCategory, setCategory] = useState(
|
const [selectedCategory, setCategory] = useState(
|
||||||
@@ -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 },
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -162,7 +166,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setJobPopout({ show: true, data: {thePrice, ...value} });
|
setJobPopout({ show: true, data: { thePrice, ...value } });
|
||||||
}}
|
}}
|
||||||
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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