Compare commits

..

34 Commits

Author SHA1 Message Date
victorAnumudu 976b4afbbf API call for worker task completed added 2023-06-13 15:28:12 +01:00
ameye 5f0364df10 Merge branch 'no-task-background' of WrenchBoard/Users-Wrench into master 2023-06-13 10:46:50 +00:00
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
victorAnumudu 97bfcd68b5 default height added to box tables 2023-06-12 14:00:45 +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
ameye c1805376ae Merge branch 'coupon-page-cleanup' of WrenchBoard/Users-Wrench into master 2023-06-12 11:12:17 +00:00
Ebube e60a2aaea2 fixed 2023-06-12 12:04:38 +01:00
Ebube 72118cefc4 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into coupon-page-cleanup 2023-06-12 11:52:39 +01:00
Ebube 30131e53c2 cleaned up better 2023-06-12 11:48:46 +01:00
ameye 79361f35f2 Merge branch 'coupon-page-cleanup' of WrenchBoard/Users-Wrench into master 2023-06-12 10:44:40 +00:00
Ebube 8749bf9f55 . 2023-06-12 11:41:25 +01:00
Ebube 4204b94231 corrected bg size and position 2023-06-12 10:55:20 +01:00
Ebube 7b1f27a641 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into coupon-page-cleanup 2023-06-12 10:41:00 +01:00
Ebube e4569ca81f . 2023-06-12 10:40:04 +01:00
ameye 58d0fc3dee Merge branch 'banner-link-alignment' of WrenchBoard/Users-Wrench into master 2023-06-12 07:05:44 +00:00
ameye 2f2777cc05 Merge branch 'interest-count' of WrenchBoard/Users-Wrench into master 2023-06-12 07:05:34 +00:00
ameye e534c81606 Merge branch 'view-all-message' of WrenchBoard/Users-Wrench into master 2023-06-12 07:05:27 +00:00
victorAnumudu e76b589e4d popout top amended 2023-06-12 04:25:27 +01:00
victorAnumudu c01cfa104c Interest count data update 2023-06-12 03:52:30 +01:00
victorAnumudu f5c3922a02 view all message popup added 2023-06-12 03:31:58 +01:00
29 changed files with 781 additions and 500 deletions
+1 -2
View File
@@ -43,5 +43,4 @@ REACT_APP_GOOGLE_REDIRECT_URL=https://users.wrenchboard.com/login/auth/
DISABLE_ESLINT_PLUGIN=true
REACT_APP_MAX_FILE_SIZE=1000000
REACT_APP_TOTAL_NUM_FILE=4
REACT_APP_TOTAL_NUM_FILE=4
Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

