This commit was merged in pull request #190.
This commit is contained in:
2023-06-19 22:32:18 +01:00
parent 6eed7bf1f3
commit 2d366cd103
2 changed files with 8 additions and 5 deletions
+8 -4
View File
@@ -14,7 +14,7 @@ import { PriceFormatter } from "../Helpers/PriceFormatter";
export default function MyJobTable({ MyJobList, reloadJobList, className }) {
// Getting the categories
const currentJobCart = MyJobList?.data?.categories;
// DropDown Box
// DropDown Box
const filterCategories = { All: "All Categories", ...currentJobCart };
const [selectedCategory, setCategory] = useState(
@@ -60,11 +60,13 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
getCountryList();
}, [getCountryList]);
// Handle Pagination
const [currentPage, setCurrentPage] = useState(0);
const indexOfFirstItem = Number(currentPage);
const indexOfLastItem =
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
// Handle Filter Job List
const filterJobList = () => {
if (selectedCategory === "All") return MyJobList?.data?.result_list;
else
@@ -75,6 +77,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
const currentJobList = filterJobList();
// Handling Filter Pagination
const filteredCurrentJobList = currentJobList?.slice(
indexOfFirstItem,
indexOfLastItem
@@ -84,6 +87,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
handlePagingFunc(e, setCurrentPage);
};
// Handles the category selection
const handleSetCategory = (value) => {
setCurrentPage(0);
for (let i in filterCategories) {
@@ -135,7 +139,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
onClick={() => {
setDeleteJobPopout({
show: true,
data: {thePrice, ...value}
data: { thePrice, ...value },
});
}}
>
@@ -148,7 +152,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
onClick={() => {
setEditJob({
show: true,
data: {thePrice, ...value}
data: { thePrice, ...value },
});
}}
>
@@ -162,7 +166,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
<button
type="button"
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"
>
-1
View File
@@ -1,4 +1,3 @@
import { useEffect, useState } from "react";
import MyJobs from "../components/MyJobs";
import { useSelector } from "react-redux";