Compare commits

..

16 Commits

Author SHA1 Message Date
Ebube 5810345ca7 Added no task background 2023-06-13 10:31:45 +01:00
CHIEFSOFT\ameye 61d8c938e9 getCouponPending 2023-06-12 17:45:57 -04:00
CHIEFSOFT\ameye b96bb061d0 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench
# Conflicts:
#	src/components/MyCoupons/MyCoupons.jsx
2023-06-12 17:45:14 -04:00
CHIEFSOFT\ameye e0a728c5cf Coupon pening 2023-06-12 17:43:07 -04:00
ameye f63e52422d Merge branch 'coupon-page-cleanup' of WrenchBoard/Users-Wrench into master 2023-06-12 21:42:05 +00:00
Ebube 12a56bdb05 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into coupon-page-cleanup 2023-06-12 22:21:08 +01:00
Ebube 7666d78c0b . 2023-06-12 22:20:41 +01:00
ameye 0a0cca7326 Merge branch 'unused-code-cleanup' of WrenchBoard/Users-Wrench into master 2023-06-12 13:21:27 +00:00
ameye 3749fc89db Merge branch 'box-height-fixed' of WrenchBoard/Users-Wrench into master 2023-06-12 13:20:58 +00:00
ameye fcab0acdad Merge branch 'coupon-page-cleanup' of WrenchBoard/Users-Wrench into master 2023-06-12 13:20:38 +00:00
victorAnumudu 497407112c unused code cleaned 2023-06-12 14:10:26 +01:00
Ebube bbbfe799a3 . 2023-06-12 14:01:25 +01:00
Ebube 7125ce936e . 2023-06-12 13:58:06 +01:00
Ebube a235448897 Cleanup zero 2023-06-12 13:57:07 +01:00
Ebube 36479d1246 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into coupon-page-cleanup 2023-06-12 13:55:52 +01:00
Ebube 134f2fbe9f added slider image for bannerlist in zero state 2023-06-12 13:55:24 +01:00
17 changed files with 396 additions and 307 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