+40 -36
View File
@@ -1,42 +1,46 @@
import React from "react";
import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import localImgLoad from "../../lib/localImgLoad";
export default function HomeBannerOffersCard(props) {
console.log("HomeBannerOffersCard-> ##->",props)
const link_result = "/" + props.itemData.link_path;
var imgUrl = props.itemData.banner; // ? this.state.nextImgSrc : this.state.song.imgSrc;
console.log("IMAGE FOR BANNER->",imgUrl);
var divStyle = {
backgroundImage: 'url(' + imgUrl + ')'
}
var linkDivStyle = "item w-full block group banner-630-340 " + divStyle;
const [imageUrl, setImageUrl] = useState("");
const link_result = "/" + props.itemData.link_path;
useEffect(() => {
let { banner, banner_location } = props?.itemData;
if (banner_location === "LOCAL") {
const imagePath = require(`../../assets/images/${banner}`); // Replace with your directory path for local images
console.log("This is local");
setImageUrl(imagePath);
} else if (banner_location === "URL") setImageUrl(banner);
else return null;
}, []);
return (
<Link
to={link_result}
className={linkDivStyle}
>
<div className="flex flex-col justify-between h-full">
<div className="content flex justify-between items-center mb-5">
<div className="siderCardHeader">
<h1 className="text-2xl font-bold text-dark-gray dark:text-white tracking-wide">
<>{props.itemData.title}</>
</h1>
</div>
{/*<SelectBox datas={filterDatas} action={dataSetHandler} />*/}
</div>
<div className="h-[233px]">
<div className="siderCardDescription">
{props.itemData.description}
</div>
<div className="siderCardButton">
[ {props.itemData.button_text} ]
</div>
</div>
</div>
</Link>
);
return (
<Link
to={link_result}
className="item w-full block group banner-630-340 bg-cover bg-center"
style={{
backgroundImage: `url('${imageUrl}')`,
}}
>
<div className="flex flex-col justify-between h-full">
<div className="content flex justify-between items-center mb-5">
<div className="siderCardHeader">
<h1 className="text-2xl font-bold text-dark-gray dark:text-white tracking-wide">
<>{props.itemData.title}</>
</h1>
</div>
{/*<SelectBox datas={filterDatas} action={dataSetHandler} />*/}
</div>
<div className="h-[233px]">
<div className="siderCardDescription">
{props.itemData.description}
</div>
<div className="siderCardButton">
[ {props.itemData.button_text} ]
</div>
</div>
</div>
</Link>
);
}
+1 -1
View File
@@ -25,7 +25,7 @@ export default function FamilyTable({ className, familyList, loader, popUpHandle
return (
<div
className={`update-table w-full h-full p-8 bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow ${
className={`update-table w-full h-full p-8 bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow min-h-[520px] ${
className || ""
}`}
>
+30 -30
View File
@@ -10,37 +10,37 @@ import { useSelector } from "react-redux";
import HomeActivities from "./HomeActivities";
export default function FullAccountDash(props) {
console.log("PROPS IN HOME->", props);
console.log("PROPS IN HOME->",props);
const trending = datas.datas;
const jobData = datas.datas; // api calls or cache
const trending = datas.datas;
const jobData = datas.datas; // api calls or cache
const userApi = new usersService();
const userApi = new usersService();
const {userDetails} = useSelector((state) => state?.userDetails)
const { userDetails } = useSelector((state) => state?.userDetails);
return (
<div>
<div className="home-page-wrapper">
<Hero className="mb-10"
data={userDetails}
bannerList={props.bannerList}
nextDueTask={props.nextDueTask}
/>
<HomeActivities className="mb-10"/>
{/*<UpdateTable className="mb-10"/>*/}
{/*<SellHistoryMarketVisitorAnalytic className="mb-10"/>*/}
{/*<TopSellerTopBuyerSliderSection className="mb-10" />*/}
return (
<div>
<div className="home-page-wrapper">
<Hero
className="mb-10"
data={userDetails}
bannerList={props.bannerList}
nextDueTask={props.nextDueTask}
/>
<HomeActivities className="mb-10" />
{/*<UpdateTable className="mb-10"/>*/}
{/*<SellHistoryMarketVisitorAnalytic className="mb-10"/>*/}
{/*<TopSellerTopBuyerSliderSection className="mb-10" />*/}
{/*<HomeTaskDisplay*/}
{/* jobData={jobData}*/}
{/* className="mb-10"*/}
{/* bannerList={props.bannerList}*/}
{/*/>*/}
</div>
</div>
);
{/*<HomeTaskDisplay*/}
{/* jobData={jobData}*/}
{/* className="mb-10"*/}
{/* bannerList={props.bannerList}*/}
{/*/>*/}
</div>
</div>
);
}
// /*
// <Layout>
@@ -53,10 +53,10 @@ export default function FullAccountDash(props) {
// className="mb-10"
// bannerList={props.bannerList}
// />
{/* <SellHistoryMarketVisitorAnalytic className="mb-10"/>
{
/* <SellHistoryMarketVisitorAnalytic className="mb-10"/>
<TopSellerTopBuyerSliderSection className="mb-10" />
<UpdateTable className="mb-10"/>*/}
<UpdateTable className="mb-10"/>*/
}
// </div>
// </Layout>
+35 -53
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";
@@ -19,23 +15,12 @@ export default function Hero({ className, bannerList, nextDueTask }) {
infinite: true,
swipe: true,
};
const sildeData =null;
const [addFavorite, setValue] = useState(false);
const sildeData = null;
const { userDetails } = useSelector((state) => state?.userDetails);
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
let userEmail = email.split('@')[0]
let loginDate = userDetails?.last_login.split(" ")[0];
let { firstname, lastname, email, profile_pic } = userDetails;
let userEmail = email.split("@")[0];
return (
<div
@@ -55,13 +40,13 @@ export default function Hero({ className, bannerList, nextDueTask }) {
Welcome
</h1>
<span className="text-[18px] font-thin tracking-wide text-white">
Last Login : {loginDate}
Last Login : {loginDate}
</span>
</div>
{/* user */}
<div className="flex items-center space-x-3">
<div className="w-14 h-14 flex justify-center items-center rounded-full overflow-hidden">
<img src={profile_pic != '' ? profile_pic : heroUser} alt="" />
<img src={profile_pic != "" ? profile_pic : heroUser} alt="" />
</div>
<div>
<p className="text-xl tracking-wide font-bold antise text-white">
@@ -71,38 +56,35 @@ export default function Hero({ className, bannerList, nextDueTask }) {
</div>
</div>
{/* countdown */}
{ nextDueTask?.next_due && Object.keys(nextDueTask.next_due)?.length &&
(
<div className="w-full h-32 flex justify-evenly items-center sm:p-6 p-1 rounded-2xl border border-white-opacity">
<div className="flex flex-col justify-between">
<p className="text-base text-white tracking-wide">Current Task</p>
<p className="lg:text-2xl text-lg font-bold tracking-wide text-white">
{nextDueTask.next_due.item_code}
</p>
<p className="text-base text-white tracking-wide">{nextDueTask.next_due.price} Naira</p>
</div>
<div className="w-[1px] h-full bg-white-opacity"></div>
<div className="flex flex-col justify-between">
<p className="text-base text-white tracking-wide">Next due in</p>
<p className="lg:text-2xl text-lg font-bold tracking-wide text-white">
{/* <CountDown lastDate="2023-04-26 4:00:00" /> */}
<CountDown lastDate={nextDueTask.next_due.due_date} />
</p>
<div className="text-base text-white tracking-wide flex gap-[23px]">
<span>Hrs</span>
<span>Min</span>
<span>Sec</span>
</div>
{nextDueTask?.next_due && Object.keys(nextDueTask.next_due)?.length && (
<div className="w-full h-32 flex justify-evenly items-center sm:p-6 p-1 rounded-2xl border border-white-opacity">
<div className="flex flex-col justify-between">
<p className="text-base text-white tracking-wide">Current Task</p>
<p className="lg:text-2xl text-lg font-bold tracking-wide text-white">
{nextDueTask.next_due.item_code}
</p>
<p className="text-base text-white tracking-wide">
{nextDueTask.next_due.price} Naira
</p>
</div>
<div className="w-[1px] h-full bg-white-opacity"></div>
<div className="flex flex-col justify-between">
<p className="text-base text-white tracking-wide">Next due in</p>
<p className="lg:text-2xl text-lg font-bold tracking-wide text-white">
{/* <CountDown lastDate="2023-04-26 4:00:00" /> */}
<CountDown lastDate={nextDueTask.next_due.due_date} />
</p>
<div className="text-base text-white tracking-wide flex gap-[23px]">
<span>Hrs</span>
<span>Min</span>
<span>Sec</span>
</div>
</div>
)
}
</div>
)}
{/* action */}
<div className="flex lg:space-x-3 space-x-1 items-center">
<Link
to="/mytask"
className="text-white text-base sm:block hidden"
>
<Link to="/mytask" className="text-white text-base sm:block hidden">
<span className=" border-b dark:border-[#5356fb29] border-white">
{" "}
View All Task(s)
@@ -111,9 +93,9 @@ export default function Hero({ className, bannerList, nextDueTask }) {
</div>
</div>
<HomeSliders
settings={settings}
sideData={sildeData}
bannerList={bannerList}
settings={settings}
sideData={sildeData}
bannerList={bannerList}
/>
</div>
);
+25 -30
View File
@@ -1,37 +1,32 @@
import SliderCom from "../Helpers/SliderCom";
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 HomeBannerOffersCard from "../Cards/HomeBannerOffersCard";
export default function HomeSliders(props) {
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}>
{/*<div className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">*/}
{/* <img src={slider1} alt="slider" className="w-full h-full" />*/}
{/*</div>*/}
<div className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">
<img src={slider2} alt="slider" className="w-full h-full" />
</div>
{/*<div className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">*/}
{/* <img src={slider3} alt="slider" className="w-full h-full" />*/}
{/*</div>*/}
{props.bannerList?.length && props.bannerList.map((item, index) => (
<div key={index} className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">
<HomeBannerOffersCard
itemData={item}
/>
</div>
))}
</SliderCom>
// 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 <= 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"
>
<HomeBannerOffersCard itemData={item} />
</div>
</div>
</>
);
))}
</SliderCom>
</div>
</div>
</>
);
}
+41 -38
View File
@@ -6,48 +6,51 @@ import { useSelector } from "react-redux";
import FamilyDash from "./FamilyDash";
import FullAccountDash from "./FullAccountDash";
export default function Home(props) {
console.log("PROPS IN HOME->", props);
console.log("PROPS IN HOME->",props);
let [nextDueTask, setNextDueTask] = useState({});
let [nextDueTask, setNextDueTask] = useState({})
const userApi = new usersService();
const userApi = new usersService();
const { userDetails } = useSelector((state) => state?.userDetails);
const {userDetails} = useSelector((state) => state?.userDetails)
const { commonHeadBanner } = useSelector((state) => state.commonHeadBanner);
const {commonHeadBanner} = useSelector(state => state.commonHeadBanner)
// FUNCTION TO GET DASH DATA TO DETERMINE CURRENT TASK DUE TIME
const getHomeDate = () => {
userApi
.getHomeDate()
.then((res) => {
if (res.status != 200 || res.internal_return < 0) {
return;
}
setNextDueTask(res.data);
})
.catch((error) => {
console.log(error);
});
};
// FUNCTION TO GET DASH DATA TO DETERMINE CURRENT TASK DUE TIME
const getHomeDate = () => {
userApi.getHomeDate().then(res => {
if(res.status != 200 || res.internal_return < 0){
return
}
setNextDueTask(res.data)
}).catch(error => {
console.log(error)
})
}
useEffect(() => {
getHomeDate();
}, []);
useEffect(()=>{
getHomeDate()
},[])
return (
<Layout>
<div className="home-page-wrapper">
{userDetails && userDetails?.account_type == "FAMILY" && (
<FamilyDash commonHeadData={props.bannerList} />
)}
{userDetails && userDetails?.account_type == "FULL" && (
<FullAccountDash nextDueTask={nextDueTask} bannerList={props.bannerList} />
)}
</div>
</Layout>
);
return (
<Layout>
<div className="home-page-wrapper">
{userDetails && userDetails?.account_type == "FAMILY" && (
<FamilyDash commonHeadData={props.bannerList} />
)}
{userDetails && userDetails?.account_type == "FULL" && (
<FullAccountDash
nextDueTask={nextDueTask}
bannerList={props.bannerList}
/>
)}
</div>
</Layout>
);
}
// /*
// <Layout>
@@ -60,10 +63,10 @@ export default function Home(props) {
// className="mb-10"
// bannerList={props.bannerList}
// />
{/* <SellHistoryMarketVisitorAnalytic className="mb-10"/>
{
/* <SellHistoryMarketVisitorAnalytic className="mb-10"/>
<TopSellerTopBuyerSliderSection className="mb-10" />
<UpdateTable className="mb-10"/>*/}
<UpdateTable className="mb-10"/>*/
}
// </div>
// </Layout>
@@ -245,7 +245,7 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
<div className="">
<p className="flex items-center tracking-wide">
Interest: <b className="ml-1">{marketInt?.public_view}</b>
Interest: <b className="ml-1">{details.interest_count}</b>
</p>
<hr />
<p className="my-1">Expire: {expireIntDate}</p>
+128 -2
View File
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import React, { useEffect, useState, useRef, forwardRef } from "react";
import { useSelector } from "react-redux";
import Layout from "../Partials/Layout";
import { useNavigate } from "react-router-dom";
@@ -6,6 +6,8 @@ import ActiveJobMessage from "./ActiveJobMessage";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import CountDown from "../Helpers/CountDown";
import IndexJobActions from "./JobActions/IndexJobActions";
import ModalCom from "../Helpers/ModalCom";
import { useReactToPrint } from "react-to-print";
import usersService from "../../services/UsersService";
@@ -25,6 +27,18 @@ function ActiveJobs(props) {
let [requestStatus, setRequestStatus] = useState({loading: false, status: false, message: ''})
let [popUp, setPopUp] = useState(false) // STATE FOR POPOUT MODAL
const printRef = useRef();
// to handle printing
const handlePrint = useReactToPrint({
content: () => printRef.current,
});
const popUpHandler = () => { // FUNCTION TO HANDLE POPOUT
setPopUp(prev => !prev)
}
// FUNCTION TO HANDLE MESSAGE CHANGE
const handleMessageChange = ({target:{value}}) => {
setMessageToSend(value)
@@ -395,7 +409,12 @@ function ActiveJobs(props) {
{/* MESSAGE SECTION */}
<div className="w-full lg:w-1/2">
<p className="text-lg font-bold text-dark-gray dark:text-black tracking-wide">Message</p>
<div className="flex justify-between items-center gap-5">
<p className="text-lg font-bold text-dark-gray dark:text-black tracking-wide">Message</p>
<button type="button" onClick={popUpHandler} className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
view all
</button>
</div>
{props.activeJobMesList.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
@@ -405,6 +424,12 @@ function ActiveJobs(props) {
{/* END OF MESSAGE */}
</div>
{/* POPOUT SECTION */}
{popUp &&
<PopModal popUpHandler={popUpHandler} popUp={popUp} details={props.details} activeJobMesList={props.activeJobMesList} handlePrint={handlePrint} myRef={printRef} />
}
{/* END OF POPOUT SECTION */}
</Layout>
);
}
@@ -429,3 +454,104 @@ function convertFileToBase64(file) {
});
}
//POPOUT COMPONENT FUNCTION
const PopModal = ({popUpHandler, popUp, details, activeJobMesList, handlePrint, myRef}) => {
return (
<ModalCom action={popUpHandler} situation={popUp} className="edit-popup">
<div ref={myRef} className="message-modal-wrapper min-w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="message-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">
{details?.contract}
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
onClick={popUpHandler}
>
<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>
</button>
</div>
<div className="job-action-modal-body w-full px-10 py-8 gap-4">
<div className="w-full flex flex-col items-center">
{activeJobMesList.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
<div className="message-table h-[500px] overflow-y-auto">
<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"></th>
</tr>
</thead>
{activeJobMesList?.data?.length ?
(
<tbody>
{activeJobMesList?.data?.map((item, index) => (
<tr key={index} className='text-slate-500'>
<td>
<div className="msg_box">
<div className="msg_header">{item.msg_date} {item.msg_firstname}</div>
<span className="p-2" dangerouslySetInnerHTML={{__html: item.message}}></span>
</div>
</td>
</tr>
))}
</tbody>
)
:
activeJobMesList.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 Message Found!</td>
</tr>
</tbody>
}
</table>
</div>
}
</div>
{/* btn */}
<div className='flex justify-end items-center'>
<div className="py-3 w-full lg:w-1/2 flex justify-between items-center">
<button onClick={handlePrint} type="button" className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
<span className='text-white'>Print</span>
</button>
<button onClick={popUpHandler} type="button" className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white">
<span className='text-gradient'>Cancel</span>
</button>
</div>
</div>
</div>
</div>
</ModalCom>
)
}
@@ -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>
@@ -1,10 +1,16 @@
import React, { useState, useRef } from 'react'
import React, { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import ModalCom from '../../Helpers/ModalCom'
import LoadingSpinner from '../../Spinners/LoadingSpinner'
import usersService from '../../../services/UsersService'
function CurrentTaskAction({jobDetails}) {
const apiCall = new usersService()
const navigate = useNavigate()
const [checked, setChecked] = useState(false)
const [reqStatus, setReqStatus] = useState({loading:false, status: false, message: ''})
@@ -20,16 +26,37 @@ function CurrentTaskAction({jobDetails}) {
// FUNCTION TO HANDLE WHEN USER CLICKS ON SEND FOR REVIEW AND ACCEPTANCE
const taskCompletedSubmit = () => {
setReqStatus({loading:true, status: false, message: ''})
if(!checked){
setReqStatus({loading:true, status: false, message: ''}) // Sets loading spinner active
let reqData = {
contract: jobDetails.contract,
contract_uid: jobDetails.contract_uid,
job_action: 'NOTIFY_COMPLETE',
}
if(!checked){ // checks that checkbox is selected
setReqStatus({loading:false, status: false, message: 'Please check the box above'})
return setTimeout(()=>{
setReqStatus({loading:false, status: false, message: ''})
}, 3000)
}
setTimeout(()=>{
setReqStatus({loading:false, status: false, message: ''})
}, 3000)
// API CALL TO MARK TASK AS COMPLETED BY WORKER
apiCall.taskCompleted(reqData).then((res)=>{
if(res.status != 200 || res.data.internal_return < 0){
setReqStatus({loading:false, status: false, message: 'unable to complete request. Try again'})
return
}
setReqStatus({loading:false, status: true, message: 'Task marked completed successfully'})
setTimeout(()=>{ // Sets popout to false and navigates user to /mytask after 3 seconds
popUpHandler()
navigate('/mytask', {replace: true})
}, 3000)
}).catch(err => {
setReqStatus({loading:false, status: false, message: 'Opps! Network error. Try again'})
}).finally(()=>{
setTimeout(()=>{
setReqStatus({loading:false, status: false, message: ''})
}, 3000)
})
}
return (
@@ -37,9 +64,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>
@@ -28,7 +28,7 @@ export default function MyActiveJobTable({ MyJobList, className }) {
return (
<div
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow ${
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow min-h-[520px] ${
className || ""
}`}
>
@@ -45,7 +45,7 @@ export default function MyActiveJobTable({ MyJobList, className }) {
<>
{MyJobList &&
MyJobList?.result_list &&
MyJobList.result_list.length > 0 &&
MyJobList.result_list.length > 0 ?
currentActiveJobList.map((value, index) => (
<tr
key={index}
@@ -112,7 +112,14 @@ export default function MyActiveJobTable({ MyJobList, className }) {
</div>
</td>
</tr>
))}
))
:
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
<td className="p-2">
No Active Task!
</td>
</tr>
}
</>
}
</tbody>
+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>
</>
);
}
+10 -3
View File
@@ -70,7 +70,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
return (
<div
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow ${
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow min-h-[520px] ${
className || ""
}`}
>
@@ -102,7 +102,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
<>
{MyJobList &&
MyJobList?.data?.result_list &&
MyJobList.data?.result_list.length > 0 &&
MyJobList.data?.result_list.length > 0 ?
currentJobList.map((value, index) => (
<tr
key={index}
@@ -181,7 +181,14 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
</button>
</td>
</tr>
))}
))
:
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
<td className="p-2">
No Jobs Avaliable!
</td>
</tr>
}
</>
) : selectedCategory === "Explore" ? (
<></>
@@ -25,7 +25,7 @@ export default function MyPendingJobTable({ MyJobList, className }) {
return (
<div
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow ${
className={`update-table w-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow min-h-[520px] ${
className || ""
}`}
>
@@ -42,7 +42,7 @@ export default function MyPendingJobTable({ MyJobList, className }) {
<>
{MyJobList &&
MyJobList?.result_list &&
MyJobList.result_list.length > 0 &&
MyJobList.result_list.length > 0 ?
currentActiveJobList.map((value, index) => (
<tr
key={index}
@@ -105,7 +105,14 @@ export default function MyPendingJobTable({ MyJobList, className }) {
</button>
</td>
</tr>
))}
))
:
<tr className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
<td className="p-2">
No Pending Task!
</td>
</tr>
}
</>
}
</tbody>
+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 -1
View File
@@ -22,7 +22,7 @@ function Balance({wallet, coupon}) {
<div className='w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin'>
{/* WALLET 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 bg-white dark:bg-dark-white rounded-2xl shadow">
<div className="wallet w-full md:p-8 p-4 h-full bg-white dark:bg-dark-white rounded-2xl shadow min-h-[520px]">
<div className='flex items-baseline justify-between'>
{/*<h2 className='text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>Wallet</h2>*/}
{/*<p className='text-base text-slate-500 dark:text-white'>Add New Wallet</p>*/}
+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;
}
};
+19 -3
View File
@@ -621,6 +621,20 @@ input[type="text"][dir="rtl"] {
.modal-com {
transition: all 0.1s ease-in-out;
}
@media print {
body .modal-com{
height: 100%;
overflow: hidden;
}
.job-action-modal-body button, .message-modal-header button {
display: none;
}
.message-modal-wrapper .message-table{
height: 100%;
overflow-y: hidden;
}
}
/* TODO: =================================modal end================================= */
/* TODO: =================================login ================================= */
.btn-login {
@@ -819,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;
+2 -4
View File
@@ -1,4 +1,2 @@
export default function localImgLoad(location) {
const img = require(`../assets/${location}`);
return img;
}
const localImgLoad = (location) => require(`../assets/${location}`);
export default localImgLoad
+12
View File
@@ -653,6 +653,18 @@ class usersService {
return this.postAuxEnd("/offersresponse", postData);
}
// END POINT FOR WORKER TO MARK TASK AS COMPLETED
taskCompleted(reqData) {
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
action: 14015,
...reqData,
};
return this.postAuxEnd("/activetaskstatus", postData);
}
/*
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
+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 />
</>
);
}