added the redeem coupon api
This commit was merged in pull request #167.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useState, useRef, forwardRef } from "react";
|
import React, { useEffect, useState, useRef } from "react";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import Layout from "../Partials/Layout";
|
import Layout from "../Partials/Layout";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|||||||
@@ -21,17 +21,20 @@ const CouponPopup = ({ popUpHandler, data }) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
popUpHandler();
|
popUpHandler();
|
||||||
setLoader(false);
|
setLoader(false);
|
||||||
|
}, 3000);
|
||||||
throw new Response(res);
|
throw new Response(res);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
error &&
|
// error &&
|
||||||
toast.warn("An error occurred while processing your coupon.", {
|
// toast.warn("An error occurred while processing your coupon.", {
|
||||||
autoClose: 3000,
|
// autoClose: 3000,
|
||||||
hideProgressBar: true,
|
// hideProgressBar: true,
|
||||||
});
|
// });
|
||||||
setLoader(false);
|
setLoader(false);
|
||||||
console.log(error)
|
console.log(error);
|
||||||
|
return;
|
||||||
// throw new Error(error);
|
// throw new Error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -82,7 +85,7 @@ const CouponPopup = ({ popUpHandler, data }) => {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={redeemCouponHandler}
|
onClick={redeemCouponHandler}
|
||||||
className="text-white btn-gradient text-lg tracking-wide px-6 py-2 rounded-full"
|
className="text-white lg:w-[167px] btn-gradient flex justify-center items-center text-lg tracking-wide px-6 py-2 rounded-full"
|
||||||
>
|
>
|
||||||
{loader ? (
|
{loader ? (
|
||||||
<div className="signup btn-loader"></div>
|
<div className="signup btn-loader"></div>
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import dataImage2 from "../../assets/images/data-table-user-2.png";
|
import dataImage2 from "../../assets/images/data-table-user-2.png";
|
||||||
import PendingJobsPopout from "../jobPopout/PendingJobsPopout";
|
import PendingJobsPopout from "../jobPopout/PendingJobsPopout";
|
||||||
|
|
||||||
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||||
import PaginatedList from "../Pagination/PaginatedList";
|
import PaginatedList from "../Pagination/PaginatedList";
|
||||||
|
|
||||||
export default function MyPendingJobTable({ MyJobList, className }) {
|
export default function MyPendingJobTable({ MyJobList, className }) {
|
||||||
const filterCategories = ["All Categories", "Explore", "Featured"];
|
|
||||||
const [selectedCategory, setCategory] = useState(filterCategories[0]);
|
|
||||||
let [jobPopout, setJobPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
let [jobPopout, setJobPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(0);
|
const [currentPage, setCurrentPage] = useState(0);
|
||||||
@@ -42,8 +39,10 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
<>
|
<>
|
||||||
{MyJobList &&
|
{MyJobList &&
|
||||||
MyJobList?.result_list &&
|
MyJobList?.result_list &&
|
||||||
MyJobList.result_list.length > 0 ?
|
MyJobList.result_list.length > 0 ? (
|
||||||
currentActiveJobList.map((value, index) => (
|
currentActiveJobList.map((value, index) => {
|
||||||
|
let deliveryDate = value?.expire?.split(" ")[0];
|
||||||
|
return (
|
||||||
<tr
|
<tr
|
||||||
key={index}
|
key={index}
|
||||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||||
@@ -68,6 +67,7 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
{value.price * 0.01}
|
{value.price * 0.01}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Duration:{" "}
|
Duration:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
@@ -79,7 +79,7 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
Expire:{" "}
|
Expire:{" "}
|
||||||
<span className="text-purple">
|
<span className="text-purple">
|
||||||
{" "}
|
{" "}
|
||||||
{value.expire}
|
{deliveryDate}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
@@ -91,6 +91,7 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td className="text-right py-4 px-2">
|
<td className="text-right py-4 px-2">
|
||||||
@@ -105,14 +106,13 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
|||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))
|
)
|
||||||
:
|
})
|
||||||
|
) : (
|
||||||
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
|
||||||
<td className="p-2">
|
<td className="p-2">No Pending Task!</td>
|
||||||
No Pending Task!
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
}
|
)}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ export default function MyJobTable({ className, ActiveJobList }) {
|
|||||||
{Number(task?.price) * 0.01}
|
{Number(task?.price) * 0.01}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span className="text-sm text-thin-light-gray">
|
<span className="text-sm text-thin-light-gray">
|
||||||
Duration:
|
Duration:
|
||||||
<span className="text-purple ml-1">
|
<span className="text-purple ml-1">
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
import React, { useContext, useState, useEffect } from "react";
|
import React, { useContext, useState, useEffect } from "react";
|
||||||
import usersService from "../services/UsersService";
|
import usersService from "../services/UsersService";
|
||||||
//import MyJobs from "../components/MyJobs";
|
|
||||||
import MyActiveJobs from "../components/MyActiveJobs";
|
|
||||||
import MyPendingJobs from "../components/MyPendingJobs";
|
import MyPendingJobs from "../components/MyPendingJobs";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
export default function MyPendingJobsPage() {
|
export default function MyPendingJobsPage() {
|
||||||
let {commonHeadBanner} = useSelector(state => state.commonHeadBanner)
|
let { commonHeadBanner } = useSelector((state) => state.commonHeadBanner);
|
||||||
const [MyJobList, setMyJobList] = useState([]);
|
const [MyJobList, setMyJobList] = useState([]);
|
||||||
const api = new usersService();
|
const api = new usersService();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user