@@ -1,7 +1,5 @@
import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import localImgLoad from "../../lib/localImgLoad";
import bannerImage from "../../assets/images/banner-coupons.jpg";
export default function HomeBannerOffersCard(props) {
const [imageUrl, setImageUrl] = useState("");
-15
View File
@@ -3,11 +3,7 @@ import { Link } from "react-router-dom";
import { toast } from "react-toastify";
import heroBg from "../../assets/images/hero-bg.svg";
import heroUser from "../../assets/images/hero-user.png";
import slider1 from "../../assets/images/slider-1.jpg";
import slider2 from "../../assets/images/slider-2.jpg";
import slider3 from "../../assets/images/slider-3.jpg";
import CountDown from "../Helpers/CountDown";
import SliderCom from "../Helpers/SliderCom";
import HomeSliders from "./HomeSliders";
import { useSelector } from "react-redux";
@@ -20,18 +16,7 @@ export default function Hero({ className, bannerList, nextDueTask }) {
swipe: true,
};
const sildeData = null;
const [addFavorite, setValue] = useState(false);
const { userDetails } = useSelector((state) => state?.userDetails);
const favoriteHandler = () => {
if (!addFavorite) {
setValue(true);
toast.success("Added to Favorite List");
} else {
setValue(false);
toast.warn("Remove to Favorite List");
}
};
let loginDate = userDetails?.last_login.split(" ")[0];
let { firstname, lastname, email, profile_pic } = userDetails;
+9 -3
View File
@@ -1,19 +1,25 @@
import SliderCom from "../Helpers/SliderCom";
import slider2 from "../../assets/images/slider-2.jpg";
import HomeBannerOffersCard from "../Cards/HomeBannerOffersCard";
export default function HomeSliders(props) {
console.log("BANNER LIST IN HomeSliders->", props.bannerList);
// console.log("BANNER LIST IN HomeSliders->", props.bannerList);
// debugger;
return (
<>
<div className="hero-slider relative 2xl:w-[600px] xl:w-[500px] lg:w-[420px] w-full mb-2 lg:mb-0 ">
<div className="w-full">
<SliderCom settings={props.settings}>
{props.bannerList?.length &&
{props.bannerList?.length <= 0 && (
<div className="item w-full h-full bg-white dark:bg-dark-white max-h-80 rounded-2xl overflow-hidden">
<img src={slider2} alt="slider" className="w-full h-full" />
</div>
)}
{props.bannerList?.length > 0 &&
props.bannerList.map((item, index) => (
<div
key={index}
className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden"
className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden"
>
<HomeBannerOffersCard itemData={item} />
</div>
@@ -6,14 +6,14 @@ function CurrentJobAction() {
<p className="my-3 py-1 text-base active-owner">
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
<tbody>
<tr className=" border-b dark:border-[#5356fb29] hover:bg-gray-50">
<td className=" py-1">
<tr>
<td>
<div className="flex space-x-2 items-center w-full">
<div className="flex flex-col flex-[0.9]">
<h1 className="text-xl text-dark-gray dark:text-white">
Waiting for the completion message from the client before you can approve.
</h1>
</div>
{/*<div className="flex flex-col flex-[0.9]"> </div>*/}
</div>
</td>
@@ -37,9 +37,8 @@ function CurrentTaskAction({jobDetails}) {
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 active-worker">
<tbody>
<tr className=" border-b">
<tr>
<td>
<div className="flex space-x-2 items-center w-full">
<h1 className="text-xl text-dark-gray dark:text-white">
I completed this task and ready for review and acceptance.
@@ -6,14 +6,14 @@ function PastDueJobAction() {
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 owner-pastdue">
<tbody>
<tr className="border-b dark:border-[#5356fb29] hover:bg-gray-50">
<tr>
<td>
<div className="flex space-x-2 items-center w-full">
<div className="flex flex-col flex-[0.9]">
<h1 className="text-xl text-dark-gray dark:text-white">
Time allocated has passed
</h1>
</div>
{/*<div className="flex flex-col flex-[0.9]"> </div>*/}
</div>
</td>
</tr>
@@ -6,14 +6,14 @@ function PastDueTaskAction() {
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 worker-pastdue">
<tbody>
<tr className=" border-b dark:border-[#5356fb29] hover:bg-gray-50">
<tr>
<td>
<div className="flex space-x-2 items-center w-full">
<div className="flex flex-col flex-[0.9]">
<h1 className="text-xl text-dark-gray dark:text-white">
You have missed the allocated time
</h1>
</div>
{/*<div className="flex flex-col flex-[0.9]"> </div>*/}
</div>
</td>
</tr>
@@ -6,14 +6,14 @@ function ReviewJobAction() {
<p className="my-3 py-1 text-base">
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 review-owner">
<tbody>
<tr className="border-b dark:border-[#5356fb29]">
<td className=" py-1">
<tr>
<td>
<div className="flex space-x-2 items-center w-full">
<div className="flex flex-col flex-[0.9]">
<h1 className="text-xl text-dark-gray dark:text-white">
This Job is Ready for your review
</h1>
</div>
{/*<div className="flex flex-col flex-[0.9]"> </div>*/}
</div>
</td>
</tr>
+96
View File
@@ -0,0 +1,96 @@
const CouponPopup = ({ popUpHandler, data }) => {
return (
<div className="logout-modal-wrapper lg:w-[460px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="logout-modal-header w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
Redeem Coupon
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
onClick={popUpHandler}
>
<CloseIcon />
</button>
</div>
<form className="logout-modal-body w-full flex flex-col items-center px-10 py-8 gap-4 border-b dark:border-[#5356fb29] border-light-purple">
<div className="input-com mb-7 flex gap-1 items-center w-full">
{/* Coupon */}
<div className="flex items-center justify-between flex-[0.3]">
<label
className="input-label text-[#181c32] dark:text-white text-[15px] font-semibold"
htmlFor="coupon-token"
>
Coupon:
</label>
</div>
<div className=" flex-[0.7] max-w-[150px]">{data?.code}</div>
</div>
<div className="input-com mb-7 flex gap-1 items-center w-full">
{/* Amount */}
<div className="flex items-center justify-between flex-[0.3]">
<label
className="input-label text-[#181c32] dark:text-white text-[15px] font-semibold"
htmlFor="amount"
>
Amount:
</label>
</div>
<div className=" flex-[0.7] max-w-[150px]">{`${data?.amount} Naira`}</div>
</div>
<div className="signin-area w-full">
<div className="flex justify-end">
<button
// type="button"
className="text-white btn-gradient text-lg tracking-wide px-6 py-2 rounded-full"
>
{/* {loader ? (
<div className="signup btn-loader"></div>
) : (
)} */}
<span className="font-semibold tracking-wider">Redeem Now!</span>
</button>
</div>
</div>
</form>
<div className="signin-area w-full px-5 py-4">
<div className="flex justify-end">
<button
onClick={popUpHandler}
className="border-gradient text-lg tracking-wide px-6 py-2 rounded-full"
>
<span>Cancel</span>
</button>
</div>
</div>
</div>
);
};
export default CouponPopup;
const CloseIcon = () => (
<svg
width="36"
height="36"
viewBox="0 0 36 36"
fill="none"
className="fill-current"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M36 16.16C36 17.4399 36 18.7199 36 20.0001C35.7911 20.0709 35.8636 20.2554 35.8385 20.4001C34.5321 27.9453 30.246 32.9248 22.9603 35.2822C21.9006 35.6251 20.7753 35.7657 19.6802 35.9997C18.4003 35.9997 17.1204 35.9997 15.8401 35.9997C15.5896 35.7086 15.2189 35.7732 14.9034 35.7093C7.77231 34.2621 3.08728 30.0725 0.769671 23.187C0.435002 22.1926 0.445997 21.1199 0 20.1599C0 18.7198 0 17.2798 0 15.8398C0.291376 15.6195 0.214408 15.2656 0.270759 14.9808C1.71321 7.69774 6.02611 2.99691 13.0428 0.700951C14.0118 0.383805 15.0509 0.386897 15.9999 0C17.2265 0 18.4532 0 19.6799 0C19.7156 0.124041 19.8125 0.136067 19.9225 0.146719C27.3 0.868973 33.5322 6.21922 35.3801 13.427C35.6121 14.3313 35.7945 15.2484 36 16.16ZM33.011 18.0787C33.0433 9.77105 26.3423 3.00309 18.077 2.9945C9.78479 2.98626 3.00344 9.658 2.98523 17.8426C2.96667 26.1633 9.58859 32.9601 17.7602 33.0079C26.197 33.0577 32.9787 26.4186 33.011 18.0787Z"
fill=""
fillOpacity="0.6"
/>
<path
d="M15.9309 18.023C13.9329 16.037 12.007 14.1207 10.0787 12.2072C9.60071 11.733 9.26398 11.2162 9.51996 10.506C9.945 9.32677 11.1954 9.0811 12.1437 10.0174C13.9067 11.7585 15.6766 13.494 17.385 15.2879C17.9108 15.8401 18.1633 15.7487 18.6375 15.258C20.3586 13.4761 22.1199 11.7327 23.8822 9.99096C24.8175 9.06632 26.1095 9.33639 26.4967 10.517C26.7286 11.2241 26.3919 11.7413 25.9133 12.2178C24.1757 13.9472 22.4477 15.6855 20.7104 17.4148C20.5228 17.6018 20.2964 17.7495 20.0466 17.9485C22.0831 19.974 24.0372 21.8992 25.9689 23.8468C26.9262 24.8119 26.6489 26.1101 25.4336 26.4987C24.712 26.7292 24.2131 26.3441 23.7455 25.8757C21.9945 24.1227 20.2232 22.3892 18.5045 20.6049C18.0698 20.1534 17.8716 20.2269 17.4802 20.6282C15.732 22.4215 13.9493 24.1807 12.1777 25.951C11.7022 26.4262 11.193 26.7471 10.4738 26.4537C9.31345 25.9798 9.06881 24.8398 9.98589 23.8952C11.285 22.5576 12.6138 21.2484 13.9387 19.9355C14.5792 19.3005 15.2399 18.6852 15.9309 18.023Z"
fill="#"
fillOpacity="0.6"
/>
</svg>
);
+103 -60
View File
@@ -1,67 +1,110 @@
import React, {useState} from 'react'
import React, { useEffect, useState } from "react";
import PaginatedList from "../Pagination/PaginatedList";
import { handlePagingFunc } from "../Pagination/HandlePagination";
import ModalCom from "../Helpers/ModalCom";
import CouponPopup from "./CouponPopup";
import { useNavigate } from "react-router-dom";
//import PaginatedList from '../../Pagination/PaginatedList'
import PaginatedList from '../Pagination/PaginatedList';
import { handlePagingFunc } from '../Pagination/HandlePagination';
function CouponTable({ coupon }) {
const [currentPage, setCurrentPage] = useState(0);
const [couponPopup, setCouponPopup] = useState({ state: false, data: null });
const indexOfFirstItem = Number(currentPage);
const indexOfLastItem =
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
const currentCoupon = coupon?.data?.slice(indexOfFirstItem, indexOfLastItem);
function CouponTable({coupon}) {
const handlePagination = (e) => {
handlePagingFunc(e, setCurrentPage);
};
const [currentPage, setCurrentPage] = useState(0);
const indexOfFirstItem = Number(currentPage);
const indexOfLastItem = Number(indexOfFirstItem)+Number(process.env.REACT_APP_ITEM_PER_PAGE);
const currentCoupon = coupon?.data?.slice(indexOfFirstItem, indexOfLastItem);
const navigate = useNavigate();
const handlePagination = (e) => {
handlePagingFunc(e,setCurrentPage)
}
const handleCouponPopUp = () =>
setCouponPopup((prev) => ({ state: !prev.state }));
return (
<div className='flex flex-col justify-between h-full'>
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="p-2">Coupon</th>
{/*<th className="p-2">Description</th>*/}
{/*<th className="p-2">Amount</th>*/}
<th className="p-2">Status</th>
</tr>
</thead>
{coupon.data.length ?
(
<tbody>
{currentCoupon.map((item, index) => (
<tr key={index} className='text-slate-500'>
<td className="p-2">{item.added} <br /> {item.code} <br />{item.amount}</td>
{/*<td className="p-2"></td>*/}
{/*<td className="p-2"></td>*/}
<td className="p-2">{item.status}</td>
</tr>
))}
</tbody>
)
:
coupon.error ?
(
<tbody>
<tr className='text-slate-500'>
<td className="p-2" colSpan={4}>Opps! an error occurred. Please try again!</td>
</tr>
</tbody>
)
:
<tbody>
<tr className='text-slate-500'>
<td className="p-2" colSpan={4}>No Purchase History Found!</td>
</tr>
</tbody>
}
</table>
useEffect(() => {
if (!coupon) navigate("/my-coupon", { replace: true });
}, []);
{/* PAGINATION BUTTON */}
<PaginatedList onClick={handlePagination} prev={currentPage == 0 ? true : false} next={currentPage+Number(process.env.REACT_APP_ITEM_PER_PAGE) >= coupon?.data?.length ? true : false} data={coupon?.data} start={indexOfFirstItem} stop={indexOfLastItem} />
{/* END OF PAGINATION BUTTON */}
</div>
)
return (
<div className="flex flex-col justify-between h-full">
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className="border-b-2">
<tr className="text-slate-600">
<th className="p-2">Coupon</th>
<th className="p-2 text-center">Amount</th>
<th className="p-2"></th>
</tr>
</thead>
{coupon.data.length ? (
<tbody>
{currentCoupon.map((item, index) => (
<tr key={index} className="text-slate-500">
<td className="p-2 cursor-default">
{item.added} <br /> {item.code}
</td>
<td className="p-2 text-center cursor-default">{`${item.amount} Naira`}</td>
<td className="p-2 h-20 flex items-center justify-end">
<button
type="button"
className="btn-gradient w-[116px] h-[46px] text-white rounded-full text-base bg-pink flex justify-center items-center"
onClick={() => {
setCouponPopup((prev) => ({
state: !prev.state,
data: item,
}));
}}
>
Redeem
</button>
</td>
</tr>
))}
</tbody>
) : coupon.error ? (
<tbody>
<tr className="text-slate-500">
<td className="p-2" colSpan={4}>
Opps! an error occurred. Please try again!
</td>
</tr>
</tbody>
) : (
<tbody>
<tr className="text-slate-500">
<td className="p-2" colSpan={4}>
No Purchase History Found!
</td>
</tr>
</tbody>
)}
</table>
{/* PAGINATION BUTTON */}
<PaginatedList
onClick={handlePagination}
prev={currentPage === 0 ? true : false}
next={
currentPage + Number(process.env.REACT_APP_ITEM_PER_PAGE) >=
coupon?.data?.length
? true
: false
}
data={coupon?.data}
start={indexOfFirstItem}
stop={indexOfLastItem}
/>
{/* END OF PAGINATION BUTTON */}
{couponPopup.state && (
<ModalCom action={handleCouponPopUp} situation={couponPopup.state}>
<CouponPopup
data={couponPopup.data}
popUpHandler={handleCouponPopUp}
/>
</ModalCom>
)}
</div>
);
}
export default CouponTable
export default CouponTable;
+63 -60
View File
@@ -1,69 +1,72 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect, useState } from "react";
import Layout from "../Partials/Layout";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import CouponTable from "./CouponTable";
import usersService from '../../services/UsersService'
import usersService from "../../services/UsersService";
export default function MyCoupons() {
const apiCall = new usersService()
let [couponHistory, setCouponHistory] = useState({ // FOR COUPON HISTORY
loading: true,
data: [],
error: false
})
const apiCall = new usersService();
let [couponHistory, setCouponHistory] = useState({
// FOR COUPON HISTORY
loading: true,
data: [],
error: false,
});
//FUNCTION TO GET COUPON HISTORY
const getCouponHistory = ()=>{
apiCall.getCouponHx().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setCouponHistory(prev => ({...prev, loading: false}))
return
}
setCouponHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setCouponHistory(prev => ({...prev, loading: false, error: true}))
})
}
//FUNCTION TO GET COUPON HISTORY
const getCouponHistory = () => {
apiCall
.getCouponPending()
.then((res) => {
if (res.data.internal_return < 0) {
// success but no data
setCouponHistory((prev) => ({ ...prev, loading: false }));
return;
}
setCouponHistory((prev) => ({
...prev,
loading: false,
data: res.data.result_list,
}));
})
.catch((error) => {
setCouponHistory((prev) => ({ ...prev, loading: false, error: true }));
});
};
useEffect(()=>{
getCouponHistory()
}, [])
useEffect(() => {
getCouponHistory();
}, []);
return (
<>
<Layout>
<div className="my-wallet-wrapper w-full mb-10">
{/* heading */}
<div className="sm:flex justify-between items-center mb-6">
<div className="mb-5 sm:mb-0">
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
Coupons
</h1>
</div>
<div className="slider-btns flex space-x-4">
</div>
</div>
<div className='w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin'>
{/* COUPON SECTION */}
<div className="lg:w-4/4 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-full max-h-[500px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow">
{couponHistory.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
<CouponTable coupon={couponHistory} />
}
</div>
</div>
{/* END OF COUPON SECTION */}
</div>
</div>
</Layout>
</>
);
return (
<>
<Layout>
<div className="my-wallet-wrapper w-full mb-10">
{/* heading */}
<div className="sm:flex justify-start items-center mb-6">
<div className="mb-5 sm:mb-0">
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
Coupons
</h1>
</div>
</div>
<div className="w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin">
{/* COUPON SECTION */}
<div className="lg:w-4/4 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-full max-h-[500px] min-h-[500px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow coupon">
{couponHistory.loading ? (
<div className="w-full h-full flex justify-center items-center">
<LoadingSpinner size="16" color="sky-blue" />
</div>
) : (
<CouponTable coupon={couponHistory} />
)}
</div>
</div>
{/* END OF COUPON SECTION */}
</div>
</div>
</Layout>
</>
);
}
+50 -53
View File
@@ -1,60 +1,55 @@
import React, { useCallback, useEffect, useMemo, useState } from "react";
import { useState } from "react";
import dataImage1 from "../../assets/images/data-table-user-1.png";
import PaginatedList from "../Pagination/PaginatedList";
import { handlePagingFunc } from "../Pagination/HandlePagination";
import usersService from "../../services/UsersService";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import { useNavigate, useLocation } from "react-router-dom";
import {useNavigate, useLocation} from 'react-router-dom'
const noTasksBg = require("../../assets/images/no-task-background.jpg");
export default function MyJobTable({ className, ActiveJobList }) {
let navigate = useNavigate()
let {pathname} = useLocation()
// const [tasksData, setTasksData] = useState(null);
// const [loader, setLoader] = useState(false);
// let apiCall = useMemo(() => new usersService(), []);
// const displayTasks = useCallback(async () => {
// try {
// const res = await apiCall.getMyActiveTaskList();
// let {
// data: { result_list },
// internal_return,
// statusText,
// } = await res;
// if (internal_return < 0 || statusText !== "OK") return;
// setTasksData(result_list);
// setLoader(false);
// } catch (error) {
// throw new Error(error);
// }
// }, [apiCall]);
// useEffect(() => {
// displayTasks();
// }, []);
let navigate = useNavigate();
let { pathname } = useLocation();
const [currentPage, setCurrentPage] = useState(0);
const indexOfFirstItem = Number(currentPage);
const indexOfLastItem =
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
const currentTask = ActiveJobList?.data?.slice(indexOfFirstItem, indexOfLastItem);
const currentTask = ActiveJobList?.data?.slice(
indexOfFirstItem,
indexOfLastItem
);
const handlePagination = (e) => {
handlePagingFunc(e, setCurrentPage);
};
// To navigate to task
const [btnLoader, setBtnLoader] = useState(false);
const navigateMarket = () => {
setBtnLoader(true);
setTimeout(() => {
navigate("/market", { replace: true });
setBtnLoader(false);
}, 2500);
};
return (
<div
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow min-h-[520px] ${
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow min-h-[520px] relative ${
className || ""
}`}
} bg-cover bg-center`}
style={{
backgroundImage: !ActiveJobList?.data.length
? `url('${noTasksBg}')`
: "none",
}}
>
{!ActiveJobList?.data.length && (
<div class="absolute inset-0 bg-black opacity-30"></div>
)}
{ActiveJobList.loading ? (
<div className="w-full h-[500px] flex items-center justify-center">
<div className="w-full h-[520px] flex items-center justify-center">
<LoadingSpinner size="16" color="sky-blue" />
</div>
) : (
@@ -117,7 +112,7 @@ export default function MyJobTable({ className, ActiveJobList }) {
type="button"
onClick={() => {
navigate("/manage-active-job", {
state: {...task, pathname},
state: { ...task, pathname },
});
}}
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
@@ -127,23 +122,27 @@ export default function MyJobTable({ className, ActiveJobList }) {
</div>
</div>
))
)
:
(
ActiveJobList.status ?
<div className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
<div className="p-2">
No Tasks!
) : ActiveJobList.status ? (
<div className="flex flex-col items-center justify-center gap-9 my-5">
<div className="p-2 font-bold text-3xl text-white whitespace-nowrap">
You currently have "0" task
</div>
<button
className="w-[115px] h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
onClick={navigateMarket}
>
{btnLoader ? (
<div className="signup btn-loader"></div>
) : (
"Find Task"
)}
</button>
</div>
:
<div className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
<p className="p-2">
Error Occurred! Unable to display Tasks!
</p>
</div>
)
}
) : (
<div className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
<p className="p-2">Error Occurred! Unable to display Tasks!</p>
</div>
)}
</div>
{/* PAGINATION BUTTON */}
@@ -166,5 +165,3 @@ export default function MyJobTable({ className, ActiveJobList }) {
</div>
);
}
/* */
+1 -45
View File
@@ -20,9 +20,6 @@ function Wallet() {
}
const WalletRoutes = () => {
const apiCall = new usersService()
@@ -38,18 +35,6 @@ const WalletRoutes = () => {
error: false
})
let [purchaseHistory, setPurchaseHistory] = useState({ // FOR PURCHASE HISTORY
loading: true,
data: [],
error: false
})
let [couponHistory, setCouponHistory] = useState({ // FOR COUPON HISTORY
loading: true,
data: [],
error: false
})
//FUNCTION TO GET WALLET LIST
const getWalletList = ()=>{
apiCall.getUserWallets(null).then((res)=>{
@@ -76,38 +61,9 @@ const WalletRoutes = () => {
})
}
//FUNCTION TO GET PURCHASE HISTORY
const getPurchaseHistory = ()=>{
apiCall.getPurchaseHx().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setPurchaseHistory(prev => ({...prev, loading: false}))
return
}
// console.log('purchase',res.data)
setPurchaseHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setPurchaseHistory(prev => ({...prev, loading: false, error: true}))
})
}
//FUNCTION TO GET COUPON HISTORY
const getCouponHistory = ()=>{
apiCall.getCouponHx().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setCouponHistory(prev => ({...prev, loading: false}))
return
}
setCouponHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setCouponHistory(prev => ({...prev, loading: false, error: true}))
})
}
useEffect(()=>{
getWalletList()
getPaymentHistory()
getPurchaseHistory()
getCouponHistory()
}, [])
return (
<Routes>
@@ -115,7 +71,7 @@ const WalletRoutes = () => {
<Route path='add-fund' element={<AddFund payment={paymentHistory} />} />
<Route path='add-fund/confirm-add-fund' element={<ConfirmAddFund payment={paymentHistory} />} />
<Route path='transfer-fund' element={<TransferFund payment={paymentHistory} wallet={walletList} />} />
<Route index element={<Balance coupon={couponHistory} wallet={walletList} />} />
<Route index element={<Balance wallet={walletList} />} />
<Route path='transfer-fund/add-recipient' element={<AddRecipient />} />
<Route path='transfer-fund/confirm-transfer' element={<ConfirmTransfer payment={paymentHistory} wallet={walletList} />} />
<Route path='*' element={<Navigate to='/' />} />
+49 -43
View File
@@ -1,54 +1,60 @@
import React from 'react';
import { createRoutesFromChildren } from 'react-router-dom';
const PaginatedList = ({ onClick, prev, next, data, start, stop }) => {
if(data.length > process.env.REACT_APP_ITEM_PER_PAGE){
if (data.length > process.env.REACT_APP_ITEM_PER_PAGE) {
return (
<div className='p-3 flex justify-center items-center space-x-2 border-t-2'>
<div className="p-3 flex justify-center items-center min-h-[70px] space-x-2 border-t-2">
{/* Render pagination buttons */}
{!prev &&
<button
className={`p-2 ${prev ? 'border' : null}`}
name='prev'
onClick={onClick}
>
<>&lt;</>
</button>
}
{!prev && (
<button
className={`p-2 border ${
prev ? "border-black" : "border-transparent"
} btn-shine rounded-full h-11 w-11`}
name="prev"
onClick={onClick}
>
<>&lt;</>
</button>
)}
{
data.map((item, index)=>{
if(index%process.env.REACT_APP_ITEM_PER_PAGE == 0 && index >= start && index <= stop){
return (
<button
key={index}
value={index}
className={`p-2 ${index==start ? 'border' : null}`}
onClick={onClick}
name='page_num'
disabled={index == start}
>
{index <= 0 ? index+1 : (index/process.env.REACT_APP_ITEM_PER_PAGE)+1}
</button>
)
}
})
}
{!next &&
{data.map((item, index) => {
if (
index % process.env.REACT_APP_ITEM_PER_PAGE == 0 &&
index >= start &&
index <= stop
) {
return (
<button
className={`p-2 ${next ? 'border' : null}`}
name='next'
key={index}
value={index}
className={`p-2 border ${
index === start ? "border-black" : "border-transparent"
} btn-shine rounded-full h-11 w-11`}
onClick={onClick}
name="page_num"
disabled={index === start}
>
<>&gt;</>
{index <= 0
? index + 1
: index / process.env.REACT_APP_ITEM_PER_PAGE + 1}
</button>
}
</div>
)
}else{
return null
);
}
})}
{!next && (
<button
className={`p-2 border ${
next ? "border-black" : "border-transparent"
} btn-shine rounded-full h-11 w-11`}
name="next"
onClick={onClick}
>
<>&gt;</>
</button>
)}
</div>
);
} else {
return null;
}
};
+5 -3
View File
@@ -833,19 +833,21 @@ TODO: Responsive ===========================
/* Update table scrollbar */
.update-table::-webkit-scrollbar-track, .update-table > *::-webkit-scrollbar-track,
.market-pop::-webkit-scrollbar-track{
.market-pop::-webkit-scrollbar-track,
.wallet.coupon::-webkit-scrollbar-track{
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.1);
background-color: transparent;
border-radius: 10px;
}
.update-table::-webkit-scrollbar, .update-table > *::-webkit-scrollbar,
.market-pop::-webkit-scrollbar {
.market-pop::-webkit-scrollbar,
.wallet.coupon::-webkit-scrollbar {
width: 10px;
background-color: transparent;
}
.update-table::-webkit-scrollbar-thumb, .update-table > *::-webkit-scrollbar-thumb {
.update-table::-webkit-scrollbar-thumb, .update-table > *::-webkit-scrollbar-thumb, .wallet.coupon::-webkit-scrollbar-thumb {
border-radius: 10px;
border-top-right-radius: 50px;
border-bottom-right-radius: 50px;
+5 -7
View File
@@ -1,11 +1,9 @@
import React from "react";
//import WalletRoutes from "../components/MyWallet/Wallet";
import MyCoupons from "../components/MyCoupons/MyCoupons";
export default function MyCouponPage() {
return (
<>
<MyCoupons />
</>
);
return (
<>
<MyCoupons />
</>
);
}