Compare commits
279 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d081dd73d6 | |||
| 9b9e10efbb | |||
| 07040832d7 | |||
| f928f45615 | |||
| 1b0f6c0b89 | |||
| 8315e226dd | |||
| 13da84099c | |||
| 3b6f2a4ca0 | |||
| bdc67590d1 | |||
| 89d2682eaf | |||
| 41a617a265 | |||
| c72765b38c | |||
| fe3306cb98 | |||
| 13b96a3b8d | |||
| f4c0c5bf15 | |||
| bc2a4340f2 | |||
| a4b85e9c85 | |||
| 6dab5412c7 | |||
| 1bd6064b52 | |||
| 4949bd28aa | |||
| f1ef5e163d | |||
| 2f6f0bf501 | |||
| ddf361b496 | |||
| 9f8b61175e | |||
| 0e850b2222 | |||
| ad1c27a9ef | |||
| 1f97780398 | |||
| 5a97e9a185 | |||
| 7eb26ce88a | |||
| 3876e1440d | |||
| df1a006f13 | |||
| 77ab969f61 | |||
| 6da9b9158d | |||
| 5088561e13 | |||
| 6dd870bb05 | |||
| e5c511bd8f | |||
| ead1be773f | |||
| 2d6c189f57 | |||
| 841dfee7e6 | |||
| 8ac8808348 | |||
| f57f443b1e | |||
| 0f770474af | |||
| 8668c39c6f | |||
| 840abb4dcc | |||
| 9da4ed2282 | |||
| 713c333e96 | |||
| 3b27db4ffe | |||
| 8db2316a30 | |||
| a1072c58c0 | |||
| 5b9c564f96 | |||
| c14d8b0659 | |||
| 43f59e8e84 | |||
| ca53101b55 | |||
| f3b8190418 | |||
| 6a37da92f0 | |||
| 3d382695cd | |||
| 9b0ff4a1e6 | |||
| 7231d97492 | |||
| f880afabb0 | |||
| e9d9dd2395 | |||
| a9c273aa17 | |||
| dddd314412 | |||
| 43f0039d29 | |||
| c9a475b525 | |||
| 74b2a554f1 | |||
| d2a406563a | |||
| d509fb024c | |||
| 4acae3401d | |||
| 05a1dc3663 | |||
| 63eb8b9729 | |||
| a474d42d85 | |||
| dcb820590d | |||
| 614c376c92 | |||
| b589277678 | |||
| 00a70f3574 | |||
| 7859cffd49 | |||
| 3a574d1fd0 | |||
| 7c6a2316a8 | |||
| ef99a8f1f7 | |||
| ba0aac126c | |||
| 05453661ee | |||
| aee1b9e3bb | |||
| 9a0dc0d01a | |||
| a467626fae | |||
| 47932d7301 | |||
| de4de35611 | |||
| b3c2785a4b | |||
| 2719b8426d | |||
| fed2358a45 | |||
| ff129480a5 | |||
| 8cf0c8da89 | |||
| 6aaf682d38 | |||
| 9f77a01bb2 | |||
| 9d79e1c709 | |||
| 78ac5d5b24 | |||
| 75657350a3 | |||
| 171f99d997 | |||
| 25c7cd75c7 | |||
| fd68800b00 | |||
| 33f1515d2c | |||
| 2cc30d6c47 | |||
| cfadb42811 | |||
| 1bb2eb3203 | |||
| cd68861dfa | |||
| 9fb0a65e46 | |||
| 15fce205a6 | |||
| dddf6af401 | |||
| 1a86361fbb | |||
| 4f69786f19 | |||
| 5634c1542b | |||
| f9e3d2aad2 | |||
| 921d1af7f0 | |||
| c98d2e41ef | |||
| ea260fa15a | |||
| b604e0b527 | |||
| 991571b2d2 | |||
| 1f98a3eacb | |||
| 031a2f6680 | |||
| bf22570857 | |||
| 89aa5e0aef | |||
| 680833d5be | |||
| 1e0af67542 | |||
| 406af95861 | |||
| 14f69d4c3b | |||
| 24f915ee55 | |||
| 5da67c4c06 | |||
| a21eaa40f2 | |||
| a00e40dbe9 | |||
| fa51914987 | |||
| c8d40c1630 | |||
| f673fe99ef | |||
| 8d5d0672cc | |||
| 09def50875 | |||
| d6920b320c | |||
| cbfaf1e073 | |||
| 3d59b36850 | |||
| f1d659b273 | |||
| ad49489377 | |||
| 386fc8cb0c | |||
| 0045a791fe | |||
| b48cb48213 | |||
| 856c70628a | |||
| fa40f8f725 | |||
| 8c475a56bb | |||
| 7ca8c23479 | |||
| 688592e1a3 | |||
| d12b949bcc | |||
| 3a219a20bb | |||
| e6bc184747 | |||
| 2a3edcf3be | |||
| a1d96488bf | |||
| 3f17920bd0 | |||
| 4014a84e1a | |||
| 60ed9e7bcf | |||
| 479ea408f6 | |||
| 9ca4ba3199 | |||
| e5fa6544a5 | |||
| f55b7186b9 | |||
| 05515333ba | |||
| 7212ab6cfc | |||
| 020154d51a | |||
| e4aadfb627 | |||
| 6a79c3e56f | |||
| 81707c7bd8 | |||
| e5b36e3f45 | |||
| 6f2fc17090 | |||
| e6392bc433 | |||
| f8e14fe6a0 | |||
| 91a42cfe9d | |||
| 3128a77b46 | |||
| d7d67e4763 | |||
| 388e49467e | |||
| 043718837d | |||
| d0e2ba0aa3 | |||
| a1dc72e5b0 | |||
| 2ab1c960c7 | |||
| 25734882cb | |||
| ae31962cd7 | |||
| 96d775d0ba | |||
| bcd45edb2f | |||
| a5631b6291 | |||
| 2fff427346 | |||
| 6ef445958c | |||
| 66660d98f9 | |||
| 359344772e | |||
| 1533465f8d | |||
| 66b1ff5f92 | |||
| c141ab1ef2 | |||
| 8a7b56068d | |||
| bb5a966249 | |||
| 199dec01fe | |||
| 3775c520ff | |||
| bf19dfe86a | |||
| 4b7c3beb53 | |||
| f032ed21b5 | |||
| cab461bd2e | |||
| a4307310ad | |||
| dda3207573 | |||
| 0dd7e5cd19 | |||
| caaff883f1 | |||
| f4ea8d9197 | |||
| df136b3b30 | |||
| c04b909489 | |||
| 4c208e8a58 | |||
| d5017db2ba | |||
| 78ebed6e55 | |||
| f0c016deb8 | |||
| 4a0cfa03a5 | |||
| 36d8c70fd9 | |||
| 23443a4677 | |||
| 16e5656422 | |||
| 0e42668285 | |||
| 66bd8cf6ec | |||
| 3d7ad25517 | |||
| 2d5c828089 | |||
| e39a8358f7 | |||
| e9c57550a2 | |||
| 27f87ee92d | |||
| edf23352ef | |||
| 002e2fead4 | |||
| 160c302417 | |||
| 44ae966cc1 | |||
| f3b977c624 | |||
| 0c99e416ea | |||
| fd531d7d10 | |||
| ac027a3228 | |||
| 001492eeb5 | |||
| 72fe2cad5f | |||
| eac693eba6 | |||
| d3b1462fe3 | |||
| 748546641d | |||
| 48a50fd47c | |||
| e87cb95b43 | |||
| 7638d68a7d | |||
| 3541363f9f | |||
| 30ce6a7d6e | |||
| 115366672a | |||
| 3cd8b6e574 | |||
| 9850cdd392 | |||
| 6d98141c39 | |||
| 5fe5ccbd4d | |||
| 76c0994eb0 | |||
| a1bc6db381 | |||
| 6f5d72e033 | |||
| 762de4c23e | |||
| 2a8b7ba6ec | |||
| 50e44dab43 | |||
| 7649a90c47 | |||
| 3c2c46e293 | |||
| 8dc634d900 | |||
| 3a9cb4667e | |||
| 5f4b032f68 | |||
| 8ab3e9ae50 | |||
| 01b5fba75b | |||
| 66b8c96592 | |||
| 616352e1ac | |||
| acc4417835 | |||
| 7da693f298 | |||
| b0423c665c | |||
| 7089b8f14b | |||
| 2c2e2b0ca5 | |||
| ba3dd91d81 | |||
| 3f04c9f9f8 | |||
| 781f5cc5a6 | |||
| 58097d8b57 | |||
| 630ccefa51 | |||
| ed9f2dec0e | |||
| d2ed29c6a6 | |||
| 4e81156d72 | |||
| e402c02c1f | |||
| 5907b5d872 | |||
| 042cc4110c | |||
| 944fd134f6 | |||
| 5e6b208513 | |||
| 762601a5c3 | |||
| 1e28a0e15b | |||
| a910ab177f | |||
| 4e741f587c | |||
| f779529cc6 |
@@ -14,6 +14,7 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
|
||||
|
||||
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
||||
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
||||
REACT_APP_ENDPOINT_KEY="WRENCH-BOARD-2024"
|
||||
|
||||
#SOCKETS ENDS
|
||||
REACT_APP_PRIMARY_SOCKET="https://socket-dev.wrenchboard.com"
|
||||
@@ -71,7 +72,8 @@ REACT_APP_APPLE_SOCIAL_LOGIN=0
|
||||
REACT_APP_LINKEDIN_SOCIAL_LOGIN=0
|
||||
|
||||
#File Handling
|
||||
REACT_APP_MAX_FILE_SIZE=1000000
|
||||
REACT_APP_MAX_FILE_SIZE=1048576
|
||||
REACT_APP_MAX_VIDEO_FILE_SIZE=31457280
|
||||
REACT_APP_TOTAL_NUM_FILE=4
|
||||
|
||||
#Auth Text(s)
|
||||
@@ -114,4 +116,16 @@ REACT_APP_SHOW_NEW_FAMILY_DASH=1
|
||||
REACT_APP_SHOW_ACCOUNT_DASH=1
|
||||
|
||||
# Displays the slider banners
|
||||
REACT_APP_SHOW_SLIDER_BANNERS=0
|
||||
REACT_APP_SHOW_SLIDER_BANNERS=0
|
||||
|
||||
# FOR MEDIA LINK
|
||||
REACT_APP_MEDIA_LINK='https://dev-media.wrenchboard.com'
|
||||
|
||||
# FOR FAMILY GAME LINK
|
||||
REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
||||
|
||||
# REACT APP CUSTOMTIMER
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
|
||||
#SHOW OR HIDE MY PAGE LINK ROUTE
|
||||
REACT_APP_SHOW_USER_PAGE=1
|
||||
+17
-2
@@ -14,6 +14,7 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
|
||||
|
||||
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
||||
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
|
||||
REACT_APP_ENDPOINT_KEY="WRENCH-BOARD-2024"
|
||||
|
||||
#SOCKETS ENDS
|
||||
REACT_APP_PRIMARY_SOCKET="https://socket-dev.wrenchboard.com"
|
||||
@@ -42,7 +43,9 @@ REACT_APP_GOOGLE_CLIENT_SECRET=aozK_2G8UjaCmLgPPkv9abIm
|
||||
REACT_APP_GOOGLE_CLIENT_SCOPE="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
|
||||
REACT_APP_GOOGLE_REDIRECT_URL=http://localhost:9082/login/auth/
|
||||
|
||||
REACT_APP_MAX_FILE_SIZE=1000000
|
||||
#File Handling
|
||||
REACT_APP_MAX_FILE_SIZE=1048576
|
||||
REACT_APP_MAX_VIDEO_FILE_SIZE=31457280
|
||||
REACT_APP_TOTAL_NUM_FILE=4
|
||||
|
||||
REACT_APP_LOGOUT_TEXT="Sign Out"
|
||||
@@ -82,4 +85,16 @@ REACT_APP_SHOW_NEW_FAMILY_DASH=1
|
||||
REACT_APP_SHOW_ACCOUNT_DASH=1
|
||||
|
||||
# Displays the slider banners
|
||||
REACT_APP_SHOW_SLIDER_BANNERS=0
|
||||
REACT_APP_SHOW_SLIDER_BANNERS=0
|
||||
|
||||
# FOR MEDIA LINK
|
||||
REACT_APP_MEDIA_LINK='https://dev-media.wrenchboard.com'
|
||||
|
||||
# FOR FAMILY GAME LINK
|
||||
REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
||||
|
||||
# REACT APP CUSTOMTIMER
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
|
||||
#SHOW OR HIDE MY PAGE LINK ROUTE
|
||||
REACT_APP_SHOW_USER_PAGE=1
|
||||
+17
-2
@@ -14,6 +14,7 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
|
||||
|
||||
REACT_APP_AUX_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/en/wrench/api/v1"
|
||||
REACT_APP_USERS_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/en/wrench/api/v1"
|
||||
REACT_APP_ENDPOINT_KEY="WRENCH-BOARD-2024"
|
||||
|
||||
#SOCKETS ENDS
|
||||
REACT_APP_PRIMARY_SOCKET="https://socket.wrenchboard.com"
|
||||
@@ -49,7 +50,9 @@ REACT_APP_FACEBOOK_REDIRECT_URL="https://users.wrenchboard.com/login/auth/flogin
|
||||
|
||||
DISABLE_ESLINT_PLUGIN=true
|
||||
|
||||
REACT_APP_MAX_FILE_SIZE=1000000
|
||||
#File Handling
|
||||
REACT_APP_MAX_FILE_SIZE=1048576
|
||||
REACT_APP_MAX_VIDEO_FILE_SIZE=31457280
|
||||
REACT_APP_TOTAL_NUM_FILE=4
|
||||
|
||||
REACT_APP_LOGOUT_TEXT="Sign Out"
|
||||
@@ -88,4 +91,16 @@ REACT_APP_SHOW_NEW_FAMILY_DASH=1
|
||||
REACT_APP_SHOW_ACCOUNT_DASH=1
|
||||
|
||||
# Displays the slider banners
|
||||
REACT_APP_SHOW_SLIDER_BANNERS=0
|
||||
REACT_APP_SHOW_SLIDER_BANNERS=0
|
||||
|
||||
# FOR MEDIA LINK
|
||||
REACT_APP_MEDIA_LINK='https://media.wrenchboard.com'
|
||||
|
||||
# FOR FAMILY GAME LINK
|
||||
REACT_APP_FAM_GAME_LINK='https://games.wrenchboard.com'
|
||||
|
||||
# REACT APP CUSTOMTIMER
|
||||
REACT_APP_CUSTOMTIMER=90
|
||||
|
||||
#SHOW OR HIDE MY PAGE LINK ROUTE
|
||||
REACT_APP_SHOW_USER_PAGE=0
|
||||
Vendored
+10
-1
@@ -21,5 +21,14 @@
|
||||
"emmet.triggerExpansionOnTab": true,
|
||||
"emmet.includeLanguages": {
|
||||
"javascript": "javascriptreact"
|
||||
}
|
||||
},
|
||||
"cSpell.words": [
|
||||
"completesignuplink",
|
||||
"MOBILEUSER",
|
||||
"MYFILES",
|
||||
"mynotifications",
|
||||
"PASSWORDRESET",
|
||||
"TRANSFERSTART",
|
||||
"WRENCHBOARD"
|
||||
]
|
||||
}
|
||||
|
||||
+12
-3
@@ -6,9 +6,18 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
|
||||
|
||||
<meta name="description" content="wrenchboard.com is an online marketplace to make money from your skills, find, buy and sell professional services. Connect with freelancers to get work done faster. Trade your freelance services."/>
|
||||
<meta name="title" content="WrenchBoard: Find a Freelancer | Sell Professional Services"/><meta name="keywords" content="Online Jobs, Online Workers, work online Nigeria, hire a freelancer, hire freelancers, freelance marketplace, freelancer hire, freelance service, freelance professional services, How to make money online, find workers online, Online Services, digital services, freelancers community in Ghana, freelancers community in Nigeria, freelancer site in Africa, Best freelance website in Africa, Freelance Designers, Photographers, Writers in Nigeria, freelancers, freelance outsourcing in Nigeria, freelance IT services in Nigeria, hire freelancers online in Nigeria, freelance services online in Nigeria, freelance contractor in Nigeria, freelance sites in Nigeria, freelance jobs in Nigeria, freelance projects in Nigeria, freelance jobs online in Nigeria, professional freelancers in Nigeria, buy professional services in Nigeria, professional services jobs, professional business services, professional service providers in Nigeria, freelancing services, freelancing sites in Nigeria, freelancers for hire in Nigeria, freelancer search in Nigeria, search freelancer in Nigeria, find freelancers in Nigeria, Find workers US. Outsource from US to Nigeria, find a freelancer in Nigeria, freelancing projects in Nigeria, web freelancing in Nigeria, outsourcing sites freelancers in Nigeria, website for freelancers in Nigeria, marketplace for freelancers "/>
|
||||
<meta
|
||||
name="description"
|
||||
content="WrenchBoard.com is the place to set family goals and reward achievements. Find tasks to earn from, or send tasks for others to perform for you."
|
||||
/>
|
||||
<meta
|
||||
name="title"
|
||||
content="WrenchBoard: Reward Accomplishments | Get Family Engaged"
|
||||
/>
|
||||
<meta
|
||||
name="keywords"
|
||||
content="Empower families to reward accomplishment, set goals, and encourage kids to understand goals, earning, and the benefit of savings – in one app experience."
|
||||
/>
|
||||
<link rel="manifest" href="/manifest.json"/>
|
||||
<script>
|
||||
!function(e,a,t,n,g,c,o){e.GoogleAnalyticsObject=g,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,c=a.createElement(t),o=a.getElementsByTagName(t)[0],c.async=1,c.src="https://www.google-analytics.com/analytics.js",o.parentNode.insertBefore(c,o)}(window,document,"script",0,"ga"),ga("create","UA-54829827-4","auto"),ga("send","pageview")</script><script defer="defer" src="/static/js/main.787e423f.js"></script><link href="/static/css/main.418eaf65.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body><script>var LHC_API=LHC_API||{};LHC_API.args={mode:"widget",lhc_base_url:"//chat.live.wrenchboard.com/",wheight:450,wwidth:350,pheight:520,pwidth:500,leaveamessage:!0,check_messages:!1},function(){var e=document.createElement("script");e.type="text/javascript",e.setAttribute("crossorigin","anonymous"),e.async=!0;var t=new Date;e.src="//chat.live.wrenchboard.com/design/defaulttheme/js/widgetv2/index.js?"+t.getFullYear()+t.getMonth()+t.getDate();var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}()
|
||||
|
||||
+9
-6
@@ -66,6 +66,8 @@ import FamWorkInProgressPage from "./views/FamWorkInProgressPage";
|
||||
import MyPastDueTasksPage from "./views/MyPastDueTasksPage";
|
||||
import FamilyWalletPage from "./views/FamilyWalletPage";
|
||||
import FamilyActivitiesPage from "./views/FamilyActivitiesPage";
|
||||
import FamGamesPage from "./views/FamGamesPage";
|
||||
import FamilyRoutesPage from "./views/FamilyRoutesPage";
|
||||
|
||||
export default function Routers() {
|
||||
return (
|
||||
@@ -144,12 +146,9 @@ export default function Routers() {
|
||||
<Route exact path="/ai-question" element={<FamAIQuestionPage />} />
|
||||
<Route exact path="/myfiles" element={<FamMyFilesPage />} />
|
||||
<Route exact path="/ai-lab" element={<FamAIQuestionPage />} />
|
||||
<Route exact path="/fam-games" element={<FamGamesPage />} />
|
||||
<Route exact path="/work-in-progress" element={<FamWorkInProgressPage />} />
|
||||
<Route
|
||||
exact
|
||||
path="/familysettings"
|
||||
element={<FamilySettingsPage />}
|
||||
/>
|
||||
|
||||
<Route exact path="/pastdue" element={<MyPastDueTasksPage />} />
|
||||
<Route exact path="/notification" element={<Notification />} />
|
||||
<Route exact path="/mytask" element={<MyTaskPage />} />
|
||||
@@ -168,8 +167,12 @@ export default function Routers() {
|
||||
path="/my-review-jobs"
|
||||
element={<MyReviewDueJobsPage />}
|
||||
/>
|
||||
<Route exact path="/acc-family" element={<FamilyAccPage />} />
|
||||
|
||||
{/* <Route exact path='/acc-family' element={<FamilyAccPage />} />
|
||||
<Route exact path="/acc-family/activities" element={<FamilyActivitiesPage />} />
|
||||
<Route exact path="/acc-family/familysettings" element={<FamilySettingsPage />} /> */}
|
||||
<Route path='/acc-family/*' element={<FamilyRoutesPage />} />
|
||||
|
||||
<Route exact path="/manage-family" element={<FamilyManagePage />} />
|
||||
<Route exact path="/start-job" element={<StartJob />} />
|
||||
<Route exact path="/yourpage" element={<YourPages />} />
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 52 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
+301
-240
@@ -72,49 +72,74 @@ function AddJob({ popUpHandler, categories }) {
|
||||
}
|
||||
};
|
||||
|
||||
// For form initial values
|
||||
const initialValues = {
|
||||
// initial values for formik
|
||||
country: walletDetails.data.length == 1 ? walletDetails.data[0].country : '',
|
||||
price: "",
|
||||
title: "",
|
||||
description: "",
|
||||
job_detail: "",
|
||||
timeline_days: "",
|
||||
category: [],
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="add-job p-5 w-full bg-white dark:bg-dark-white dark:text-white rounded-md flex flex-col justify-between">
|
||||
<Formik
|
||||
initialValues={IV}
|
||||
<Formik
|
||||
initialValues={initialValues}
|
||||
validationSchema={validationSchema}
|
||||
onSubmit={handleAddJob}
|
||||
>
|
||||
{(props) => {
|
||||
return (
|
||||
<Form>
|
||||
<div className="flex flex-col-reverse sm:flex-row">
|
||||
<div className="fields w-full">
|
||||
{/* inputs starts here */}
|
||||
<div className="xl:flex xl:space-x-7 mb-[5px]">
|
||||
<div className="field w-full mb-6 xl:mb-0">
|
||||
<label
|
||||
htmlFor="country"
|
||||
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex item-center gap-1"
|
||||
>
|
||||
Currency
|
||||
{props.errors.country && props.touched.country && (
|
||||
<span className="text-[12px] text-red-500">
|
||||
{props.errors.country}
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
<select
|
||||
id="country"
|
||||
name="country"
|
||||
value={props.values.country}
|
||||
className={`input-field p-2 mt-3 rounded-md placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none border`}
|
||||
onChange={props.handleChange}
|
||||
onBlur={props.handleBlur}
|
||||
>
|
||||
{walletDetails?.loading ? (
|
||||
<option className="text-slate-500 text-lg" value="">
|
||||
Loading...
|
||||
</option>
|
||||
) : walletDetails.data.length ? (
|
||||
<>
|
||||
<Form className='contents'>
|
||||
<div className="add-job p-5 w-full h-full rounded-md flex flex-col justify-between overflow-y-auto">
|
||||
<div className="flex flex-col-reverse sm:flex-row">
|
||||
<div className="fields w-full">
|
||||
{/* inputs starts here */}
|
||||
<div className="xl:flex xl:space-x-7 mb-[5px]">
|
||||
<div className="field w-full mb-[5px] xl:mb-0">
|
||||
<label
|
||||
htmlFor="country"
|
||||
className="job-label job-label-flex"
|
||||
>
|
||||
<span>Currency</span>
|
||||
{props.errors.country && props.touched.country && (
|
||||
<span className="text-[12px] text-red-500">
|
||||
{props.errors.country}
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
<select
|
||||
id="country"
|
||||
name="country"
|
||||
value={props.values.country}
|
||||
className={`input-field p-2 mt-3 rounded-full placeholder:text-base text-dark-gray w-full h-[42px] bg-slate-100 focus:ring-0 focus:outline-none border`}
|
||||
onChange={props.handleChange}
|
||||
onBlur={props.handleBlur}
|
||||
disabled={walletDetails.data.length == 1}
|
||||
>
|
||||
{walletDetails?.loading ? (
|
||||
<option className="text-slate-500 text-lg" value="">
|
||||
Select a currency
|
||||
Loading...
|
||||
</option>
|
||||
) : walletDetails.data.length > 1 ? (
|
||||
<>
|
||||
<option className="text-slate-500 text-lg" value="">
|
||||
Select a currency
|
||||
</option>
|
||||
{walletDetails.data?.map((item, index) => (
|
||||
<option
|
||||
key={index}
|
||||
className="text-slate-500 text-lg"
|
||||
value={item?.country}
|
||||
>
|
||||
{item?.description}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
) : walletDetails.data.length == 1 ?
|
||||
<>
|
||||
{walletDetails.data?.map((item, index) => (
|
||||
<option
|
||||
key={index}
|
||||
@@ -125,238 +150,274 @@ function AddJob({ popUpHandler, categories }) {
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<option className="text-slate-500 text-lg" value="">
|
||||
No Options Found! Try Again
|
||||
</option>
|
||||
)}
|
||||
</select>
|
||||
:(
|
||||
<option className="text-slate-500 text-lg" value="">
|
||||
No Options Found! Try Again
|
||||
</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
<div className="field w-full mb-[5px] xl:mb-0">
|
||||
<InputCom
|
||||
fieldClass="px-6 text-right flex"
|
||||
label="Price"
|
||||
labelClass=""
|
||||
type="number"
|
||||
name="price"
|
||||
placeholder="0"
|
||||
value={props.values.price}
|
||||
inputHandler={props.handleChange}
|
||||
blurHandler={props.handleBlur}
|
||||
error={
|
||||
props.errors.price &&
|
||||
props.touched.price &&
|
||||
props.errors.price
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Timeline */}
|
||||
<div className="field w-full mb-[5px] xl:mb-0">
|
||||
<label
|
||||
className="job-label job-label-flex"
|
||||
htmlFor="timeline_days"
|
||||
>
|
||||
Timeline
|
||||
<span className="text-green-700 text-[12px] tracking-wide">
|
||||
- Duration
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<Field
|
||||
component="select"
|
||||
name="timeline_days"
|
||||
className={`input-field p-2 mt-3 rounded-full placeholder:text-base text-dark-gray w-full h-[42px] bg-slate-100 focus:ring-0 focus:outline-none border ${
|
||||
props.errors.timeline_days &&
|
||||
props.touched.timeline_days
|
||||
? "border-[#ff0a0a63] shadow-red-500 animate-shake"
|
||||
: "dark:border-[#5e6278]"
|
||||
}`}
|
||||
value={props.values.timeline_days}
|
||||
>
|
||||
<option value="" className='text-slate-500 text-lg'>Select Duration</option>
|
||||
{publicArray.map(({ name, duration }, idx) => (
|
||||
<option
|
||||
key={idx}
|
||||
className="text-slate-500 text-lg"
|
||||
value={duration}
|
||||
>
|
||||
{name}
|
||||
</option>
|
||||
))}
|
||||
</Field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
<div className="field w-full">
|
||||
{/* Title */}
|
||||
<div className="field w-full mb-[5px]">
|
||||
<InputCom
|
||||
fieldClass="px-6 text-right"
|
||||
label="Price"
|
||||
labelClass="tracking-wide"
|
||||
type="number"
|
||||
name="price"
|
||||
placeholder="0"
|
||||
value={props.values.price}
|
||||
fieldClass="px-6"
|
||||
label="Title"
|
||||
labelClass=""
|
||||
type="text"
|
||||
name="title"
|
||||
value={props.values.title}
|
||||
inputHandler={props.handleChange}
|
||||
blurHandler={props.handleBlur}
|
||||
error={
|
||||
props.errors.price &&
|
||||
props.touched.price &&
|
||||
props.errors.price
|
||||
props.errors.title &&
|
||||
props.touched.title &&
|
||||
props.errors.title
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<div className="field w-full mb-[5px]">
|
||||
<InputCom
|
||||
fieldClass="px-6"
|
||||
label="Title"
|
||||
labelClass="tracking-wide"
|
||||
type="text"
|
||||
name="title"
|
||||
value={props.values.title}
|
||||
inputHandler={props.handleChange}
|
||||
blurHandler={props.handleBlur}
|
||||
error={
|
||||
props.errors.title &&
|
||||
props.touched.title &&
|
||||
props.errors.title
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<div className="field w-full mb-[5px]">
|
||||
<InputCom
|
||||
fieldClass="px-6"
|
||||
label="Description"
|
||||
labelClass="tracking-wide"
|
||||
type="text"
|
||||
name="description"
|
||||
value={props.values.description}
|
||||
inputHandler={props.handleChange}
|
||||
blurHandler={props.handleBlur}
|
||||
error={
|
||||
props.errors.description &&
|
||||
props.touched.description &&
|
||||
props.errors.description
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Details */}
|
||||
<div className="field flex flex-col sm:flex-row w-full mb-[5px] gap-2">
|
||||
<div className="sm:w-[60%] w-full">
|
||||
<label
|
||||
htmlFor="Job Delivery Details"
|
||||
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1"
|
||||
>
|
||||
Job Delivery Details
|
||||
{props.errors.job_detail &&
|
||||
props.touched.job_detail && (
|
||||
<span className="text-[12px] text-red-500">
|
||||
{props.errors.job_detail}
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
<textarea
|
||||
id="Job Delivery Details"
|
||||
rows="5"
|
||||
className={`input-field px-3 py-2 placeholder:text-base text-dark-gray dark:text-white w-full h-[100px] bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px] border`}
|
||||
style={{ resize: "none" }}
|
||||
name="job_detail"
|
||||
value={props.values.job_detail}
|
||||
onChange={props.handleChange}
|
||||
onBlur={props.handleBlur}
|
||||
{/* Description */}
|
||||
<div className="field w-full mb-[5px]">
|
||||
<InputCom
|
||||
fieldClass="px-6"
|
||||
label="Description"
|
||||
labelClass=""
|
||||
type="text"
|
||||
name="description"
|
||||
value={props.values.description}
|
||||
inputHandler={props.handleChange}
|
||||
blurHandler={props.handleBlur}
|
||||
error={
|
||||
props.errors.description &&
|
||||
props.touched.description &&
|
||||
props.errors.description
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="sm:w-[35%] w-full">
|
||||
<div
|
||||
htmlFor="Job Categories"
|
||||
className='className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block"'
|
||||
id="checked-group"
|
||||
>
|
||||
Categories
|
||||
</div>
|
||||
<div
|
||||
className="sm:flex-col flex flex-wrap px-3 mt-3"
|
||||
role="group"
|
||||
aria-labelledby="checked-group"
|
||||
>
|
||||
{categories ? (
|
||||
<>
|
||||
{Object?.entries(categories).map(([key, value]) => (
|
||||
<label
|
||||
key={key}
|
||||
className="flex gap-1 w-full items-center"
|
||||
>
|
||||
<Field
|
||||
type="checkbox"
|
||||
name="category"
|
||||
value={key}
|
||||
/>
|
||||
<span className="text-[13.975px]">{value}</span>
|
||||
</label>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<label className="flex gap-1 w-full items-center">
|
||||
<Field type="checkbox" name="category" />
|
||||
<span className="text-[13.975px]">null</span>
|
||||
</label>
|
||||
)}
|
||||
<span className="h-5 text-sm italic text-[#cf3917]">
|
||||
{props.errors.category &&
|
||||
props.touched.category &&
|
||||
"please select a category"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="field w-full mb-[5px]">
|
||||
<div className={`flex items-center justify-between mb-2.5`}>
|
||||
<label
|
||||
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block"
|
||||
htmlFor="timeline_days"
|
||||
>
|
||||
Timeline
|
||||
<span className="text-green-700 text-sm tracking-wide">
|
||||
- Expected duration of this task
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<Field
|
||||
component="select"
|
||||
name="timeline_days"
|
||||
className={`input-field p-2 mt-3 rounded-md placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none border ${
|
||||
props.errors.timeline_days &&
|
||||
props.touched.timeline_days
|
||||
? "border-[#ff0a0a63] shadow-red-500 border-[0.5px] animate-shake"
|
||||
: "border border-[#f5f8fa] dark:border-[#5e6278]"
|
||||
}`}
|
||||
value={props.values.timeline_days}
|
||||
>
|
||||
<option value="">Select Duration</option>
|
||||
{publicArray.map(({ name, duration }, idx) => (
|
||||
<option
|
||||
key={idx}
|
||||
className="text-slate-500 text-lg"
|
||||
value={duration}
|
||||
{/* Details */}
|
||||
<div className="field flex flex-col sm:flex-row w-full mb-[5px] gap-2">
|
||||
<div className="sm:w-[60%] w-full">
|
||||
<label
|
||||
htmlFor="Job Delivery Details"
|
||||
className="job-label job-label-flex"
|
||||
>
|
||||
{name}
|
||||
</option>
|
||||
))}
|
||||
</Field>
|
||||
</div>
|
||||
{/* inputs ends here */}
|
||||
</div>
|
||||
</div>
|
||||
Job Delivery Details
|
||||
{props.errors.job_detail &&
|
||||
props.touched.job_detail && (
|
||||
<span className="text-[12px] text-red-500">
|
||||
{props.errors.job_detail}
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
<textarea
|
||||
id="Job Delivery Details"
|
||||
rows="5"
|
||||
className={`input-field px-3 py-2 placeholder:text-base text-dark-gray dark:text-white w-full h-[100px] bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px] border`}
|
||||
style={{ resize: "none" }}
|
||||
name="job_detail"
|
||||
value={props.values.job_detail}
|
||||
onChange={props.handleChange}
|
||||
onBlur={props.handleBlur}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
||||
<div className="content-footer w-full">
|
||||
{/* error or success display */}
|
||||
{requestStatus.message != "" &&
|
||||
(!requestStatus.status ? (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
<div className="sm:w-[35%] w-full">
|
||||
<label
|
||||
htmlFor="Job Categories"
|
||||
className='job-label'
|
||||
id="checked-group"
|
||||
>
|
||||
Categories
|
||||
</label>
|
||||
<div
|
||||
className="sm:flex-col flex flex-wrap px-3 mt-3"
|
||||
role="group"
|
||||
aria-labelledby="checked-group"
|
||||
>
|
||||
{categories ? (
|
||||
<>
|
||||
{Object?.entries(categories).map(([key, value]) => (
|
||||
<label
|
||||
key={key}
|
||||
className="flex gap-1 w-full items-center"
|
||||
>
|
||||
<Field
|
||||
type="checkbox"
|
||||
name="category"
|
||||
value={key}
|
||||
/>
|
||||
<span className="text-[13.975px]">{value}</span>
|
||||
</label>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<label className="flex gap-1 w-full items-center">
|
||||
<Field type="checkbox" name="category" />
|
||||
<span className="text-[13.975px]">null</span>
|
||||
</label>
|
||||
)}
|
||||
<span className="h-5 text-sm italic text-[#cf3917]">
|
||||
{props.errors.category &&
|
||||
props.touched.category &&
|
||||
"please select a category"}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
requestStatus.status && (
|
||||
|
||||
{/* <div className="field w-full mb-[5px]">
|
||||
<div className={`flex items-center justify-between mb-2.5`}>
|
||||
<label
|
||||
className="job-label"
|
||||
htmlFor="timeline_days"
|
||||
>
|
||||
Timeline
|
||||
<span className="text-green-700 text-sm tracking-wide">
|
||||
- Expected duration of this task
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<Field
|
||||
component="select"
|
||||
name="timeline_days"
|
||||
className={`input-field p-2 mt-3 rounded-md placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none border ${
|
||||
props.errors.timeline_days &&
|
||||
props.touched.timeline_days
|
||||
? "border-[#ff0a0a63] shadow-red-500 border-[0.5px] animate-shake"
|
||||
: "border border-[#f5f8fa] dark:border-[#5e6278]"
|
||||
}`}
|
||||
value={props.values.timeline_days}
|
||||
>
|
||||
<option value="">Select Duration</option>
|
||||
{publicArray.map(({ name, duration }, idx) => (
|
||||
<option
|
||||
key={idx}
|
||||
className="text-slate-500 text-lg"
|
||||
value={duration}
|
||||
>
|
||||
{name}
|
||||
</option>
|
||||
))}
|
||||
</Field>
|
||||
</div> */}
|
||||
{/* inputs ends here */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
||||
<div className="content-footer w-full">
|
||||
{/* error or success display */}
|
||||
{requestStatus.message != "" &&
|
||||
(!requestStatus.status ? (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
className={`relative p-4 my-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
{/* End of error or success display */}
|
||||
|
||||
<div className="w-full h-[70px] border-t border-light-purple dark:border-[#5356fb29] flex justify-end items-center">
|
||||
<div className="flex items-center space-x-4 mr-9">
|
||||
<button
|
||||
type="button"
|
||||
className="text-18 text-light-red tracking-wide "
|
||||
>
|
||||
<span
|
||||
className="border-b dark:border-[#5356fb29] border-light-red"
|
||||
onClick={popUpHandler}
|
||||
>
|
||||
{" "}
|
||||
Cancel
|
||||
</span>
|
||||
</button>
|
||||
|
||||
{requestStatus?.loading ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
type="submit"
|
||||
className="w-[152px] h-[46px] flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
Add Job
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
requestStatus.status && (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
{/* End of error or success display */}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer-wrapper grid grid-cols-1 xxs:grid-cols-3">
|
||||
<div className="w-full col-span-1 xxs:col-span-2 xxs:col-start-2 flex justify-between items-center">
|
||||
<button
|
||||
type="button"
|
||||
className="custom-btn border border-light-red text-light-red"
|
||||
>
|
||||
<span
|
||||
className="px-2"
|
||||
onClick={popUpHandler}
|
||||
>
|
||||
{" "}
|
||||
Cancel
|
||||
</span>
|
||||
</button>
|
||||
|
||||
{requestStatus?.loading ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
type="submit"
|
||||
className="custom-btn btn-gradient text-white"
|
||||
>
|
||||
Add Job
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
}}
|
||||
</Formik>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,63 +13,68 @@ export default function LoginLayout({ slogan, children }) {
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`h-screen overflow-y-auto bg-cover bg-center`}
|
||||
className={`min-h-screen overflow-y-auto bg-cover bg-center flex flex-col justify-between items-center`}
|
||||
style={{
|
||||
backgroundImage: `url(${countryMode == "NG" ? bgImgNig : bgImgCom})`,
|
||||
}}
|
||||
>
|
||||
<div className={`w-full grid grid-cols-1 lg:grid-cols-2`}>
|
||||
|
||||
<div className={`w-full grid grid-cols-1 xl:grid-cols-2`}>
|
||||
{/* <div
|
||||
className={`auth-bg hidden lg:block bg-blue-50 relative bg-cover bg-no-repeat border-0 after:content-[''] after:absolute after:inset-0`}
|
||||
className={`auth-bg hidden xl:block bg-blue-50 relative bg-cover bg-no-repeat border-0 after:content-[''] after:absolute after:inset-0`}
|
||||
style={{backgroundImage: `url(${bgImg})`}}
|
||||
>
|
||||
</div> */}
|
||||
<div className="p-5 sm:p-7 flex place-content-center lg:col-start-2">
|
||||
<div className="py-5 w-full sm:w-11/12 max-w-[550px] shadow-md bg-slate-50 rounded-[0.475rem]">
|
||||
<div className="p-5 sm:p-7 flex place-content-center xl:col-start-2">
|
||||
<div className="py-5 w-full sm:w-11/12 max-w-[550px] shadow-md bg-slate-50 dark:bg-dark-white rounded-[0.475rem]">
|
||||
<div className="w-full flex justify-center items-center">
|
||||
{children && children}
|
||||
</div>
|
||||
<div className="w-full flex flex-col justify-center items-center px-10">
|
||||
<div className="w-full flex justify-center items-center pt-5">
|
||||
<div className="flex items-center">
|
||||
<a
|
||||
href="https://www.wrenchboard.com/about-us"
|
||||
className="text-[#a1a5b7] text-[15px] px-2 font-medium hover:text-[#009ef7]"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
About
|
||||
</a>
|
||||
<a
|
||||
href="https://www.wrenchboard.com/service"
|
||||
className="text-[#a1a5b7] text-[15px] px-2 font-medium hover:text-[#009ef7]"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Services
|
||||
</a>
|
||||
<a
|
||||
href="https://www.wrenchboard.com/contact"
|
||||
className="text-[#a1a5b7] text-[15px] px-2 font-medium hover:text-[#009ef7]"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Contact Us
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<p className="py-1 text-black text-[15px] px-2 font-medium flex items-center gap-1">
|
||||
<span className="dark:text-white">
|
||||
© {new Date().getFullYear()} -
|
||||
</span>
|
||||
<Link to="/" className="text-[#009ef7] ml-1">
|
||||
WrenchBoard
|
||||
</Link>{" "}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='w-full shadow-md bg-slate-50 dark:bg-dark-white'>
|
||||
<div className="w-full flex flex-col md:flex-row justify-center items-center px-10 py-2">
|
||||
<div className="flex justify-center items-center">
|
||||
<div className="flex items-center">
|
||||
<a
|
||||
href="https://www.wrenchboard.com/about-us"
|
||||
className="text-[#a1a5b7] text-[15px] px-2 font-medium hover:text-[#009ef7]"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
About
|
||||
</a>
|
||||
<a
|
||||
href="https://www.wrenchboard.com/service"
|
||||
className="text-[#a1a5b7] text-[15px] px-2 font-medium hover:text-[#009ef7]"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Services
|
||||
</a>
|
||||
<a
|
||||
href="https://www.wrenchboard.com/contact"
|
||||
className="text-[#a1a5b7] text-[15px] px-2 font-medium hover:text-[#009ef7]"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
Contact Us
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-black text-[15px] px-2 font-medium flex items-center gap-1">
|
||||
<span className="dark:text-white">
|
||||
© {new Date().getFullYear()} -
|
||||
</span>
|
||||
<Link to="/" className="text-[#009ef7] ml-1">
|
||||
WrenchBoard
|
||||
</Link>{" "}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -145,6 +145,7 @@ export default function Login() {
|
||||
localStorage.setItem("member_id", `${res.data.member_id}`);
|
||||
localStorage.setItem("uid", `${res.data.uid}`);
|
||||
localStorage.setItem("session_token", `${res.data.session}`);
|
||||
localStorage.setItem("wallet_available_status", `${res.data.wallet_available_status}`);
|
||||
if (res.data?.account_type == "FAMILY") {
|
||||
sessionStorage.setItem("family_uid", res.data?.family_uid);
|
||||
sessionStorage.setItem("parent_uid", res.data?.parent_uid);
|
||||
@@ -562,7 +563,7 @@ export default function Login() {
|
||||
{loginType == "full" && (
|
||||
<>
|
||||
<div className="pt-5 text-[#181c32] text-center font-semibold text-[13.975px] leading-[20.9625px]">
|
||||
This site is protected by a Captcha. Our Privacy Policy and
|
||||
This site is protected by a Captcha. <br />Our Privacy Policy and
|
||||
Terms of Service apply.
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||
import WrenchBoard from "../../../assets/images/wrenchboard-logo-text.png";
|
||||
import WrenchBoard from "../../../assets/images/wrenchboard-logo-text_new.png";
|
||||
import usersService from "../../../services/UsersService";
|
||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||
import AuthLayout from "../AuthLayout2";
|
||||
@@ -180,11 +180,11 @@ export default function SignUp() {
|
||||
</span>
|
||||
</div>
|
||||
<div className="w-full flex items-center gap-2">
|
||||
<div className="border-b border-[#eff2f5] max-w-[50%] w-full"></div>
|
||||
<span className="text-[#b5b5c3] font-medium text-[0.7rem] w-[2%]">
|
||||
<div className="border-b border-[#eff2f5] w-[48%]"></div>
|
||||
<span className="text-[#b5b5c3] font-medium text-[0.7rem]">
|
||||
OR
|
||||
</span>
|
||||
<div className="border-b border-[#eff2f5] max-w-[50%] w-full"></div>
|
||||
<div className="border-b border-[#eff2f5] w-[48%]"></div>
|
||||
</div>
|
||||
<div className="input-area">
|
||||
<SelectOption
|
||||
@@ -413,7 +413,7 @@ const SelectOption = ({
|
||||
disabled={disable}
|
||||
name={name}
|
||||
id={name}
|
||||
className="input-wrapper border border-[#f5f8fa] dark:border-[#5e6278] w-full rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base focus-visible:border-transparent focus-visible:outline-0 focus-visible:ring-transparent "
|
||||
className="px-6 input-wrapper border border-[#f5f8fa] dark:border-[#5e6278] w-full rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-dark-gray bg-[#f5f8fa] dark:bg-[#FAFAFA] text-base focus-visible:border-transparent focus-visible:outline-0 focus-visible:ring-transparent "
|
||||
onChange={inputHandler}
|
||||
value={value}
|
||||
>
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||
import WrenchBoard from "../../../assets/images/wrenchboard-logo-text.png";
|
||||
import debounce from "../../../hooks/debounce";
|
||||
import usersService from "../../../services/UsersService";
|
||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||
import AuthLayout from "../AuthLayout2";
|
||||
import LoadingSpinner from '../../../components/Spinners/LoadingSpinner'
|
||||
import { updateUserDetails } from "../../../store/UserDetails";
|
||||
|
||||
export default function VerifyLink() {
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const [email, setEmail] = useState("");
|
||||
const [password, setPassword] = useState("");
|
||||
const [msgError, setMsgError] = useState("");
|
||||
@@ -49,12 +55,14 @@ export default function VerifyLink() {
|
||||
) {
|
||||
localStorage.setItem("email", `${data?.email}`);
|
||||
localStorage.setItem("member_id", `${data?.member_id}`);
|
||||
localStorage.setItem("uid", `${data?.uid}`);
|
||||
localStorage.setItem("session_token", `${data?.session}`);
|
||||
localStorage.setItem("session", `${data?.session}`);
|
||||
localStorage.setItem("uid", data?.uid);
|
||||
|
||||
navigate("/", { replace: true });
|
||||
setLinkLoader(false);
|
||||
localStorage.setItem("wallet_available_status", `${data?.wallet_available_status}`);
|
||||
dispatch(updateUserDetails({ ...data }));
|
||||
setTimeout(() => {
|
||||
navigate("/", { replace: true });
|
||||
setLinkLoader(false);
|
||||
}, 2000);
|
||||
} else {
|
||||
setLinkLoader(false);
|
||||
setMsgError("Invalid Link or Password Combination");
|
||||
@@ -119,7 +127,14 @@ export default function VerifyLink() {
|
||||
<>
|
||||
<AuthLayout slogan="Welcome to WrenchBoard">
|
||||
{pageLoader ? (
|
||||
<img src={WrenchBoard} alt="wrenchboard" className="h-10 mx-auto" />
|
||||
<div className='flex flex-col justify-center items-center gap-4'>
|
||||
<img src={WrenchBoard} alt="wrenchboard" className="h-10 mx-auto" />
|
||||
<div className='flex flex-col justify-center items-center'>
|
||||
<LoadingSpinner height='h-40' size='8' />
|
||||
<p>Loading...</p>
|
||||
<p>please do not refresh</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-full">
|
||||
<div className="mb-12">
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { useState } from "react";
|
||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||
import MarketPopUp from "../MarketPlace/PopUp/MarketPopUp";
|
||||
import { useSelector } from "react-redux";
|
||||
import PendingJobsPopout from "../jobPopout/PendingJobsPopout";
|
||||
|
||||
export default function AvailableJobsCard({
|
||||
className,
|
||||
@@ -8,11 +10,19 @@ export default function AvailableJobsCard({
|
||||
hidden = false,
|
||||
contentDisplay,
|
||||
image_server,
|
||||
marketPlaceProduct
|
||||
}) {
|
||||
//debugger;
|
||||
const [marketPopUp, setMarketPopUp] = useState({ show: false, data: {} });
|
||||
const [jobPopout, setJobPopout] = useState({ show: false, data: {} });
|
||||
|
||||
const [imageUrl, setImageUrl] = useState("");
|
||||
|
||||
const {
|
||||
userDetails: { uid },
|
||||
} = useSelector((state) => state?.userDetails); // GETS USER DETAILS
|
||||
|
||||
|
||||
let thePrice = PriceFormatter(
|
||||
datas?.price * 0.01,
|
||||
datas?.currency_code,
|
||||
@@ -34,63 +44,70 @@ export default function AvailableJobsCard({
|
||||
<>
|
||||
{contentDisplay == "grid" ? (
|
||||
<div
|
||||
className={`card-style-two w-full h-[426px] p-[20px] bg-white dark:bg-dark-white rounded-2xl section-shadow ${
|
||||
className={`card-style-two w-full p-[10px] bg-white dark:bg-dark-white rounded-2xl section-shadow ${
|
||||
className || ""
|
||||
}`}
|
||||
>
|
||||
<div
|
||||
onClick={() => {
|
||||
setMarketPopUp({ show: true, data: datas });
|
||||
datas.market_uid != uid ? setMarketPopUp({ show: true, data: datas }) :setJobPopout({ show: true, data: datas });
|
||||
}}
|
||||
className="flex flex-col justify-between w-full h-full"
|
||||
className="flex flex-col gap-2 justify-between w-full h-full"
|
||||
>
|
||||
<h1 className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize">
|
||||
{datas.title}
|
||||
</h1>
|
||||
|
||||
<div className="card-two-info flex justify-between items-center">
|
||||
<div className="owned-by flex space-x-2 items-center">
|
||||
<div>
|
||||
<p className="text-thin-light-gray text-sm leading-3">
|
||||
Added
|
||||
</p>
|
||||
<p className="text-base text-dark-gray dark:text-white">
|
||||
{new Date(datas.offer_added).toLocaleDateString()}
|
||||
</p>
|
||||
</div>
|
||||
<div className='w-full flex items-center gap-4'>
|
||||
<div className='min-w-[60px] min-h-[60px] max-w-[60px] max-h-[60px] rounded-full overflow-hidden'>
|
||||
<img className='w-full h-full object-cover' src={image} alt='Job Image' />
|
||||
</div>
|
||||
<div className="w-[1px] bg-light-purple dark:bg-dark-light-purple h-7"></div>
|
||||
<div className="created-by flex space-x-2 items-center flex-row-reverse">
|
||||
<div>
|
||||
<p className="text-thin-light-gray text-sm leading-3 text-right">
|
||||
Expires
|
||||
</p>
|
||||
<p className="text-base text-dark-gray dark:text-white text-right">
|
||||
{new Date(datas.expire).toLocaleDateString()}
|
||||
</p>
|
||||
<div className='w-full'>
|
||||
<h1 className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize">
|
||||
{datas.title}
|
||||
</h1>
|
||||
|
||||
<div className="card-two-info flex justify-between items-center">
|
||||
<div className="owned-by flex space-x-2 items-center">
|
||||
<div>
|
||||
<p className="text-thin-light-gray text-sm leading-3">
|
||||
Added
|
||||
</p>
|
||||
<p className="text-base text-dark-gray dark:text-white">
|
||||
{new Date(datas.offer_added).toLocaleDateString()}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-[1px] bg-light-purple dark:bg-dark-light-purple h-7"></div>
|
||||
<div className="created-by flex space-x-2 items-center flex-row-reverse">
|
||||
<div>
|
||||
<p className="text-thin-light-gray text-sm leading-3 text-right">
|
||||
Expires
|
||||
</p>
|
||||
<p className="text-base text-dark-gray dark:text-white text-right">
|
||||
{new Date(datas.expire).toLocaleDateString()}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="thumbnail-area w-full">
|
||||
<div
|
||||
className="w-full h-[236px] p-6 rounded-xl overflow-hidden bg-center bg-cover bg-no-repeat"
|
||||
style={{
|
||||
backgroundImage: `url('${image}')`,
|
||||
}}
|
||||
className="w-full p-1 h-[150px] rounded-xl overflow-y-auto bg-center bg-cover bg-no-repeat"
|
||||
// style={{
|
||||
// backgroundImage: `url('${image}')`,
|
||||
// }}
|
||||
>
|
||||
<div className="flex justify-center bg-slate-100 p-2 rounded-md">
|
||||
{datas.description}
|
||||
<div className="flex flex-col min-h-full bg-slate-100 p-2 rounded-md">
|
||||
<p>{datas.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="details-area">
|
||||
<div className="product-two-options flex justify-between mb-5 relative"></div>
|
||||
|
||||
{/* <div className="product-two-options flex justify-between mb-5 relative"></div> */}
|
||||
<div className="flex justify-between">
|
||||
<div className="flex items-center space-x-2">
|
||||
<div>
|
||||
<p className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white">
|
||||
<div className='w-full'>
|
||||
<p className="w-full flex gap-1 items-center font-bold text-xl tracking-wide text-dark-gray dark:text-white">
|
||||
{/* {thePrice} | {datas.timeline_days} day(s) */}
|
||||
{datas?.offer_depend_uid && <i className="fa-solid fa-lock p-1 text-red-500 text-[12px]"></i>}
|
||||
{thePrice}
|
||||
</p>
|
||||
<p className="text-sm text-lighter-gray">
|
||||
@@ -102,15 +119,27 @@ export default function AvailableJobsCard({
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button
|
||||
{datas.market_uid != uid ?
|
||||
<button
|
||||
type="button"
|
||||
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
|
||||
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
|
||||
onClick={() => {
|
||||
setMarketPopUp({ show: true, data: datas });
|
||||
}}
|
||||
>
|
||||
View
|
||||
</button>
|
||||
:
|
||||
<button
|
||||
type="button"
|
||||
className="px-4 py-2.5 text-white text-sm bg-yellow-500 rounded-full tracking-wide"
|
||||
onClick={() => {
|
||||
setMarketPopUp({ show: true, data: datas });
|
||||
setJobPopout({ show: true, data: datas });
|
||||
}}
|
||||
>
|
||||
View
|
||||
</button>
|
||||
>
|
||||
Manage
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,7 +154,7 @@ export default function AvailableJobsCard({
|
||||
<div className="flex flex-col flex-[0.9]">
|
||||
<h1
|
||||
onClick={() => {
|
||||
setMarketPopUp({ show: true, data: datas });
|
||||
datas.market_uid != uid ? setMarketPopUp({ show: true, data: datas }) :setJobPopout({ show: true, data: datas })
|
||||
}}
|
||||
className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize"
|
||||
>
|
||||
@@ -134,7 +163,7 @@ export default function AvailableJobsCard({
|
||||
|
||||
<div
|
||||
onClick={() => {
|
||||
setMarketPopUp({ show: true, data: datas });
|
||||
datas.market_uid != uid ? setMarketPopUp({ show: true, data: datas }) :setJobPopout({ show: true, data: datas })
|
||||
}}
|
||||
className="my-2"
|
||||
>
|
||||
@@ -144,7 +173,8 @@ export default function AvailableJobsCard({
|
||||
</div>
|
||||
|
||||
<div className="block sm:flex flex-wrap gap-4">
|
||||
<p className="text-sm text-thin-light-gray flex flext-start gap-1">
|
||||
<p className="text-sm text-thin-light-gray flex flext-start gap-1 items-center">
|
||||
{datas?.offer_depend_uid && <i className="fa-solid fa-lock p-1 text-red-500 text-[12px]"></i>}
|
||||
Price: <span className="text-purple">{thePrice}</span>
|
||||
</p>
|
||||
<p className="text-sm text-thin-light-gray">
|
||||
@@ -162,8 +192,9 @@ export default function AvailableJobsCard({
|
||||
</div>
|
||||
</div>
|
||||
<div className="">
|
||||
{datas.market_uid != uid ?
|
||||
<button
|
||||
type="button"
|
||||
type="button"
|
||||
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
|
||||
onClick={() => {
|
||||
setMarketPopUp({ show: true, data: datas });
|
||||
@@ -171,6 +202,17 @@ export default function AvailableJobsCard({
|
||||
>
|
||||
View
|
||||
</button>
|
||||
:
|
||||
<button
|
||||
type="button"
|
||||
className="px-4 py-2.5 text-white text-sm bg-yellow-500 rounded-full tracking-wide"
|
||||
onClick={() => {
|
||||
setJobPopout({ show: true, data: datas });
|
||||
}}
|
||||
>
|
||||
Manage
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -181,8 +223,21 @@ export default function AvailableJobsCard({
|
||||
setMarketPopUp({ show: false, data: {} });
|
||||
}}
|
||||
situation={marketPopUp.show}
|
||||
marketPlaceProduct={marketPlaceProduct}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Active Job Popout */}
|
||||
{jobPopout.show && (
|
||||
<PendingJobsPopout
|
||||
details={datas}
|
||||
onClose={() => {
|
||||
setJobPopout({ show: false, data: {} });
|
||||
}}
|
||||
situation={jobPopout.show}
|
||||
/>
|
||||
)}
|
||||
{/* End of Active Job Popout */}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { Suspense, lazy } from "react";
|
||||
import localImgLoad from "../../lib/localImgLoad";
|
||||
import CountDown from "../Helpers/CountDown";
|
||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||
|
||||
const VideoElement = lazy(() => import("../VideoCom/VideoElement")); // LAZY IMPORTING VIDEO COMPONENT
|
||||
|
||||
export default function OfferCard({
|
||||
datas,
|
||||
hidden = false,
|
||||
@@ -19,9 +22,13 @@ export default function OfferCard({
|
||||
return (
|
||||
<div className="card-style-one flex flex-col justify-between w-full h-[387px] bg-white dark:bg-dark-white p-3 pb rounded-2xl">
|
||||
<div className="content">
|
||||
{/* thumbnail */}
|
||||
<div className="w-full h-40">
|
||||
{/* thumbnail image */}
|
||||
{/* thumbnail image/video */}
|
||||
{datas.job_type == "MEDIA" ?
|
||||
<Suspense fallback={<p>Loading...</p>}>
|
||||
<VideoElement videoId={datas?.media_uid} />
|
||||
</Suspense>
|
||||
:
|
||||
<div
|
||||
className="thumbnail w-full h-full rounded-xl overflow-hidden px-4 pt-4"
|
||||
style={{
|
||||
@@ -30,6 +37,7 @@ export default function OfferCard({
|
||||
>
|
||||
{hidden && <div className="flex justify-center"></div>}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
{/* details */}
|
||||
<div className="details">
|
||||
@@ -38,15 +46,15 @@ export default function OfferCard({
|
||||
</h1>
|
||||
|
||||
<div className="w-full p-2 rounded-lg border border-[#E3E4FE] dark:border-[#a7a9b533] ">
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<div className="flex flex-col justify-between items-center border-r-2">
|
||||
<div className="grid grid-cols-1 gap-2">
|
||||
{/* <div className="flex flex-col justify-between items-center border-r-2">
|
||||
<p className="text-sm text-thin-light-gray dark:text-white tracking-wide">
|
||||
Task Code
|
||||
</p>
|
||||
<p className="text-base font-bold tracking-wide text-dark-gray dark:text-white">
|
||||
{datas.contract}
|
||||
</p>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="flex flex-col justify-between items-center">
|
||||
<p className="text-sm text-red-500 tracking-wide">Expires</p>
|
||||
<p className="text-base font-bold tracking-wide text-dark-gray dark:text-white">
|
||||
|
||||
@@ -34,7 +34,7 @@ export default function SocketIOContextProvider({children}) {
|
||||
|
||||
const marketUpdate = (message, room) => {
|
||||
if(message && room){
|
||||
socket.emit("marketjob_addded", { message, room });
|
||||
socket.emit("marketjob_added", { message, room });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -44,6 +44,12 @@ export default function SocketIOContextProvider({children}) {
|
||||
}
|
||||
};
|
||||
|
||||
const sendJobInterestToOwner = (message, room) => {
|
||||
if(message && room){
|
||||
socket.emit("marketjob", { message:{...message}, room });
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
socket.on("receive_message", (data) => {
|
||||
// setSocketMsgReceived(data.message);
|
||||
@@ -65,8 +71,21 @@ export default function SocketIOContextProvider({children}) {
|
||||
if(message.action == "REFRESH_TASK" && message.audience == "PARENT"){ // for refreshing parent account when child accepts or rejects a job
|
||||
dispatch(tableReload({type:'PARENTFAMILYTASKLIST'})) // dispatches to update parent family task list on parent side
|
||||
}
|
||||
if(message.action == "REFRESH_WALLET" && message.family_uid == user_uid && message.audience == "MEMBER"){ // for refreshing child wallet account when parent sends money to kid
|
||||
dispatch(tableReload({type:'WALLETTABLE'})) // dispatches to update wallet balance on family side
|
||||
}
|
||||
// console.log('DATA', data)
|
||||
});
|
||||
|
||||
socket.on("marketjob_actions", (data) => { // Triggers refresh on owner side, when somebody sends/shows interest in a job
|
||||
let user_uid = userDetails.account_type == 'FULL' ? userDetails.uid : sessionStorage.getItem('family_uid') // gets user UID
|
||||
let {message} = data
|
||||
if(message.action == "REFRESH_OFFERS" && message.audience == "MERCHANT" && message.market_uid == user_uid){ // for refreshing job owner offer interest list when any worker sends interest
|
||||
dispatch(tableReload({type:'OFFERINTERESTLISTRELOAD'}))
|
||||
}
|
||||
console.log('data', data)
|
||||
});
|
||||
|
||||
}, [socket]);
|
||||
|
||||
let values = {
|
||||
@@ -76,6 +95,7 @@ export default function SocketIOContextProvider({children}) {
|
||||
setSocketMsgReceived,
|
||||
marketUpdate,
|
||||
parentAssignJobToKid,
|
||||
sendJobInterestToOwner,
|
||||
socketMsgReceived,
|
||||
// room,
|
||||
// setRoom,
|
||||
|
||||
@@ -29,14 +29,15 @@ const AccountDashboard = ({ className, bannerList }) => {
|
||||
props;
|
||||
|
||||
return (
|
||||
<TopBanner
|
||||
btn={short_button_text}
|
||||
image={image}
|
||||
title={short_title}
|
||||
desc={short_description}
|
||||
link_path={link_path}
|
||||
key={idx}
|
||||
/>
|
||||
<div key={idx}>
|
||||
<TopBanner
|
||||
btn={short_button_text}
|
||||
image={image}
|
||||
title={short_title}
|
||||
desc={short_description}
|
||||
link_path={link_path}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
@@ -44,18 +45,21 @@ const AccountDashboard = ({ className, bannerList }) => {
|
||||
{getLowerBanner?.map((props, idx) => {
|
||||
let image = getImage(props);
|
||||
|
||||
let { short_title, short_description, short_button_text, link_path } =
|
||||
let { short_title, short_description, short_button_text, link_path, card_type, blog_id } =
|
||||
props;
|
||||
|
||||
return (
|
||||
<LowerBanner
|
||||
btn={short_button_text}
|
||||
image={image}
|
||||
title={short_title}
|
||||
desc={short_description}
|
||||
link_path={link_path}
|
||||
key={idx}
|
||||
/>
|
||||
<div key={idx}>
|
||||
<LowerBanner
|
||||
btn={short_button_text}
|
||||
image={image}
|
||||
title={short_title}
|
||||
desc={short_description}
|
||||
link_path={link_path}
|
||||
card_type={card_type}
|
||||
blog_id={blog_id}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
@@ -100,24 +104,26 @@ const TopBanner = ({ image, title = "", desc = "", btn, link_path, key }) => {
|
||||
);
|
||||
};
|
||||
|
||||
const LowerBanner = ({ image, title = "", desc = "", btn, link_path, key }) => {
|
||||
const LowerBanner = ({ image, title = "", desc = "", btn, link_path, card_type, blog_id, key }) => {
|
||||
const newLinkPath = card_type == 'BLOG' ? `${link_path}?blog_id=${blog_id}` : link_path
|
||||
|
||||
return (
|
||||
<div
|
||||
key={key}
|
||||
className="flex flex-col bg-white shadow-md h-full rounded-xl dark:border-[#5356fb29] dark:bg-dark-white"
|
||||
>
|
||||
<div className="w-full flex justify-between border-b border-slate-300 p-2">
|
||||
<div className="h-[130px] flex justify-between items-center">
|
||||
<div className="w-full xxs:flex justify-between items-center border-b border-slate-300 p-2">
|
||||
<div className="min-h-[150px] sm:min-h-[130px] flex justify-between items-center">
|
||||
<div className="px-2 flex flex-col gap-2 dark:text-white">
|
||||
<Link to={link_path} className="text-lg font-bold">
|
||||
<Link to={newLinkPath} className="text-lg font-bold">
|
||||
{title}
|
||||
</Link>
|
||||
<p to={link_path} className="text-sm">
|
||||
<p to={newLinkPath} className="text-sm">
|
||||
{desc}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<Link to={link_path} className="w-[150px] h-[100px]">
|
||||
<Link to={newLinkPath} className="w-[150px] h-[100px]">
|
||||
<img
|
||||
src={image}
|
||||
alt="banner-img"
|
||||
@@ -127,7 +133,7 @@ const LowerBanner = ({ image, title = "", desc = "", btn, link_path, key }) => {
|
||||
</Link>
|
||||
</div>
|
||||
<div className="flex justify-between w-full px-2 items-center">
|
||||
<Link to={link_path} className="text-slate-300 font-semibold text-sm">
|
||||
<Link to={newLinkPath} className="text-slate-300 font-semibold text-sm">
|
||||
{btn}
|
||||
</Link>
|
||||
<button className="flex items-center justify-center gap-2">
|
||||
|
||||
@@ -52,7 +52,13 @@ export default function FamilyActivities() {
|
||||
<span>Family</span>
|
||||
</Link>
|
||||
</div>
|
||||
<Suspense fallback={<LoadingSpinner color="sky-blue" size="16" />}>
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="bg-white">
|
||||
<LoadingSpinner color="sky-blue" size="16" height='h-[30rem]' />
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<FamilyTableNew />
|
||||
</Suspense>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,346 @@
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
} from "react";
|
||||
import { Link, useOutletContext } from "react-router-dom";
|
||||
import usersService from "../../services/UsersService";
|
||||
import Icons from "../Helpers/Icons";
|
||||
import InputCom from "../Helpers/Inputs/InputCom";
|
||||
import ModalCom from "../Helpers/ModalCom";
|
||||
import Layout from "../Partials/Layout";
|
||||
import FamilyTableSettings from "./FamilyTableSettings";
|
||||
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
||||
|
||||
export default function FamilyListSettings() {
|
||||
|
||||
const {loader, setLoader, familyList, setListReload} = useOutletContext() // CONTEXT VALUES FROM OUTLET TO CHILD
|
||||
|
||||
// State to store the selected year and month
|
||||
const [selectedYear, setSelectedYear] = useState("");
|
||||
const [selectedMonth, setSelectedMonth] = useState("");
|
||||
// const [familyList, setFamilyList] = useState({});
|
||||
// const [loader, setLoader] = useState(false);
|
||||
const [popUp, setPopUp] = useState(false);
|
||||
// const [listReload, setListReload] = useState(false);
|
||||
const [msgErr, setMsgErr] = useState("");
|
||||
const [formData, setFormData] = useState({
|
||||
first_name: "",
|
||||
last_name: "",
|
||||
});
|
||||
|
||||
const apiCall = useMemo(() => new usersService(), []);
|
||||
|
||||
const popUpHandler = () => {
|
||||
setPopUp((prev) => !prev);
|
||||
};
|
||||
|
||||
// Handle year selection
|
||||
const handleYearChange = (e) => {
|
||||
setSelectedYear(e.target.value);
|
||||
};
|
||||
|
||||
// Handle month selection
|
||||
const handleMonthChange = (e) => {
|
||||
setSelectedMonth(e.target.value);
|
||||
};
|
||||
|
||||
const handleInputChange = (event) => {
|
||||
const { name, value } = event?.target;
|
||||
setFormData((prevFormData) => ({ ...prevFormData, [name]: value }));
|
||||
};
|
||||
|
||||
// use the useEffect hook to clear the selected month if the year changes (to ensure consistency)
|
||||
useEffect(() => {
|
||||
if (selectedYear === "" && selectedMonth !== "") {
|
||||
setSelectedMonth("");
|
||||
}
|
||||
}, [selectedYear]);
|
||||
|
||||
const addMember = async () => {
|
||||
const { first_name, last_name } = formData;
|
||||
setLoader(true);
|
||||
try {
|
||||
if (first_name !== "" && last_name !== "") {
|
||||
const reqData = {
|
||||
firstname: first_name,
|
||||
lastname: last_name,
|
||||
year: +selectedYear,
|
||||
month: +selectedMonth,
|
||||
};
|
||||
|
||||
const res = await apiCall.addFamily(reqData);
|
||||
const { data } = res;
|
||||
|
||||
if (data?.internal_return > 0 && data?.status === "OK") {
|
||||
setLoader(false);
|
||||
setListReload((prev) => !prev);
|
||||
popUpHandler();
|
||||
} else {
|
||||
setLoader(false);
|
||||
setMsgErr("Sorry, something went wrong");
|
||||
}
|
||||
} else {
|
||||
setLoader(false);
|
||||
setMsgErr("Please fill in the fields");
|
||||
}
|
||||
} catch (error) {
|
||||
setLoader(false);
|
||||
setMsgErr("An error occurred");
|
||||
throw new Error(error);
|
||||
} finally {
|
||||
setTimeout(() => {
|
||||
setMsgErr(null);
|
||||
}, Number(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT));
|
||||
setFormData({
|
||||
first_name: "",
|
||||
last_name: "",
|
||||
});
|
||||
setSelectedMonth("");
|
||||
setSelectedYear("");
|
||||
}
|
||||
};
|
||||
|
||||
// const memberList = useCallback(async () => {
|
||||
// setLoader(true);
|
||||
// try {
|
||||
// const res = await apiCall.familyListings();
|
||||
// const { data } = res;
|
||||
// if (data?.internal_return >= 0 && data?.status === "OK") {
|
||||
// const { result_list, session_image_server } = data;
|
||||
// setFamilyList({ result_list, session_image_server });
|
||||
// sessionStorage.setItem("family_list", JSON.stringify(result_list))
|
||||
// setLoader(false);
|
||||
// } else {
|
||||
// return;
|
||||
// }
|
||||
// } catch (error) {
|
||||
// setLoader(false);
|
||||
// throw new Error(error);
|
||||
// }
|
||||
// }, [apiCall]);
|
||||
|
||||
// useEffect(() => {
|
||||
// let checkMemberList = true;
|
||||
// if (checkMemberList) {
|
||||
// memberList();
|
||||
// }
|
||||
// return () => {
|
||||
// checkMemberList = false;
|
||||
// };
|
||||
// }, [listReload, memberList]);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/*<CommonHead />*/}
|
||||
<div className="notification-page w-full">
|
||||
<div className="notification-wrapper w-full">
|
||||
<FamilyTableSettings
|
||||
familyList={familyList?.result_list}
|
||||
loader={loader}
|
||||
popUpHandler={popUpHandler}
|
||||
imageServer={familyList?.session_image_server}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{popUp && (
|
||||
<ModalCom action={popUpHandler} situation={popUp}>
|
||||
<FamilyForm
|
||||
popUpHandler={popUpHandler}
|
||||
value={formData}
|
||||
selectedYear={selectedYear}
|
||||
selectedMonth={selectedMonth}
|
||||
monthHandler={handleMonthChange}
|
||||
yearHandler={handleYearChange}
|
||||
inputHandler={handleInputChange}
|
||||
msgErr={msgErr}
|
||||
onClick={addMember}
|
||||
loader={loader}
|
||||
/>
|
||||
</ModalCom>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const FamilyForm = ({
|
||||
value: { first_name, last_name },
|
||||
ageValue,
|
||||
inputHandler,
|
||||
selectedMonth,
|
||||
selectedYear,
|
||||
monthHandler,
|
||||
yearHandler,
|
||||
msgErr,
|
||||
loader,
|
||||
onClick,
|
||||
popUpHandler,
|
||||
}) => {
|
||||
return (
|
||||
<div className="logout-modal-wrapper w-11/12 lg:w-[460px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Add Members
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="modal-close-btn"
|
||||
onClick={popUpHandler}
|
||||
>
|
||||
<CloseIcon />
|
||||
</button>
|
||||
</div>
|
||||
<form className="logout-modal-body w-full flex flex-col items-center px-10 py-8 gap-4">
|
||||
<InputCom
|
||||
placeholder="Firstname"
|
||||
label="First Name:"
|
||||
name="first_name"
|
||||
type="text"
|
||||
parentClass="flex items-center gap-1 w-full"
|
||||
labelClass="flex-[0.4] mb-0"
|
||||
inputClass="flex-[0.6] input-curve lg border border-[#dce4e9]"
|
||||
fieldClass="px-2"
|
||||
value={first_name}
|
||||
inputHandler={inputHandler}
|
||||
/>
|
||||
<InputCom
|
||||
placeholder="Lastname"
|
||||
label="Last Name:"
|
||||
name="last_name"
|
||||
type="text"
|
||||
parentClass="flex items-center gap-1 w-full"
|
||||
labelClass="flex-[0.4] mb-0"
|
||||
inputClass="flex-[0.6] input-curve lg border border-[#dce4e9]"
|
||||
fieldClass="px-2"
|
||||
value={last_name}
|
||||
inputHandler={inputHandler}
|
||||
/>
|
||||
<div className="input-com mb-7 flex flex-col gap-1 w-full">
|
||||
{/* Age dropdown */}
|
||||
<div className="">
|
||||
<label
|
||||
className="job-label"
|
||||
htmlFor="age-selection"
|
||||
>
|
||||
Birthday: (Year/Month)
|
||||
</label>
|
||||
</div>
|
||||
<YearMonthDropdowns
|
||||
handleMonthChange={monthHandler}
|
||||
handleYearChange={yearHandler}
|
||||
selectedMonth={selectedMonth}
|
||||
selectedYear={selectedYear}
|
||||
/>
|
||||
</div>
|
||||
{msgErr && (
|
||||
<div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-xs font-light leading-[19.5px]">
|
||||
{msgErr}
|
||||
</div>
|
||||
)}
|
||||
<div className="signin-area w-full">
|
||||
<div className="flex justify-center">
|
||||
<button
|
||||
type="button"
|
||||
onClick={onClick}
|
||||
// className={`rounded-[0.475rem] text-white flex justify-center bg-[#4687ba] hover:bg-[#009ef7] transition-all duration-300 items-center h-[42px] py-[0.8875rem] px-[1.81rem] text-[14.95px] btn-login`}
|
||||
className="text-white btn-gradient text-lg tracking-wide px-6 py-2 rounded-full"
|
||||
>
|
||||
{loader ? (
|
||||
<div className="signup btn-loader"></div>
|
||||
) : (
|
||||
<span>Add</span>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
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>
|
||||
);
|
||||
|
||||
function YearMonthDropdowns({
|
||||
selectedMonth,
|
||||
selectedYear,
|
||||
handleMonthChange,
|
||||
handleYearChange,
|
||||
}) {
|
||||
// Get the current year
|
||||
const currentYear = new Date().getFullYear();
|
||||
|
||||
// Generate an array of years from the current year to (currentYear - 19)
|
||||
const years = Array.from({ length: 17 }, (_, index) => currentYear - index);
|
||||
|
||||
// Array of month names
|
||||
const months = [
|
||||
"January",
|
||||
"February",
|
||||
"March",
|
||||
"April",
|
||||
"May",
|
||||
"June",
|
||||
"July",
|
||||
"August",
|
||||
"September",
|
||||
"October",
|
||||
"November",
|
||||
"December",
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="flex max-w-[330px] w-full self-end gap-4">
|
||||
<select
|
||||
id="yearDropdown"
|
||||
value={selectedYear}
|
||||
onChange={handleYearChange}
|
||||
className="input-wrapper border border-[#f5f8fa] dark:border-[#5e6278] w-56 rounded-[35px] h-10 overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base focus-visible:border-transparent focus-visible:outline-0 focus-visible:ring-transparent px-4"
|
||||
// size="5"
|
||||
>
|
||||
<option value="">Select a Year</option>
|
||||
{years.map((year) => (
|
||||
<option key={year} value={year}>
|
||||
{year}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
|
||||
<select
|
||||
id="monthDropdown"
|
||||
value={selectedMonth}
|
||||
onChange={handleMonthChange}
|
||||
className="input-wrapper border border-[#f5f8fa] dark:border-[#5e6278] w-56 rounded-[35px] h-10 overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base focus-visible:border-transparent focus-visible:outline-0 focus-visible:ring-transparent px-4"
|
||||
// size="5"
|
||||
>
|
||||
<option value="">Select a Month</option>
|
||||
{months.map((month, index) => (
|
||||
<option key={month} value={index + 1}>
|
||||
{month}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useLocation, useNavigate } from "react-router-dom";
|
||||
import { Link, useLocation, useNavigate } from "react-router-dom";
|
||||
import Layout from "../Partials/Layout";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
import FamilyManageTabs from "./FamilyManageTabs";
|
||||
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
||||
|
||||
export default function FamilyManage() {
|
||||
const [selectTab, setValue] = useState("today");
|
||||
@@ -34,7 +35,7 @@ export default function FamilyManage() {
|
||||
<div className="notification-page w-full mb-10">
|
||||
<div className="notification-wrapper w-full">
|
||||
{/* heading */}
|
||||
<div className="sm:flex justify-between items-center mb-6">
|
||||
{/* <div className="sm:flex justify-between items-center mb-6">
|
||||
<div className="mb-5 sm:mb-0">
|
||||
<h1 className="text-26 font-bold inline-flex gap-3 text-dark-gray dark:text-white items-center">
|
||||
<span
|
||||
@@ -50,6 +51,40 @@ export default function FamilyManage() {
|
||||
className="relative"
|
||||
></div>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="w-full mb-5 flex justify-between items-center">
|
||||
<div className="">
|
||||
<CustomBreadcrumb
|
||||
title = {'Manage Family'}
|
||||
breadcrumb={
|
||||
[
|
||||
{ link: "/", title: "Home" },
|
||||
{ link: "/manage-family", title: "Manage Family", active: true},
|
||||
]
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<Link
|
||||
className="item-content relative text-[18px] transition-all duration-300 ease-in-out bg-[#76a5df] text-white font-medium dark:text-white h-12 px-2 flex items-center gap-2 rounded-md shadow-sm justify-center cursor-pointer dark:bg-[linear-gradient(134.38deg,#f539f8_0%,#c342f9_43.55%,#5356fb_104.51%)]"
|
||||
to="/acc-family"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
strokeWidth={1.5}
|
||||
stroke="currentColor"
|
||||
className="w-4 h-4"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"
|
||||
/>
|
||||
</svg>
|
||||
|
||||
<span>Family</span>
|
||||
</Link>
|
||||
</div>
|
||||
<FamilyManageTabs accountDetails={accountDetails} />
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,7 @@ import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
import AssignTaskPopout from "./FamilyPopout/AssignTaskPopout";
|
||||
import FamilyWallet from "./Tabs/FamilyWallet";
|
||||
import { apiConst } from "../../lib/apiConst";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
// Lazy Imports for components
|
||||
const FamilyWaitlist = lazy(() => import("./Tabs/FamilyWaitlist"));
|
||||
@@ -29,43 +30,32 @@ export default function FamilyManageTabs({
|
||||
listReload,
|
||||
loader,
|
||||
}) {
|
||||
|
||||
const { jobListTable, pendingListTable, parentFamilyTaskList } = useSelector((state) => state.tableReload); // TABLE RELOAD TRIGGERS
|
||||
|
||||
// Initial state for family details
|
||||
const initialDetailState = {
|
||||
loading: false,
|
||||
data: null,
|
||||
data: [],
|
||||
};
|
||||
// console.log('accountDetails',accountDetails)
|
||||
// State for family details, tasks, waitlist, and pending
|
||||
const [details, setDetails] = useState({
|
||||
familyDetails: { ...initialDetailState },
|
||||
familyTasks: { ...initialDetailState },
|
||||
familyWaitList: { ...initialDetailState },
|
||||
familyPending: { ...initialDetailState },
|
||||
});
|
||||
|
||||
// Function to reset family details, tasks, waitlist, and pending
|
||||
const resetDetails = () => {
|
||||
setDetails({
|
||||
familyDetails: { ...initialDetailState },
|
||||
familyTasks: { ...initialDetailState },
|
||||
familyWaitList: { ...initialDetailState },
|
||||
familyPending: { ...initialDetailState },
|
||||
});
|
||||
};
|
||||
// State for family details, tasks, waitlist, and pending
|
||||
let [familyDetails, setFamilyDetails] = useState({loading: false, data: {}})
|
||||
let [familyTasks, setFamilyTasks] = useState({...initialDetailState})
|
||||
let [familyWaitList, setFamilyWaitList] = useState({...initialDetailState})
|
||||
let [familyPending, setFamilyPending] = useState({...initialDetailState})
|
||||
|
||||
|
||||
const [updatePage, setUpdatePage] = useState(false) // State to determine when to update the page
|
||||
|
||||
// State for family task data
|
||||
const [familyTask, setFamilyTask] = useState({ loading: false, data: [] });
|
||||
// State for list of created jobs by FULL USER
|
||||
const [jobList, setJobList] = useState({ loading: false, data: [] });
|
||||
|
||||
// State for active task
|
||||
// State for active/selected job
|
||||
const [activeTask, setActiveTask] = useState({ id: 0, data: {} });
|
||||
|
||||
// State for error messages
|
||||
const [errMsg, setErrMsg] = useState("");
|
||||
|
||||
// State for family task popout
|
||||
const [familyTaskPopout, setFamilyTaskPopout] = useState(false);
|
||||
const [assignTaskPopout, setAssignTaskPopout] = useState(false);
|
||||
|
||||
let [uploadStatus, setUploadStatus] = useState({loading: false, status: false, message:''}) // HOLDS STATE FOR UPLOAD PROFILE PICTURE STATUS
|
||||
|
||||
@@ -79,8 +69,8 @@ export default function FamilyManageTabs({
|
||||
const apiCall = useMemo(() => new usersService(), []);
|
||||
|
||||
// Function to handle toggling the family task popout
|
||||
const familyPopUpHandler = () => {
|
||||
setFamilyTaskPopout((prev) => !prev);
|
||||
const familyAssignPopUpHandler = () => {
|
||||
setAssignTaskPopout((prev) => !prev);
|
||||
};
|
||||
|
||||
// Function to trigger a click on the hidden profile image input
|
||||
@@ -177,44 +167,43 @@ export default function FamilyManageTabs({
|
||||
Tasks: (
|
||||
<FamilyTasks
|
||||
className={className}
|
||||
loader={details.familyTasks.loading}
|
||||
familyData={details.familyTasks.data}
|
||||
familyData={familyTasks}
|
||||
accountDetails={accountDetails}
|
||||
/>
|
||||
),
|
||||
Waiting: (
|
||||
<FamilyWaitlist
|
||||
familyData={details.familyWaitList.data}
|
||||
familyData={familyWaitList}
|
||||
accountDetails={accountDetails}
|
||||
loader={details.familyWaitList.loading}
|
||||
setUpdatePage={setUpdatePage}
|
||||
jobList={jobList}
|
||||
setActiveTask={setActiveTask}
|
||||
activeTask={activeTask}
|
||||
/>
|
||||
),
|
||||
Pending: (
|
||||
<FamilyPending
|
||||
familyData={details.familyPending.data}
|
||||
familyData={familyPending}
|
||||
accountDetails={accountDetails}
|
||||
loader={details.familyPending.loading}
|
||||
setUpdatePage={setUpdatePage}
|
||||
/>
|
||||
),
|
||||
Account: (
|
||||
<FamilyAccount
|
||||
familyData={details.familyDetails.data}
|
||||
familyData={familyDetails}
|
||||
myRef={accountRef}
|
||||
loader={details.familyDetails.loading}
|
||||
handlePrint={useHandlePrint}
|
||||
/>
|
||||
),
|
||||
Profile: <FamilyProfile familyData={details.familyDetails.data} />,
|
||||
wallet: <FamilyWallet familyData={details.familyDetails.data} />,
|
||||
Profile: <FamilyProfile familyData={familyDetails.data} />,
|
||||
wallet: <FamilyWallet familyData={familyDetails.data} />,
|
||||
};
|
||||
|
||||
// Default tab component
|
||||
const defaultTabComponent = (
|
||||
<FamilyTasks
|
||||
className={className}
|
||||
loader={details.familyTasks.loading}
|
||||
familyData={details.familyTasks.data}
|
||||
familyData={familyTasks}
|
||||
accountDetails={accountDetails}
|
||||
/>
|
||||
);
|
||||
@@ -222,67 +211,90 @@ export default function FamilyManageTabs({
|
||||
// Selected tab component based on the current 'tab'
|
||||
const selectedTabComponent = tabComponents[tab] || defaultTabComponent;
|
||||
|
||||
// Effect to manage family details and related data
|
||||
// Effect to manage family details
|
||||
useEffect(() => {
|
||||
const manageFamily = async () => {
|
||||
setFamilyDetails({loading:true, data: {}})
|
||||
try {
|
||||
resetDetails();
|
||||
|
||||
setDetails({
|
||||
familyDetails: { loading: true },
|
||||
familyTasks: { loading: true },
|
||||
familyWaitList: { loading: true },
|
||||
familyPending: { loading: true },
|
||||
});
|
||||
|
||||
const { family_uid } = accountDetails;
|
||||
const reqData = { family_uid };
|
||||
|
||||
const [familyRes, tasksRes, familyWaitRes, familyPending] =
|
||||
await Promise.all([
|
||||
apiCall.ManageFamily(reqData),
|
||||
apiCall.ManageTasks(reqData),
|
||||
apiCall.ManageFamilyWaitlist(),
|
||||
apiCall.ManageFamilyPending(),
|
||||
]);
|
||||
|
||||
const familyData = familyRes.data;
|
||||
const tasksData = tasksRes.data;
|
||||
const familyWaitData = familyWaitRes.data;
|
||||
const familyPendingData = familyPending.data;
|
||||
|
||||
// Function to check for errors in data
|
||||
const checkDataError = (data) => data?.internal_return < 0;
|
||||
|
||||
if (
|
||||
checkDataError(familyData) ||
|
||||
checkDataError(tasksData) ||
|
||||
checkDataError(familyWaitData) ||
|
||||
checkDataError(familyPendingData)
|
||||
) {
|
||||
return;
|
||||
const response = await apiCall.ManageFamily(reqData)
|
||||
if(response.status != 200 || !response?.data){
|
||||
return setFamilyDetails({loading:false, data: {}})
|
||||
}
|
||||
|
||||
setDetails({
|
||||
familyDetails: { loading: false, data: familyData },
|
||||
familyTasks: { loading: false, data: tasksData },
|
||||
familyWaitList: { loading: false, data: familyWaitData },
|
||||
familyPending: { loading: false, data: familyPendingData },
|
||||
});
|
||||
setFamilyDetails({loading:false, data: response?.data})
|
||||
} catch (error) {
|
||||
resetDetails();
|
||||
setErrMsg("An error occurred");
|
||||
throw new Error(error);
|
||||
setFamilyDetails({loading:false, data: {}})
|
||||
}
|
||||
};
|
||||
|
||||
// Invoke the manageFamily function when the component mounts
|
||||
manageFamily();
|
||||
}, []);
|
||||
|
||||
// Effect to manage active family task details
|
||||
useEffect(() => {
|
||||
const manageTasks = async () => {
|
||||
setFamilyTasks({loading:true, data: []})
|
||||
try {
|
||||
const { family_uid } = accountDetails;
|
||||
const reqData = { family_uid };
|
||||
|
||||
const response = await apiCall.ManageTasks(reqData)
|
||||
if(response.status != 200 || !response?.data){
|
||||
return setFamilyTasks({loading:false, data: []})
|
||||
}
|
||||
setFamilyTasks({loading:false, data: response?.data})
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
setFamilyTasks({loading:false, data: []})
|
||||
}
|
||||
};
|
||||
// Invoke the manageFamily function when the component mounts
|
||||
manageTasks();
|
||||
}, [updatePage, parentFamilyTaskList]);
|
||||
|
||||
// Effect to manage family wait task details
|
||||
useEffect(() => {
|
||||
const manageFamilyWaitlist = async () => {
|
||||
setFamilyWaitList({loading:true, data: []})
|
||||
try {
|
||||
const response = await apiCall.ManageFamilyWaitlist()
|
||||
if(response.status != 200 || !response?.data){
|
||||
return setFamilyWaitList({loading:false, data: []})
|
||||
}
|
||||
setFamilyWaitList({loading:false, data: response?.data})
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
setFamilyWaitList({loading:false, data: []})
|
||||
}
|
||||
};
|
||||
// Invoke the manageFamily function when the component mounts
|
||||
manageFamilyWaitlist();
|
||||
}, [updatePage]);
|
||||
|
||||
// Effect to manage family tasks
|
||||
// Effect to manage family pending task details
|
||||
useEffect(() => {
|
||||
const manageFamilyPending = async () => {
|
||||
setFamilyPending({loading:true, data: []})
|
||||
try {
|
||||
const response = await apiCall.ManageFamilyPending()
|
||||
if(response.status != 200 || !response?.data){
|
||||
return setFamilyPending({loading:false, data: []})
|
||||
}
|
||||
setFamilyPending({loading:false, data: response?.data})
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
setFamilyPending({loading:false, data: []})
|
||||
}
|
||||
};
|
||||
// Invoke the manageFamily function when the component mounts
|
||||
manageFamilyPending();
|
||||
}, [updatePage, pendingListTable]);
|
||||
|
||||
// Effect to get all parent job list
|
||||
useEffect(() => {
|
||||
let checkFamilyTask = true;
|
||||
const reqData = {
|
||||
limit: 30,
|
||||
offset: 0,
|
||||
@@ -290,12 +302,11 @@ export default function FamilyManageTabs({
|
||||
action: apiConst.WRENCHBOARD_PICTURE_FAMMEMBER,
|
||||
};
|
||||
|
||||
if (checkFamilyTask) {
|
||||
setFamilyTask({ loading: true });
|
||||
setJobList({ loading: true });
|
||||
apiCall
|
||||
.getMyJobList(reqData)
|
||||
.then((res) => {
|
||||
setFamilyTask({ loading: false, data: res?.data?.result_list });
|
||||
setJobList({ loading: false, data: res?.data?.result_list });
|
||||
if (res?.data?.result_list?.length) {
|
||||
setActiveTask((prev) => ({
|
||||
...prev,
|
||||
@@ -304,15 +315,9 @@ export default function FamilyManageTabs({
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
setFamilyTask({ loading: false, data: [] });
|
||||
setJobList({ loading: false, data: [] });
|
||||
console.log("Error", err);
|
||||
});
|
||||
}
|
||||
|
||||
// Cleanup function to prevent memory leaks
|
||||
return () => {
|
||||
checkFamilyTask = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -395,7 +400,7 @@ export default function FamilyManageTabs({
|
||||
</ul>
|
||||
<button
|
||||
type="button"
|
||||
onClick={familyPopUpHandler}
|
||||
onClick={familyAssignPopUpHandler}
|
||||
className="p-1 my-1 w-[100px] flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
Add task
|
||||
@@ -417,15 +422,14 @@ export default function FamilyManageTabs({
|
||||
</Suspense>
|
||||
</div>
|
||||
|
||||
{familyTaskPopout && (
|
||||
{assignTaskPopout && (
|
||||
<AssignTaskPopout
|
||||
action={familyPopUpHandler}
|
||||
situation={familyTaskPopout}
|
||||
familyTask={familyTask}
|
||||
setFamilyTask={setFamilyTask}
|
||||
action={familyAssignPopUpHandler}
|
||||
situation={assignTaskPopout}
|
||||
jobList={jobList}
|
||||
setActiveTask={setActiveTask}
|
||||
activeTask={activeTask}
|
||||
familyDetailsData={details.familyDetails.data}
|
||||
familyDetailsData={familyDetails.data}
|
||||
setUpdatePage={setUpdatePage}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,359 @@
|
||||
import React, { useEffect, useState, lazy, Suspense } from 'react'
|
||||
import LoadingSpinner from '../../Spinners/LoadingSpinner'
|
||||
import { NewTasks } from './forms'
|
||||
import { PriceFormatter } from '../../Helpers/PriceFormatter'
|
||||
import { useSelector } from 'react-redux';
|
||||
import { InputCom } from '../../AddJob/settings';
|
||||
import * as Yup from "yup";
|
||||
import { Form, Formik } from "formik";
|
||||
|
||||
|
||||
// To get the validation schema
|
||||
const validationSchema = Yup.object().shape({
|
||||
currency: Yup.string()
|
||||
.min(1, "Minimum 3 characters")
|
||||
.max(25, "Maximum 25 characters")
|
||||
.required("required"),
|
||||
amount: Yup.number()
|
||||
.typeError("Invalid number")
|
||||
.min(1, "Must be greater than 0")
|
||||
.test("no-e", "Invalid number", (value) => {
|
||||
if (value && /\d+e/.test(value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.required("required"),
|
||||
job_description: Yup.string()
|
||||
.min(3, "Minimum 3 characters")
|
||||
.max(499, "Maximum 499 characters")
|
||||
.required("required"),
|
||||
timeline_days: Yup.number()
|
||||
.typeError("you must specify a number")
|
||||
.min(1, "Must be greater than 0")
|
||||
.required("required"),
|
||||
});
|
||||
|
||||
|
||||
|
||||
const VideoElement = lazy(() => import("../../VideoCom/VideoElement")); // LAZY IMPORTING VIDEO COMPONENT
|
||||
|
||||
export default function AssignMediaTask({
|
||||
commonMedia,
|
||||
requestStatus,
|
||||
setRequestStatus,
|
||||
assignMediaTask,
|
||||
activeMedia,
|
||||
handleActiveMedia,
|
||||
closeModal,
|
||||
family_uid
|
||||
}) {
|
||||
|
||||
const {userDetails} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||
|
||||
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||
|
||||
// For form initial values
|
||||
const initialValues = {
|
||||
// initial values for formik
|
||||
currency: walletDetails.data.length == 1 ? walletDetails.data[0].country : '',
|
||||
amount: "",
|
||||
job_description: "",
|
||||
timeline_days: "",
|
||||
media_uid: activeMedia?.uid,
|
||||
family_uid: family_uid,
|
||||
media_type: "COMMON"
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
// let imageSrc = (localStorage.getItem("session_token")
|
||||
// ? `${userDetails?.session_image_server}${localStorage.getItem("session_token")}/job/${activeMedia.uid}` : ""); // FOR GETTING JOB IMAGE
|
||||
|
||||
return (
|
||||
<>
|
||||
{commonMedia?.loading ? (
|
||||
<div className="h-[30rem] w-full flex justify-center items-center">
|
||||
<LoadingSpinner color="sky-blue" size="16" />
|
||||
</div>
|
||||
) : (
|
||||
<Formik
|
||||
initialValues={initialValues}
|
||||
validationSchema={validationSchema}
|
||||
onSubmit={(values, helpers)=>{assignMediaTask(values, helpers)}}
|
||||
>
|
||||
{(props) => {
|
||||
return (
|
||||
<Form className='contents'>
|
||||
<>
|
||||
<div
|
||||
className={`job-action-modal-body w-full h-full overflow-y-auto md:grid md:grid-cols-2`}
|
||||
>
|
||||
<div className="p-4 pt-0">
|
||||
<div className="p-4 w-full h-[450px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
||||
{commonMedia?.data?.length ? (
|
||||
commonMedia?.data?.map((item, index) => (
|
||||
<div
|
||||
key={item.uid}
|
||||
className="mb-2 flex justify-start items-center gap-2 text-sky-blue text-base cursor-pointer"
|
||||
onClick={() => handleActiveMedia(item)}
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name="media-list"
|
||||
checked={activeMedia?.uid == item?.uid}
|
||||
onChange={() =>
|
||||
handleActiveMedia(item)
|
||||
}
|
||||
className="w-[15px] h-[15px] cursor-pointer"
|
||||
/>
|
||||
<p className="w-full text-dark-gray dark:text-white tracking-wide">
|
||||
{item?.title}
|
||||
</p>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<p className="p-8 text-lg text-dark-gray dark:text-white tracking-wide text-center cursor-default">
|
||||
No Media found!
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/*Right Hand Side for details && Task Type === select */}
|
||||
<>
|
||||
{commonMedia?.data?.length > 0 ? (
|
||||
<div className="p-4 py-0 h-auto">
|
||||
<div className="w-full">
|
||||
<div className="mb-3 w-full">
|
||||
<label className="job-label">
|
||||
Description
|
||||
</label>
|
||||
<p className="p-1 text-sm text-slate-900 dark:text-white">
|
||||
{activeMedia?.description}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="my-3 w-full flex items-center justify-center">
|
||||
<div className="w-full max-w-xs h-28 rounded-2xl flex items-center justify-center">
|
||||
<Suspense fallback={<p>Loading...</p>}>
|
||||
<VideoElement videoId={activeMedia?.uid} />
|
||||
</Suspense>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-3 gap-3">
|
||||
{/* Price */}
|
||||
<div className="field w-full flex flex-col justify-between">
|
||||
<label htmlFor="price" className="job-label flex gap-1">
|
||||
Reward
|
||||
<span className='text-red-500 text-base'>{props.errors.amount && props.touched.amount && '*'}</span>
|
||||
</label>
|
||||
<InputCom
|
||||
fieldClass="px-6 text-right"
|
||||
// label="Price"
|
||||
// labelClass="tracking-wide"
|
||||
inputBg="bg-slate-100"
|
||||
type="number"
|
||||
name="amount"
|
||||
placeholder="0"
|
||||
value={props.values.amount}
|
||||
inputHandler={props.handleChange}
|
||||
// error={props.errors.price && props.touched.price && props.errors.price}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Currency */}
|
||||
<div className="field w-full flex flex-col justify-between">
|
||||
<label
|
||||
htmlFor="currency"
|
||||
className="job-label flex gap-1 invisible"
|
||||
>
|
||||
Currency
|
||||
{props.errors.currency && props.touched.currency && <span className="text-base text-red-500">*</span>}
|
||||
</label>
|
||||
<select
|
||||
id="currency"
|
||||
name="currency"
|
||||
value={props.values.currency}
|
||||
className={`input-field w-full h-[42px] flex items-center px-2 mt-2 rounded-full placeholder:text-base text-dark-gray dark:text-white bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none ${props.errors.currency && props.touched.currency && 'border border-red-500'}`}
|
||||
onChange={props.handleChange}
|
||||
disabled={walletDetails.data.length == 1}
|
||||
>
|
||||
{walletDetails?.loading ? (
|
||||
<option className="text-slate-500 text-[13.975px]" value="">
|
||||
Loading...
|
||||
</option>
|
||||
) : walletDetails.data.length ? (
|
||||
<>
|
||||
{walletDetails.data.length == 1 ?
|
||||
<>
|
||||
{walletDetails.data?.map((item, index) => (
|
||||
<option
|
||||
key={index}
|
||||
className="text-slate-500 text-lg"
|
||||
value={item?.country}
|
||||
>
|
||||
{item?.code}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
:
|
||||
<>
|
||||
<option className="text-slate-500 text-[13.975px]" value="">
|
||||
Select
|
||||
</option>
|
||||
{walletDetails.data?.map((item, index) => (
|
||||
<option
|
||||
key={index}
|
||||
className="text-slate-500 text-lg"
|
||||
value={item?.country}
|
||||
>
|
||||
{item?.code}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
}
|
||||
</>
|
||||
) : (
|
||||
<option className="text-slate-500 text-lg" value="">
|
||||
No Options Found!
|
||||
</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Duration */}
|
||||
<div className="field w-full flex flex-col justify-between">
|
||||
<label
|
||||
htmlFor="timeline_days"
|
||||
className="job-label flex gap-1"
|
||||
>
|
||||
Timeline
|
||||
{props.errors.timeline_days && props.touched.timeline_days && <span className="text-base text-red-500">*</span>}
|
||||
</label>
|
||||
<select
|
||||
id="timeline_days"
|
||||
name="timeline_days"
|
||||
value={props.values.timeline_days}
|
||||
className={`input-field w-full h-[42px] flex items-center px-2 mt-2 rounded-full placeholder:text-base text-dark-gray dark:text-white bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none`}
|
||||
onChange={props.handleChange}
|
||||
>
|
||||
{publicArray.length && (
|
||||
<>
|
||||
<option className="text-slate-500 text-[13.975px]" value="">
|
||||
Select
|
||||
</option>
|
||||
{publicArray.map(({ name, duration }, idx) => (
|
||||
<option
|
||||
key={idx}
|
||||
className="text-slate-500 text-[13.975px]"
|
||||
value={duration}
|
||||
>
|
||||
{name}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Delivery Detail */}
|
||||
<div className="my-3">
|
||||
<label className="w-full job-label flex gap-1">
|
||||
Delivery Detail
|
||||
{props.errors.job_description && props.touched.job_description && <span className="text-base text-red-500">*</span>}
|
||||
</label>
|
||||
<textarea
|
||||
className={`p-1 w-full text-sm text-slate-900 dark:text-white bg-transparent outline-none border border-slate-300 rounded-md`}
|
||||
rows="5"
|
||||
style={{ resize: "none" }}
|
||||
value={props.values.job_description}
|
||||
onChange={props.handleChange}
|
||||
name='job_description'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
|
||||
{/* BTN */}
|
||||
<div className="modal-footer-wrapper">
|
||||
{/* error or success display */}
|
||||
<div className="w-auto h-auto flex items-center">
|
||||
{requestStatus.message != "" &&
|
||||
(!requestStatus.status ? (
|
||||
<div
|
||||
className={`relative p-2 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px] self-start`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
) : (
|
||||
requestStatus.status && (
|
||||
<div
|
||||
className={`relative p-2 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* End of error or success display */}
|
||||
<div className="w-auto h-auto flex items-center gap-20">
|
||||
<button
|
||||
disabled={requestStatus.loading}
|
||||
onClick={()=>closeModal()}
|
||||
type="button"
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className="text-gradient">Close</span>
|
||||
</button>
|
||||
<div className="">
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner color="sky-blue" size="8" />
|
||||
) : (
|
||||
<button
|
||||
type="submit"
|
||||
disabled={requestStatus.loading}
|
||||
// onClick={assignFamilyTask}
|
||||
className="custom-btn btn-gradient text-white"
|
||||
>
|
||||
Assign
|
||||
</button>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
}
|
||||
</Formik>
|
||||
)
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
const publicArray = [
|
||||
{ duration: 1, name: "1 day" },
|
||||
{ duration: 2, name: "2 days" },
|
||||
{ duration: 3, name: "3 days" },
|
||||
{ duration: 4, name: "4 days" },
|
||||
{ duration: 5, name: "5 days" },
|
||||
{ duration: 6, name: "6 days" },
|
||||
{ duration: 7, name: "1 week" },
|
||||
{ duration: 14, name: "2 weeks" },
|
||||
{ duration: 21, name: "3 weeks" },
|
||||
{ duration: 28, name: "4 weeks" },
|
||||
];
|
||||
@@ -0,0 +1,263 @@
|
||||
import React from 'react'
|
||||
import LoadingSpinner from '../../Spinners/LoadingSpinner'
|
||||
import { NewTasks } from './forms'
|
||||
import { PriceFormatter } from '../../Helpers/PriceFormatter'
|
||||
import { useSelector } from 'react-redux';
|
||||
import AttachFile from '../../attachmentCom/AttachFile';
|
||||
|
||||
export default function AssignPrevNewTask({
|
||||
jobList,
|
||||
requestStatus,
|
||||
assignFamilyTask,
|
||||
taskType,
|
||||
switchTaskType,
|
||||
formState,
|
||||
setFormState,
|
||||
activeTask,
|
||||
handleActiveTask,
|
||||
closeModal
|
||||
}) {
|
||||
|
||||
const {userDetails} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||
|
||||
|
||||
let imageSrc = (localStorage.getItem("session_token")
|
||||
? `${userDetails?.session_image_server}${localStorage.getItem("session_token")}/job/${activeTask?.data?.job_uid}` : ""); // FOR GETTING JOB IMAGE
|
||||
|
||||
return (
|
||||
<>
|
||||
{jobList?.loading ? (
|
||||
<div className="h-[30rem] w-full flex justify-center items-center">
|
||||
<LoadingSpinner color="sky-blue" size="16" />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div
|
||||
className={`job-action-modal-body w-full h-full overflow-y-auto md:grid ${
|
||||
taskType !== "new" ? "md:grid-cols-2" : "md:grid-cols-1"
|
||||
}`}
|
||||
>
|
||||
<div className="px-4">
|
||||
<div className="mb-2 w-full flex items-center gap-4">
|
||||
<div className="flex items-center gap-2 text-sky-blue text-base">
|
||||
<input
|
||||
type="radio"
|
||||
name="task-type"
|
||||
value="select"
|
||||
className="w-[20px] h-[20px] cursor-pointer"
|
||||
checked={taskType == "select"}
|
||||
onChange={switchTaskType}
|
||||
/>
|
||||
<span className="text-lg tracking-wide font-semibold">Previous Task</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-sky-blue text-base">
|
||||
<input
|
||||
type="radio"
|
||||
name="task-type"
|
||||
value="new"
|
||||
className="w-[20px] h-[20px] cursor-pointer"
|
||||
checked={taskType == "new"}
|
||||
onChange={switchTaskType}
|
||||
/>
|
||||
<span className="text-lg tracking-wide font-semibold">New Task</span>
|
||||
</div>
|
||||
</div>
|
||||
{/* Task Type === select */}
|
||||
{taskType == "select" && (
|
||||
<div className="p-4 w-full h-[450px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
||||
{jobList?.data?.length ? (
|
||||
jobList?.data?.map((item, index) => (
|
||||
<div
|
||||
key={item.job_uid}
|
||||
className="mb-2 flex justify-start items-center gap-2 text-sky-blue text-base cursor-pointer"
|
||||
onClick={() => handleActiveTask(item.job_uid, item)}
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name="task-list"
|
||||
checked={
|
||||
activeTask.id == item.job_uid ||
|
||||
(activeTask.id == index && true)
|
||||
}
|
||||
onChange={() =>
|
||||
handleActiveTask(item.job_uid, item)
|
||||
}
|
||||
className="w-[15px] h-[15px] cursor-pointer"
|
||||
/>
|
||||
<p className="w-full text-dark-gray dark:text-white tracking-wide">
|
||||
{item?.title}
|
||||
</p>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<p className="p-8 text-lg text-dark-gray dark:text-white tracking-wide text-center cursor-default">
|
||||
No Task found!
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{taskType == "new" && (
|
||||
<div className="px-4 w-full">
|
||||
<NewTasks
|
||||
formState={formState}
|
||||
setFormState={setFormState}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/*Right Hand Side for details && Task Type === select */}
|
||||
{taskType == "select" && (
|
||||
<>
|
||||
{jobList?.data?.length > 0 ? (
|
||||
<div className="px-4">
|
||||
<div className="w-full">
|
||||
<p className="text-lg font-bold text-dark-gray dark:text-white tracking-wide border-b-2 max-h-[50px] overflow-y-auto">
|
||||
{activeTask?.data?.title}
|
||||
</p>
|
||||
{/* <div className="my-3">
|
||||
<Detail
|
||||
label="Description"
|
||||
value={activeTask?.data?.description}
|
||||
/>
|
||||
</div> */}
|
||||
<div className='flex flex-col gap-2'>
|
||||
<div className="my-1 w-full">
|
||||
<label className="job-label">
|
||||
Description
|
||||
</label>
|
||||
<p className="p-1 text-sm text-slate-900 dark:text-white max-h-[100px] overflow-y-auto">
|
||||
{activeTask?.data?.description}
|
||||
</p>
|
||||
</div>
|
||||
<div className="w-full grid grid-cols-2">
|
||||
<div className="w-full">
|
||||
<div className="w-full flex items-center gap-1">
|
||||
<label className="job-label">
|
||||
Reward
|
||||
</label>
|
||||
<p className="p-1 text-sm text-slate-900 dark:text-white">
|
||||
{PriceFormatter(
|
||||
activeTask?.data?.price * 0.01,
|
||||
activeTask?.data?.currency,
|
||||
activeTask?.data?.curreny_code
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="w-full flex items-center gap-1">
|
||||
<label className="job-label">
|
||||
Timeline
|
||||
</label>
|
||||
<p className="p-1 text-sm text-slate-900 dark:text-white">{`${activeTask?.data?.timeline_days} day(s)`}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full flex items-center justify-center">
|
||||
<div className="mb-1 w-24 max-h-24 rounded-2xl flex items-center justify-center">
|
||||
<img
|
||||
className="w-full h-auto"
|
||||
loading="lazy"
|
||||
src={imageSrc}
|
||||
alt='job image'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ATTACHMENT SECTION*/}
|
||||
<div className="w-full max-h-28">
|
||||
<AttachFile data={activeTask.data} />
|
||||
</div>
|
||||
|
||||
<div className="my-3">
|
||||
<label className="w-full job-label">
|
||||
Delivery Detail
|
||||
</label>
|
||||
<textarea
|
||||
className={`p-1 w-full text-sm text-slate-900 dark:text-white bg-transparent outline-none border border-slate-300 rounded-md`}
|
||||
rows="5"
|
||||
style={{ resize: "none" }}
|
||||
value={activeTask?.data?.job_detail}
|
||||
readOnly
|
||||
// onChange={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* BTN */}
|
||||
<div className="modal-footer-wrapper">
|
||||
{/* error or success display */}
|
||||
<div className="w-auto h-auto flex items-center">
|
||||
{requestStatus.message != "" &&
|
||||
(!requestStatus.status ? (
|
||||
<div
|
||||
className={`relative p-2 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px] self-start`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
) : (
|
||||
requestStatus.status && (
|
||||
<div
|
||||
className={`relative p-2 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* End of error or success display */}
|
||||
<div className="w-auto h-auto flex items-center gap-20">
|
||||
<button
|
||||
disabled={requestStatus.loading}
|
||||
onClick={()=>closeModal()}
|
||||
type="button"
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className="text-gradient">Close</span>
|
||||
</button>
|
||||
<div className="">
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner color="sky-blue" size="8" />
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
disabled={requestStatus.loading || requestStatus.status}
|
||||
onClick={assignFamilyTask}
|
||||
className={`custom-btn btn-gradient text-white ${requestStatus.status && 'opacity-50'}`}
|
||||
>
|
||||
Assign
|
||||
</button>
|
||||
)
|
||||
// : (
|
||||
// <button
|
||||
// type="button"
|
||||
// disabled={requestStatus.loading}
|
||||
// onClick={assignFamilyTask}
|
||||
// className="px-1 w-40 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white cursor-pointer"
|
||||
// >
|
||||
// {details
|
||||
// ? `Assign task to ${details?.firstname}`
|
||||
// : familyDetailsData
|
||||
// ? `Assign task to ${familyDetailsData.firstname}`
|
||||
// : "Assign"}
|
||||
// </button>
|
||||
// )
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import React, { Suspense, useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { useLocation, useOutletContext } from "react-router-dom";
|
||||
import usersService from "../../../services/UsersService";
|
||||
import { tableReload } from "../../../store/TableReloads";
|
||||
import ModalCom from "../../Helpers/ModalCom";
|
||||
@@ -9,21 +9,32 @@ import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
import Detail from "../../jobPopout/popoutcomponent/Detail";
|
||||
import { NewTasks } from "./forms";
|
||||
import { SocketValues } from "../../Contexts/SocketIOContext";
|
||||
import { errorMsg } from "../../../lib/errorMsg";
|
||||
|
||||
import AssignPrevNewTask from "./AssignPrevNewTask";
|
||||
import AssignMediaTask from "./AssignMediaTask";
|
||||
|
||||
const AssignTaskPopout = ({
|
||||
action,
|
||||
details,
|
||||
situation,
|
||||
familyDetailsData,
|
||||
familyTask,
|
||||
jobList,
|
||||
activeTask,
|
||||
setActiveTask,
|
||||
setUpdatePage,
|
||||
assignTaskChecker,
|
||||
|
||||
familyList
|
||||
}) => {
|
||||
|
||||
const newJobList = {...jobList, data:jobList?.data?.filter(item => item?.job_mode == 'FAMILY')}
|
||||
|
||||
const {parentAssignJobToKid} = SocketValues()
|
||||
|
||||
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||
|
||||
|
||||
const apiCall = new usersService();
|
||||
|
||||
let { pathname, state } = useLocation();
|
||||
|
||||
const {userDetails} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||
@@ -37,9 +48,9 @@ const AssignTaskPopout = ({
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const getFamilySession = JSON.parse(sessionStorage.getItem("family_list"));
|
||||
// const getFamilySession = JSON.parse(sessionStorage.getItem("family_list"));
|
||||
|
||||
const familyList = getFamilySession?.map((member) => (
|
||||
const famList = familyList?.map((member) => (
|
||||
<option key={member?.family_uid} value={member?.family_uid}>
|
||||
{member?.firstname} {member?.lastname}
|
||||
</option>
|
||||
@@ -51,6 +62,21 @@ const AssignTaskPopout = ({
|
||||
message: "",
|
||||
}); // HOLDS RESPONSE FOR SENDING API REQUEST
|
||||
|
||||
let [commonMedia, setCommonMedia] = useState({loading: true, data: [], image: ''}) // HOLDS COMMON MEDIA DATA
|
||||
let [activeMedia, setActiveMedia] = useState({}) // HOLDS ACTIVE COMMON MEDIA DATA
|
||||
const handleActiveMedia = (data = {}) => {
|
||||
// FUNCTION TO CHANGE SELECTED ACTIVE MEDIA
|
||||
setActiveMedia({...data});
|
||||
};
|
||||
|
||||
|
||||
let [assignType, setAssignType] = useState("task"); // SWITCHES BTW TASK AND MEDIA ASSIGNMENT
|
||||
|
||||
const switchAssignType = ({ target: { name } }) => {
|
||||
// FUNCTION TO CHANGE ASSIGN TASK TYPE
|
||||
setAssignType(name);
|
||||
};
|
||||
|
||||
let [taskType, setTaskType] = useState(details ? "new" : "select"); // SWITCHES BTW SELECT TASK AND NEW TASK
|
||||
|
||||
const switchTaskType = ({ target: { value } }) => {
|
||||
@@ -67,7 +93,7 @@ const AssignTaskPopout = ({
|
||||
const [formState, setFormState] = useState({
|
||||
// Initialize form state with desired fields
|
||||
banner: details?.banner || "default.jpg",
|
||||
country: details?.country || "",
|
||||
country: details?.country ? details?.country : walletDetails.data.length == 1 ? walletDetails.data[0].country : '',
|
||||
price: details?.price || "",
|
||||
title: details?.title || "",
|
||||
description: details?.description || "",
|
||||
@@ -80,20 +106,20 @@ const AssignTaskPopout = ({
|
||||
setRequestStatus({ loading: true, status: false, message: "" });
|
||||
|
||||
if(!selectedFamilyUid){ // If no family found, throw error
|
||||
setRequestStatus({ loading: false, status: false, message: "Please Select Family Member" });
|
||||
setRequestStatus({ loading: false, status: false, message: "Please Select a Kid" });
|
||||
return setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
let reqData = {};
|
||||
if (taskType == "select") {
|
||||
if (taskType == "select" && assignType == 'task') {
|
||||
// RUNS HERE IF TASK TYPE IS SELECT
|
||||
if (!Object.keys(activeTask.data).length) {
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "No Task is seleted",
|
||||
message: "No Task is selected",
|
||||
});
|
||||
return setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
@@ -111,7 +137,7 @@ const AssignTaskPopout = ({
|
||||
};
|
||||
}
|
||||
|
||||
if (taskType === "new") {
|
||||
if (taskType === "new" && assignType == 'task') {
|
||||
const {
|
||||
banner,
|
||||
category,
|
||||
@@ -170,10 +196,13 @@ const AssignTaskPopout = ({
|
||||
.assignFamilyTask(reqData)
|
||||
.then((res) => {
|
||||
if (res.status != 200 || res.data.internal_return < 0) {
|
||||
|
||||
let error = errorMsg[res?.data?.error_msg] || ''
|
||||
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "failed to assign task",
|
||||
message: error? error : "failed to assign task",
|
||||
});
|
||||
|
||||
return setTimeout(() => {
|
||||
@@ -185,7 +214,7 @@ const AssignTaskPopout = ({
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: true,
|
||||
message: "action successful",
|
||||
message: "Task Assigned successfully",
|
||||
});
|
||||
|
||||
setUpdatePage(prev => !prev); // Updates family task page by calling the useeffect hook
|
||||
@@ -221,6 +250,48 @@ const AssignTaskPopout = ({
|
||||
});
|
||||
};
|
||||
|
||||
const closeModal = () => { // FOR CLOSING ASSIGN TASK MODAL
|
||||
action()
|
||||
}
|
||||
|
||||
const assignMediaTask = (values, helpers) => { // FUNCTION TO HANDLE ASSIGNING MEDIA TASK
|
||||
setRequestStatus({ loading: true, status: false, message: "" });
|
||||
|
||||
if(!selectedFamilyUid){ // If no family found, throw error
|
||||
setRequestStatus({ loading: false, status: false, message: "Please Select a Kid" });
|
||||
return setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
let reqData = {...values, assign_mode:'110012', family_uid:selectedFamilyUid, media_uid:activeMedia.uid, amount:values.amount * 100}
|
||||
|
||||
apiCall.parentAssignMediaTask(reqData).then(res => { // API CALL TO ASSIGN MEDIA TASK
|
||||
if(res.status != 200 || res.data.internal_return < 0){
|
||||
let error = errorMsg[res?.data?.error_msg] || ''
|
||||
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: error? error : "failed to assign task",
|
||||
});
|
||||
return setTimeout(()=>{
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 3000)
|
||||
}
|
||||
setRequestStatus({ loading: false, status: true, message: "Task Assigned Successfully" });
|
||||
return setTimeout(()=>{
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
closeModal() // FOR CLOSING ASSIGN MODAL
|
||||
}, 3000)
|
||||
}).catch(err => {
|
||||
setRequestStatus({ loading: false, status: false, message: "Failed, something went wrong. Try Again" });
|
||||
return setTimeout(()=>{
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(()=>{ // effect to update family UID when components mounts
|
||||
if(familyDetailsData?.uid){
|
||||
setSelectedFamilyUid(familyDetailsData?.uid)
|
||||
@@ -231,12 +302,22 @@ const AssignTaskPopout = ({
|
||||
}
|
||||
},[])
|
||||
|
||||
useEffect(()=>{
|
||||
apiCall.getParentCommonMedia().then((res)=>{
|
||||
// console.log('RESPONSE', res)
|
||||
setCommonMedia({loading: false, data: res?.data?.result, image: ''})
|
||||
setActiveMedia(res?.data?.result[0])
|
||||
}).catch(err => {
|
||||
setCommonMedia({loading: false, data: [], image: ''})
|
||||
})
|
||||
},[])
|
||||
|
||||
return (
|
||||
<>
|
||||
<ModalCom action={action} situation={situation}>
|
||||
<div className="w-11/12 lg:w-[700px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="w-full flex items-center justify-between lg:px-10 lg:py-8 px-[30px] py-[23px] bg-sky-blue/50 border-b dark:border-[#5356fb29] border-light-purple">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide flex items-center">
|
||||
<div className="modal-container">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
{details ? (
|
||||
` Assign ${details?.firstname}'s Task`
|
||||
) : familyDetailsData ? (
|
||||
@@ -244,18 +325,18 @@ const AssignTaskPopout = ({
|
||||
) : (
|
||||
<div className="flex items-center gap-2">
|
||||
<span className="text-black">Assign task to{" "}</span>
|
||||
<div className="w-[270px] h-[40px] flex items-center relative after:absolute after:content-['▼'] active:after:rotate-180 after:transition-all after:duration-300 after:z-20 after:right-2 after:top-1/2 after:-translate-y-1/2 after:text-white after:text-lg">
|
||||
<div className="w-[270px] h-[40px] flex items-center">
|
||||
<select
|
||||
name=""
|
||||
id=""
|
||||
className="relative z-10 appearance-none text-lg text-white px-2 tracking-wide font-semibold transition-all cursor-pointer bg-blue-900 focus:outline-none border border-gray-200 rounded-full w-full h-full"
|
||||
className="text-lg text-black/80 px-2 tracking-wide font-semibold transition-all cursor-pointer bg-white focus:outline-none border border-gray-200 rounded-full w-full h-full"
|
||||
onChange={handleFamChange}
|
||||
value={selectedFamilyUid}
|
||||
>
|
||||
<option value="" className="">
|
||||
Select a kid
|
||||
</option>
|
||||
{familyList}
|
||||
{famList}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -263,7 +344,7 @@ const AssignTaskPopout = ({
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#000] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<svg
|
||||
@@ -287,218 +368,52 @@ const AssignTaskPopout = ({
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
{familyTask?.loading ? (
|
||||
<div className="h-[100px] w-full flex justify-center items-center">
|
||||
<LoadingSpinner color="sky-blue" size="16" />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div
|
||||
className={`job-action-modal-body w-full md:grid ${
|
||||
taskType !== "new" ? "md:grid-cols-2" : "md:grid-cols-1"
|
||||
}`}
|
||||
<div className="modal-body-wrapper p-[0!important]">
|
||||
<div className="px-4 py-2 w-full flex items-center gap-4">
|
||||
<button
|
||||
name='task'
|
||||
className={`py-1 px-2 font-medium bg-transparent border border-purple text-purple transition-all rounded-md duration-300 ${assignType=='task' && 'bg-yellow-500'}`}
|
||||
onClick={switchAssignType}
|
||||
disabled={requestStatus.loading}
|
||||
>
|
||||
<div className="p-4">
|
||||
<div className="mb-2 w-full flex items-center gap-4">
|
||||
<div className="flex items-center gap-2 text-sky-blue text-base">
|
||||
<input
|
||||
type="radio"
|
||||
name="task-type"
|
||||
value="select"
|
||||
className="w-[20px] h-[20px] cursor-pointer"
|
||||
checked={taskType == "select"}
|
||||
onChange={switchTaskType}
|
||||
/>
|
||||
<span>Select Task</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 text-sky-blue text-base">
|
||||
<input
|
||||
type="radio"
|
||||
name="task-type"
|
||||
value="new"
|
||||
className="w-[20px] h-[20px] cursor-pointer"
|
||||
checked={taskType == "new"}
|
||||
onChange={switchTaskType}
|
||||
/>
|
||||
<span>New Task</span>
|
||||
</div>
|
||||
</div>
|
||||
{/* Task Type === select */}
|
||||
{taskType == "select" && (
|
||||
<div className="p-4 w-full h-[400px] overflow-y-auto bg-slate-100 rounded-md dark:bg-[#11131f] dark:text-white">
|
||||
{familyTask?.data?.length ? (
|
||||
familyTask?.data?.map((item, index) => (
|
||||
<div
|
||||
key={item.job_uid}
|
||||
className="mb-2 flex justify-start items-center gap-2 text-sky-blue text-base cursor-pointer"
|
||||
onClick={() => handleActiveTask(item.job_uid, item)}
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
name="task-list"
|
||||
checked={
|
||||
activeTask.id == item.job_uid ||
|
||||
(activeTask.id == index && true)
|
||||
}
|
||||
onChange={() =>
|
||||
handleActiveTask(item.job_uid, item)
|
||||
}
|
||||
className="w-[15px] h-[15px] cursor-pointer"
|
||||
/>
|
||||
<p className="w-full text-dark-gray dark:text-white tracking-wide">
|
||||
{item?.title}
|
||||
</p>
|
||||
</div>
|
||||
))
|
||||
) : (
|
||||
<p className="p-8 text-lg text-dark-gray dark:text-white tracking-wide text-center cursor-default">
|
||||
No Task found!
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
{taskType == "new" && (
|
||||
<div className="p-4 w-full h-[400px]">
|
||||
<NewTasks
|
||||
formState={formState}
|
||||
setFormState={setFormState}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/*Right Hand Side for details && Task Type === select */}
|
||||
{taskType == "select" && (
|
||||
<>
|
||||
{familyTask?.data?.length > 0 ? (
|
||||
<div className="p-4">
|
||||
<div className="w-full">
|
||||
<p className="text-lg font-bold text-dark-gray dark:text-white tracking-wide border-b-2">
|
||||
{activeTask?.data?.title}
|
||||
</p>
|
||||
<div className="my-3">
|
||||
<Detail
|
||||
label="Description"
|
||||
value={activeTask?.data?.description}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex items-center">
|
||||
<div className="my-3 w-full flex items-center gap-1">
|
||||
<label className="job-label">
|
||||
Price
|
||||
</label>
|
||||
<p className="p-1 text-sm text-slate-900 dark:text-white">
|
||||
{PriceFormatter(
|
||||
activeTask?.data?.price * 0.01,
|
||||
activeTask?.data?.currency,
|
||||
activeTask?.data?.curreny_code
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="my-3 w-full flex items-center gap-1">
|
||||
<label className="job-label">
|
||||
Timeline
|
||||
</label>
|
||||
<p className="p-1 text-sm text-slate-900 dark:text-white">{`${activeTask?.data?.timeline_days} day(s)`}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Dummy, no value found for created! thus commented*/}
|
||||
{/* <div className="my-3 sm:flex items-center">
|
||||
<Detail
|
||||
label="Created"
|
||||
value={`Dummy, no value found for created!`}
|
||||
/>
|
||||
</div> */}
|
||||
|
||||
<div className="my-3">
|
||||
<label className="w-full job-label">
|
||||
Delivery Detail
|
||||
</label>
|
||||
<textarea
|
||||
className={`p-1 w-full text-sm text-slate-900 dark:text-white bg-transparent outline-none border border-slate-300 rounded-md`}
|
||||
rows="5"
|
||||
style={{ resize: "none" }}
|
||||
value={activeTask?.data?.job_detail}
|
||||
readOnly
|
||||
// onChange={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* BTN */}
|
||||
<div className="py-2 px-4 border-t-2 flex justify-between items-center">
|
||||
{/* error or success display */}
|
||||
<div className="w-auto h-auto flex items-center">
|
||||
{requestStatus.message != "" &&
|
||||
(!requestStatus.status ? (
|
||||
<div
|
||||
className={`relative p-2 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px] self-start`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
) : (
|
||||
requestStatus.status && (
|
||||
<div
|
||||
className={`relative p-2 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* End of error or success display */}
|
||||
<div className="w-auto h-auto flex items-center gap-20">
|
||||
<button
|
||||
disabled={requestStatus.loading}
|
||||
onClick={action}
|
||||
type="button"
|
||||
className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white cursor-pointer"
|
||||
>
|
||||
<span className="text-gradient">Close</span>
|
||||
</button>
|
||||
<div className="">
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner color="sky-blue" size="8" />
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
disabled={requestStatus.loading}
|
||||
onClick={assignFamilyTask}
|
||||
className="px-1 w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white cursor-pointer"
|
||||
>
|
||||
Assign
|
||||
</button>
|
||||
)
|
||||
// : (
|
||||
// <button
|
||||
// type="button"
|
||||
// disabled={requestStatus.loading}
|
||||
// onClick={assignFamilyTask}
|
||||
// className="px-1 w-40 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white cursor-pointer"
|
||||
// >
|
||||
// {details
|
||||
// ? `Assign task to ${details?.firstname}`
|
||||
// : familyDetailsData
|
||||
// ? `Assign task to ${familyDetailsData.firstname}`
|
||||
// : "Assign"}
|
||||
// </button>
|
||||
// )
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
Task
|
||||
</button>
|
||||
<button
|
||||
name='media'
|
||||
className={`py-1 px-2 font-medium bg-transparent border border-purple text-purple transition-all rounded-md duration-300 ${assignType=='media' && 'bg-yellow-500'}`}
|
||||
onClick={switchAssignType}
|
||||
disabled={requestStatus.loading}
|
||||
>
|
||||
Media
|
||||
</button>
|
||||
</div>
|
||||
<div className="contents">
|
||||
{assignType == 'task' ?
|
||||
<AssignPrevNewTask
|
||||
jobList={newJobList}
|
||||
requestStatus={requestStatus}
|
||||
assignFamilyTask={assignFamilyTask}
|
||||
taskType={taskType}
|
||||
switchTaskType={switchTaskType}
|
||||
formState={formState}
|
||||
setFormState={setFormState}
|
||||
activeTask={activeTask}
|
||||
handleActiveTask={handleActiveTask}
|
||||
closeModal={closeModal}
|
||||
/>
|
||||
:
|
||||
<AssignMediaTask
|
||||
commonMedia={commonMedia}
|
||||
requestStatus={requestStatus}
|
||||
assignMediaTask={assignMediaTask}
|
||||
activeMedia={activeMedia}
|
||||
handleActiveMedia={handleActiveMedia}
|
||||
closeModal={closeModal}
|
||||
family_uid = {selectedFamilyUid}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
</>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import usersService from "../../../../services/UsersService";
|
||||
import InputCom from "../../../Helpers/Inputs/InputCom";
|
||||
import { useSelector } from "react-redux";
|
||||
|
||||
export default function NewTasks({ formState, setFormState }) {
|
||||
let [currency, setCurrency] = useState({
|
||||
loading: true,
|
||||
status: false,
|
||||
data: null,
|
||||
});
|
||||
|
||||
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||
|
||||
// let [currency, setCurrency] = useState({
|
||||
// loading: true,
|
||||
// status: false,
|
||||
// data: null,
|
||||
// });
|
||||
|
||||
const selectImage = require(`../../../../assets/images/taskbanners/${
|
||||
formState.banner || "default.jpg"
|
||||
@@ -15,25 +19,25 @@ export default function NewTasks({ formState, setFormState }) {
|
||||
const ApiCall = new usersService();
|
||||
|
||||
// FUNCTION TO GET Currency
|
||||
const getUserCurrency = () => {
|
||||
setCurrency((prev) => ({ ...prev, loading: true }));
|
||||
ApiCall.getUserWallets()
|
||||
.then((res) => {
|
||||
if (res.data.internal_return < 0) {
|
||||
setCurrency({ loading: false, status: true, data: [] });
|
||||
return;
|
||||
}
|
||||
// const getUserCurrency = () => {
|
||||
// setCurrency((prev) => ({ ...prev, loading: true }));
|
||||
// ApiCall.getUserWallets()
|
||||
// .then((res) => {
|
||||
// if (res.data.internal_return < 0) {
|
||||
// setCurrency({ loading: false, status: true, data: [] });
|
||||
// return;
|
||||
// }
|
||||
|
||||
setCurrency({
|
||||
loading: false,
|
||||
status: true,
|
||||
data: res.data.result_list,
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
setCurrency({ loading: false, status: false, data: [] });
|
||||
});
|
||||
};
|
||||
// setCurrency({
|
||||
// loading: false,
|
||||
// status: true,
|
||||
// data: res.data.result_list,
|
||||
// });
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// setCurrency({ loading: false, status: false, data: [] });
|
||||
// });
|
||||
// };
|
||||
|
||||
const handleInputChange = (event) => {
|
||||
const { name, value } = event.target;
|
||||
@@ -43,79 +47,163 @@ export default function NewTasks({ formState, setFormState }) {
|
||||
}));
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getUserCurrency();
|
||||
}, []);
|
||||
// useEffect(() => {
|
||||
// getUserCurrency();
|
||||
// }, []);
|
||||
|
||||
return (
|
||||
<form className="w-full flex justify-between items-start">
|
||||
<div className="flex flex-col gap-3 max-w-[77%]">
|
||||
{/* inputs starts here */}
|
||||
<div className="grid md:grid-cols-3 grid-cols-1 gap-6 mb-[5px]">
|
||||
{/* Currency */}
|
||||
<div className="field w-full mb-6 xl:mb-0">
|
||||
<label
|
||||
htmlFor="country"
|
||||
className="job-label"
|
||||
>
|
||||
Currency
|
||||
{/* {props.errors.country && props.touched.country && <span className="text-[12px] text-red-500">{props.errors.country}</span>} */}
|
||||
</label>
|
||||
<select
|
||||
id="country"
|
||||
name="country"
|
||||
value={formState.country}
|
||||
className={`input-field p-2 mt-3 rounded-md placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none`}
|
||||
onChange={handleInputChange}
|
||||
// onBlur={props.handleBlur}
|
||||
>
|
||||
{currency?.loading ? (
|
||||
<option className="text-slate-500 text-[13.975px]" value="">
|
||||
Loading...
|
||||
</option>
|
||||
) : currency.data.length ? (
|
||||
<>
|
||||
<option className="text-slate-500 text-[13.975px]" value="">
|
||||
Currency
|
||||
</option>
|
||||
{currency.data?.map((item, index) => (
|
||||
<option
|
||||
key={index}
|
||||
className="text-slate-500 text-lg"
|
||||
value={item?.country}
|
||||
>
|
||||
{item?.description}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
) : (
|
||||
<option className="text-slate-500 text-lg" value="">
|
||||
No Options Found! Try Again
|
||||
</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
<div className="w-full block sm:grid grid-cols-3 gap-2">
|
||||
|
||||
<div className="w-full flex flex-col gap-2 col-span-2">
|
||||
{/* Title */}
|
||||
<div className="field w-full">
|
||||
<label htmlFor="price" className="job-label">Price</label>
|
||||
<label htmlFor="title" className="job-label">Title</label>
|
||||
<InputCom
|
||||
fieldClass="px-6 text-right"
|
||||
// label="Price"
|
||||
fieldClass="px-6"
|
||||
// label="Title"
|
||||
// labelClass="tracking-wide"
|
||||
inputBg="bg-slate-100"
|
||||
type="number"
|
||||
name="price"
|
||||
placeholder="0"
|
||||
value={formState.price}
|
||||
type="text"
|
||||
name="title"
|
||||
value={formState.title}
|
||||
inputHandler={handleInputChange}
|
||||
// blurHandler={props.handleBlur}
|
||||
// error={props.errors.price && props.touched.price && props.errors.price}
|
||||
// blurHandler={props.handleBlur}
|
||||
// error={props.errors.title && props.touched.title && props.errors.title}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<div className="field flex flex-col sm:flex-row w-full gap-2">
|
||||
<div className="w-full">
|
||||
<label
|
||||
htmlFor="description"
|
||||
className='job-label'
|
||||
>
|
||||
Description
|
||||
</label>
|
||||
<textarea
|
||||
id="description"
|
||||
rows="5"
|
||||
className={`input-field px-3 py-2 placeholder:text-base text-dark-gray dark:text-white w-full h-[80px] bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px]`}
|
||||
style={{ resize: "none" }}
|
||||
name="description"
|
||||
value={formState.description}
|
||||
onChange={handleInputChange}
|
||||
// onBlur={props.handleBlur}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Details */}
|
||||
<div className="field flex flex-col sm:flex-row w-full gap-2">
|
||||
<div className="w-full">
|
||||
<label
|
||||
htmlFor="Job Delivery Details"
|
||||
className='job-label'
|
||||
>
|
||||
Delivery Detail
|
||||
{/* {props.errors.job_detail && props.touched.job_detail && <span className="text-[12px] text-red-500">{props.errors.job_detail}</span>} */}
|
||||
</label>
|
||||
<textarea
|
||||
id="Job Delivery Details"
|
||||
rows="5"
|
||||
className={`input-field px-3 py-2 placeholder:text-base text-dark-gray dark:text-white w-full h-[100px] bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px]`}
|
||||
style={{ resize: "none" }}
|
||||
name="job_detail"
|
||||
value={formState.job_detail}
|
||||
onChange={handleInputChange}
|
||||
// onBlur={props.handleBlur}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* inputs starts here */}
|
||||
<div className="w-full flex flex-col gap-2">
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
{/* Price */}
|
||||
<div className="field w-full">
|
||||
<label htmlFor="price" className="job-label">Reward</label>
|
||||
<InputCom
|
||||
fieldClass="px-6 text-right"
|
||||
// label="Price"
|
||||
// labelClass="tracking-wide"
|
||||
inputBg="bg-slate-100"
|
||||
type="number"
|
||||
name="price"
|
||||
placeholder="0"
|
||||
value={formState.price}
|
||||
inputHandler={handleInputChange}
|
||||
// blurHandler={props.handleBlur}
|
||||
// error={props.errors.price && props.touched.price && props.errors.price}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Currency */}
|
||||
<div className="field w-full">
|
||||
<label
|
||||
htmlFor="country"
|
||||
className="job-label invisible"
|
||||
>
|
||||
Currency
|
||||
{/* {props.errors.country && props.touched.country && <span className="text-[12px] text-red-500">{props.errors.country}</span>} */}
|
||||
</label>
|
||||
<select
|
||||
id="country"
|
||||
name="country"
|
||||
value={formState.country}
|
||||
className={`input-field w-full h-[42px] flex items-center px-2 mt-2 rounded-full placeholder:text-base text-dark-gray dark:text-white bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none`}
|
||||
onChange={handleInputChange}
|
||||
disabled={walletDetails.data.length == 1}
|
||||
// onBlur={props.handleBlur}
|
||||
>
|
||||
{walletDetails?.loading ? (
|
||||
<option className="text-slate-500 text-[13.975px]" value="">
|
||||
Loading...
|
||||
</option>
|
||||
) : walletDetails.data.length ? (
|
||||
<>
|
||||
{walletDetails.data.length == 1 ?
|
||||
<>
|
||||
{walletDetails.data?.map((item, index) => (
|
||||
<option
|
||||
key={index}
|
||||
className="text-slate-500 text-lg"
|
||||
value={item?.country}
|
||||
>
|
||||
{item?.code}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
:
|
||||
<>
|
||||
<option className="text-slate-500 text-[13.975px]" value="">
|
||||
Select
|
||||
</option>
|
||||
{walletDetails.data?.map((item, index) => (
|
||||
<option
|
||||
key={index}
|
||||
className="text-slate-500 text-lg"
|
||||
value={item?.country}
|
||||
>
|
||||
{item?.code}
|
||||
</option>
|
||||
))}
|
||||
</>
|
||||
}
|
||||
</>
|
||||
) : (
|
||||
<option className="text-slate-500 text-lg" value="">
|
||||
No Options Found! Try Again
|
||||
</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Duration */}
|
||||
<div className="field w-full mb-6 xl:mb-0">
|
||||
<div className="field w-full">
|
||||
<label
|
||||
htmlFor="timeline_days"
|
||||
className="job-label"
|
||||
@@ -127,17 +215,18 @@ export default function NewTasks({ formState, setFormState }) {
|
||||
id="timeline_days"
|
||||
name="timeline_days"
|
||||
value={formState.timeline_days}
|
||||
className={`input-field p-2 mt-3 rounded-md placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none`}
|
||||
className={`input-field w-full h-[42px] flex items-center px-2 mt-2 rounded-full placeholder:text-base text-dark-gray dark:text-white bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none`}
|
||||
onChange={handleInputChange}
|
||||
// onBlur={props.handleBlur}
|
||||
>
|
||||
{publicArray.length && (
|
||||
<>
|
||||
<option className="text-slate-500 text-[13.975px]" value="">
|
||||
Duration
|
||||
Select
|
||||
</option>
|
||||
{publicArray.map(({ name, duration }, idx) => (
|
||||
<option
|
||||
key={idx}
|
||||
className="text-slate-500 text-[13.975px]"
|
||||
value={duration}
|
||||
>
|
||||
@@ -148,74 +237,19 @@ export default function NewTasks({ formState, setFormState }) {
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<div className="field w-full mb-[5px]">
|
||||
<label htmlFor="title" className="job-label">Title</label>
|
||||
<InputCom
|
||||
fieldClass="px-6"
|
||||
// label="Title"
|
||||
// labelClass="tracking-wide"
|
||||
inputBg="bg-slate-100"
|
||||
type="text"
|
||||
name="title"
|
||||
value={formState.title}
|
||||
inputHandler={handleInputChange}
|
||||
// blurHandler={props.handleBlur}
|
||||
// error={props.errors.title && props.touched.title && props.errors.title}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<div className="field w-full mb-[5px]">
|
||||
<label htmlFor="description" className="job-label">Description</label>
|
||||
<InputCom
|
||||
fieldClass="px-6"
|
||||
// label="Description"
|
||||
// labelClass="tracking-wide"
|
||||
inputBg="bg-slate-100"
|
||||
type="text"
|
||||
name="description"
|
||||
value={formState.description}
|
||||
inputHandler={handleInputChange}
|
||||
// blurHandler={props.handleBlur}
|
||||
// error={props.errors.description && props.touched.description && props.errors.description}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Details */}
|
||||
<div className="field flex flex-col sm:flex-row w-full mb-[5px] gap-2">
|
||||
{/* Banner Image */}
|
||||
<div className="w-full">
|
||||
<label
|
||||
htmlFor="Job Delivery Details"
|
||||
className='job-label'
|
||||
>
|
||||
Job Delivery Details
|
||||
{/* {props.errors.job_detail && props.touched.job_detail && <span className="text-[12px] text-red-500">{props.errors.job_detail}</span>} */}
|
||||
</label>
|
||||
<textarea
|
||||
id="Job Delivery Details"
|
||||
rows="5"
|
||||
className={`input-field px-3 py-2 placeholder:text-base text-dark-gray dark:text-white w-full h-[100px] bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-[#dce4e9] rounded-[10px]`}
|
||||
style={{ resize: "none" }}
|
||||
name="job_detail"
|
||||
value={formState.job_detail}
|
||||
onChange={handleInputChange}
|
||||
// onBlur={props.handleBlur}
|
||||
/>
|
||||
<div className="h-32 w-full">
|
||||
<img
|
||||
src={selectImage}
|
||||
alt="task_banner_img"
|
||||
className="w-full h-full object-contain"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* Banner Image */}
|
||||
<div className="max-w-[20%] w-full">
|
||||
<div className="h-32 w-full">
|
||||
<img
|
||||
src={selectImage}
|
||||
alt="task_banner_img"
|
||||
className="w-full h-full object-contain"
|
||||
/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import React, {useState, useEffect} from "react";
|
||||
import { Outlet } from "react-router-dom";
|
||||
import Layout from "../Partials/Layout";
|
||||
import usersService from "../../services/UsersService";
|
||||
|
||||
|
||||
export default function FamilyRoutes() {
|
||||
|
||||
const apiCall = new usersService();
|
||||
|
||||
const [loader, setLoader] = useState(false);
|
||||
|
||||
const [familyList, setFamilyList] = useState({});
|
||||
|
||||
const [listReload, setListReload] = useState(false);
|
||||
|
||||
const memberList = async () => {
|
||||
setLoader(true);
|
||||
try {
|
||||
const res = await apiCall.familyListings();
|
||||
const { data } = res;
|
||||
if (data?.internal_return >= 0 && data?.status === "OK") {
|
||||
const { result_list, session_image_server } = data;
|
||||
setFamilyList({ result_list, session_image_server });
|
||||
sessionStorage.setItem("family_list", JSON.stringify(result_list))
|
||||
setLoader(false);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
setLoader(false);
|
||||
throw new Error(error);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
memberList();
|
||||
}, [listReload]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Outlet context={{loader, setLoader, familyList, setListReload}} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,15 @@
|
||||
import React from 'react'
|
||||
import React, {Suspense, lazy} from 'react'
|
||||
// import FamilyList from '../../FamilyList'
|
||||
import LoadingSpinner from '../../../../components/Spinners/LoadingSpinner'
|
||||
|
||||
const AddFamily = () => {
|
||||
const FamilyListSettings = lazy(() => import('../../FamilyListSettings'));
|
||||
return (
|
||||
<div>Add Family</div>
|
||||
<>
|
||||
<Suspense fallback={<LoadingSpinner color="sky-blue" size="16" height='h-full min-h-[500px]' />}>
|
||||
<FamilyListSettings />
|
||||
</Suspense>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
import React, { Suspense, useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useLocation, useOutletContext } from "react-router-dom";
|
||||
import usersService from "../../../../services/UsersService";
|
||||
import ModalCom from '../../../Helpers/ModalCom';
|
||||
import LoadingSpinner from "../../../Spinners/LoadingSpinner";
|
||||
import localImgLoad from '../../../../lib/localImgLoad'
|
||||
|
||||
// import { tableReload } from "../../../store/TableReloads";
|
||||
// import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||
|
||||
|
||||
const RelativePopout = ({
|
||||
relativeSelected,
|
||||
action,
|
||||
situation,
|
||||
familyList
|
||||
}) => {
|
||||
|
||||
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||
|
||||
const {userDetails} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||
|
||||
const [relativeSettings, setRelativeSettings] = useState({loading:true, data:[]})
|
||||
const [reloadSettings, setReloadSettings] = useState(false)
|
||||
|
||||
const [relativeEditKids, setRelativeEditKids] = useState({loading:false, family_uid: ''})
|
||||
|
||||
const apiCall = new usersService();
|
||||
|
||||
let { pathname, state } = useLocation();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const handleUncheck = (e, family_uid) => { // FUNCTION TO EDIT RELATIVE KIDS
|
||||
let isChecked = e.target.checked
|
||||
const reqData = {
|
||||
family_uid: family_uid,
|
||||
relative_uid: relativeSelected.relative_uid,
|
||||
add: isChecked ? '1' : '0'
|
||||
}
|
||||
// console.log('family_uid', isChecked)
|
||||
setRelativeEditKids({loading:true, family_uid:family_uid})
|
||||
apiCall.getRelativeEditKids(reqData).then(res => {
|
||||
setReloadSettings(prev => !prev) // MAKE RELATIVE SETTINGS TO RELOAD IN ORDER TO SET RELATIVE EDIT KIDS LOADING TO FALSE
|
||||
// setRelativeEditKids({loading:false, family_uid:''})
|
||||
}).catch((err)=>{
|
||||
setRelativeEditKids({loading:false, family_uid:''})
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(()=>{ // FUNCTION TO GET RELATIVE KIDS SETTINGS
|
||||
apiCall.getRelativeSettings({relative_uid: relativeSelected.relative_uid}).then(res => {
|
||||
setRelativeSettings({loading:false, data:res?.data?.kids_list || []})
|
||||
}).catch((err)=>{
|
||||
setRelativeSettings({loading:false, data:[]})
|
||||
console.log(err)
|
||||
}).finally(()=>{ // SET RELATIVE EDIT KIDS TO FALSE
|
||||
setRelativeEditKids({loading:false, family_uid:''})
|
||||
})
|
||||
},[reloadSettings])
|
||||
|
||||
return (
|
||||
<>
|
||||
<ModalCom action={action} situation={situation}>
|
||||
<div className="modal-container">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
{relativeSelected.firstname && relativeSelected.firstname} {relativeSelected.lastname && relativeSelected.lastname}
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<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="modal-body-wrapper">
|
||||
<div className="h-full w-full grid grid-cols-2 gap-2 space-x-2">
|
||||
<div className='col-span-2 md:col-span-1 overflow-y-auto h-[350px]'>
|
||||
{familyList.loader || relativeSettings.loading ?
|
||||
<LoadingSpinner size='10' color='bg-sky-500' height='min-h-[300px]' />
|
||||
: (!familyList.loader && familyList?.familyList?.result_list?.length > 0) ?
|
||||
familyList?.familyList?.result_list?.map(item => {
|
||||
const isChecked = relativeSettings?.data?.filter(value => value?.family_uid == item?.family_uid)
|
||||
const image = localStorage.getItem("session_token") ? `${familyList?.imageServer}${localStorage.getItem("session_token")}/family/${item?.family_uid}` : "";
|
||||
return (
|
||||
<div key={item.family_uid || index} className="flex items-center border-b dark:border-[#5356fb29] hover:bg-gray-50">
|
||||
<div className='p-2 flex justify-center items-center'>
|
||||
{relativeEditKids.loading && relativeEditKids.family_uid == item.family_uid?
|
||||
<LoadingSpinner size='4' color='bg-sky-500' />
|
||||
:
|
||||
<input
|
||||
checked={isChecked?.length > 0}
|
||||
type="checkbox"
|
||||
className='w-4 h-4 border-2 border-blue-500 rounded-sm bg-white cursor-pointer'
|
||||
onChange={(e) => handleUncheck(e, item.family_uid)}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
<div className='p-2'>
|
||||
<div className="flex space-x-2 items-center w-full">
|
||||
<div className="min-w-[30px] min-h-[30px] max-w-[30px] max-h-[30px] rounded-full overflow-hidden flex justify-center items-center">
|
||||
<img
|
||||
src={image || localImgLoad(`images/icons/${banner}`)}
|
||||
alt={`Avatar`}
|
||||
className="w-full h-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col w-full">
|
||||
<h1 className="font-bold text-[16px] text-dark-gray dark:text-white whitespace-nowrap">
|
||||
{`${item?.firstname} ${item?.lastname}`}
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
:
|
||||
<div className='min-h-[100px] w-full flex flex-col justify-center items-center'>No records found!</div>
|
||||
}
|
||||
</div>
|
||||
<div className='col-span-2 md:col-span-1 bg-green-100 min-h-[100px]'>
|
||||
{/* dummy to be filled latter*/}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer-wrapper justify-end">
|
||||
<button
|
||||
onClick={action}
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className='text-gradient'>Close</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default RelativePopout;
|
||||
@@ -0,0 +1,173 @@
|
||||
import React, { Suspense, useEffect, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useLocation, useOutletContext } from "react-router-dom";
|
||||
import usersService from "../../../../services/UsersService";
|
||||
import ModalCom from '../../../Helpers/ModalCom';
|
||||
import LoadingSpinner from "../../../Spinners/LoadingSpinner";
|
||||
import localImgLoad from '../../../../lib/localImgLoad'
|
||||
|
||||
// import { tableReload } from "../../../store/TableReloads";
|
||||
// import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||
|
||||
|
||||
const RelativeReminderPopout = ({
|
||||
relativeSelected,
|
||||
action,
|
||||
situation,
|
||||
familyList
|
||||
}) => {
|
||||
|
||||
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||
|
||||
const {userDetails} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
|
||||
|
||||
const [relativeReminder, setRelativeReminder] = useState({loading:false, status:false, msg:''})
|
||||
|
||||
const apiCall = new usersService();
|
||||
|
||||
let { pathname, state } = useLocation();
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const cancelInvite = (family_uid) => { // FUNCTION TO EDIT RELATIVE KIDS
|
||||
const reqData = {
|
||||
relative_uid: relativeSelected.relative_uid,
|
||||
reminder: 'PENDING_ACCOUNT'
|
||||
}
|
||||
}
|
||||
|
||||
const sendRelativeReminder = ()=>{ // FUNCTION TO SEND REMINDER
|
||||
setRelativeReminder({loading:true, status:false, msg:''})
|
||||
const reqData = {
|
||||
relative_uid: relativeSelected.relative_uid,
|
||||
reminder: 'PENDING_ACCOUNT'
|
||||
}
|
||||
apiCall.sendRelativeReminder(reqData).then(res => {
|
||||
if(res?.data?.internal_return < 0){
|
||||
setRelativeReminder({loading:false, status:false, msg:'failed to send'})
|
||||
return
|
||||
}
|
||||
setRelativeReminder({loading:false, status:true, msg:'Reminder Sent'})
|
||||
setTimeout(()=>{
|
||||
action() // CLOSE MODAL
|
||||
}, 3000)
|
||||
}).catch((err)=>{
|
||||
setRelativeReminder({loading:false, status:false, msg:'Network error'})
|
||||
console.log(err)
|
||||
}).finally(()=>{
|
||||
setTimeout(()=>{
|
||||
setRelativeReminder({loading:false, status:false, msg:''})
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<ModalCom action={action} situation={situation}>
|
||||
<div className="modal-container">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
{relativeSelected.firstname && relativeSelected.firstname} {relativeSelected.lastname && relativeSelected.lastname}
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<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="modal-body-wrapper">
|
||||
<div className="h-full w-full grid grid-cols-4 gap-2 space-x-4">
|
||||
<div className='col-span-4 md:col-span-3 overflow-y-auto h-full md:border-r-2'>
|
||||
<div className='p-2 w-full md:max-w-xl flex flex-col gap-4 justify-center items-center rounded-2xl'>
|
||||
<div className='py-2 w-full flex items-center gap-1'>
|
||||
<h1 className="min-w-[120px] text-xl text-right font-extrabold text-black dark:text-white tracking-wide">First name :</h1>
|
||||
{/* <p className="text-lg font-normal text-dark-gray dark:text-white tracking-wide">{'Dummy'}</p> */}
|
||||
</div>
|
||||
<div className='py-2 w-full flex items-center gap-1'>
|
||||
<h1 className="min-w-[120px] text-xl text-right font-extrabold text-black dark:text-white tracking-wide">Last name :</h1>
|
||||
{/* <p className="text-lg font-normal text-dark-gray dark:text-white tracking-wide">{'Dummy'}</p> */}
|
||||
</div>
|
||||
<div className='py-2 w-full flex items-center gap-1'>
|
||||
<h1 className="min-w-[120px] text-xl text-right font-extrabold text-black dark:text-white tracking-wide">Email :</h1>
|
||||
{/* <p className="text-lg font-normal text-dark-gray dark:text-white tracking-wide">{'Dummy'}</p> */}
|
||||
</div>
|
||||
<div className='py-2 w-full flex items-center gap-1'>
|
||||
<h1 className="min-w-[120px] text-xl text-right font-extrabold text-black dark:text-white tracking-wide">Family Type :</h1>
|
||||
{/* <p className="text-lg font-normal text-dark-gray dark:text-white tracking-wide">{'Dummy'}</p> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='col-span-4 md:col-span-1 min-h-[100px] flex md:flex-col justify-between items-center'>
|
||||
<>
|
||||
{relativeReminder.loading ?
|
||||
<LoadingSpinner size='10' color='bg-sky-500' />
|
||||
:
|
||||
<button
|
||||
className={`p-4 w-200px md:w-full bg-emerald-700 text-white px-2 py-2 border-4 border-slate-300 text-lg lg:text-xl font-medium rounded-2xl ${relativeReminder.status && 'opacity-50'}`}
|
||||
name='sendreminder'
|
||||
onClick={sendRelativeReminder}
|
||||
disabled={relativeReminder.status || relativeReminder.loading}
|
||||
>
|
||||
{/* {relativeReminder.msg ? relativeReminder.msg : <>Send <br />Reminder</>} */}
|
||||
Send <br />Reminder
|
||||
</button>
|
||||
}
|
||||
</>
|
||||
<>
|
||||
{relativeReminder.msg &&
|
||||
<p className={`hidden md:flex w-full break-words text-center ${relativeReminder.status ? 'text-emerald-500' : 'text-red-500'}`}>{relativeReminder.msg}</p>
|
||||
}
|
||||
</>
|
||||
<>
|
||||
{/* <LoadingSpinner size='10' color='bg-sky-500' /> */}
|
||||
<button
|
||||
className='p-4 w-200px md:w-full bg-orange-500 text-white px-2 py-2 border-4 border-slate-300 text-lg lg:text-xl font-medium rounded-2xl'
|
||||
name='cancelreminder'
|
||||
onClick={cancelInvite}
|
||||
>
|
||||
Cancel <br />Invitation
|
||||
</button>
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
<>
|
||||
{relativeReminder.msg &&
|
||||
<p className={`md:hidden w-full break-words text-center ${relativeReminder.status ? 'text-emerald-500' : 'text-red-500'}`}>{relativeReminder.msg}</p>
|
||||
}
|
||||
</>
|
||||
</div>
|
||||
<div className="modal-footer-wrapper justify-end">
|
||||
<button
|
||||
onClick={action}
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className='text-gradient'>Close</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default RelativeReminderPopout;
|
||||
@@ -2,7 +2,10 @@ import React, { useState } from 'react'
|
||||
import { handlePagingFunc } from '../../../Pagination/HandlePagination';
|
||||
import PaginatedList from '../../../Pagination/PaginatedList';
|
||||
|
||||
export default function RelativeTable({relativeList}) {
|
||||
import RelativePopout from './RelativePopout';
|
||||
import RelativeReminderPopout from './RelativeReminderPopout';
|
||||
|
||||
export default function RelativeTable({relativeList, familyList}) {
|
||||
|
||||
// Handle Pagination
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
@@ -10,21 +13,43 @@ export default function RelativeTable({relativeList}) {
|
||||
const indexOfLastItem =Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||
|
||||
const currentRelativeList = relativeList?.slice(indexOfFirstItem, indexOfLastItem);
|
||||
|
||||
const [relativePopout, setRelativePopout] = useState({show:false, data:null})
|
||||
|
||||
const [reminderPopout, setReminderPopout] = useState({show:false, data:null})
|
||||
|
||||
const closePopout = () => {
|
||||
setRelativePopout({show:false, data:null})
|
||||
}
|
||||
|
||||
const closeReminderPopout = () => {
|
||||
setReminderPopout({show:false, data:null})
|
||||
}
|
||||
|
||||
const handlePagination = (e) => {
|
||||
handlePagingFunc(e, setCurrentPage);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={`w-full overflow-hidden rounded-2xl`}>
|
||||
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between min-h-[400px]">
|
||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className='py-4 px-2'></th>
|
||||
<th className='py-4 px-2'></th>
|
||||
<th className='py-4 px-2 text-center'>Status</th>
|
||||
<th className='py-4 px-2 text-center'>Kids</th>
|
||||
<th className='py-4 px-2'></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<>
|
||||
{relativeList && relativeList?.length > 0 ? (
|
||||
currentRelativeList.map((value, index) => (
|
||||
<tr key={value.uid || index} className="border-b dark:border-[#5356fb29] hover:bg-gray-50">
|
||||
<td className='p-2'>
|
||||
<td className='py-4 px-2'>
|
||||
<div className="flex flex-col">
|
||||
<h1 className="font-bold text-xl text-dark-gray dark:text-white">
|
||||
{value.firstname && value.firstname} {value.lastname && value.lastname}
|
||||
@@ -34,13 +59,49 @@ export default function RelativeTable({relativeList}) {
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td className='p-2'>
|
||||
<td className='py-4 px-2'>
|
||||
{/* <span>Family Type</span> */}
|
||||
<span>{value.family_type && value.family_type.toUpperCase()}</span>
|
||||
</td>
|
||||
<td className='p-2 text-right'>
|
||||
{value.status_action ?
|
||||
<td className='py-4 px-2 text-center'>
|
||||
<button
|
||||
type='button'
|
||||
className='p-1 cursor-pointer text-center bg-sky-50'
|
||||
onClick={() => setReminderPopout({show:true, data:{relativeSelected:value}})}
|
||||
>
|
||||
{value.status && value.status}
|
||||
</button>
|
||||
</td>
|
||||
:
|
||||
<td className='py-4 px-2 text-center'>
|
||||
{value.status && value.status}
|
||||
</td>
|
||||
}
|
||||
<td className='py-4 px-2 text-center'>
|
||||
{value.kid_count && value.kid_count}
|
||||
</td>
|
||||
<td className='py-4 px-2 flex items-center justify-end'>
|
||||
<button
|
||||
onClick={() => setRelativePopout({show:true, data:{relativeSelected:value}})}
|
||||
type="button"
|
||||
className="w-12 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
) : (
|
||||
@@ -69,5 +130,25 @@ export default function RelativeTable({relativeList}) {
|
||||
{/* END OF PAGINATION BUTTON */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{relativePopout.show &&
|
||||
<RelativePopout
|
||||
situation={relativePopout.show}
|
||||
action={closePopout}
|
||||
relativeSelected={relativePopout.data.relativeSelected}
|
||||
familyList={familyList}
|
||||
/>
|
||||
}
|
||||
|
||||
{reminderPopout.show &&
|
||||
<RelativeReminderPopout
|
||||
situation={reminderPopout.show}
|
||||
action={closeReminderPopout}
|
||||
relativeSelected={reminderPopout.data.relativeSelected}
|
||||
familyList={familyList}
|
||||
/>
|
||||
}
|
||||
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ import InviteRelative from './InviteRelative'
|
||||
import usersService from '../../../../services/UsersService'
|
||||
import LoadingSpinner from '../../../Spinners/LoadingSpinner'
|
||||
|
||||
const Relatives = () => {
|
||||
const Relatives = ({familyList}) => {
|
||||
|
||||
const api = new usersService()
|
||||
|
||||
@@ -47,7 +47,7 @@ const Relatives = () => {
|
||||
{relativeList.loading ?
|
||||
<LoadingSpinner size='8' height='h-full' />
|
||||
:
|
||||
<RelativeTable relativeList={relativeList.result_list} />
|
||||
<RelativeTable relativeList={relativeList.result_list} familyList={familyList} />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Link, useLocation } from "react-router-dom";
|
||||
import { Link, useLocation, useOutletContext } from "react-router-dom";
|
||||
import CustomBreadcrumb from "../../Breadcrumb/CustomBreadcrumb";
|
||||
import Icons from "../../Helpers/Icons";
|
||||
import Layout from "../../Partials/Layout";
|
||||
import { AddFamily, FamilyBanner, Relatives } from "./Tabs";
|
||||
|
||||
const FamilySettings = () => {
|
||||
|
||||
const {loader, setLoader, familyList, setListReload} = useOutletContext() // CONTEXT VALUES FROM OUTLET TO CHILD
|
||||
|
||||
let { state } = useLocation();
|
||||
|
||||
const imageServer = state?.imageServer
|
||||
|
||||
let relativeFamilyList = {loader, familyList, imageServer}
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
id: 1,
|
||||
@@ -44,7 +52,7 @@ const FamilySettings = () => {
|
||||
|
||||
const tabComponents = {
|
||||
add_family: <AddFamily />,
|
||||
relatives: <Relatives />,
|
||||
relatives: <Relatives familyList={relativeFamilyList} />,
|
||||
family_banner: <FamilyBanner imageServer={state.imageServer} />,
|
||||
};
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ export default function FamilyTable({
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`update-table w-full h-full p-4 bg-white dark:bg-dark-white overflow-y-auto rounded-2xl section-shadow min-h-[520px] flex flex-col justify-between ${
|
||||
className={`update-table w-full h-full p-4 bg-white dark:bg-dark-white overflow-y-auto rounded-2xl min-h-[520px] flex flex-col justify-between ${
|
||||
className || ""
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { Suspense, lazy, useEffect, useMemo, useState } from "react";
|
||||
import { useLocation } from "react-router-dom";
|
||||
import { useLocation, useOutletContext } from "react-router-dom";
|
||||
import { apiConst } from "../../lib/apiConst";
|
||||
import usersService from "../../services/UsersService";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
@@ -13,59 +13,44 @@ const FamilyPending = lazy(() => import("./Tabs/FamilyNewPending"));
|
||||
|
||||
export default function FamilyTableNew() {
|
||||
|
||||
const { parentFamilyTaskList } = useSelector((state) => state.tableReload);
|
||||
console.log('parentFamilyTaskList', parentFamilyTaskList)
|
||||
const {familyList} = useOutletContext() // CONTEXT VALUES FROM OUTLET TO CHILD
|
||||
|
||||
const { jobListTable, pendingListTable, parentFamilyTaskList } = useSelector((state) => state.tableReload); // TABLE RELOAD TRIGGERS
|
||||
|
||||
|
||||
let { pathname } = useLocation();
|
||||
|
||||
// Initial state for family details
|
||||
const initialDetailState = {
|
||||
loading: true,
|
||||
data: null,
|
||||
link: "",
|
||||
loading: false,
|
||||
data: [],
|
||||
};
|
||||
|
||||
const [assignTaskChecker, setAssignTaskChecker] = useState(false);
|
||||
|
||||
// console.log('accountDetails',accountDetails)
|
||||
// State for family details, tasks, waitlist, and pending
|
||||
const [details, setDetails] = useState({
|
||||
familyDetails: { ...initialDetailState },
|
||||
familyTasks: { ...initialDetailState },
|
||||
familyWaitList: { ...initialDetailState },
|
||||
familyPending: { ...initialDetailState },
|
||||
});
|
||||
let [familyTasks, setFamilyTasks] = useState({...initialDetailState})
|
||||
|
||||
// Function to reset family details, tasks, waitlist, and pending
|
||||
const resetDetails = () => {
|
||||
setDetails({
|
||||
familyDetails: { ...initialDetailState },
|
||||
familyTasks: { ...initialDetailState },
|
||||
familyWaitList: { ...initialDetailState },
|
||||
familyPending: { ...initialDetailState },
|
||||
});
|
||||
};
|
||||
let [familyPending, setFamilyPending] = useState({...initialDetailState})
|
||||
|
||||
let [familyWaitList, setFamilyWaitList] = useState({...initialDetailState})
|
||||
|
||||
const [updatePage, setUpdatePage] = useState(false); // State to determine when to update the page
|
||||
|
||||
// State for family task data
|
||||
const [familyTask, setFamilyTask] = useState({ loading: false, data: [] });
|
||||
// State for list of created jobs by FULL USER
|
||||
const [jobList, setJobList] = useState({ loading: false, data: [] });
|
||||
|
||||
// State for active task
|
||||
// State for active/selected job
|
||||
const [activeTask, setActiveTask] = useState({ id: 0, data: {} });
|
||||
|
||||
// State for error messages
|
||||
const [errMsg, setErrMsg] = useState("");
|
||||
|
||||
// State for family task popout
|
||||
const [familyTaskPopout, setFamilyTaskPopout] = useState(false);
|
||||
const [assignTaskPopout, setAssignTaskPopout] = useState(false);
|
||||
|
||||
|
||||
// Create an instance of the usersService class
|
||||
const apiCall = useMemo(() => new usersService(), []);
|
||||
|
||||
// Function to handle toggling the family task popout
|
||||
const familyPopUpHandler = () => {
|
||||
setFamilyTaskPopout((prev) => !prev);
|
||||
const familyAssignPopUpHandler = () => {
|
||||
setAssignTaskPopout((prev) => !prev);
|
||||
};
|
||||
|
||||
// Array of tab names
|
||||
@@ -87,26 +72,19 @@ export default function FamilyTableNew() {
|
||||
const tabComponents = {
|
||||
Tasks: (
|
||||
<FamilyTasks
|
||||
image_link={details.familyTasks.link}
|
||||
loader={details.familyTasks.loading}
|
||||
familyData={details.familyTasks.data}
|
||||
action={familyPopUpHandler}
|
||||
setAssignTaskChecker={setAssignTaskChecker}
|
||||
familyData={familyTasks}
|
||||
action={familyAssignPopUpHandler}
|
||||
/>
|
||||
),
|
||||
Waiting: (
|
||||
<FamilyWaitlist
|
||||
image_link={details.familyWaitList.link}
|
||||
familyData={details.familyWaitList.data}
|
||||
loader={details.familyWaitList.loading}
|
||||
familyData={familyWaitList}
|
||||
setUpdatePage={setUpdatePage}
|
||||
/>
|
||||
),
|
||||
Pending: (
|
||||
<FamilyPending
|
||||
image_link={details.familyPending.link}
|
||||
familyData={details.familyPending.data}
|
||||
loader={details.familyPending.loading}
|
||||
familyData={familyPending}
|
||||
/>
|
||||
),
|
||||
};
|
||||
@@ -116,83 +94,66 @@ export default function FamilyTableNew() {
|
||||
// Selected tab component based on the current 'tab'
|
||||
const selectedTabComponent = tabComponents[tab] || defaultTabComponent;
|
||||
|
||||
// Effect to manage family details and related data
|
||||
|
||||
// Effect to manage active family task details
|
||||
useEffect(() => {
|
||||
const manageFamily = async () => {
|
||||
const manageTasks = async () => {
|
||||
setFamilyTasks({loading:true, data: []})
|
||||
try {
|
||||
// resetDetails();
|
||||
|
||||
// setDetails({
|
||||
// familyTasks: { loading: true },
|
||||
// familyWaitList: { loading: true },
|
||||
// familyPending: { loading: true },
|
||||
// });
|
||||
|
||||
// const { family_uid } = accountDetails;
|
||||
// const reqData = { family_uid };
|
||||
|
||||
const [familyTasksData, familyWaitingRes, familyPendingRes] =
|
||||
await Promise.all([
|
||||
apiCall.getMyActiveJobList(),
|
||||
apiCall.ManageFamilyNewWaitlist(),
|
||||
apiCall.ManageFamilyPending(),
|
||||
]);
|
||||
|
||||
let tasksData = familyTasksData?.data?.result_list;
|
||||
let _familyWaitData = familyWaitingRes?.data?.result_list;
|
||||
let familyPendingData = familyPendingRes?.data?.result_list;
|
||||
|
||||
// Getting the image server link
|
||||
let imageServerLink = familyWaitingRes.data?.session_image_server;
|
||||
|
||||
// Function to check for errors in data
|
||||
const checkDataError = (data) => data?.internal_return < 0;
|
||||
|
||||
if (
|
||||
checkDataError(tasksData) ||
|
||||
checkDataError(_familyWaitData) ||
|
||||
checkDataError(familyPendingData)
|
||||
) {
|
||||
return;
|
||||
const response = await apiCall.getMyActiveJobList()
|
||||
if(response.status != 200 || !response?.data){
|
||||
return setFamilyTasks({loading:false, data: []})
|
||||
}
|
||||
|
||||
setDetails({
|
||||
familyTasks: {
|
||||
loading: false,
|
||||
data: tasksData,
|
||||
link: imageServerLink,
|
||||
},
|
||||
familyWaitList: {
|
||||
loading: false,
|
||||
data: _familyWaitData,
|
||||
link: imageServerLink,
|
||||
},
|
||||
familyPending: {
|
||||
loading: false,
|
||||
data: familyPendingData,
|
||||
link: imageServerLink,
|
||||
},
|
||||
});
|
||||
setFamilyTasks({loading:false, data: response?.data})
|
||||
} catch (error) {
|
||||
// resetDetails();
|
||||
setDetails({
|
||||
familyDetails: { ...initialDetailState, loading: false, },
|
||||
familyTasks: { ...initialDetailState, loading: false, },
|
||||
familyWaitList: { ...initialDetailState, loading: false,},
|
||||
familyPending: { ...initialDetailState, loading: false, },
|
||||
})
|
||||
setErrMsg("An error occurred");
|
||||
throw new Error(error);
|
||||
setFamilyTasks({loading:false, data: []})
|
||||
}
|
||||
};
|
||||
|
||||
// Invoke the manageFamily function when the component mounts
|
||||
manageFamily();
|
||||
manageTasks();
|
||||
}, [updatePage, parentFamilyTaskList]);
|
||||
|
||||
// Effect to manage family tasks
|
||||
// Effect to manage family wait task details
|
||||
useEffect(() => {
|
||||
const manageFamilyWaitlist = async () => {
|
||||
setFamilyWaitList({loading:true, data: []})
|
||||
try {
|
||||
const response = await apiCall.ManageFamilyWaitlist()
|
||||
if(response.status != 200 || !response?.data){
|
||||
return setFamilyWaitList({loading:false, data: []})
|
||||
}
|
||||
setFamilyWaitList({loading:false, data: response?.data})
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
setFamilyWaitList({loading:false, data: []})
|
||||
}
|
||||
};
|
||||
// Invoke the manageFamily function when the component mounts
|
||||
manageFamilyWaitlist();
|
||||
}, [updatePage]);
|
||||
|
||||
// Effect to manage family pending task details
|
||||
useEffect(() => {
|
||||
const manageFamilyPending = async () => {
|
||||
setFamilyPending({loading:true, data: []})
|
||||
try {
|
||||
const response = await apiCall.ManageFamilyPending()
|
||||
if(response.status != 200 || !response?.data){
|
||||
return setFamilyPending({loading:false, data: []})
|
||||
}
|
||||
setFamilyPending({loading:false, data: response?.data})
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
setFamilyPending({loading:false, data: []})
|
||||
}
|
||||
};
|
||||
// Invoke the manageFamily function when the component mounts
|
||||
manageFamilyPending();
|
||||
}, [updatePage, pendingListTable]);
|
||||
|
||||
// Effect to get all parent job list
|
||||
useEffect(() => {
|
||||
let checkFamilyTask = true;
|
||||
const reqData = {
|
||||
limit: 30,
|
||||
offset: 0,
|
||||
@@ -200,12 +161,11 @@ export default function FamilyTableNew() {
|
||||
action: apiConst.WRENCHBOARD_PICTURE_FAMMEMBER,
|
||||
};
|
||||
|
||||
if (checkFamilyTask) {
|
||||
setFamilyTask({ loading: true });
|
||||
setJobList({ loading: true });
|
||||
apiCall
|
||||
.getMyJobList(reqData)
|
||||
.then((res) => {
|
||||
setFamilyTask({ loading: false, data: res?.data?.result_list });
|
||||
setJobList({ loading: false, data: res?.data?.result_list });
|
||||
if (res?.data?.result_list?.length) {
|
||||
setActiveTask((prev) => ({
|
||||
...prev,
|
||||
@@ -214,15 +174,9 @@ export default function FamilyTableNew() {
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
setFamilyTask({ loading: false, data: [] });
|
||||
setJobList({ loading: false, data: [] });
|
||||
console.log("Error", err);
|
||||
});
|
||||
}
|
||||
|
||||
// Cleanup function to prevent memory leaks
|
||||
return () => {
|
||||
checkFamilyTask = false;
|
||||
};
|
||||
}, []);
|
||||
|
||||
// console.log(updatePage);
|
||||
@@ -260,7 +214,7 @@ export default function FamilyTableNew() {
|
||||
</ul>
|
||||
<button
|
||||
type="button"
|
||||
onClick={familyPopUpHandler}
|
||||
onClick={familyAssignPopUpHandler}
|
||||
className="p-1 my-1 w-[100px] flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
Add task
|
||||
@@ -282,20 +236,19 @@ export default function FamilyTableNew() {
|
||||
</Suspense>
|
||||
</div>
|
||||
|
||||
{familyTaskPopout && (
|
||||
{assignTaskPopout && (
|
||||
<AssignTaskPopout
|
||||
action={familyPopUpHandler}
|
||||
situation={familyTaskPopout}
|
||||
familyTask={familyTask}
|
||||
setFamilyTask={setFamilyTask}
|
||||
action={familyAssignPopUpHandler}
|
||||
situation={assignTaskPopout}
|
||||
jobList={jobList}
|
||||
setActiveTask={setActiveTask}
|
||||
activeTask={activeTask}
|
||||
familyDetailsData={''}
|
||||
setUpdatePage={setUpdatePage}
|
||||
// updateFamilyPendingTable={updateFamilyPendingTable}
|
||||
pathname={pathname}
|
||||
assignTaskChecker={assignTaskChecker}
|
||||
familyList={familyList?.result_list}
|
||||
/>
|
||||
)}
|
||||
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
import React, { useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||
import PaginatedList from "../Pagination/PaginatedList";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
|
||||
import familyImage from "../../assets/images/no-family-side.png";
|
||||
import { formatDateString } from "../../lib";
|
||||
import localImgLoad from "../../lib/localImgLoad";
|
||||
|
||||
/**
|
||||
* Renders a list of family members that can be managed.
|
||||
* It has its current maximum members at 8 and it comes with pagination and loading spinner functionality.
|
||||
|
||||
* @returns {JSX.Element} - The rendered component.
|
||||
*/
|
||||
export default function FamilyTableSettings({
|
||||
className,
|
||||
familyList,
|
||||
loader,
|
||||
popUpHandler,
|
||||
imageServer,
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
const itemsPerPage = Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||
const indexOfFirstItem = Number(currentPage);
|
||||
const indexOfLastItem =
|
||||
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||
const currentFamilyList = familyList?.slice(
|
||||
indexOfFirstItem,
|
||||
indexOfLastItem
|
||||
);
|
||||
|
||||
const handleManageClick = (familyMember) => {
|
||||
navigate("/manage-family", { state: familyMember });
|
||||
};
|
||||
|
||||
const handlePagination = (e) => {
|
||||
handlePagingFunc(e, setCurrentPage);
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders a table row for a family member.
|
||||
* @returns {JSX.Element} - The table row component.
|
||||
*/
|
||||
const FamilyRow = ({
|
||||
firstname,
|
||||
lastname,
|
||||
age,
|
||||
added,
|
||||
last_login,
|
||||
task_count,
|
||||
family_uid,
|
||||
banner,
|
||||
enable_traking,
|
||||
profile_picture,
|
||||
imageServer,
|
||||
username,
|
||||
}) => {
|
||||
// Check for valid dates
|
||||
const addedDate = added ? added.split(" ")[0] : "N/A";
|
||||
const loginDate = last_login ? formatDateString(last_login) : "N/A";
|
||||
const key = `family-${family_uid}`; // Assign a unique key
|
||||
const image = localStorage.getItem("session_token")
|
||||
? `${imageServer}${localStorage.getItem(
|
||||
"session_token"
|
||||
)}/family/${family_uid}`
|
||||
: "";
|
||||
|
||||
const trackingStatus =
|
||||
enable_traking === "0"
|
||||
? "Stopped"
|
||||
: enable_traking === "100"
|
||||
? "Active"
|
||||
: "";
|
||||
|
||||
return (
|
||||
<tr
|
||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||
key={key}
|
||||
>
|
||||
<td className="py-4">
|
||||
<div className="flex space-x-2 items-center w-full">
|
||||
<div className="w-[60px] h-[60px] rounded-full overflow-hidden flex justify-center items-center">
|
||||
<img
|
||||
// src={profile_picture}
|
||||
src={
|
||||
image ||
|
||||
profile_picture ||
|
||||
localImgLoad(`images/icons/${banner}`)
|
||||
}
|
||||
alt={`Avatar of ${firstname} ${lastname}`}
|
||||
className="w-full h-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col flex-[0.9]">
|
||||
<h1 className="font-bold text-lg text-dark-gray dark:text-white whitespace-nowrap">
|
||||
{`${firstname} ${lastname}`}{" "}
|
||||
<span className="ml-1 text-sm">{`[${username}]`}</span>
|
||||
</h1>
|
||||
<span className="text-sm text-thin-light-gray">
|
||||
Added: <span className="text-purple ml-1">{addedDate}</span>
|
||||
</span>
|
||||
<span className="text-sm text-thin-light-gray">
|
||||
Last Login:{" "}
|
||||
<span className="text-purple ml-1">{loginDate}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
{/* <td className="text-center py-4 px-2">
|
||||
<div className="flex space-x-1 items-center justify-center">
|
||||
<span
|
||||
className={`text-base font-medium whitespace-nowrap ${
|
||||
enable_traking === "0"
|
||||
? "text-[#FF0000] dark:text-[#FF6666]"
|
||||
: enable_traking === "100"
|
||||
? "text-[#00A000] dark:text-[#00FF00]"
|
||||
: "text-dark-gray dark:text-white"
|
||||
}`}
|
||||
>
|
||||
{trackingStatus}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td className="text-center py-4 px-2">
|
||||
<div className="flex space-x-1 items-center justify-center">
|
||||
<span className="text-base text-dark-gray dark:text-white font-medium whitespace-nowrap">
|
||||
{task_count}
|
||||
</span>
|
||||
</div>
|
||||
</td> */}
|
||||
|
||||
<td className="text-right py-4 px-2 flex items-center justify-center">
|
||||
<button
|
||||
onClick={() =>
|
||||
handleManageClick({
|
||||
firstname,
|
||||
lastname,
|
||||
age,
|
||||
added,
|
||||
last_login,
|
||||
task_count,
|
||||
family_uid,
|
||||
banner,
|
||||
image,
|
||||
})
|
||||
}
|
||||
type="button"
|
||||
className="w-12 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`update-table w-full h-full p-4 bg-white dark:bg-dark-white overflow-y-auto rounded-2xl min-h-[520px] flex flex-col justify-between ${
|
||||
className || ""
|
||||
}`}
|
||||
>
|
||||
<div className="relative w-full h-full overflow-x-auto sm:rounded-lg">
|
||||
{loader ? (
|
||||
<div className="h-full min-h-[500px] w-full overflow-hidden flex justify-center items-center">
|
||||
<LoadingSpinner size="16" color="sky-blue" height='h-full' />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{familyList?.length > 0 ? (
|
||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400 relative">
|
||||
<thead className="sticky top-0">
|
||||
<tr className="text-base text-thin-light-gray whitespace-nowrap border-b dark:border-[#5356fb29] default-border-bottom ">
|
||||
<th className="py-4">Name</th>
|
||||
{/* <th className="py-4 text-center">Tracking</th>
|
||||
<th className="py-4 text-center">No of Tasks</th> */}
|
||||
<th className="py-4 text-right"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="h-full">
|
||||
{currentFamilyList?.map((familyMember, index) => {
|
||||
return (
|
||||
<FamilyRow
|
||||
key={index}
|
||||
{...familyMember}
|
||||
imageServer={imageServer}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
<div className="font-bold text-center text-xl md:text-2xl lg:text-4xl text-dark-gray md:flex items-center justify-between">
|
||||
<div className="p-2 w-full md:w-1/2">
|
||||
<p className="mb-4 p-3 md:p-16">
|
||||
Add your family, assign tasks, and get the whole team
|
||||
engaged.
|
||||
</p>
|
||||
<button
|
||||
onClick={popUpHandler}
|
||||
type="button"
|
||||
className="text-white btn-gradient text-lg tracking-wide px-5 py-2 rounded-full"
|
||||
>
|
||||
Add Family
|
||||
</button>
|
||||
</div>
|
||||
<div className="p-2 w-full md:w-1/2">
|
||||
<img className="w-full" src={familyImage} alt="Add Family" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{/* PAGINATION BUTTON */}
|
||||
<PaginatedList
|
||||
onClick={handlePagination}
|
||||
prev={currentPage == 0}
|
||||
next={currentPage + itemsPerPage >= familyList?.length}
|
||||
data={familyList}
|
||||
start={indexOfFirstItem}
|
||||
stop={indexOfLastItem}
|
||||
/>
|
||||
{/* END OF PAGINATION BUTTON */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import QRCode from "react-qr-code";
|
||||
import { useSelector } from "react-redux";
|
||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
|
||||
const FamilyAccount = forwardRef(({ familyData, myRef, handlePrint, loader }, ref) => {
|
||||
const FamilyAccount = forwardRef(({ familyData, myRef, handlePrint}, ref) => {
|
||||
const { userDetails } = useSelector((state) => state.userDetails);
|
||||
return (
|
||||
<div
|
||||
@@ -13,16 +13,19 @@ const FamilyAccount = forwardRef(({ familyData, myRef, handlePrint, loader }, re
|
||||
<div className="update-table w-full lg:min-h-[450px] h-full p-8 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow ">
|
||||
<div className="flex items-center justify-around h-[380px]">
|
||||
<div className="flex flex-col">
|
||||
<h2 className="print:block hidden font-bold text-lg tracking-wide text-dark-gray dark:text-white capitalize mb-10">
|
||||
Firstname: {familyData?.data?.firstname ? familyData?.data?.firstname : "please wait..."}
|
||||
</h2>
|
||||
<h2 className="font-bold text-lg tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize">
|
||||
Username:{" "}
|
||||
<span className="ml-2 normal-case">
|
||||
{familyData?.username ? familyData?.username : "please wait..."}
|
||||
{familyData?.data?.username ? familyData?.data?.username : "please wait..."}
|
||||
</span>
|
||||
</h2>
|
||||
<h2 className="font-bold text-lg tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize">
|
||||
Pin:{" "}
|
||||
<span className="ml-2 normal-case">
|
||||
{familyData?.pin ? familyData?.pin : "please wait..."}
|
||||
{familyData?.data?.pin ? familyData?.data?.pin : "please wait..."}
|
||||
</span>
|
||||
</h2>
|
||||
</div>
|
||||
@@ -35,7 +38,7 @@ const FamilyAccount = forwardRef(({ familyData, myRef, handlePrint, loader }, re
|
||||
<p className="text-xl tracking-wide mb-[15px] text-center font-bold text-dark-gray dark:text-white">
|
||||
Scan the code from mobile app
|
||||
</p>
|
||||
{loader ?
|
||||
{familyData.loading ?
|
||||
<div className="w-full">
|
||||
<LoadingSpinner size='8' color='sky-blue' />
|
||||
</div>
|
||||
@@ -44,7 +47,7 @@ const FamilyAccount = forwardRef(({ familyData, myRef, handlePrint, loader }, re
|
||||
size={256}
|
||||
style={{ height: "auto", maxWidth: "100%", width: "100%" }}
|
||||
// value={`https://www.google.com`}
|
||||
value={`${userDetails?.uid}@${familyData?.username}@${familyData?.uid}`}
|
||||
value={`${userDetails?.uid}@${familyData?.data?.username}@${familyData?.data?.uid}`}
|
||||
viewBox={`0 0 256 256`}
|
||||
/>
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@ import { useMemo, useState } from "react";
|
||||
import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||
import { PaginatedList, handlePagingFunc } from "../../Pagination";
|
||||
import PendingJobsPopout from "../../jobPopout/PendingJobsPopout";
|
||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
|
||||
export default function FamilyPending({ familyData, image_link, loader }) {
|
||||
export default function FamilyPending({ familyData }) {
|
||||
let [jobPopout, setJobPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
||||
|
||||
let filteredFamilyData = useMemo(
|
||||
() => familyData?.filter((data) => data.family_uid !== ""),
|
||||
[familyData]
|
||||
() => familyData?.data?.result_list?.filter((data) => data.family_uid !== ""),
|
||||
[familyData?.data?.result_list]
|
||||
);
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
@@ -25,13 +26,18 @@ export default function FamilyPending({ familyData, image_link, loader }) {
|
||||
handlePagingFunc(e, setCurrentPage);
|
||||
};
|
||||
|
||||
console.log(image_link);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`update-table w-full p-3 bg-white dark:bg-dark-white overflow-hidden rounded-2xl section-shadow lg:min-h-[538px]`}
|
||||
>
|
||||
{familyData && (
|
||||
{familyData.loading ?
|
||||
(<div className="w-full h-full flex justify-center items-center">
|
||||
<LoadingSpinner size={16} color="sky-blue" height='h-[30rem]' />
|
||||
</div>
|
||||
):
|
||||
<>
|
||||
{familyData?.data?.result_list && (
|
||||
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between h-full">
|
||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||
<tbody>
|
||||
@@ -45,7 +51,7 @@ export default function FamilyPending({ familyData, image_link, loader }) {
|
||||
value?.currency_code,
|
||||
value?.currency
|
||||
);
|
||||
let image = `${image_link}${localStorage.getItem(
|
||||
let image = `${familyData?.data?.session_image_server}${localStorage.getItem(
|
||||
"session_token"
|
||||
)}/job/${value.job_uid}`;
|
||||
return (
|
||||
@@ -137,7 +143,8 @@ export default function FamilyPending({ familyData, image_link, loader }) {
|
||||
{/* END OF PAGINATION BUTTON */}
|
||||
</div>
|
||||
)}
|
||||
|
||||
</>
|
||||
}
|
||||
{/* Active Job Popout */}
|
||||
{jobPopout.show && (
|
||||
<PendingJobsPopout
|
||||
|
||||
@@ -9,17 +9,15 @@ import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
export default function FamilyNewTasks({
|
||||
familyData,
|
||||
className,
|
||||
loader,
|
||||
action,
|
||||
image_link,
|
||||
}) {
|
||||
let navigate = useNavigate();
|
||||
let { pathname } = useLocation();
|
||||
|
||||
// ...
|
||||
let filteredFamilyData = useMemo(
|
||||
() => familyData?.filter((data) => data.family_uid !== ""),
|
||||
[familyData]
|
||||
() => familyData?.data?.result_list?.filter((data) => data.family_uid !== ""),
|
||||
[familyData?.data?.result_list]
|
||||
);
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
@@ -36,22 +34,22 @@ export default function FamilyNewTasks({
|
||||
return (
|
||||
<div
|
||||
className={`update-table w-full bg-white dark:bg-dark-white h-full lg:min-h-[538px] overflow-hidden rounded-2xl section-shadow p-3 ${
|
||||
familyData?.length <= 0 && "flex items-center justify-center"
|
||||
familyData?.data?.result_list?.length <= 0 && "flex items-center justify-center"
|
||||
}`}
|
||||
>
|
||||
{loader ? (
|
||||
<div className="w-full h-full flex justify-center items-center lg:min-h-[470px]">
|
||||
<LoadingSpinner size={16} color="sky-blue" />
|
||||
{familyData.loading ? (
|
||||
<div className="w-full h-full flex justify-center items-center">
|
||||
<LoadingSpinner size={16} color="sky-blue" height='h-[30rem]' />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{familyData && (
|
||||
{familyData?.data?.result_list && (
|
||||
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between h-full">
|
||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||
<tbody>
|
||||
{
|
||||
<>
|
||||
{familyData?.length <= 0 ? (
|
||||
{familyData?.data?.result_list?.length <= 0 ? (
|
||||
<tr>
|
||||
<td
|
||||
colSpan="2"
|
||||
@@ -76,7 +74,7 @@ export default function FamilyNewTasks({
|
||||
value?.currency_code,
|
||||
value?.currency
|
||||
);
|
||||
let image = `${image_link}${localStorage.getItem(
|
||||
let image = `${familyData?.data?.result_list}${localStorage.getItem(
|
||||
"session_token"
|
||||
)}/job/${value.job_uid}`;
|
||||
return (
|
||||
|
||||
@@ -8,8 +8,6 @@ import Icons from "../../Helpers/Icons";
|
||||
const FamilyNewWaitlist = ({
|
||||
familyData,
|
||||
className,
|
||||
accountDetails,
|
||||
loader,
|
||||
setUpdatePage
|
||||
}) => {
|
||||
const [popUp, setPopUp] = useState({ show: false, data: {} });
|
||||
@@ -22,7 +20,7 @@ const FamilyNewWaitlist = ({
|
||||
const itemsPerPage = Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||
const indexOfFirstItem = currentPage;
|
||||
const indexOfLastItem = currentPage + itemsPerPage;
|
||||
const currentTask = familyData?.slice(
|
||||
const currentTask = familyData?.data?.result_list?.slice(
|
||||
indexOfFirstItem,
|
||||
indexOfLastItem
|
||||
);
|
||||
@@ -53,13 +51,13 @@ const FamilyNewWaitlist = ({
|
||||
className || ""
|
||||
}`}
|
||||
>
|
||||
{loader ? (
|
||||
<div className="w-full h-full flex justify-center items-center lg:min-h-[470px]">
|
||||
<LoadingSpinner size={16} color="sky-blue" />
|
||||
{familyData.loading ? (
|
||||
<div className="w-full h-full flex justify-center items-center">
|
||||
<LoadingSpinner size={16} color="sky-blue" height='h-[30rem]' />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{familyData && (
|
||||
{familyData?.data?.result_list && (
|
||||
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between h-full">
|
||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||
<tbody>
|
||||
@@ -69,7 +67,7 @@ const FamilyNewWaitlist = ({
|
||||
value?.banner || "default.jpg"
|
||||
}`);
|
||||
// console.log("VALUE", value);
|
||||
// let image = `${familyData.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
|
||||
// let image = `${familyData?.data?.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
|
||||
return (
|
||||
<tr
|
||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||
@@ -121,8 +119,8 @@ const FamilyNewWaitlist = ({
|
||||
<PaginatedList
|
||||
onClick={handlePagination}
|
||||
prev={currentPage === 0}
|
||||
next={currentPage + itemsPerPage >= familyData?.length}
|
||||
data={familyData}
|
||||
next={currentPage + itemsPerPage >= familyData?.data?.result_list?.length}
|
||||
data={familyData?.data?.result_list}
|
||||
start={indexOfFirstItem}
|
||||
stop={indexOfLastItem}
|
||||
/>
|
||||
|
||||
@@ -3,21 +3,23 @@ import localImgLoad from "../../../lib/localImgLoad";
|
||||
import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||
import { PaginatedList, handlePagingFunc } from "../../Pagination";
|
||||
import PendingJobsPopout from "../../jobPopout/PendingJobsPopout";
|
||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
|
||||
export default function FamilyPending({
|
||||
familyData,
|
||||
className,
|
||||
accountDetails,
|
||||
loader,
|
||||
setUpdatePage,
|
||||
}) {
|
||||
let [jobPopout, setJobPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
|
||||
|
||||
let filteredFamilyData = useMemo(
|
||||
() =>
|
||||
familyData?.result_list?.filter(
|
||||
familyData?.data?.result_list?.filter(
|
||||
(data) => data?.family_uid === accountDetails?.family_uid
|
||||
),
|
||||
[accountDetails?.family_uid, familyData?.result_list]
|
||||
[accountDetails?.family_uid, familyData?.data?.result_list]
|
||||
);
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
@@ -40,6 +42,12 @@ export default function FamilyPending({
|
||||
className || ""
|
||||
}`}
|
||||
>
|
||||
{familyData.loading ?
|
||||
(<div className="w-full h-full flex justify-center items-center">
|
||||
<LoadingSpinner size={16} color="sky-blue" height='h-[30rem]' />
|
||||
</div>
|
||||
):
|
||||
<>
|
||||
{filteredFamilyData && (
|
||||
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between h-full">
|
||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||
@@ -54,7 +62,7 @@ export default function FamilyPending({
|
||||
value?.currency_code,
|
||||
value?.currency
|
||||
);
|
||||
let image = `${familyData.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
|
||||
let image = `${familyData.data.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
|
||||
return (
|
||||
<tr
|
||||
key={index}
|
||||
@@ -144,6 +152,8 @@ export default function FamilyPending({
|
||||
{/* END OF PAGINATION BUTTON */}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
|
||||
{/* Active Job Popout */}
|
||||
{jobPopout.show && (
|
||||
@@ -151,6 +161,7 @@ export default function FamilyPending({
|
||||
details={jobPopout.data}
|
||||
onClose={() => {
|
||||
setJobPopout({ show: false, data: {} });
|
||||
setUpdatePage(prev => !prev);
|
||||
}}
|
||||
situation={jobPopout.show}
|
||||
/>
|
||||
|
||||
@@ -10,7 +10,6 @@ import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
export default function FamilyTasks({
|
||||
familyData,
|
||||
className,
|
||||
loader,
|
||||
accountDetails,
|
||||
}) {
|
||||
let navigate = useNavigate();
|
||||
@@ -19,17 +18,17 @@ export default function FamilyTasks({
|
||||
// ...
|
||||
const filteredFamilyData = useMemo(
|
||||
() =>
|
||||
familyData?.result_list?.filter(
|
||||
familyData?.data?.result_list?.filter(
|
||||
(data) => data?.family_uid === accountDetails?.family_uid
|
||||
),
|
||||
[familyData, accountDetails]
|
||||
[familyData?.data, accountDetails]
|
||||
);
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
const indexOfFirstItem = Number(currentPage);
|
||||
const indexOfLastItem =
|
||||
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||
const currentTask = familyData?.result_list.slice(
|
||||
const currentTask = familyData?.data?.result_list?.slice(
|
||||
indexOfFirstItem,
|
||||
indexOfLastItem
|
||||
);
|
||||
@@ -43,21 +42,21 @@ export default function FamilyTasks({
|
||||
className || ""
|
||||
}`}
|
||||
>
|
||||
{loader ? (
|
||||
<div className="w-full h-full flex justify-center items-center lg:min-h-[470px]">
|
||||
<LoadingSpinner size={16} color="sky-blue" />
|
||||
{familyData.loading ? (
|
||||
<div className="w-full h-full flex justify-center items-center">
|
||||
<LoadingSpinner size={16} color="sky-blue" height='h-[30rem]' />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{familyData && familyData?.result_list && (
|
||||
{familyData?.data && familyData?.data?.result_list && (
|
||||
<div className="relative w-full overflow-x-auto sm:rounded-lg flex flex-col justify-between h-full">
|
||||
<table className="w-full text-sm text-left text-gray-500 dark:text-gray-400">
|
||||
<tbody>
|
||||
{
|
||||
<>
|
||||
{familyData &&
|
||||
familyData?.result_list &&
|
||||
familyData.result_list.length > 0 ? (
|
||||
{familyData?.data &&
|
||||
familyData?.data?.result_list &&
|
||||
familyData?.data.result_list.length > 0 ? (
|
||||
currentTask.map((value, index) => {
|
||||
// find due date
|
||||
const dueDate = value?.delivery_date.split(" ")[0];
|
||||
@@ -67,7 +66,7 @@ export default function FamilyTasks({
|
||||
value?.currency_code,
|
||||
value?.currency
|
||||
);
|
||||
let image = `${familyData.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
|
||||
let image = `${familyData?.data?.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
|
||||
return (
|
||||
<tr
|
||||
key={index}
|
||||
@@ -149,11 +148,11 @@ export default function FamilyTasks({
|
||||
prev={currentPage == 0 ? true : false}
|
||||
next={
|
||||
currentPage + Number(process.env.REACT_APP_ITEM_PER_PAGE) >=
|
||||
familyData?.result_list.length
|
||||
familyData?.data?.result_list.length
|
||||
? true
|
||||
: false
|
||||
}
|
||||
data={familyData?.result_list}
|
||||
data={familyData?.data?.result_list}
|
||||
start={indexOfFirstItem}
|
||||
stop={indexOfLastItem}
|
||||
/>
|
||||
|
||||
@@ -5,7 +5,7 @@ import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
import AssignTaskPopout from "../FamilyPopout/AssignTaskPopout";
|
||||
|
||||
const FamilyWaitlist = memo(
|
||||
({ familyData, className, accountDetails, loader, setUpdatePage }) => {
|
||||
({ familyData, className, accountDetails, setUpdatePage, jobList, setActiveTask, activeTask }) => {
|
||||
const [popUp, setPopUp] = useState({ show: false, data: {} });
|
||||
const [continueTaskPopup, setContinueTaskPopup] = useState({
|
||||
show: false,
|
||||
@@ -13,10 +13,10 @@ const FamilyWaitlist = memo(
|
||||
});
|
||||
const filteredFamilyData = useMemo(
|
||||
() =>
|
||||
familyData?.result_list?.filter(
|
||||
familyData?.data?.result_list?.filter(
|
||||
(data) => data?.family_uid === accountDetails?.family_uid
|
||||
),
|
||||
[familyData, accountDetails]
|
||||
[familyData.data, accountDetails]
|
||||
);
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
@@ -52,9 +52,9 @@ const FamilyWaitlist = memo(
|
||||
className || ""
|
||||
}`}
|
||||
>
|
||||
{loader ? (
|
||||
<div className="w-full h-full flex justify-center items-center lg:min-h-[470px]">
|
||||
<LoadingSpinner size={16} color="sky-blue" />
|
||||
{familyData.loading ? (
|
||||
<div className="w-full h-full flex justify-center items-center">
|
||||
<LoadingSpinner size={16} color="sky-blue" height='h-[30rem]' />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
@@ -67,14 +67,13 @@ const FamilyWaitlist = memo(
|
||||
const selectedImage = require(`../../../assets/images/family/${
|
||||
value?.banner || "default.jpg"
|
||||
}`);
|
||||
console.log('VALUE', value)
|
||||
// let image = `${familyData.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
|
||||
// let image = `${familyData.data.session_image_server}${localStorage.getItem('session_token')}/job/${value.job_uid}`
|
||||
return (
|
||||
<tr
|
||||
className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50"
|
||||
key={value.uid}
|
||||
>
|
||||
<td className="py-4">
|
||||
<td className="px-2 py-4">
|
||||
<div className="w-full flex justify-between items-center">
|
||||
<div className="account-name flex space-x-4 items-center">
|
||||
<div className="icon w-14 h-14 flex justify-center items-center">
|
||||
@@ -93,23 +92,40 @@ const FamilyWaitlist = memo(
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-2 flex flex-col items-center justify-center">
|
||||
{/* <div className="px-2 flex flex-col items-center justify-center">
|
||||
<p className="text-sm font-bold text-dark-gray dark:text-white">
|
||||
{addedDate}
|
||||
</p>
|
||||
<p className="text-xs py-1.5 w-[70px] cursor-default tracking-wide rounded-full bg-gold text-white flex justify-center items-center">
|
||||
{value.status_text}
|
||||
</p>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
</td>
|
||||
<td className="text-right py-4 px-2">
|
||||
<button
|
||||
onClick={() => openPopUp(value)}
|
||||
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
View
|
||||
</button>
|
||||
<td className="text-right px-2 py-4">
|
||||
<div className='w-full flex justify-end items-center gap-4'>
|
||||
<p className="text-xs py-1.5 w-[70px] cursor-default tracking-wide rounded-full bg-gold text-white flex justify-center items-center">
|
||||
{value.status_text}
|
||||
</p>
|
||||
<button
|
||||
onClick={() => openPopUp(value)}
|
||||
className="w-12 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
@@ -145,6 +161,9 @@ const FamilyWaitlist = memo(
|
||||
action={closeContinueTaskPopup}
|
||||
situation={continueTaskPopup.show}
|
||||
setUpdatePage={setUpdatePage}
|
||||
jobList={jobList}
|
||||
setActiveTask={setActiveTask}
|
||||
activeTask={activeTask}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,7 @@ function FamilyWallet({familyData}) {
|
||||
|
||||
useEffect(()=>{
|
||||
setFamilyWallet({loading:true, data: []})
|
||||
apiUrl.getFamilyWallet({family_uid:familyData?.uid}).then(res => {
|
||||
apiUrl.getKidWallets({family_uid:familyData?.uid}).then(res => {
|
||||
setFamilyWallet({loading:false, data: res?.data?.result_list || []})
|
||||
}).catch(error => {
|
||||
setFamilyWallet({loading:false, data: []})
|
||||
|
||||
@@ -9,8 +9,9 @@ import usersService from "../../../../services/UsersService";
|
||||
import LoadingSpinner from "../../../Spinners/LoadingSpinner";
|
||||
import { PriceFormatter } from "../../../Helpers/PriceFormatter";
|
||||
import { tableReload } from "../../../../store/TableReloads";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { apiConst } from "../../../../lib/apiConst";
|
||||
import { SocketValues } from "../../../Contexts/SocketIOContext";
|
||||
|
||||
const validationSchema = Yup.object().shape({
|
||||
// amount: Yup.string()
|
||||
@@ -30,6 +31,11 @@ const validationSchema = Yup.object().shape({
|
||||
});
|
||||
|
||||
function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
|
||||
|
||||
const {userDetails} = useSelector((state) => state?.userDetails); // Gets User Detail
|
||||
|
||||
const { parentAssignJobToKid } = SocketValues() // socket emit event from FULL account
|
||||
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const apiUrl = new usersService();
|
||||
@@ -54,6 +60,7 @@ function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
|
||||
};
|
||||
// FUNCTION TO PERFORM FAMILY TRANSFER
|
||||
const handleAddFund = (values) => {
|
||||
|
||||
setRequestStatus({ loading: true, status: false, message: "" });
|
||||
|
||||
let senderBal = startTransfer?.data?.origing_current_balance || ""; // SENDER'S ACCOUNT BALANCE
|
||||
@@ -132,6 +139,17 @@ function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
|
||||
status: true,
|
||||
message: "Transfer Successful",
|
||||
});
|
||||
|
||||
//SENDS MESSAGE TO SOCKET TO UPDATE CHILD ACCOUNT
|
||||
// message, room
|
||||
let socketMsg = {
|
||||
"audience": "MEMBER",
|
||||
"action": "REFRESH_WALLET",
|
||||
"family_uid": reqData.family_uid,
|
||||
}
|
||||
let socketRoom = `FAMILY-${userDetails.uid}`
|
||||
parentAssignJobToKid(socketMsg, socketRoom) //SENDS MESSAGE TO SOCKET TO UPDATE CHILD ACCOUNT
|
||||
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
dispatch(tableReload({ type: "WALLETTABLE" })); // UPDATES PARENT WALLET ACCOUNT
|
||||
@@ -170,13 +188,13 @@ function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
|
||||
return (
|
||||
<ModalCom action={action} situation={situation}>
|
||||
<div className="relative logout-modal-wrapper lg:w-[500px] 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 border-light-purple dark:border-[#5356fb29] ">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Add Fund
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<svg
|
||||
@@ -271,7 +289,7 @@ function FamilyAddFundPopout({ action, situation, wallet, familyData }) {
|
||||
<div className="field w-full mb-[0.5rem]">
|
||||
<div className="w-full">
|
||||
<label
|
||||
htmlFor="Job Delivery Details"
|
||||
htmlFor="job-label"
|
||||
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1"
|
||||
>
|
||||
Comment
|
||||
|
||||
@@ -5,7 +5,7 @@ import React, {
|
||||
useMemo,
|
||||
useState,
|
||||
} from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Link, useOutletContext } from "react-router-dom";
|
||||
import usersService from "../../services/UsersService";
|
||||
import Icons from "../Helpers/Icons";
|
||||
import InputCom from "../Helpers/Inputs/InputCom";
|
||||
@@ -16,13 +16,16 @@ import FamilyTable from "./FamilyTable";
|
||||
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
||||
|
||||
export default function FamilyAcc() {
|
||||
|
||||
const {loader, setLoader, familyList, setListReload} = useOutletContext() // CONTEXT VALUES FROM OUTLET TO CHILD
|
||||
|
||||
// State to store the selected year and month
|
||||
const [selectedYear, setSelectedYear] = useState("");
|
||||
const [selectedMonth, setSelectedMonth] = useState("");
|
||||
const [familyList, setFamilyList] = useState({});
|
||||
const [loader, setLoader] = useState(false);
|
||||
// const [familyList, setFamilyList] = useState({});
|
||||
// const [loader, setLoader] = useState(false);
|
||||
const [popUp, setPopUp] = useState(false);
|
||||
const [listReload, setListReload] = useState(false);
|
||||
// const [listReload, setListReload] = useState(false);
|
||||
const [msgErr, setMsgErr] = useState("");
|
||||
const [formData, setFormData] = useState({
|
||||
first_name: "",
|
||||
@@ -101,34 +104,34 @@ export default function FamilyAcc() {
|
||||
}
|
||||
};
|
||||
|
||||
const memberList = useCallback(async () => {
|
||||
setLoader(true);
|
||||
try {
|
||||
const res = await apiCall.familyListings();
|
||||
const { data } = res;
|
||||
if (data?.internal_return >= 0 && data?.status === "OK") {
|
||||
const { result_list, session_image_server } = data;
|
||||
setFamilyList({ result_list, session_image_server });
|
||||
sessionStorage.setItem("family_list", JSON.stringify(result_list))
|
||||
setLoader(false);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
} catch (error) {
|
||||
setLoader(false);
|
||||
throw new Error(error);
|
||||
}
|
||||
}, [apiCall]);
|
||||
// const memberList = useCallback(async () => {
|
||||
// setLoader(true);
|
||||
// try {
|
||||
// const res = await apiCall.familyListings();
|
||||
// const { data } = res;
|
||||
// if (data?.internal_return >= 0 && data?.status === "OK") {
|
||||
// const { result_list, session_image_server } = data;
|
||||
// setFamilyList({ result_list, session_image_server });
|
||||
// sessionStorage.setItem("family_list", JSON.stringify(result_list))
|
||||
// setLoader(false);
|
||||
// } else {
|
||||
// return;
|
||||
// }
|
||||
// } catch (error) {
|
||||
// setLoader(false);
|
||||
// throw new Error(error);
|
||||
// }
|
||||
// }, [apiCall]);
|
||||
|
||||
useEffect(() => {
|
||||
let checkMemberList = true;
|
||||
if (checkMemberList) {
|
||||
memberList();
|
||||
}
|
||||
return () => {
|
||||
checkMemberList = false;
|
||||
};
|
||||
}, [listReload, memberList]);
|
||||
// useEffect(() => {
|
||||
// let checkMemberList = true;
|
||||
// if (checkMemberList) {
|
||||
// memberList();
|
||||
// }
|
||||
// return () => {
|
||||
// checkMemberList = false;
|
||||
// };
|
||||
// }, [listReload, memberList]);
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
@@ -177,7 +180,7 @@ export default function FamilyAcc() {
|
||||
</span>
|
||||
</Link>
|
||||
<Link
|
||||
to={`/familysettings`}
|
||||
to={`/acc-family/familysettings`}
|
||||
state={{ imageServer: familyList?.session_image_server }}
|
||||
className="slider-btns flex space-x-4 w-12 h-12 rounded-md shadow-sm justify-center items-center cursor-pointer dark:bg-[linear-gradient(134.38deg,#f539f8_0%,#c342f9_43.55%,#5356fb_104.51%)] bg-[#76a5df] text-white"
|
||||
>
|
||||
@@ -248,13 +251,13 @@ const FamilyForm = ({
|
||||
}) => {
|
||||
return (
|
||||
<div className="logout-modal-wrapper w-11/12 lg:w-[460px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<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 dark:border-[#5356fb29] ">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Add Members
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={popUpHandler}
|
||||
>
|
||||
<CloseIcon />
|
||||
@@ -267,8 +270,8 @@ const FamilyForm = ({
|
||||
name="first_name"
|
||||
type="text"
|
||||
parentClass="flex items-center gap-1 w-full"
|
||||
labelClass="flex-[0.2] mb-0"
|
||||
inputClass="flex-[0.8] input-curve lg border border-[#dce4e9]"
|
||||
labelClass="flex-[0.4] mb-0"
|
||||
inputClass="flex-[0.6] input-curve lg border border-[#dce4e9]"
|
||||
fieldClass="px-2"
|
||||
value={first_name}
|
||||
inputHandler={inputHandler}
|
||||
@@ -279,8 +282,8 @@ const FamilyForm = ({
|
||||
name="last_name"
|
||||
type="text"
|
||||
parentClass="flex items-center gap-1 w-full"
|
||||
labelClass="flex-[0.2] mb-0"
|
||||
inputClass="flex-[0.8] input-curve lg border border-[#dce4e9]"
|
||||
labelClass="flex-[0.4] mb-0"
|
||||
inputClass="flex-[0.6] input-curve lg border border-[#dce4e9]"
|
||||
fieldClass="px-2"
|
||||
value={last_name}
|
||||
inputHandler={inputHandler}
|
||||
@@ -289,7 +292,7 @@ const FamilyForm = ({
|
||||
{/* Age dropdown */}
|
||||
<div className="">
|
||||
<label
|
||||
className="input-label text-[#181c32] dark:text-white text-[15px] font-semibold"
|
||||
className="job-label"
|
||||
htmlFor="age-selection"
|
||||
>
|
||||
Birthday: (Year/Month)
|
||||
|
||||
@@ -80,13 +80,11 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
||||
}
|
||||
};
|
||||
|
||||
console.log(details);
|
||||
|
||||
return (
|
||||
<ModalCom action={onClose} situation={situation}>
|
||||
<div className="logout-modal-wrapper lw-[90%] md:w-[48rem] h-full lg:h-[627px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[1.875rem] py-[1.4375rem] border-b dark:border-[#5356fb29] border-light-purple">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="logout-modal-wrapper lw-[90%] md:w-[48rem] min-h-[500px] bg-white dark:bg-dark-white lg:rounded-2xl">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
{isManageFamilyPage
|
||||
? `${state?.firstname}'s Suggested Task`
|
||||
: isActivitiesPage
|
||||
@@ -95,7 +93,7 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={onClose}
|
||||
>
|
||||
<svg
|
||||
@@ -179,10 +177,10 @@ const SuggestTask = ({ details, onClose, situation, continuePopupData }) => {
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<div className="field w-full mb-[.3125rem]">
|
||||
<div className="w-full mb-[.3125rem]">
|
||||
<label
|
||||
htmlFor="description"
|
||||
className='input-label text-[#181c32] dark:text-white text-[1.125rem] leading-[1.3102rem] font-semibold flex items-center gap-1'
|
||||
className='job-label'
|
||||
>
|
||||
Description
|
||||
{props.errors.description &&
|
||||
|
||||
@@ -7,7 +7,7 @@ function DataIteration(props) {
|
||||
{datas &&
|
||||
datas?.length >= endLength &&
|
||||
datas?.slice(startLength, endLength)
|
||||
.map((value) => children({ datas: value }))}
|
||||
.map((value, index) => children({ datas: value, index }))}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ export default function InputCom({
|
||||
<div className={`flex items-center justify-between mb-2.5 ${labelClass}`}>
|
||||
{label && (
|
||||
<label
|
||||
className={`input-label text-[#181c32] text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1 ${labalClass}`}
|
||||
className={`job-label ${error && 'job-label-flex'} ${labalClass}`}
|
||||
htmlFor={name}
|
||||
>
|
||||
{label}
|
||||
@@ -95,8 +95,7 @@ export default function InputCom({
|
||||
value={value}
|
||||
onChange={inputHandler}
|
||||
className={`input-field placeholder:text-base text-dark-gray w-full h-full ${
|
||||
inputBg ? inputBg : "bg-[#FAFAFA] dark:bg-[#11131F] dark:text-white tracking-wide"
|
||||
} focus:ring-0 focus:outline-none ${fieldClass}`}
|
||||
inputBg && inputBg} tracking-wide focus:ring-0 focus:outline-none ${fieldClass}`}
|
||||
type={type}
|
||||
id={name}
|
||||
name={name}
|
||||
|
||||
@@ -14,9 +14,9 @@ export default function ModalCom({ action, children, situation, isOpen, classNam
|
||||
<div className="modal-com">
|
||||
<div
|
||||
onClick={action || isOpen}
|
||||
className="fixed top-0 left-0 w-full lg:h-[100vh] h-full bg-black bg-opacity-40 backdrop-filter backdrop-blur-sm z-50"
|
||||
className="fixed top-0 left-0 bottom-0 w-full bg-black bg-opacity-40 backdrop-filter backdrop-blur-sm z-50"
|
||||
></div>
|
||||
<div className={`fixed lg:h-100vh h-full z-[99999999999999] w-full lg:w-auto inset-0 flex flex-col justify-center items-center ${className}`}>
|
||||
<div className={`fixed h-full z-[99999999999999] w-full lg:w-auto inset-0 flex flex-col justify-center items-center ${className}`}>
|
||||
{children && children}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,7 @@ function JobsCompleted() {
|
||||
|
||||
const apiCall = new usersService()
|
||||
|
||||
let [familyRewardHistory, setFamilyRewardHistory] = useState({ // FOR PURCHASE HISTORY
|
||||
let [jobHistory, setJobHistory] = useState({ // FOR PURCHASE HISTORY
|
||||
loading: true,
|
||||
data: [],
|
||||
error: false
|
||||
@@ -22,7 +22,7 @@ function JobsCompleted() {
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
const indexOfFirstItem = Number(currentPage);
|
||||
const indexOfLastItem = Number(indexOfFirstItem)+Number(process.env.REACT_APP_ITEM_PER_PAGE);
|
||||
const currentReward = familyRewardHistory?.data?.slice(indexOfFirstItem, indexOfLastItem);
|
||||
const currentReward = jobHistory?.data?.slice(indexOfFirstItem, indexOfLastItem);
|
||||
|
||||
const handlePagination = (e) => {
|
||||
handlePagingFunc(e,setCurrentPage)
|
||||
@@ -31,18 +31,15 @@ function JobsCompleted() {
|
||||
|
||||
//FUNCTION TO GET FAMILY REWARD HISTORY
|
||||
const getJobCompletedHistory = ()=>{
|
||||
// apiCall.getFamilyRewardHx().then((res)=>{
|
||||
// if(res.data.internal_return < 0){ // success but no data
|
||||
// setFamilyRewardHistory(prev => ({...prev, loading: false}))
|
||||
// return
|
||||
// }
|
||||
// setFamilyRewardHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
|
||||
// }).catch((error)=>{
|
||||
// setFamilyRewardHistory(prev => ({...prev, loading: false, error: true}))
|
||||
// })
|
||||
setTimeout(()=>{
|
||||
setFamilyRewardHistory(prev => ({...prev, loading: false, error:true}))
|
||||
},3000)
|
||||
apiCall.getContractHx().then((res)=>{
|
||||
if(res.data.internal_return < 0){ // success but no data
|
||||
setJobHistory(prev => ({...prev, loading: false}))
|
||||
return
|
||||
}
|
||||
setJobHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
|
||||
}).catch((error)=>{
|
||||
setJobHistory(prev => ({...prev, loading: false, error: true}))
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
@@ -50,43 +47,43 @@ function JobsCompleted() {
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className='flex flex-col justify-between min-h-[500px]'>
|
||||
{familyRewardHistory.loading ?
|
||||
<div className='p-4 flex flex-col justify-between min-h-[500px]'>
|
||||
{jobHistory?.loading ?
|
||||
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
|
||||
: familyRewardHistory.data.length ?
|
||||
: jobHistory?.data?.length ?
|
||||
<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>
|
||||
<th className="p-2">Amount</th>
|
||||
<th className="p-2">Date</th>
|
||||
<th className="p-2">Confirmation</th>
|
||||
<thead className='w-full'>
|
||||
<tr className='text-slate-600 dark:text-white'>
|
||||
<th className="p-4">Title</th>
|
||||
<th className="p-4 text-right">Amount</th>
|
||||
{/* <th className="p-4">Date</th>
|
||||
<th className="p-4">Contract</th> */}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{currentReward.map((item, index) => {
|
||||
let date = new Date(item.added).toLocaleDateString()
|
||||
{currentReward?.map((item, index) => {
|
||||
let date = new Date(item?.delivery_date).toLocaleDateString()
|
||||
return (
|
||||
<tr key={index} className='text-slate-500'>
|
||||
<td className="p-2">
|
||||
<tr key={index} className='dark:text-white dark:bg-dark-white border-y dark:border-[#5356fb29] hover:bg-gray-50 dark:hover:bg-gray-50 dark:hover:text-black transition-all duration-300'>
|
||||
<td className="p-4 w-full">
|
||||
<div className='flex items-center gap-2'>
|
||||
<img src={item.icon} className='min-w-[60px] max-w-[60px] min-h-[60px] max-h-[60px] rounded-full bg-slate-500' alt='Reward Logo' />
|
||||
{/* <img src={item.icon} className='min-w-[60px] max-w-[60px] min-h-[60px] max-h-[60px] rounded-full bg-slate-500' alt='Reward Logo' /> */}
|
||||
<div className='flex flex-col'>
|
||||
<h1 className='text-lg font-bold'>Reward to {item.rec_firstname} {item.rec_lastname}</h1>
|
||||
<p className='text-sm'>{item.description}</p>
|
||||
<h1 className='text-lg font-bold line-clamp-1'>{item?.title}</h1>
|
||||
<p className='text-sm line-clamp-2'>{item?.description}</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="p-2">{AmountTo2DP(item.amount*0.01)} {item.currency}</td>
|
||||
<td className="p-2">{date}</td>
|
||||
<td className="p-2">{item.confirmation}</td>
|
||||
<td className="p-4 text-right">{AmountTo2DP(item?.price*0.01)} {item?.currency}</td>
|
||||
{/* <td className="p-4">{date}</td>
|
||||
<td className="p-4">{item?.contract}</td> */}
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
)}
|
||||
</tbody>
|
||||
</table>
|
||||
:familyRewardHistory.error ?
|
||||
:jobHistory?.error ?
|
||||
<div className="p-2 text-slate-500 flex flex-col grow justify-center items-center">
|
||||
<span>Opps! an error occurred. Please try again!</span>
|
||||
</div>
|
||||
@@ -97,7 +94,7 @@ function JobsCompleted() {
|
||||
}
|
||||
|
||||
{/* PAGINATION BUTTON */}
|
||||
<PaginatedList onClick={handlePagination} prev={currentPage == 0 ? true : false} next={currentPage+Number(process.env.REACT_APP_ITEM_PER_PAGE) >= familyRewardHistory?.data?.length ? true : false} data={familyRewardHistory?.data} start={indexOfFirstItem} stop={indexOfLastItem} />
|
||||
<PaginatedList onClick={handlePagination} prev={currentPage == 0 ? true : false} next={currentPage+Number(process.env.REACT_APP_ITEM_PER_PAGE) >= jobHistory?.data?.length ? true : false} data={jobHistory?.data} start={indexOfFirstItem} stop={indexOfLastItem} />
|
||||
{/* END OF PAGINATION BUTTON */}
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, {useEffect, useState} from 'react'
|
||||
import React, {memo, useCallback, useEffect, useState} from 'react'
|
||||
import Image from '../../assets/images/taskbanners/default.jpg'
|
||||
|
||||
import usersService from '../../services/UsersService';
|
||||
@@ -9,8 +9,8 @@ import LoadingSpinner from '../Spinners/LoadingSpinner';
|
||||
|
||||
import { AmountTo2DP } from '../Helpers/PriceFormatter';
|
||||
|
||||
function RewardsTable() {
|
||||
|
||||
export const RewardsTable = memo(() => {
|
||||
const apiCall = new usersService()
|
||||
|
||||
let [familyRewardHistory, setFamilyRewardHistory] = useState({ // FOR PURCHASE HISTORY
|
||||
@@ -30,7 +30,7 @@ function RewardsTable() {
|
||||
|
||||
|
||||
//FUNCTION TO GET FAMILY REWARD HISTORY
|
||||
const getFamilyRewardHistory = ()=>{
|
||||
const getFamilyRewardHistory = useCallback(()=>{
|
||||
apiCall.getFamilyRewardHx().then((res)=>{
|
||||
if(res.data.internal_return < 0){ // success but no data
|
||||
setFamilyRewardHistory(prev => ({...prev, loading: false}))
|
||||
@@ -40,32 +40,32 @@ function RewardsTable() {
|
||||
}).catch((error)=>{
|
||||
setFamilyRewardHistory(prev => ({...prev, loading: false, error: true}))
|
||||
})
|
||||
}
|
||||
},[])
|
||||
|
||||
useEffect(()=>{
|
||||
getFamilyRewardHistory()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className='flex flex-col justify-between min-h-[500px]'>
|
||||
<div className='p-4 flex flex-col justify-between min-h-[500px]'>
|
||||
{familyRewardHistory.loading ?
|
||||
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
|
||||
: familyRewardHistory.data.length ?
|
||||
<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>
|
||||
<th className="p-2">Amount</th>
|
||||
<th className="p-2">Date</th>
|
||||
<th className="p-2">Confirmation</th>
|
||||
<thead className='w-full'>
|
||||
<tr className='text-slate-600 dark:text-white'>
|
||||
<th className="p-4"></th>
|
||||
<th className="p-4 text-right">Amount</th>
|
||||
<th className="p-4">Date</th>
|
||||
<th className="p-4">Confirmation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{currentReward.map((item, index) => {
|
||||
let date = new Date(item.added).toLocaleDateString()
|
||||
return (
|
||||
<tr key={index} className='text-slate-500'>
|
||||
<td className="p-2">
|
||||
<tr key={index} className='dark:text-white dark:bg-dark-white border-y dark:border-[#5356fb29] hover:bg-gray-50 dark:hover:bg-gray-50 dark:hover:text-black transition-all duration-300'>
|
||||
<td className="p-4">
|
||||
<div className='flex items-center gap-2'>
|
||||
<img src={item.icon} className='min-w-[60px] max-w-[60px] min-h-[60px] max-h-[60px] rounded-full bg-slate-500' alt='Reward Logo' />
|
||||
<div className='flex flex-col'>
|
||||
@@ -74,9 +74,9 @@ function RewardsTable() {
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td className="p-2">{AmountTo2DP(item.amount*0.01)} {item.currency}</td>
|
||||
<td className="p-2">{date}</td>
|
||||
<td className="p-2">{item.confirmation}</td>
|
||||
<td className="p-4 text-right">{AmountTo2DP(item.amount*0.01)} {item.currency}</td>
|
||||
<td className="p-4">{date}</td>
|
||||
<td className="p-4">{item.confirmation}</td>
|
||||
</tr>
|
||||
)
|
||||
}
|
||||
@@ -99,5 +99,5 @@ function RewardsTable() {
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
)
|
||||
export default RewardsTable
|
||||
@@ -13,11 +13,38 @@ import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
import RewardsTable from "./RewardsTable";
|
||||
import JobsCompleted from "./JobsCompleted";
|
||||
|
||||
import TabButton from "../customTabs/TabButton";
|
||||
|
||||
export default function History() {
|
||||
|
||||
const apiCall = new usersService()
|
||||
|
||||
let [tab, setTab] = useState("purchases"); //STATE FOR SWITCHING BETWEEN TABS
|
||||
const [selectedTab, setSelectedTab] = useState("purchases");
|
||||
// let [tab, setTab] = useState("purchases"); //STATE FOR SWITCHING BETWEEN TABS
|
||||
// const tabs = ["purchases", "recent activity", "rewards", 'jobs completed'] //STATE FOR SWITCHING BETWEEN TABS
|
||||
|
||||
const tabs = [ //STATE FOR SWITCHING BETWEEN TABS
|
||||
{
|
||||
id: 1,
|
||||
title: "purchases",
|
||||
iconName: "history",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "recent activity",
|
||||
iconName: "history",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "rewards",
|
||||
iconName: "history",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: "jobs completed",
|
||||
iconName: "history",
|
||||
},
|
||||
]
|
||||
|
||||
let [paymentHistory, setPaymentHistory] = useState({ // FOR PAYMENT HISTORY
|
||||
loading: true,
|
||||
@@ -70,244 +97,84 @@ export default function History() {
|
||||
<>
|
||||
<Layout>
|
||||
<div className="history-wrapper w-full mb-10">
|
||||
<div className="w-full">
|
||||
<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">
|
||||
<div className="w-full">
|
||||
<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">
|
||||
|
||||
History
|
||||
History
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div className="slider-btns flex space-x-4">
|
||||
</h1>
|
||||
</div>
|
||||
<div className="slider-btns flex space-x-4">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/*<div className="quick-counters-widget w-full mb-11">*/}
|
||||
{/* <div className="grid xl:grid-cols-4 lg:grid-cols-2 grid-cols-1 gap-[30px]">*/}
|
||||
{/* <HistoryAnalyticsCard*/}
|
||||
{/* title="Total Sells"*/}
|
||||
{/* numberOfCount={71}*/}
|
||||
{/* numberOfAnalyse={324.75}*/}
|
||||
{/* primaryColor="#5356FB"*/}
|
||||
{/* iconBg="rgba(83, 86, 251, 0.16)"*/}
|
||||
{/* >*/}
|
||||
{/* <svg*/}
|
||||
{/* width="38"*/}
|
||||
{/* height="31"*/}
|
||||
{/* viewBox="0 0 38 31"*/}
|
||||
{/* fill="none"*/}
|
||||
{/* xmlns="http://www.w3.org/2000/svg"*/}
|
||||
{/* >*/}
|
||||
{/* <path*/}
|
||||
{/* d="M33.0451 12.6481C32.5478 14.368 32.1426 16.0074 31.5716 17.5846C31.4311 17.9737 30.7496 18.4066 30.3121 18.4112C25.1937 18.471 20.0754 18.4503 14.957 18.4526C14.1995 18.4526 13.716 18.0796 13.5433 17.3543C12.7328 13.9651 11.9154 10.5759 11.1418 7.17975C10.907 6.15285 11.3744 5.51968 12.3644 5.51277C16.5365 5.48514 20.7085 5.50125 24.9842 5.50125C24.9336 7.71622 25.5368 9.6526 27.2153 11.1285C28.857 12.579 30.7979 13.0142 33.0451 12.6481Z"*/}
|
||||
{/* fill="#5356FB"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M12.4851 19.636C15.9295 19.636 19.3142 19.636 22.6988 19.636C24.9138 19.636 27.1287 19.6314 29.3437 19.6383C30.3752 19.6406 30.96 20.1034 30.9877 20.9024C31.0153 21.7428 30.412 22.2539 29.3391 22.2539C23.4747 22.2585 17.6126 22.2585 11.7483 22.2539C10.5602 22.2539 10.2309 21.9638 9.97077 20.7642C8.85637 15.6113 7.73277 10.4607 6.6391 5.30318C6.51016 4.69763 6.27301 4.35686 5.64904 4.16576C4.21921 3.72829 2.81701 3.19872 1.4056 2.70139C0.219833 2.28234 -0.219938 1.64226 0.102407 0.820278C0.420147 0.00750794 1.10858 -0.199714 2.23449 0.191705C3.98666 0.799556 5.72272 1.45345 7.49332 2.00605C8.38667 2.28464 8.81263 2.78888 9.00143 3.69145C10.0813 8.81904 11.2026 13.9374 12.3147 19.0581C12.3492 19.2101 12.4045 19.362 12.4851 19.636Z"*/}
|
||||
{/* fill="#5356FB"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M25.8048 6.28397C25.7886 3.08815 28.3789 0.490967 31.5747 0.50248C34.7061 0.511689 37.2848 3.11347 37.2802 6.26094C37.2756 9.3992 34.6877 11.9941 31.5494 12.001C28.4112 12.0079 25.8209 9.43144 25.8048 6.28397ZM33.99 3.73514C32.9516 4.84723 31.9339 5.9386 30.7251 7.23489C30.1472 6.44974 29.6798 5.81887 29.1456 5.0959C28.6092 5.6577 28.2546 6.02839 28.0243 6.27245C29.0052 7.28554 29.9423 8.25027 30.808 9.14593C32.2125 7.73682 33.6585 6.28857 35.2264 4.71599C34.9709 4.51337 34.6646 4.26931 34.3561 4.02525C34.2594 3.94466 34.1627 3.86868 33.99 3.73514Z"*/}
|
||||
{/* fill="#5356FB"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M27.9144 23.32C29.9474 23.3016 31.6052 24.8995 31.6443 26.9164C31.6835 28.9679 30.0165 30.651 27.9489 30.651C25.9296 30.651 24.2788 29.0094 24.2696 26.9993C24.2626 24.9801 25.8859 23.3384 27.9144 23.32ZM29.5767 26.974C29.5744 26.0829 28.8745 25.36 27.9949 25.3415C27.0832 25.3208 26.3233 26.0737 26.328 26.9924C26.3326 27.8743 27.044 28.6064 27.9144 28.6295C28.8261 28.6525 29.579 27.8996 29.5767 26.974Z"*/}
|
||||
{/* fill="#5356FB"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M13.0216 30.6485C10.9908 30.6324 9.36064 29 9.36524 26.9853C9.37215 24.9062 11.0184 23.2922 13.1091 23.3152C15.126 23.3382 16.7446 25.0006 16.7216 27.0245C16.6963 29.0506 15.05 30.6647 13.0216 30.6485ZM14.6724 26.9899C14.6747 26.0643 13.9195 25.3206 13.0008 25.3437C12.1351 25.3667 11.396 26.115 11.396 26.9761C11.3937 27.8395 12.1259 28.597 12.987 28.627C13.8988 28.6569 14.6701 27.9086 14.6724 26.9899Z"*/}
|
||||
{/* fill="#5356FB"*/}
|
||||
{/* />*/}
|
||||
{/* </svg>*/}
|
||||
{/* </HistoryAnalyticsCard>*/}
|
||||
{/* <HistoryAnalyticsCard*/}
|
||||
{/* title="Active Customer"*/}
|
||||
{/* numberOfCount="7583k+"*/}
|
||||
{/* numberOfAnalyse={324.75}*/}
|
||||
{/* primaryColor="#F539F8"*/}
|
||||
{/* iconBg="#FEEBFE"*/}
|
||||
{/* >*/}
|
||||
{/* <svg*/}
|
||||
{/* width="28"*/}
|
||||
{/* height="30"*/}
|
||||
{/* viewBox="0 0 28 30"*/}
|
||||
{/* fill="none"*/}
|
||||
{/* xmlns="http://www.w3.org/2000/svg"*/}
|
||||
{/* >*/}
|
||||
{/* <path*/}
|
||||
{/* d="M13.8146 13.1935C13.3126 13.0277 12.8406 12.9333 12.4216 12.7261C8.70772 10.891 5.00536 9.03523 1.29839 7.18865C1.0267 7.05281 0.817179 6.87782 0.812574 6.55317C0.80797 6.21471 1.01749 6.02591 1.303 5.88315C4.98464 4.04809 8.66628 2.20842 12.3456 0.368751C13.4048 -0.160815 14.4478 -0.100951 15.4931 0.426313C17.8577 1.61669 20.2316 2.79555 22.6008 3.97901C23.8096 4.58226 25.0161 5.18781 26.2226 5.79336C26.2916 5.82789 26.3607 5.86013 26.4321 5.89467C26.7084 6.0236 26.8995 6.22392 26.8995 6.54396C26.8995 6.86861 26.6946 7.0505 26.4229 7.18405C24.7075 8.03826 22.9945 8.89708 21.2792 9.75129C19.2991 10.7391 17.3282 11.7406 15.3365 12.7031C14.8622 12.931 14.3234 13.0323 13.8146 13.1935Z"*/}
|
||||
{/* fill="#F539F8"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M12.8602 22.8893C12.8602 24.9477 12.8625 27.0061 12.8579 29.0645C12.8556 29.7966 12.4434 30.0545 11.7688 29.7437C8.39339 28.1895 5.01567 26.64 1.64717 25.0743C0.562705 24.5701 0.0101156 23.6882 0.00551066 22.4955C-0.0036992 18.5721 0.000903485 14.6487 0.00320595 10.7253C0.00320595 9.96783 0.429164 9.68692 1.10609 10.0001C4.59662 11.6095 8.08485 13.2281 11.5777 14.8306C12.4641 15.2382 12.874 15.9013 12.8671 16.8706C12.8533 18.8784 12.8625 20.8838 12.8625 22.8916C12.8625 22.8893 12.8602 22.8893 12.8602 22.8893Z"*/}
|
||||
{/* fill="#F539F8"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M14.848 22.8313C14.848 20.8121 14.8526 18.7928 14.8457 16.7736C14.8434 15.8618 15.2602 15.2332 16.0775 14.8556C19.5911 13.2347 23.107 11.6183 26.6205 9.99971C27.2606 9.705 27.7004 9.96978 27.7004 10.6674C27.705 14.63 27.7119 18.5902 27.6958 22.5527C27.6912 23.7661 27.0695 24.6135 25.9758 25.12C23.2451 26.3817 20.5121 27.6412 17.7814 28.9006C17.1965 29.17 16.614 29.4394 16.0315 29.7088C15.2394 30.0726 14.8457 29.8262 14.8457 28.9651C14.8457 26.9205 14.8457 24.8736 14.8457 22.829C14.8457 22.8313 14.8457 22.8313 14.848 22.8313Z"*/}
|
||||
{/* fill="#F539F8"*/}
|
||||
{/* />*/}
|
||||
{/* </svg>*/}
|
||||
{/* </HistoryAnalyticsCard>*/}
|
||||
{/* <HistoryAnalyticsCard*/}
|
||||
{/* title="Total Prodcuts"*/}
|
||||
{/* numberOfCount="6753"*/}
|
||||
{/* numberOfAnalyse={324.75}*/}
|
||||
{/* primaryColor="#27AE60"*/}
|
||||
{/* iconBg="#E9F7EF"*/}
|
||||
{/* >*/}
|
||||
{/* <svg*/}
|
||||
{/* width="31"*/}
|
||||
{/* height="31"*/}
|
||||
{/* viewBox="0 0 31 31"*/}
|
||||
{/* fill="none"*/}
|
||||
{/* xmlns="http://www.w3.org/2000/svg"*/}
|
||||
{/* >*/}
|
||||
{/* <path*/}
|
||||
{/* d="M15.0808 30.1824C10.7113 30.1824 6.3438 30.1824 1.97428 30.1824C0.641347 30.1824 -0.102099 29.364 0.0113425 28.0453C0.163273 26.3032 0.380025 24.5752 0.807456 22.8736C1.18424 21.3725 1.99859 20.3536 3.48345 19.7783C5.65302 18.9355 7.84892 18.182 10.0772 17.5155C10.1805 17.4851 10.3446 17.5358 10.4398 17.6046C11.9105 18.6702 13.3772 19.7398 14.8377 20.8195C15.018 20.9532 15.1355 20.9572 15.3178 20.8215C16.7784 19.7418 18.245 18.6722 19.7157 17.6067C19.8109 17.5378 19.973 17.4831 20.0763 17.5135C22.3694 18.2002 24.6382 18.9558 26.8584 19.8633C28.1306 20.384 28.8862 21.2591 29.2549 22.5596C29.7208 24.2025 29.9477 25.8798 30.1016 27.5733C30.1239 27.8265 30.1523 28.0818 30.1584 28.337C30.1867 29.364 29.421 30.1683 28.3919 30.1804C27.4094 30.1926 26.429 30.1824 25.4465 30.1824C21.9926 30.1824 18.5367 30.1824 15.0808 30.1824Z"*/}
|
||||
{/* fill="#27AE60"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M8.44531 7.35622C8.58509 4.27912 9.72152 2.01232 12.3205 0.671285C15.3146 -0.872326 18.969 0.337039 20.6929 3.36754C21.7443 5.21501 21.8962 7.17795 21.4323 9.21382C21.0008 11.1059 20.2108 12.8338 18.967 14.3389C18.3735 15.056 17.6908 15.6739 16.846 16.0811C15.2498 16.8488 13.7629 16.5774 12.4137 15.5118C10.4366 13.952 9.39133 11.8108 8.78563 9.43057C8.59724 8.6851 8.53444 7.90722 8.44531 7.35622Z"*/}
|
||||
{/* fill="#27AE60"*/}
|
||||
{/* />*/}
|
||||
{/* </svg>*/}
|
||||
{/* </HistoryAnalyticsCard>*/}
|
||||
{/* <HistoryAnalyticsCard*/}
|
||||
{/* title="Close Offer"*/}
|
||||
{/* numberOfCount="745"*/}
|
||||
{/* numberOfAnalyse={-324.75}*/}
|
||||
{/* primaryColor="#EB5757"*/}
|
||||
{/* iconBg="#FDEEEE"*/}
|
||||
{/* >*/}
|
||||
{/* <svg*/}
|
||||
{/* width="70"*/}
|
||||
{/* height="70"*/}
|
||||
{/* viewBox="0 0 70 70"*/}
|
||||
{/* fill="none"*/}
|
||||
{/* xmlns="http://www.w3.org/2000/svg"*/}
|
||||
{/* >*/}
|
||||
{/* <circle*/}
|
||||
{/* opacity="0.1"*/}
|
||||
{/* cx="35"*/}
|
||||
{/* cy="35"*/}
|
||||
{/* r="35"*/}
|
||||
{/* fill="#EB5757"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M20.8416 32.9067C24.7077 32.9067 28.5465 32.9067 32.4127 32.9067C32.4127 38.4719 32.4127 44.0165 32.4127 49.616C32.2848 49.616 32.1637 49.616 32.0427 49.616C28.8753 49.616 25.7079 49.6183 22.5406 49.616C21.5084 49.616 20.8233 48.94 20.8233 47.9124C20.821 43.03 20.8233 38.1454 20.8233 33.263C20.8256 33.1465 20.8347 33.0346 20.8416 32.9067Z"*/}
|
||||
{/* fill="#EB5757"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M36.8789 49.6137C36.8789 44.0143 36.8789 38.4696 36.8789 32.9067C40.7154 32.9067 44.529 32.9067 48.3906 32.9067C48.3906 33.062 48.3906 33.1968 48.3906 33.3315C48.3906 38.1796 48.3906 43.0277 48.3906 47.8736C48.3906 48.9377 47.7307 49.6137 46.6802 49.6137C43.5243 49.616 40.3706 49.6137 37.2146 49.6137C37.1118 49.6137 37.0091 49.6137 36.8789 49.6137Z"*/}
|
||||
{/* fill="#EB5757"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M19.002 31.2053C19.002 30.6595 19.002 30.1434 19.002 29.6273C19.002 28.4193 18.9975 27.2089 19.002 26.0009C19.0043 25.0692 19.6734 24.359 20.5983 24.3567C24.4781 24.3453 28.358 24.3521 32.2379 24.3521C32.2836 24.3521 32.3292 24.3613 32.4046 24.3704C32.4046 26.6426 32.4046 28.9125 32.4046 31.2053C27.9515 31.2053 23.503 31.2053 19.002 31.2053Z"*/}
|
||||
{/* fill="#EB5757"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M36.875 31.217C36.875 28.9197 36.875 26.6658 36.875 24.373C37.0052 24.3662 37.1262 24.3502 37.2449 24.3502C40.9878 24.3502 44.7306 24.3479 48.4735 24.3525C49.5719 24.3547 50.2228 25.0307 50.2182 26.1337C50.2136 27.6888 50.2182 29.244 50.2159 30.7968C50.2159 30.9316 50.2159 31.0663 50.2159 31.217C45.7491 31.217 41.3303 31.217 36.875 31.217Z"*/}
|
||||
{/* fill="#EB5757"*/}
|
||||
{/* />*/}
|
||||
{/* <path*/}
|
||||
{/* d="M34.6091 21.749C35.8994 19.6001 37.6441 17.9947 39.6651 16.6565C40.8594 15.8664 42.0674 15.7385 43.2686 16.588C44.536 17.4855 45.0407 18.7483 44.7712 20.2669C44.5155 21.7033 43.6454 22.6533 42.241 23.0872C42.1017 23.1306 41.9464 23.1306 41.798 23.1306C37.1006 23.1328 32.4032 23.1214 27.7057 23.142C26.8905 23.1443 26.2145 22.8679 25.6391 22.3427C24.5384 21.3356 24.1661 20.0705 24.5475 18.641C24.9152 17.2617 25.824 16.3802 27.2376 16.0605C27.772 15.9394 28.2881 16.0011 28.7859 16.2363C30.1446 16.8826 31.2819 17.8326 32.3529 18.8693C33.2275 19.7188 34.0314 20.63 34.6091 21.749ZM34.0702 22.4158C34.0793 22.3861 34.0907 22.3564 34.0999 22.3267C33.0357 21.2078 31.903 20.171 30.526 19.4334C29.8295 19.0612 29.0805 19.1662 28.4913 19.7028C27.9798 20.1664 27.8062 20.7579 28.0209 21.3197C28.2607 21.9499 28.9161 22.4181 29.5555 22.4181C30.9371 22.4181 32.3187 22.4181 33.7003 22.4181C33.8258 22.4158 33.9492 22.4158 34.0702 22.4158ZM35.1184 22.3633C35.2166 22.3907 35.2577 22.4135 35.3011 22.4135C36.8197 22.4158 38.3383 22.4432 39.8569 22.4089C40.7681 22.3884 41.4988 21.3379 41.2727 20.4884C41.0284 19.5704 39.6559 18.8145 38.8064 19.3991C37.9752 19.97 37.1462 20.5501 36.3515 21.1689C35.9131 21.5069 35.5477 21.9408 35.1184 22.3633Z"*/}
|
||||
{/* fill="#EB5757"*/}
|
||||
{/* />*/}
|
||||
{/* </svg>*/}
|
||||
{/* </HistoryAnalyticsCard>*/}
|
||||
{/* </div>*/}
|
||||
{/*</div>*/}
|
||||
{/*<MarketHistorySection />*/}
|
||||
{/* <TopHxBox className="mb-11" /> */}
|
||||
<div className='w-full p-4 md:p-8 bg-white dark:bg-dark-white rounded-2xl shadow bottomMargin'>
|
||||
{/* switch button */}
|
||||
<div className="pl-7 my-2 flex items-center border-b border-slate-300 gap-3">
|
||||
<button
|
||||
name="purchases"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
tab == "purchases" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Purchases
|
||||
</button>
|
||||
<button
|
||||
name="recent"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
tab == "recent" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Recent Activity
|
||||
</button>
|
||||
<button
|
||||
name="reward"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
tab == "reward" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Rewards
|
||||
</button>
|
||||
<button
|
||||
name="jobs_completed"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
tab == "jobs_completed" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Jobs Completed
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/* END OF switch button */}
|
||||
<div className="history-tables w-full">
|
||||
{/* PURCHASE SECTION */}
|
||||
{tab == 'purchases' &&
|
||||
<div className="wallet w-full border-t">
|
||||
{/* <h1 className="p-2 text-xl font-bold text-dark-gray dark:text-white tracking-wide">Purchases</h1> */}
|
||||
{purchaseHistory.loading ?
|
||||
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
|
||||
:
|
||||
<PurchasesTable purchase={purchaseHistory} />
|
||||
<div className="w-full h-full p-4 bg-white dark:bg-dark-white rounded-2xl section-shadow lg:flex lg:px-10 px-4 justify-between">
|
||||
<div className="content-tab-items lg:w-[230px] w-full mr-2">
|
||||
<div className='overflow-hidden mb-5 lg:mb-0 py-2 lg:py-8'>
|
||||
{tabs.map((item) => (
|
||||
<div key={item.id} className='w-full'>
|
||||
<TabButton
|
||||
key={item.id}
|
||||
item={item.title}
|
||||
iconName={item.iconName}
|
||||
selectedTab={selectedTab}
|
||||
setSelectedTab={setSelectedTab}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-[1px] bg-[#E3E4FE] dark:bg-[#a7a9b533] mr-10"></div>
|
||||
<div className="flex-1 overflow-y-auto min-h-[520px]">
|
||||
<>
|
||||
{/* PURCHASE SECTION */}
|
||||
{selectedTab == 'purchases' &&
|
||||
<div className="wallet w-full">
|
||||
{/* <h1 className="p-2 text-xl font-bold text-dark-gray dark:text-white tracking-wide">Purchases</h1> */}
|
||||
{purchaseHistory.loading ?
|
||||
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
|
||||
:
|
||||
<PurchasesTable purchase={purchaseHistory} />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
{/* END OF PURCHASE SECTION */}
|
||||
|
||||
{/* RECENT ACTIVITY SECTION */}
|
||||
{tab == 'recent' &&
|
||||
<div className="wallet w-full border-t">
|
||||
{/* <h1 className="p-2 text-xl font-bold text-dark-gray dark:text-white tracking-wide">Recent Activity</h1> */}
|
||||
{/* <p className='text-base text-slate-500 dark:text-white'>Activity Report</p> */}
|
||||
{paymentHistory.loading ?
|
||||
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
|
||||
:
|
||||
<RecentActivityTable payment={paymentHistory} />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
{/* END OF RECENT ACTIVITY SECTION */}
|
||||
{/* END OF PURCHASE SECTION */}
|
||||
|
||||
{/* RECENT ACTIVITY SECTION */}
|
||||
{selectedTab == 'recent activity' &&
|
||||
<div className="wallet w-full">
|
||||
{/* <h1 className="p-2 text-xl font-bold text-dark-gray dark:text-white tracking-wide">Recent Activity</h1> */}
|
||||
{/* <p className='text-base text-slate-500 dark:text-white'>Activity Report</p> */}
|
||||
{paymentHistory.loading ?
|
||||
<LoadingSpinner size='16' color='sky-blue' height='h-[500px]' />
|
||||
:
|
||||
<RecentActivityTable payment={paymentHistory} />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
{/* END OF RECENT ACTIVITY SECTION */}
|
||||
|
||||
{/* REWARD SECTION */}
|
||||
{tab == 'reward' &&
|
||||
<div className="wallet w-full border-t">
|
||||
<RewardsTable />
|
||||
</div>
|
||||
}
|
||||
{/* END OF REWARD SECTION */}
|
||||
{/* REWARD SECTION */}
|
||||
{selectedTab == 'rewards' &&
|
||||
<div className="wallet w-full">
|
||||
<RewardsTable />
|
||||
</div>
|
||||
}
|
||||
{/* END OF REWARD SECTION */}
|
||||
|
||||
{/* JOBS COMPLETED SECTION */}
|
||||
{tab == 'jobs_completed' &&
|
||||
<div className="wallet w-full border-t">
|
||||
<JobsCompleted />
|
||||
</div>
|
||||
}
|
||||
{/* END OF JOBS COMPLETED SECTION */}
|
||||
{/* JOBS COMPLETED SECTION */}
|
||||
{selectedTab == 'jobs completed' &&
|
||||
<div className="wallet w-full">
|
||||
<JobsCompleted />
|
||||
</div>
|
||||
}
|
||||
{/* END OF JOBS COMPLETED SECTION */}
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/*<HistoryTable />*/}
|
||||
</div>
|
||||
</div>
|
||||
</Layout>
|
||||
</>
|
||||
|
||||
@@ -67,7 +67,7 @@ export default function Home(props) {
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<div className="home-page-wrapper">
|
||||
<div className="w-full">
|
||||
{userDetails && userDetails?.account_type == "FAMILY" ? (
|
||||
<FamilyDash
|
||||
account={userDetails}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import React from 'react'
|
||||
|
||||
export default function Iframe({src, title}) {
|
||||
return (
|
||||
<iframe
|
||||
src={src}
|
||||
title={title}
|
||||
className='w-full h-full'
|
||||
>
|
||||
</iframe>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import React from 'react'
|
||||
|
||||
export default function ImageElement({className, src, alt}) {
|
||||
return (
|
||||
<div className='w-full h-full flex justify-center items-center'>
|
||||
<img src={src} alt={alt} className={`object-cover w-auto h-full ${className && className}`} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -88,14 +88,14 @@ export default function AddGroup({ action, situation, setUpdateList }) {
|
||||
|
||||
return (
|
||||
<ModalCom action={action} situation={situation}>
|
||||
<div className="logout-modal-wrapper lg:w-[500px] 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 border-light-purple dark:border-[#5356fb29] ">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Add Group
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<svg
|
||||
@@ -135,28 +135,6 @@ export default function AddGroup({ action, situation, setUpdateList }) {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full flex justify-between items-center gap-4">
|
||||
<button
|
||||
onClick={action}
|
||||
type="button"
|
||||
className="text-base text-light-red tracking-wide "
|
||||
>
|
||||
<span className="border-b dark:border-[#5356fb29] border-light-red">
|
||||
Cancel
|
||||
</span>
|
||||
</button>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
onClick={() => addGroup()}
|
||||
type="button"
|
||||
className="w-[152px] h-[46px] flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
Add Group
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
||||
{requestStatus.message != "" &&
|
||||
@@ -177,6 +155,29 @@ export default function AddGroup({ action, situation, setUpdateList }) {
|
||||
))}
|
||||
{/* End of error or success display */}
|
||||
</div>
|
||||
|
||||
<div className="modal-footer-wrapper">
|
||||
<button
|
||||
onClick={action}
|
||||
type="button"
|
||||
className="custom-btn text-light-red border border-light-red"
|
||||
>
|
||||
<span className="">
|
||||
Cancel
|
||||
</span>
|
||||
</button>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
onClick={() => addGroup()}
|
||||
type="button"
|
||||
className="custom-btn btn-gradient text-white"
|
||||
>
|
||||
Add Group
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
);
|
||||
|
||||
@@ -20,14 +20,14 @@ export default function DeleteGroup({action, situation, details}) {
|
||||
action={action}
|
||||
situation={situation}
|
||||
>
|
||||
<div className="logout-modal-wrapper lg:w-[500px] 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 border-light-purple dark:border-[#5356fb29] ">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Delete Group
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<svg
|
||||
@@ -76,26 +76,6 @@ export default function DeleteGroup({action, situation, details}) {
|
||||
Are you sure, you want to delete <br /> <span>'{details?.group_name}'</span> group?
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex space-x-2.5">
|
||||
<button
|
||||
onClick={action}
|
||||
type="button"
|
||||
className=" border-gradient text-18 tracking-wide px-4 py-3 rounded-full"
|
||||
>
|
||||
<span className="text-gradient">Cancel</span>
|
||||
</button>
|
||||
{requestStatus.laoding ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
onClick={() => deleteGroup()}
|
||||
type="button"
|
||||
className="text-white primary-gradient text-18 tracking-wide px-4 py-3 rounded-full"
|
||||
>
|
||||
Confirm Delete
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
||||
{requestStatus.message != "" &&
|
||||
@@ -116,6 +96,26 @@ export default function DeleteGroup({action, situation, details}) {
|
||||
))}
|
||||
{/* End of error or success display */}
|
||||
</div>
|
||||
<div className="modal-footer-wrapper">
|
||||
<button
|
||||
onClick={action}
|
||||
type="button"
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className="text-gradient">Cancel</span>
|
||||
</button>
|
||||
{requestStatus.laoding ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
onClick={() => deleteGroup()}
|
||||
type="button"
|
||||
className="custom-btn primary-gradient text-white"
|
||||
>
|
||||
Confirm Delete
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
)
|
||||
|
||||
@@ -20,14 +20,14 @@ export default function DeleteMember({action, situation, details}) {
|
||||
action={action}
|
||||
situation={situation}
|
||||
>
|
||||
<div className="logout-modal-wrapper lg:w-[500px] 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 border-light-purple dark:border-[#5356fb29] ">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="logout-modal-wrapper lg:w-[500px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Remove Member
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<svg
|
||||
@@ -76,26 +76,6 @@ export default function DeleteMember({action, situation, details}) {
|
||||
Are you sure, you want to remove <br /> <span>'{details?.firstname} {details.lastname}'</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex space-x-2.5">
|
||||
<button
|
||||
onClick={action}
|
||||
type="button"
|
||||
className=" border-gradient text-18 tracking-wide px-4 py-3 rounded-full"
|
||||
>
|
||||
<span className="text-gradient">Cancel</span>
|
||||
</button>
|
||||
{requestStatus.laoding ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
onClick={() => deleteMember()}
|
||||
type="button"
|
||||
className="text-white primary-gradient text-18 tracking-wide px-4 py-3 rounded-full"
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
||||
{requestStatus.message != "" &&
|
||||
@@ -115,7 +95,27 @@ export default function DeleteMember({action, situation, details}) {
|
||||
)
|
||||
))}
|
||||
{/* End of error or success display */}
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer-wrapper">
|
||||
<button
|
||||
onClick={action}
|
||||
type="button"
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className="text-gradient">Cancel</span>
|
||||
</button>
|
||||
{requestStatus.laoding ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
<button
|
||||
onClick={() => deleteMember()}
|
||||
type="button"
|
||||
className="custom-btn primary-gradient text-white"
|
||||
>
|
||||
Remove
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
)
|
||||
|
||||
@@ -24,12 +24,6 @@ export default function MemberList({
|
||||
|
||||
const handleFieldsChange = ({ target: { name, value } }) => {
|
||||
setFields((prev) => ({ ...prev, [name]: value }));
|
||||
// let error = requestState?.errors?.indexOf(name) //// checks if the input field was in error array and removes it when the input changes
|
||||
// if(error >= 0){
|
||||
// let oldErrorArr = requestState.errors
|
||||
// let newErrorArr = oldErrorArr.splice(error, 1)
|
||||
// setRequestState(prev => ({...prev, errors:oldErrorArr}))
|
||||
// }
|
||||
|
||||
if (value == "") {
|
||||
setRequestState({
|
||||
@@ -89,6 +83,63 @@ export default function MemberList({
|
||||
// return
|
||||
// }
|
||||
|
||||
if(fields.firstname.length > 25){ // checks if firstname length is more than 25
|
||||
setRequestState({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "Firstname must not be more than 25 characters",
|
||||
data: [],
|
||||
errors: [],
|
||||
});
|
||||
return setTimeout(() => {
|
||||
setRequestState({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "",
|
||||
data: [],
|
||||
errors: [],
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
if(fields.lastname.length > 25){ // checks if lastname length is more than 25
|
||||
setRequestState({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "Lastname must not be more than 25 characters",
|
||||
data: [],
|
||||
errors: [],
|
||||
});
|
||||
return setTimeout(() => {
|
||||
setRequestState({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "",
|
||||
data: [],
|
||||
errors: [],
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
if(fields.email.length > 45){ // checks if email length is more than 45
|
||||
setRequestState({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "Email must not be more than 45 characters",
|
||||
data: [],
|
||||
errors: [],
|
||||
});
|
||||
return setTimeout(() => {
|
||||
setRequestState({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "",
|
||||
data: [],
|
||||
errors: [],
|
||||
});
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
//checks if email is a valid email address
|
||||
let regEx = /^[^0-9][a-zA-Z0-9._%+-]+@[a-zA-Z]+(\.[a-zA-Z]+)+$/;
|
||||
if (!EmailValidator(fields.email)) {
|
||||
@@ -201,7 +252,7 @@ export default function MemberList({
|
||||
{selectedGroup?.name}
|
||||
</h1>
|
||||
<div className="w-full flex flex-col-reverse lg:flex-col">
|
||||
<div className="py-3 w-full">
|
||||
<div className="relative py-3 w-full">
|
||||
<div className="relative grid grid-cols-1 sm:grid-cols-2 gap-2 place-content-center">
|
||||
<div className="input-item">
|
||||
<InputCom
|
||||
@@ -229,13 +280,15 @@ export default function MemberList({
|
||||
// iconName="message"
|
||||
/>
|
||||
</div>
|
||||
<div className="input-item w-full">
|
||||
</div>
|
||||
<div className="sm:flex gap-2 items-center">
|
||||
<div className="input-item my-2 w-full sm:w-9/12">
|
||||
<InputCom
|
||||
labelClass="tracking-wider"
|
||||
fieldClass="sm:px-6 px-2"
|
||||
value={fields.email}
|
||||
inputHandler={handleFieldsChange}
|
||||
inputClass="xl:w-[16rem] 2xl:w-full"
|
||||
inputClass=""
|
||||
placeholder="Email"
|
||||
// label="Email"
|
||||
name="email"
|
||||
@@ -243,7 +296,7 @@ export default function MemberList({
|
||||
// iconName="message"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-end items-end">
|
||||
<div className="flex justify-end items-end w-full sm:w-3/12">
|
||||
{requestState.loading ? (
|
||||
<LoadingSpinner size="8" color="sky-blue" />
|
||||
) : (
|
||||
@@ -266,10 +319,11 @@ export default function MemberList({
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div className="absolute top-full w-full my-1 text-center">
|
||||
{!requestState.loading && requestState.message && (
|
||||
<p
|
||||
className={`text-lg absolute -bottom-7 left-0 ${
|
||||
className={`text-base ${
|
||||
requestState.status ? "text-green-500" : "text-red-500"
|
||||
}`}
|
||||
>
|
||||
|
||||
@@ -4,6 +4,8 @@ import ListView from "../../assets/images/list-view.png";
|
||||
import AvailableJobsCard from "../Cards/AvailableJobsCard";
|
||||
import DataIteration from "../Helpers/DataIteration";
|
||||
import SelectBox from "../Helpers/SelectBox";
|
||||
import NewPaginatedList from "../Pagination/NewPaginatedList";
|
||||
import InfiniteScroll from "../infiniteScroll/InfiniteScroll";
|
||||
|
||||
export default function MainSection({
|
||||
className,
|
||||
@@ -18,7 +20,7 @@ export default function MainSection({
|
||||
);
|
||||
const [tab, setTab] = useState(Object.keys(marketCategories)[0]);
|
||||
|
||||
let [contentDisplay, setContentDisplay] = useState("list"); // STATE TO HOLD LIST VIEW STYLE
|
||||
let [contentDisplay, setContentDisplay] = useState("grid"); // STATE TO HOLD LIST VIEW STYLE
|
||||
|
||||
// Convert to array in order to map
|
||||
const mappedArray = Object.entries(marketCategories).map(([key, value]) => {
|
||||
@@ -95,7 +97,9 @@ export default function MainSection({
|
||||
</div>
|
||||
{/* end of contentDisplay toggler */}
|
||||
</div>
|
||||
<div className="filter-navigate-content w-full min-h-screen">
|
||||
|
||||
{/* OLD MARKET JOB LISTING */}
|
||||
{/* <div className="filter-navigate-content w-full min-h-screen">
|
||||
<div
|
||||
className={
|
||||
contentDisplay == "grid"
|
||||
@@ -108,8 +112,8 @@ export default function MainSection({
|
||||
startLength={process.env.REACT_APP_ZERO_STATE}
|
||||
endLength={products?.length}
|
||||
>
|
||||
{({ datas }) => (
|
||||
<div key={datas.job_uid}>
|
||||
{({ datas, index }) => (
|
||||
<div key={datas.job_uid+index}>
|
||||
<AvailableJobsCard
|
||||
contentDisplay={contentDisplay}
|
||||
image_server={image_server}
|
||||
@@ -119,7 +123,79 @@ export default function MainSection({
|
||||
)}
|
||||
</DataIteration>
|
||||
</div>
|
||||
</div> */}
|
||||
{/* END OF OLD MARKET JOB LISTING */}
|
||||
|
||||
{products?.length ?
|
||||
<NewPaginatedList
|
||||
data={products}
|
||||
itemsPerPage={9}
|
||||
filterItem=''
|
||||
tableTitle=''
|
||||
>
|
||||
{
|
||||
({data})=>(
|
||||
<div className="filter-navigate-content w-full min-h-[600px]">
|
||||
<div
|
||||
className={
|
||||
contentDisplay == "grid"
|
||||
? "grid lg:grid-cols-3 sm:grid-cols-2 gap-[30px]"
|
||||
: "w-full"
|
||||
}
|
||||
>
|
||||
{
|
||||
data.map((datum, index) => (
|
||||
<div key={datum.job_uid+index}>
|
||||
<AvailableJobsCard
|
||||
contentDisplay={contentDisplay}
|
||||
image_server={image_server}
|
||||
datas={datum}
|
||||
marketPlaceProduct={marketPlaceProduct}
|
||||
/>
|
||||
</div>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</NewPaginatedList>
|
||||
// <InfiniteScroll
|
||||
// allData={products}
|
||||
// addItemBy={3}
|
||||
// intialItemsToShow={9}
|
||||
// >
|
||||
// {
|
||||
// ({dataToShow})=>(
|
||||
// <div className="filter-navigate-content w-full min-h-[600px]">
|
||||
// <div
|
||||
// className={
|
||||
// contentDisplay == "grid"
|
||||
// ? "grid lg:grid-cols-3 sm:grid-cols-2 gap-[30px]"
|
||||
// : "w-full"
|
||||
// }
|
||||
// >
|
||||
// {
|
||||
// dataToShow.map((datum, index) => (
|
||||
// <div key={datum.job_uid+index}>
|
||||
// <AvailableJobsCard
|
||||
// contentDisplay={contentDisplay}
|
||||
// image_server={image_server}
|
||||
// datas={datum}
|
||||
// />
|
||||
// </div>
|
||||
// ))
|
||||
// }
|
||||
// </div>
|
||||
// </div>
|
||||
// )
|
||||
// }
|
||||
// </InfiniteScroll>
|
||||
:
|
||||
<div className="w-full h-[40rem] bg-white dark:bg-dark-white flex justify-center items-center">
|
||||
No Jobs Found!
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
import React, {useEffect, useState} from 'react'
|
||||
import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||
import usersService from "../../../services/UsersService";
|
||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
|
||||
|
||||
export default function LockJob({details, marketPlaceProduct, ManageInterest, manageInt, handleInputChange, MarketDetail, marketMsg, errMsg, textValue}) {
|
||||
const apiCall = new usersService()
|
||||
|
||||
const [completedTask, setCompletedTask] = useState({
|
||||
loading: true,
|
||||
data: []
|
||||
})
|
||||
|
||||
let thePrice = PriceFormatter(
|
||||
details?.price * 0.01,
|
||||
details?.currency_code,
|
||||
details?.currency
|
||||
);
|
||||
|
||||
let cleanedText = details?.job_description
|
||||
?.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, '"')
|
||||
.replace(/&/g, "&");
|
||||
|
||||
let dependOn = marketPlaceProduct?.filter(item => item?.job_uid == details?.offer_depend_uid)[0]
|
||||
|
||||
useEffect(()=>{
|
||||
apiCall.getVerifyCompletedTask({offer_depend_uid:details?.offer_depend_uid}).then(res => {
|
||||
console.log('RES', res.data)
|
||||
setCompletedTask({loading:false, data:res?.data?.result_list})
|
||||
}).catch(err =>{
|
||||
setCompletedTask({loading:false, data:[]})
|
||||
})
|
||||
},[])
|
||||
|
||||
return (
|
||||
<>
|
||||
{completedTask.loading ?
|
||||
<div className='w-full md:col-span-4 flex justify-center items-center min-h-[500px]'>
|
||||
<LoadingSpinner
|
||||
size='10'
|
||||
/>
|
||||
</div>
|
||||
:
|
||||
<>
|
||||
<div className="px-4 py-2 w-full md:col-span-3 md:border-r-1">
|
||||
<div className="min-h-[200px]">
|
||||
<h2 className="w-full flex gap-1 items-center font-semibold text-slate-900 dark:text-white tracking-wide">
|
||||
{details?.offer_depend_uid && <i className="fa-solid fa-lock p-1 text-red-500 text-[12px]"></i>}
|
||||
{details?.title}
|
||||
</h2>
|
||||
|
||||
{/* INPUT SECTION */}
|
||||
{[
|
||||
{
|
||||
name: "Description",
|
||||
content: details.description,
|
||||
},
|
||||
{
|
||||
name: "",
|
||||
content: {
|
||||
text: `Timeline: ${details.timeline_days} day(s) -- `,
|
||||
bold: `Budget: ${thePrice}`,
|
||||
},
|
||||
},
|
||||
// {
|
||||
// name: "Delivery Detail",
|
||||
// content: cleanedText,
|
||||
// danger: true,
|
||||
// },
|
||||
].map(({ name, content, danger }, idx) => (
|
||||
<div className={`my-1 flex flex-col items-start`} key={idx}>
|
||||
<label className="py-1 job-label w-full">
|
||||
{name}
|
||||
</label>
|
||||
<div
|
||||
className={`w-full p-2 text-slate-900 dark:text-white market-pop rounded-2xl ${
|
||||
name == "Description"
|
||||
? "min-h-[100px] max-h-[100px] h-full overflow-y-auto break-words bg-slate-50"
|
||||
: name == "Delivery Detail" ? " overflow-y-auto h-full min-h-[100px] max-h-[100px] bg-slate-50"
|
||||
: "h-full flex items-center"
|
||||
}`}
|
||||
>
|
||||
{danger ? (
|
||||
<p
|
||||
className={`dark:text-black`}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: danger && content,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<p className={`w-full text-slate-900 dark:text-black`}>
|
||||
{name !== "Delivery Detail" ? (
|
||||
<>
|
||||
{typeof content !== "object" ? content : null}
|
||||
{typeof content === "object" && (
|
||||
<>
|
||||
{/* <hr className="mb-1" /> */}
|
||||
<span className='flex w-full mb-1 h-[1px] bg-slate-500'></span>
|
||||
<span className="flex items-center gap-2 dark:text-white">
|
||||
{content?.text}
|
||||
<strong>{thePrice}</strong>
|
||||
</span>
|
||||
<span className='flex w-full mt-1 h-[1px] bg-slate-500'></span>
|
||||
{/* <hr className="mt-1" /> */}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{/* <hr className='my-3' /> */}
|
||||
{completedTask.loading ?
|
||||
<p className='py-3 w-full text-center text-lg'>Loading...</p>
|
||||
:completedTask?.data?.filter(item => item?.job_uid == details.offer_depend_uid).length > 0 ?
|
||||
<div className='w-full'>
|
||||
<label className="job-label w-full flex gap-2 items-center">
|
||||
If you have any questions about this task:
|
||||
<span className={`text-sm ${marketMsg.state ? 'text-[#57cd89]' : 'text-red-500'}`}>
|
||||
{marketMsg.state && "Message Sent!"}
|
||||
{errMsg.market && "Failed to send"}
|
||||
</span>
|
||||
</label>
|
||||
<div className="w-full flex items-center gap-3">
|
||||
<div className="w-full">
|
||||
<textarea
|
||||
className={`p-1 w-full text-sm text-slate-900 dark:text-white ${
|
||||
marketMsg.loading && "italic text-[#9CA3AF]"
|
||||
} bg-transparent outline-none border-2 border-slate-300 rounded-md`}
|
||||
rows="3"
|
||||
style={{ resize: "none" }}
|
||||
placeholder="Enter message here ..."
|
||||
value={marketMsg.loading ? "Sending..." : textValue}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="relative flex flex-col">
|
||||
<button
|
||||
className="rounded-full flex justify-center items-center w-12 h-11 bg-yellow-500 text-white"
|
||||
name="market-message"
|
||||
onClick={MarketDetail}
|
||||
disabled={marketMsg.loading}
|
||||
>
|
||||
{marketMsg.loading ? (
|
||||
<LoadingSpinner size={5} color="white" />
|
||||
) : (
|
||||
// "Send Message"
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
<div className='w-full'>
|
||||
<h1 className='text-red-600 text-lg'>This task depends on the task below</h1>
|
||||
<div className='rounded-2xl bg-red-50'>
|
||||
<div className='my-1 w-full'>
|
||||
<h2 className="p-2 w-full flex gap-1 items-center font-semibold text-slate-900 dark:text-black tracking-wide">
|
||||
{dependOn?.offer_depend_uid && <i className="fa-solid fa-lock p-1 text-red-500 text-[12px]"></i>}
|
||||
{dependOn?.title}
|
||||
</h2>
|
||||
</div>
|
||||
<div className={`p-2 flex flex-col items-start`}>
|
||||
<p className="py-1 job-label w-full dark:text-black">Description</p>
|
||||
<div className={`w-full p-2 text-slate-900 dark:text-black market-pop rounded-2xl bg-white break-words min-h-[100px] max-h-[100px]`}>
|
||||
{dependOn?.description}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div className="py-2 w-full md:col-span-1 h-full flex flex-col rounded-2xl">
|
||||
<div className="mx-auto bg-[#f1f8ff] dark:bg-[#C2C8D3] px-4 rounded-md w-full h-full md:min-h-[420px] flex flex-col justify-between">
|
||||
<div className="w-full flex flex-col justify-center pb-4 gap-2">
|
||||
<p className="job-label w-full">
|
||||
Interested?
|
||||
</p>
|
||||
<hr />
|
||||
{completedTask.loading ?
|
||||
<p className='py-3 w-full text-center text-lg'>Loading...</p>
|
||||
:completedTask?.data?.filter(item => item?.job_uid == details.offer_depend_uid).length > 0 ?
|
||||
<button
|
||||
className="btn-gradient text-white px-2 py-2 border-4 border-slate-300 text-lg lg:text-xl font-medium rounded-2xl"
|
||||
name="market-interest"
|
||||
onClick={ManageInterest}
|
||||
>
|
||||
{" "}
|
||||
<div className="flex md:flex-col justify-center gap-2">
|
||||
<span>Notify</span>
|
||||
<span>Owner</span>
|
||||
</div>
|
||||
</button>
|
||||
:
|
||||
<h1 className='text-red-600 text-base font-bold'>This task depends on completion of another task</h1>
|
||||
}
|
||||
<>
|
||||
{manageInt.loading ? (
|
||||
<p className="text-sm italic">please wait...</p>
|
||||
) : (
|
||||
<>
|
||||
{manageInt?.msg !== "" && (
|
||||
<p
|
||||
className={`text-sm italic ${
|
||||
manageInt?.state ? "text-green-500" : "text-red-500"
|
||||
}`}
|
||||
>
|
||||
{manageInt?.msg}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
|
||||
<div className="text-slate-900">
|
||||
<p className="flex items-center tracking-wide">
|
||||
<span className="job-label">Interest: </span> <b className="ml-1">{details.interest_count}</b>
|
||||
</p>
|
||||
<hr />
|
||||
<p className="my-1 flex flex-col">
|
||||
<span className="job-label">Expire: </span>
|
||||
<span> {new Date(details.expire).toLocaleString()} </span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -1,11 +1,28 @@
|
||||
import { useMemo, useState } from "react";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
import usersService from "../../../services/UsersService";
|
||||
import ModalCom from "../../Helpers/ModalCom";
|
||||
import { PriceFormatter } from "../../Helpers/PriceFormatter";
|
||||
import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
import { SocketValues } from "../../Contexts/SocketIOContext";
|
||||
import LockJob from "./LockJob";
|
||||
|
||||
const MarketPopUp = ({ details, onClose, situation, marketInt, marketPlaceProduct }) => {
|
||||
|
||||
let {sendJobInterestToOwner} = SocketValues() // function to emit job interest request
|
||||
const emitOfferInterest = () => {
|
||||
let message = {
|
||||
"audience": "MERCHANT",
|
||||
"action": "REFRESH_OFFERS",
|
||||
"offer_code": details?.offer_code,
|
||||
"offer_uid": details?.offer_uid,
|
||||
"job_uid": details?.job_uid,
|
||||
"market_uid": details?.market_uid
|
||||
}
|
||||
let room = `INTEREST-${details?.market_uid}`
|
||||
sendJobInterestToOwner(message, room)
|
||||
}
|
||||
|
||||
const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
|
||||
const [textValue, setTextValue] = useState("");
|
||||
const [errMsg, setErrMsg] = useState({
|
||||
market: false,
|
||||
@@ -88,7 +105,7 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
|
||||
state: true,
|
||||
});
|
||||
}
|
||||
|
||||
emitOfferInterest() // FUNCTIONS TO EMIT EVENT INDICATING SOMEONE SENDS AN INTEREST IN YOUR JOB
|
||||
setTimeout(() => setManageInt({ msg: "" }), 3000);
|
||||
} catch (error) {
|
||||
throw new Error(error);
|
||||
@@ -118,185 +135,232 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
|
||||
|
||||
return (
|
||||
<ModalCom action={onClose} situation={situation}>
|
||||
<div className="logout-modal-wrapper w-11/12 md:w-[650px] md:h-[580px] h-full bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[30px] py-[23px]">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="w-11/12 md:w-[650px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
{details.offer_code}
|
||||
</h1>
|
||||
<CloseIcon onClose={onClose} />
|
||||
</div>
|
||||
|
||||
<div className="md:flex bg-white dark:bg-dark-white text-slate-900 dark:text-white rounded-lg">
|
||||
<div className="p-4 w-full md:w-[75%] md:border-r-1">
|
||||
<div className="max-h-[240px] h-full">
|
||||
<h2 className="font-semibold text-slate-900 dark:text-white tracking-wide">
|
||||
{details?.title}
|
||||
</h2>
|
||||
<div className="md:grid md:grid-cols-4 bg-white dark:bg-dark-white text-slate-900 dark:text-white rounded-lg">
|
||||
{details?.offer_depend_uid ?
|
||||
<LockJob
|
||||
marketPlaceProduct={marketPlaceProduct}
|
||||
details={details}
|
||||
ManageInterest={ManageInterest}
|
||||
manageInt={manageInt}
|
||||
marketMsg={marketMsg}
|
||||
errMsg={errMsg}
|
||||
textValue={textValue}
|
||||
MarketDetail={MarketDetail}
|
||||
handleInputChange={handleInputChange}
|
||||
/>
|
||||
:
|
||||
<>
|
||||
<div className="px-4 py-2 w-full md:col-span-3 md:border-r-1">
|
||||
<div className="min-h-[300px]">
|
||||
<h2 className="w-full flex gap-1 items-center font-semibold text-slate-900 dark:text-white tracking-wide">
|
||||
{details?.offer_depend_uid && <i className="fa-solid fa-lock p-1 text-red-500 text-[12px]"></i>}
|
||||
{details?.title}
|
||||
</h2>
|
||||
|
||||
{/* INPUT SECTION */}
|
||||
{[
|
||||
{
|
||||
name: "Description",
|
||||
content: details.description,
|
||||
},
|
||||
{
|
||||
name: "",
|
||||
content: {
|
||||
text: `Timeline: ${details.timeline_days} day(s) -- `,
|
||||
bold: `Budget: ${thePrice}`,
|
||||
{/* INPUT SECTION */}
|
||||
{[
|
||||
{
|
||||
name: "Description",
|
||||
content: details.description,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Delivery Detail",
|
||||
content: cleanedText,
|
||||
danger: true,
|
||||
},
|
||||
].map(({ name, content, danger }, idx) => (
|
||||
<div className={`my-3 md:flex items-center`} key={idx}>
|
||||
<label className="w-full md:w-[19%] tracking-wide font-semibold whitespace-pre-wrap">
|
||||
{name}
|
||||
</label>
|
||||
<div
|
||||
className={`w-full md:w-3/4 text-slate-900 dark:text-white market-pop ${
|
||||
name !== "Delivery Detail"
|
||||
? " h-full flex items-center"
|
||||
: " overflow-y-auto max-h-[80px]"
|
||||
} ${name === "Description" && "max-h-14 h-full overflow-auto"}`}
|
||||
>
|
||||
{danger ? (
|
||||
<p
|
||||
className={`dark:text-white`}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: danger && content,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<p className={`w-full text-slate-900 dark:text-white`}>
|
||||
{name !== "Delivery Detail" ? (
|
||||
<>
|
||||
{typeof content !== "object" ? content : null}
|
||||
{typeof content === "object" && (
|
||||
<>
|
||||
<hr className="mb-1" />
|
||||
<span className="flex items-center gap-2 dark:text-white">
|
||||
{content?.text}
|
||||
<strong>{thePrice}</strong>
|
||||
</span>
|
||||
<hr className="mt-1" />
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<hr />
|
||||
<div className="w-full flex flex-col gap-3">
|
||||
<div className="w-full">
|
||||
<label className="w-full text-slate-900 dark:text-white tracking-wide font-semibold">
|
||||
If you have any questions about this task:
|
||||
</label>
|
||||
<textarea
|
||||
className={`p-1 w-full text-sm text-slate-900 dark:text-white ${
|
||||
marketMsg.loading && "italic text-[#9CA3AF]"
|
||||
} bg-transparent outline-none border-2 border-slate-300 rounded-md`}
|
||||
rows="3"
|
||||
style={{ resize: "none" }}
|
||||
placeholder="Enter message here ..."
|
||||
value={marketMsg.loading ? "Sending..." : textValue}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="relative flex w-full justify-end ">
|
||||
<span className="text-sm text-[#57cd89] absolute left-[8rem] top-4">
|
||||
{marketMsg.state && "Message Sent!"}
|
||||
{errMsg.market && "Something went wrong"}
|
||||
</span>
|
||||
<button
|
||||
className="self-end w-[150px] h-[48px] rounded-full text-base bg-yellow-500 text-white"
|
||||
name="market-message"
|
||||
onClick={MarketDetail}
|
||||
>
|
||||
{marketMsg.loading ? (
|
||||
<LoadingSpinner size={5} color="white" />
|
||||
) : (
|
||||
"Send Message"
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-full md:w-[23%] h-full flex flex-col">
|
||||
<div className="mx-auto bg-[#f1f8ff] dark:bg-[#C2C8D3] px-4 rounded-md md:min-h-[420px] flex flex-col justify-between">
|
||||
<div className="w-full flex flex-col justify-center pb-4 gap-2">
|
||||
<p className="w-full text-slate-900 tracking-wide my-1 font-semibold">
|
||||
Interested in the task?
|
||||
</p>
|
||||
<hr />
|
||||
<button
|
||||
className="bg-[#57cd89] text-center text-lg font-semibold text-white py-2 px-4 rounded-md inline-flex sm:flex-col flex-row sm:gap-0 gap-1 items-center justify-center"
|
||||
name="market-interest"
|
||||
onClick={ManageInterest}
|
||||
>
|
||||
{" "}
|
||||
<span>Send</span>
|
||||
<span>Interest</span>
|
||||
<span>Request</span>
|
||||
</button>
|
||||
<>
|
||||
{manageInt.loading ? (
|
||||
<p className="text-sm italic">please wait...</p>
|
||||
) : (
|
||||
<>
|
||||
{manageInt?.msg !== "" && (
|
||||
{
|
||||
name: "",
|
||||
content: {
|
||||
text: `Timeline: ${details.timeline_days} day(s) -- `,
|
||||
bold: `Budget: ${thePrice}`,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Delivery Detail",
|
||||
content: cleanedText,
|
||||
danger: true,
|
||||
},
|
||||
].map(({ name, content, danger }, idx) => (
|
||||
<div className={`my-3 md:flex items-start`} key={idx}>
|
||||
<label className="py-2 job-label w-full md:w-[19%]">
|
||||
{name}
|
||||
</label>
|
||||
<div
|
||||
className={`w-full p-2 md:w-3/4 text-slate-900 dark:text-white market-pop rounded-2xl ${
|
||||
name == "Description"
|
||||
? "min-h-[150px] max-h-[150px] h-full overflow-y-auto break-words bg-slate-50"
|
||||
: name == "Delivery Detail" ? " overflow-y-auto h-full min-h-[150px] max-h-[150px] bg-slate-50"
|
||||
: "h-full flex items-center"
|
||||
}`}
|
||||
>
|
||||
{danger ? (
|
||||
<p
|
||||
className={`text-sm italic ${
|
||||
manageInt?.state ? "text-green-500" : "text-red-500"
|
||||
}`}
|
||||
>
|
||||
{manageInt?.msg}
|
||||
className={`dark:text-black`}
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: danger && content,
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<p className={`w-full text-slate-900 dark:text-black`}>
|
||||
{name !== "Delivery Detail" ? (
|
||||
<>
|
||||
{typeof content !== "object" ? content : null}
|
||||
{typeof content === "object" && (
|
||||
<>
|
||||
{/* <hr className="mb-1" /> */}
|
||||
<span className='flex w-full mb-1 h-[1px] bg-slate-500'></span>
|
||||
<span className="flex items-center gap-2 dark:text-white">
|
||||
{content?.text}
|
||||
<strong>{thePrice}</strong>
|
||||
</span>
|
||||
<span className='flex w-full mt-1 h-[1px] bg-slate-500'></span>
|
||||
{/* <hr className="mt-1" /> */}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="text-slate-900">
|
||||
<p className="flex items-center tracking-wide">
|
||||
Interest: <b className="ml-1">{details.interest_count}</b>
|
||||
</p>
|
||||
<hr />
|
||||
<p className="my-1">Expire: {details.expire}</p>
|
||||
<hr className='my-1' />
|
||||
<div className='w-full'>
|
||||
<label className="job-label w-full flex gap-2 items-center">
|
||||
If you have any questions about this task:
|
||||
<span className={`text-sm ${marketMsg.state ? 'text-[#57cd89]' : 'text-red-500'}`}>
|
||||
{marketMsg.state && "Message Sent!"}
|
||||
{errMsg.market && "Failed to send"}
|
||||
</span>
|
||||
</label>
|
||||
<div className="w-full flex items-center gap-3">
|
||||
<div className="w-full">
|
||||
<textarea
|
||||
className={`p-1 w-full text-sm text-slate-900 dark:text-white ${
|
||||
marketMsg.loading && "italic text-[#9CA3AF]"
|
||||
} bg-transparent outline-none border-2 border-slate-300 rounded-md`}
|
||||
rows="3"
|
||||
style={{ resize: "none" }}
|
||||
placeholder="Enter message here ..."
|
||||
value={marketMsg.loading ? "Sending..." : textValue}
|
||||
onChange={handleInputChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="relative flex flex-col">
|
||||
<button
|
||||
className="rounded-full flex justify-center items-center w-12 h-11 bg-yellow-500 text-white"
|
||||
name="market-message"
|
||||
onClick={MarketDetail}
|
||||
disabled={marketMsg.loading}
|
||||
>
|
||||
{marketMsg.loading ? (
|
||||
<LoadingSpinner size={5} color="white" />
|
||||
) : (
|
||||
// "Send Message"
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
)}
|
||||
</button>
|
||||
{/* <span className="text-sm text-[#57cd89]">
|
||||
{marketMsg.state && "Sent!"}
|
||||
{errMsg.market && "Failed"}
|
||||
</span> */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
className="self-center w-[150px] mt-2 h-[48px] rounded-full text-base bg-transparent border border-red-500 text-red-500 mx-auto"
|
||||
name="cancel"
|
||||
onClick={onClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
{/* END OF ACTION SECTION */}
|
||||
|
||||
<div className="py-2 w-full md:col-span-1 h-full flex flex-col rounded-2xl">
|
||||
<div className="mx-auto bg-[#f1f8ff] dark:bg-[#C2C8D3] px-4 rounded-md w-full h-full md:min-h-[420px] flex flex-col justify-between">
|
||||
<div className="w-full flex flex-col justify-center pb-4 gap-2">
|
||||
<p className="job-label w-full">
|
||||
Interested?
|
||||
</p>
|
||||
<hr />
|
||||
<button
|
||||
className="btn-gradient text-white px-2 py-2 border-4 border-slate-300 text-lg lg:text-xl font-medium rounded-2xl"
|
||||
name="market-interest"
|
||||
onClick={ManageInterest}
|
||||
>
|
||||
{" "}
|
||||
<div className="flex md:flex-col justify-center gap-2">
|
||||
<span>Notify</span>
|
||||
<span>Owner</span>
|
||||
</div>
|
||||
</button>
|
||||
<>
|
||||
{manageInt.loading ? (
|
||||
<p className="text-sm italic">please wait...</p>
|
||||
) : (
|
||||
<>
|
||||
{manageInt?.msg !== "" && (
|
||||
<p
|
||||
className={`text-sm italic ${
|
||||
manageInt?.state ? "text-green-500" : "text-red-500"
|
||||
}`}
|
||||
>
|
||||
{manageInt?.msg}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
|
||||
<div className="text-slate-900">
|
||||
<p className="flex items-center tracking-wide">
|
||||
<span className="job-label">Interest: </span> <b className="ml-1">{details.interest_count}</b>
|
||||
</p>
|
||||
<hr />
|
||||
<p className="my-1 flex flex-col">
|
||||
<span className="job-label">Expire: </span>
|
||||
<span> {new Date(details.expire).toLocaleString()} </span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div className="modal-footer-wrapper">
|
||||
<button
|
||||
className="custom-btn bg-transparent border border-red-500 text-red-500 ml-auto"
|
||||
name="cancel"
|
||||
onClick={onClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
export default MarketPopUp;
|
||||
|
||||
const CloseIcon = ({ onClose }) => (
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={onClose}
|
||||
>
|
||||
<svg
|
||||
|
||||
@@ -3,6 +3,7 @@ import Layout from "../Partials/Layout";
|
||||
import CommonHead from "../UserHeader/CommonHead";
|
||||
import MainSection from "./MainSection";
|
||||
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
|
||||
export default function MarketPlace({ commonHeadData }) {
|
||||
let { jobLists } = useSelector((state) => state.jobLists);
|
||||
@@ -25,12 +26,18 @@ export default function MarketPlace({ commonHeadData }) {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{jobLists.loading ?
|
||||
<div className="w-full flex justify-center items-center bg-white dark:bg-dark-white">
|
||||
<LoadingSpinner size='20' height='h-[40rem]' />
|
||||
</div>
|
||||
:
|
||||
<MainSection
|
||||
marketPlaceProduct={marketData}
|
||||
categories={categories}
|
||||
image_server={image_server}
|
||||
className="mb-10"
|
||||
/>
|
||||
}
|
||||
</Layout>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function ActiveJobMessage({ activeJobMesList }) {
|
||||
|
||||
return (
|
||||
<div className='flex flex-col justify-between'>
|
||||
<div className="w-full h-full min-h-[400px] max-h-[400px] overflow-y-auto">
|
||||
<div className="w-full h-full min-h-[250px] max-h-[300px] 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'>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import React, { useState } from "react";
|
||||
import dataImage1 from "../../assets/images/data-table-user-1.png";
|
||||
import dataImage2 from "../../assets/images/data-table-user-2.png";
|
||||
import dataImage3 from "../../assets/images/data-table-user-3.png";
|
||||
import dataImage4 from "../../assets/images/data-table-user-4.png";
|
||||
import SelectBox from "../Helpers/SelectBox";
|
||||
|
||||
export default function ActiveJobMessageMedia({ activeJobMesList }) {
|
||||
return (
|
||||
<div className='flex flex-col justify-between'>
|
||||
<div className="w-full h-full min-h-[250px] max-h-[250px] 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) =>
|
||||
{
|
||||
let imageLink = `${activeJobMesList?.image}${localStorage.getItem('session_token')}/contracts/${item.msg_uid}`
|
||||
return (
|
||||
<tr key={index} className='text-slate-500'>
|
||||
<td>
|
||||
<div className={`msg_box ${item.who}`}>
|
||||
<div className="msg_header">{item.msg_date} {item.msg_firstname}</div>
|
||||
{item.msg_type == 'FILE' ?
|
||||
<a href={imageLink} target="_blank" className="p-2" dangerouslySetInnerHTML={{__html: item.message}}></a>
|
||||
:
|
||||
<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>
|
||||
)
|
||||
}
|
||||
@@ -12,6 +12,10 @@ import IndexJobActions from "./JobActions/IndexJobActions";
|
||||
import usersService from "../../services/UsersService";
|
||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||
import { SocketValues } from "../Contexts/SocketIOContext";
|
||||
import TabButton from "../customTabs/TabButton";
|
||||
import AttachFile from "../attachmentCom/AttachFile";
|
||||
|
||||
import JobDetailPopout from "./JobDetailPopout";
|
||||
|
||||
function ActiveJobs(props) {
|
||||
let {sendMessage, joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
|
||||
@@ -29,7 +33,9 @@ function ActiveJobs(props) {
|
||||
|
||||
const [filesToSend, setFilesToSend] = useState([]); // State to hold the value of files to be sent
|
||||
|
||||
const [tab, setTab] = useState("message");
|
||||
// const [tab, setTab] = useState("message");
|
||||
const tabs = ["Send Message", "Send Files",] //STATE FOR SWITCHING BETWEEN TABS
|
||||
const [selectedTab, setSelectedTab] = useState(tabs[0]);
|
||||
|
||||
const [requestStatus, setRequestStatus] = useState({
|
||||
loading: false,
|
||||
@@ -39,6 +45,8 @@ function ActiveJobs(props) {
|
||||
|
||||
let [popUp, setPopUp] = useState(false); // STATE FOR POPOUT MODAL
|
||||
|
||||
let [jobDetailModal, setJobDetailModal] = useState(false); // STATE FOR JOB DELIVERY DETAIL POPOUT MODAL
|
||||
|
||||
const printRef = useRef();
|
||||
// to handle printing
|
||||
const handlePrint = useReactToPrint({
|
||||
@@ -50,6 +58,10 @@ function ActiveJobs(props) {
|
||||
setPopUp((prev) => !prev);
|
||||
};
|
||||
|
||||
const jobDetailModalHandler = () => { // FUNCTION TO CLOSE JOB DELIVERY DETAIL MODAL
|
||||
setJobDetailModal((prev) => !prev);
|
||||
};
|
||||
|
||||
// FUNCTION TO HANDLE MESSAGE CHANGE
|
||||
const handleMessageChange = ({ target: { value } }) => {
|
||||
setMessageToSend(value);
|
||||
@@ -63,11 +75,23 @@ function ActiveJobs(props) {
|
||||
// IF NO FILE SELECTED RETURN
|
||||
return;
|
||||
}
|
||||
if (files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) {
|
||||
let fileType = files[0].type.split('/')[0].toLowerCase()
|
||||
if (fileType == 'video' && files[0].size > Number(process.env.REACT_APP_MAX_VIDEO_FILE_SIZE)) { // return if video file is more than 30mb
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "File must be <= 1mb",
|
||||
message: `File must be <= ${Number(process.env.REACT_APP_MAX_VIDEO_FILE_SIZE)/1048576} mb`,
|
||||
});
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
if (fileType != 'video' && files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) { // return if other files is more than 1mb
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: `File must be <= ${Number(process.env.REACT_APP_MAX_FILE_SIZE)/1048576} mb`,
|
||||
});
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
@@ -88,14 +112,15 @@ function ActiveJobs(props) {
|
||||
return;
|
||||
}
|
||||
// INCLUDE FILE IF NO ERROR
|
||||
setFilesToSend((prev) => [...prev, files[0]]);
|
||||
// setFilesToSend((prev) => [...prev, files[0]]); //for sending multiple file if need be
|
||||
setFilesToSend([files[0]])
|
||||
};
|
||||
|
||||
// FUNCTION TO CLEAR ALL TYPED MESSAGE OR FILES
|
||||
const handleClearAll = ({ target: { name } }) => {
|
||||
if (tab == "message") {
|
||||
if (selectedTab == "Send Message") {
|
||||
setMessageToSend("");
|
||||
} else if (tab == "files") {
|
||||
} else if (selectedTab == "Send Files") {
|
||||
setFilesToSend([]);
|
||||
} else {
|
||||
return;
|
||||
@@ -177,61 +202,46 @@ function ActiveJobs(props) {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
}
|
||||
// const fileToBase64 = async () => {
|
||||
// // Converts file data to base64 string
|
||||
// try {
|
||||
// const base64String = await convertFileToBase64(filesToSend[i]);
|
||||
// return base64String;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// };
|
||||
|
||||
for (let i = 0; i <= filesToSend.length - 1; i++) {
|
||||
// Loops through files to send array and trigger upload API call
|
||||
let reqData = {
|
||||
// file_name: filesToSend[i].name,
|
||||
// file_size: filesToSend[i].size,
|
||||
// file_type: "image/png",
|
||||
// file_data: await fileToBase64(),
|
||||
msg_type: "FILE",
|
||||
contract: props.details.contract,
|
||||
file: filesToSend[0],
|
||||
};
|
||||
|
||||
const fileToBase64 = async () => {
|
||||
// Converts file data to base64 string
|
||||
try {
|
||||
const base64String = await convertFileToBase64(filesToSend[i]);
|
||||
return base64String;
|
||||
} catch (error) {
|
||||
return false;
|
||||
ApiCall.sendFilesNew(reqData)
|
||||
.then((res) => {
|
||||
if(res.status != 200 || res.data.internal_return < 0){
|
||||
setRequestStatus({loading: false, status: false, message: 'File could not be sent, try again later'})
|
||||
return
|
||||
}
|
||||
};
|
||||
|
||||
// if(await !fileToBase64()){
|
||||
// return
|
||||
// }
|
||||
|
||||
let reqData = {
|
||||
file_name: filesToSend[i].name,
|
||||
file_size: filesToSend[i].size,
|
||||
file_type: "image/png",
|
||||
file_data: await fileToBase64(),
|
||||
msg_type: "FILE",
|
||||
contract: props.details.contract,
|
||||
};
|
||||
|
||||
ApiCall.sendFiles(reqData)
|
||||
.then((res) => {
|
||||
// if(res.status != 200 || res.data.internal_return < 0){
|
||||
// setRequestStatus({loading: false, status: false, message: 'Files(s) could not be sent, try again later'})
|
||||
// return
|
||||
// }
|
||||
// setRequestStatus({loading: false, status: true, message: 'File(s) Uploaded Successfully'})
|
||||
// props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||
// setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||
})
|
||||
.catch((error) => {
|
||||
// setRequestStatus({loading: false, status: false, message: 'Opps! something went wrong'})
|
||||
})
|
||||
.finally(() => {
|
||||
if (i == filesToSend.length - 1) {
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: true,
|
||||
message: "File(s) Uploaded Successfully",
|
||||
});
|
||||
setFilesToSend([]); // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||
props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
}
|
||||
setRequestStatus({loading: false, status: true, message: 'File Uploaded Successfully'})
|
||||
// props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||
// setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||
})
|
||||
.catch((error) => {
|
||||
setRequestStatus({loading: false, status: false, message: 'Opps! something went wrong'})
|
||||
})
|
||||
.finally(() => {
|
||||
setFilesToSend([]); // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||
props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
// FUNCTION TO CHECK IF TASK PASS DUE IS REACHED
|
||||
@@ -269,10 +279,10 @@ function ActiveJobs(props) {
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<div className="py-[20px] bg-white dark:bg-black dark:text-white px-4 rounded-2xl shadow-md md:flex justify-between items-start gap-16">
|
||||
<div className="py-[20px] bg-white dark:bg-black dark:text-white px-4 rounded-2xl shadow-md md:flex justify-between items-start gap-8">
|
||||
{/* job title */}
|
||||
<div className="w-full md:w-8/12">
|
||||
<div className="w-full flex justify-start space-x-3 items-start">
|
||||
<div className="w-full">
|
||||
<div className="w-full flex justify-start space-x-3 items-center">
|
||||
<button
|
||||
type="button"
|
||||
className="min-w-[45px] h-auto text-[#374557] border border-sky-blue p-1 rounded-full"
|
||||
@@ -320,8 +330,8 @@ function ActiveJobs(props) {
|
||||
{/* end of job title */}
|
||||
|
||||
{/* job details */}
|
||||
<div className="w-full md:w-4/12">
|
||||
<p className="text-base text-sky-blue">Delivery Detail</p>
|
||||
<div className="min-w-[150px]">
|
||||
<button className="text-base text-sky-blue" onClick={jobDetailModalHandler}>Delivery Detail</button>
|
||||
{passDue ? (
|
||||
<div className="my-1">
|
||||
<p className="text-base text-slate-700">
|
||||
@@ -394,78 +404,119 @@ function ActiveJobs(props) {
|
||||
|
||||
{/* TEXTAREA SECTION */}
|
||||
<div className="mt-5">
|
||||
<div className="">
|
||||
<div
|
||||
className="pl-7 my-2 flex items-center border-b border-slate-300 gap-3"
|
||||
// className='ml-7 flex justify-start items-center gap-3'
|
||||
>
|
||||
<button
|
||||
name="message"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
tab == "message"
|
||||
? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white"
|
||||
: "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Send Message
|
||||
</button>
|
||||
<button
|
||||
name="files"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
tab == "files"
|
||||
? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white"
|
||||
: "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Send Files
|
||||
</button>
|
||||
</div>
|
||||
{tab == "message" ? (
|
||||
<textarea
|
||||
className="p-4 w-full h-[200px] text-base text-slate-600 dark:text-white bg-white dark:bg-black border border-slate-300 outline-none"
|
||||
// rows="10"
|
||||
style={{ resize: "none" }}
|
||||
name="message"
|
||||
onChange={handleMessageChange}
|
||||
value={messageToSend}
|
||||
autoFocus
|
||||
/>
|
||||
) : (
|
||||
<div className="p-4 w-full h-[200px] text-base text-slate-600 border border-slate-300">
|
||||
<div className="files">
|
||||
<label
|
||||
htmlFor="file"
|
||||
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer"
|
||||
>
|
||||
Select Files to Upload
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
id="file"
|
||||
accept="image/*"
|
||||
style={{ display: "none" }}
|
||||
onChange={handleFileChange}
|
||||
<div className="w-full">
|
||||
{/* switch button */}
|
||||
<div className="grid grid-cols-2">
|
||||
{tabs.map((item) => (
|
||||
<TabButton
|
||||
key={item}
|
||||
item={item}
|
||||
selectedTab={selectedTab}
|
||||
setSelectedTab={setSelectedTab}
|
||||
/>
|
||||
</div>
|
||||
<div className="selected_file my-2">
|
||||
{filesToSend.length > 0 &&
|
||||
filesToSend.map((item, index) => (
|
||||
<p key={index} className="flex items-center space-x-2">
|
||||
<span>{item.name}</span>
|
||||
<button
|
||||
name="remove"
|
||||
onClick={() => handleRemoveImage(item)}
|
||||
className="px-2 flex justify-center items-center rounded-full border border-red-500 text-red-500"
|
||||
>
|
||||
x
|
||||
</button>
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{/* switch button */}
|
||||
<div className="w-full bg-red-50 overflow-x-auto">
|
||||
{selectedTab == "Send Message" ? (
|
||||
<div className="p-2 w-full">
|
||||
<textarea
|
||||
className="p-4 w-full h-[150px] text-base text-slate-600 dark:text-white bg-white dark:bg-black outline-none"
|
||||
// rows="10"
|
||||
style={{ resize: "none" }}
|
||||
name="message"
|
||||
onChange={handleMessageChange}
|
||||
value={messageToSend}
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="p-2 w-full">
|
||||
<div className="p-4 mb-2 h-[150px] text-base text-slate-600">
|
||||
<div className="files flex">
|
||||
<label
|
||||
htmlFor="file"
|
||||
className="custom-btn btn-gradient text-base text-white"
|
||||
>
|
||||
Select Files to Upload
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
id="file"
|
||||
accept="image/*,video/*"
|
||||
style={{ display: "none" }}
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="selected_file my-2 overflow-y-auto">
|
||||
{filesToSend.length > 0 &&
|
||||
filesToSend.map((item, index) => (
|
||||
<p key={index} className="flex items-center space-x-2">
|
||||
<span>{item.name}</span>
|
||||
<button
|
||||
name="remove"
|
||||
onClick={() => handleRemoveImage(item)}
|
||||
className="px-2 flex justify-center items-center rounded-full border border-red-500 text-red-500"
|
||||
>
|
||||
x
|
||||
</button>
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{/* Buttons Sections */}
|
||||
<div className="p-2 grid grid-cols-1 xxs:grid-cols-3">
|
||||
<div className="w-full col-span-3 col-start-1 xxs:col-span-2 xxs:col-start-2 flex justify-between items-center gap-4">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleClearAll}
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className="text-gradient">Clear</span>
|
||||
</button>
|
||||
{selectedTab == "Send Files" ? (
|
||||
<button
|
||||
onClick={sendFile}
|
||||
type="button"
|
||||
className="custom-btn btn-gradient text-white"
|
||||
>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
width="20"
|
||||
height="20"
|
||||
fill="white"
|
||||
>
|
||||
<path d="M12 2L2 12h3v8h14v-8h3L12 2zm0 16v-6h-2v6H7l5-5 5 5h-3z" />
|
||||
</svg>
|
||||
|
||||
<span className="text-white">Upload Files</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
onClick={sendTaskMessage}
|
||||
type="button"
|
||||
className="custom-btn btn-gradient text-white"
|
||||
>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<span className="text-white">Send</span>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{/* end of Buttons Sections */}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
||||
@@ -489,70 +540,26 @@ function ActiveJobs(props) {
|
||||
))}
|
||||
</div>
|
||||
{/* End of error or success display */}
|
||||
|
||||
{/* Buttons Sections */}
|
||||
<div className="py-2 sm:flex sm:justify-end sm:items-center">
|
||||
<div className="w-full sm:w-3/4 flex justify-between items-center space-x-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleClearAll}
|
||||
className="border-gradient text-base tracking-wide px-4 py-2 rounded-full"
|
||||
>
|
||||
<span className="text-gradient">Clear</span>
|
||||
</button>
|
||||
{tab == "files" ? (
|
||||
<button
|
||||
onClick={sendFile}
|
||||
type="button"
|
||||
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer flex justify-center items-center"
|
||||
>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
width="24"
|
||||
height="24"
|
||||
fill="white"
|
||||
>
|
||||
<path d="M12 2L2 12h3v8h14v-8h3L12 2zm0 16v-6h-2v6H7l5-5 5 5h-3z" />
|
||||
</svg>
|
||||
|
||||
<span className="text-white">Upload Files</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
onClick={sendTaskMessage}
|
||||
type="button"
|
||||
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer"
|
||||
>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<span className="text-white">Send</span>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{/* end of Buttons Sections */}
|
||||
</div>
|
||||
{/* END OF TEXTAREA */}
|
||||
</div>
|
||||
|
||||
{/* MESSAGE SECTION */}
|
||||
<div className="w-full lg:w-1/2">
|
||||
<div className="mb-4">
|
||||
<AttachFile
|
||||
data={props.details}
|
||||
showOnData={true}
|
||||
fontSize={'text-lg'}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-between items-center gap-5">
|
||||
<p className="w-full text-lg font-bold text-dark-gray dark:text-white tracking-wide flex items-center gap-2">
|
||||
<p className="w-full text-lg font-bold text-dark-gray dark:text-white tracking-wide flex items-center gap-2 justify-between">
|
||||
<span>Message</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={popUpHandler}
|
||||
className="text-[12px] tracking-wider text-emerald-600 dark:text-emerald-300"
|
||||
className="text-[12px] tracking-wider text-gray-400 dark:text-slate-400"
|
||||
>
|
||||
View all
|
||||
</button>
|
||||
@@ -586,6 +593,16 @@ function ActiveJobs(props) {
|
||||
/>
|
||||
)}
|
||||
{/* END OF POPOUT SECTION */}
|
||||
|
||||
{/* Delivery Details Popout */}
|
||||
{jobDetailModal &&
|
||||
<JobDetailPopout
|
||||
action={jobDetailModalHandler}
|
||||
situation={jobDetailModal}
|
||||
jobDetail={props?.details?.job_description}
|
||||
/>
|
||||
}
|
||||
{/* END Delivery Details Popout */}
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,716 @@
|
||||
import React, { lazy, useEffect, useRef, useState } from "react";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useReactToPrint } from "react-to-print";
|
||||
import CountDown from "../Helpers/CountDown";
|
||||
import ModalCom from "../Helpers/ModalCom";
|
||||
import Layout from "../Partials/Layout";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
import ActiveJobMessageMedia from "./ActiveJobMessageMedia";
|
||||
import IndexJobActions from "./JobActions/IndexJobActions";
|
||||
import MediaLayout from "../Partials/MediaLayout";
|
||||
|
||||
const VideoElement = lazy(() => import("../VideoCom/VideoElement"));
|
||||
|
||||
import usersService from "../../services/UsersService";
|
||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||
import { SocketValues } from "../Contexts/SocketIOContext";
|
||||
import TabButton from "../customTabs/TabButton";
|
||||
|
||||
function ActiveJobsMedia(props) {
|
||||
let {sendMessage, joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET
|
||||
|
||||
const ApiCall = new usersService();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const { userDetails } = useSelector((state) => state.userDetails);
|
||||
|
||||
const [passDue, setPassDue] = useState(
|
||||
new Date() > new Date(props.details?.delivery_date)
|
||||
); // STATE TO KNOW IF TASK IS PASSED DUE TIME
|
||||
|
||||
const [messageToSend, setMessageToSend] = useState(""); // State to hold the value of message to be sent
|
||||
|
||||
const [filesToSend, setFilesToSend] = useState([]); // State to hold the value of files to be sent
|
||||
|
||||
// const [tab, setTab] = useState("message");
|
||||
const tabs = ["Send Message", "Send Files",] //STATE FOR SWITCHING BETWEEN TABS
|
||||
const [selectedTab, setSelectedTab] = useState(tabs[0]);
|
||||
|
||||
const [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);
|
||||
};
|
||||
|
||||
// FUNCTION TO HANDLE FILE UPlOAD CHANGE
|
||||
const handleFileChange = ({ target: { files } }) => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" }); // State to determine error state
|
||||
|
||||
if (!files[0]) {
|
||||
// IF NO FILE SELECTED RETURN
|
||||
return;
|
||||
}
|
||||
let fileType = files[0].type.split('/')[0].toLowerCase()
|
||||
if (fileType == 'video' && files[0].size > Number(process.env.REACT_APP_MAX_VIDEO_FILE_SIZE)) { // return if video file is more than 30mb
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: `File must be <= ${Number(process.env.REACT_APP_MAX_VIDEO_FILE_SIZE)/1048576} mb`,
|
||||
});
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
if (fileType != 'video' && files[0].size > Number(process.env.REACT_APP_MAX_FILE_SIZE)) { // return if other files is more than 1mb
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: `File must be <= ${Number(process.env.REACT_APP_MAX_FILE_SIZE)/1048576} mb`,
|
||||
});
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
if (filesToSend.length >= Number(process.env.REACT_APP_TOTAL_NUM_FILE)) {
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: `Total number of attachment is ${Number(
|
||||
process.env.REACT_APP_TOTAL_NUM_FILE
|
||||
)}`,
|
||||
});
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
// INCLUDE FILE IF NO ERROR
|
||||
// setFilesToSend((prev) => [...prev, files[0]]); //for sending multiple file if need be
|
||||
setFilesToSend([files[0]])
|
||||
};
|
||||
|
||||
// FUNCTION TO CLEAR ALL TYPED MESSAGE OR FILES
|
||||
const handleClearAll = ({ target: { name } }) => {
|
||||
if (selectedTab == "Send Message") {
|
||||
setMessageToSend("");
|
||||
} else if (selectedTab == "Send Files") {
|
||||
setFilesToSend([]);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
// FUNCTION TO REMOVE AND IMAGE
|
||||
const handleRemoveImage = (imageToDelete) => {
|
||||
setFilesToSend((prev) =>
|
||||
prev.filter((item) => item.name != imageToDelete.name)
|
||||
);
|
||||
};
|
||||
|
||||
// FUNCTION TO SEND TASK MESSAGE
|
||||
const sendTaskMessage = () => {
|
||||
let reqData = {
|
||||
message: messageToSend,
|
||||
msg_type: "TEXT",
|
||||
contract: props.details.contract,
|
||||
};
|
||||
if (!reqData.message) {
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "Message is empty",
|
||||
});
|
||||
return setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
}
|
||||
setRequestStatus({ loading: true, status: false, message: "" });
|
||||
ApiCall.sendTaskMessage(reqData)
|
||||
.then((res) => {
|
||||
if (res.status != 200 || res.data.internal_return < 0) {
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "Message could not be sent, try again later",
|
||||
});
|
||||
return;
|
||||
}
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: true,
|
||||
message: "Message Sent Successfully",
|
||||
});
|
||||
// function to trigger socket to emit 'send_message'
|
||||
sendMessage(messageToSend, `${props.details.contract}-${props.details.contract_uid}`)
|
||||
|
||||
props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||
setMessageToSend(""); // SENDS MESSAGE TO SEND BACK TO EMPTY STRINGS
|
||||
})
|
||||
.catch((error) => {
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "Opps! something went wrong",
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
// FUNCTION TO SEND FILES
|
||||
const sendFile = async () => {
|
||||
setRequestStatus({ loading: true, status: false, message: "" });
|
||||
|
||||
if (!filesToSend.length) {
|
||||
// checks if file to send is empty
|
||||
setRequestStatus({
|
||||
loading: false,
|
||||
status: false,
|
||||
message: "No File(s) selected",
|
||||
});
|
||||
return setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// const fileToBase64 = async () => {
|
||||
// // Converts file data to base64 string
|
||||
// try {
|
||||
// const base64String = await convertFileToBase64(filesToSend[i]);
|
||||
// return base64String;
|
||||
// } catch (error) {
|
||||
// return false;
|
||||
// }
|
||||
// };
|
||||
|
||||
let reqData = {
|
||||
msg_type: "FILE",
|
||||
contract: props.details.contract,
|
||||
file: filesToSend[0],
|
||||
};
|
||||
|
||||
ApiCall.sendFilesNew(reqData)
|
||||
.then((res) => {
|
||||
if(res.status != 200 || res.data.internal_return < 0){
|
||||
setRequestStatus({loading: false, status: false, message: 'File could not be sent, try again later'})
|
||||
return
|
||||
}
|
||||
setRequestStatus({loading: false, status: true, message: 'File Uploaded Successfully'})
|
||||
// props.reloadActiveJobList(prev => !prev) // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||
// setFilesToSend([]) // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||
})
|
||||
.catch((error) => {
|
||||
setRequestStatus({loading: false, status: false, message: 'Opps! something went wrong'})
|
||||
})
|
||||
.finally(() => {
|
||||
setFilesToSend([]); // SETS FILES TO SEND TO SEND BACK TO EMPTY ARRAY
|
||||
props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD
|
||||
setTimeout(() => {
|
||||
setRequestStatus({ loading: false, status: false, message: "" });
|
||||
}, 5000);
|
||||
});
|
||||
};
|
||||
|
||||
// FUNCTION TO CHECK IF TASK PASS DUE IS REACHED
|
||||
let isPassedDue = () => {
|
||||
// console.log('TESTING',new Date() > new Date(props.details?.delivery_date) )
|
||||
if (new Date() > new Date(props.details?.delivery_date)) {
|
||||
setPassDue(true);
|
||||
} else {
|
||||
setPassDue(false);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!passDue) {
|
||||
let passDueInterval = setInterval(() => {
|
||||
isPassedDue();
|
||||
}, 1000);
|
||||
return () => {
|
||||
clearInterval(passDueInterval);
|
||||
};
|
||||
}
|
||||
}, [passDue]);
|
||||
|
||||
let thePrice = PriceFormatter(
|
||||
props.details?.price * 0.01,
|
||||
props.details?.currency_code,
|
||||
props.details?.currency
|
||||
);
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
// calls function to add user to a room
|
||||
joinRoom(`${props.details.contract}-${props.details.contract_uid}`)
|
||||
},[props.details.contract, props.details.contract_uid])
|
||||
|
||||
return (
|
||||
<MediaLayout
|
||||
backpath={props.details.pathname}
|
||||
title={props.details?.title ? props.details.title : ''}
|
||||
>
|
||||
<div className="my-4 lg:flex justify-between items-start space-y-4 lg:space-x-4 lg:space-y-0">
|
||||
<div className="w-full mb-4 border-b pb-4 lg:pb-0 lg:mb-0 lg:border-b-0">
|
||||
<div className="mb-4 w-full h-auto">
|
||||
<VideoElement videoId={props?.details?.media_uid} />
|
||||
</div>
|
||||
|
||||
<div className="w-full p-4 bg-white dark:bg-black rounded-2xl shadow-md xl:flex xl:justify-between gap-4">
|
||||
<div className="w-full flex flex-col justify-between">
|
||||
{/* <p className="w-full text-base text-right text-sky-blue">
|
||||
{props?.details && props.details.job_to}
|
||||
</p> */}
|
||||
<div className="text-base tracking-wide">
|
||||
<p className="font-semibold text-black dark:text-white tracking-wider">
|
||||
Description:{" "}
|
||||
</p>
|
||||
<p className="p-2 ml-8 border-b border-sky-blue">
|
||||
{props?.details && props.details.description}
|
||||
</p>
|
||||
</div>
|
||||
<div className="mt-6 w-full">
|
||||
<div className="w-full text-base tracking-wide">
|
||||
<p className="font-semibold text-black dark:text-white tracking-wider">
|
||||
Delivery Detail:{" "}
|
||||
</p>
|
||||
<p className="p-2 ml-8">
|
||||
{props?.details && props.details.job_description}
|
||||
</p>
|
||||
</div>
|
||||
{/* <div className="my-2 xl:my-0">
|
||||
<IndexJobActions details={props.details} />
|
||||
</div> */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-between items-center gap-1 xl:min-w-[350px]">
|
||||
<div className="h-[150px] xl:h-full w-[150px] xl:min-w-[150px]">
|
||||
<IndexJobActions details={props.details} />
|
||||
</div>
|
||||
{/* job details */}
|
||||
<div className="min-w-[170px] flex flex-col justify-center gap-2">
|
||||
{/* <p className="text-base text-sky-blue">Delivery Detail</p> */}
|
||||
{passDue ? (
|
||||
<div className="my-1">
|
||||
<p className="text-base text-slate-700">
|
||||
<span className="font-semibold">Due: </span>
|
||||
{props?.details && props.details.delivery_date.split(" ")[0]}
|
||||
</p>
|
||||
{props?.delivery_date && (
|
||||
<p className="py-2 text-base text-slate-700">
|
||||
{props.details.delivery_date.split(" ")[1]}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div className="my-1 flex items-start gap-3">
|
||||
<p className="font-semibold">Due: </p>
|
||||
<div className="flex flex-col justify-between">
|
||||
<p className="text-base text-slate-700 tracking-wide">
|
||||
<CountDown
|
||||
lastDate={props?.details && props.details.delivery_date}
|
||||
/>
|
||||
</p>
|
||||
<div className="text-base text-slate-700 tracking-wide flex gap-[5px]">
|
||||
<span>Hrs</span>
|
||||
<span>Min</span>
|
||||
<span>Sec</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="my-1 text-base text-slate-700 tracking-wide flex items-center gap-3">
|
||||
<span className="font-semibold text-black dark:text-white">
|
||||
Reward:{" "}
|
||||
</span>
|
||||
<span className="">{thePrice}</span>
|
||||
</div>
|
||||
|
||||
<div className="my-1 text-base text-slate-700 tracking-wide flex items-center gap-3">
|
||||
<span className="font-semibold text-black dark:text-white">
|
||||
Duration:{" "}
|
||||
</span>
|
||||
<span className="">
|
||||
{props.details?.timeline_days && props.details.timeline_days}{" "}
|
||||
day(s)
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{/* end of job details */}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-full lg:w-2/5 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 gap-4">
|
||||
{/* TEXTAREA SECTION */}
|
||||
<div className="w-full mb-3">
|
||||
<div className="w-full">
|
||||
{/* <div className="pl-7 flex items-center gap-3">
|
||||
<button
|
||||
name="message"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 xl:px-1 xxl:px-4 text-sm py-1 rounded-t-2xl ${
|
||||
tab == "message"
|
||||
? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white"
|
||||
: "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Send Message
|
||||
</button>
|
||||
<button
|
||||
name="files"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 xl:px-1 xxl:px-4 text-sm py-1 rounded-t-2xl ${
|
||||
tab == "files"
|
||||
? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white"
|
||||
: "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Send Files
|
||||
</button>
|
||||
</div> */}
|
||||
{/* switch button */}
|
||||
<div className="grid grid-cols-2">
|
||||
{tabs.map((item) => (
|
||||
<TabButton
|
||||
key={item}
|
||||
item={item}
|
||||
selectedTab={selectedTab}
|
||||
setSelectedTab={setSelectedTab}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
{/* switch button */}
|
||||
<div className="w-full bg-red-50 overflow-x-auto">
|
||||
{selectedTab == "Send Message" ? (
|
||||
<div className="p-2 w-full">
|
||||
<textarea
|
||||
className="p-4 w-full h-[150px] text-base text-slate-600 dark:text-white bg-white dark:bg-black outline-none"
|
||||
// rows="10"
|
||||
style={{ resize: "none" }}
|
||||
name="message"
|
||||
onChange={handleMessageChange}
|
||||
value={messageToSend}
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="p-2 w-full">
|
||||
<div className="p-4 mb-2 h-[150px] text-base text-slate-600">
|
||||
<div className="files flex">
|
||||
<label
|
||||
htmlFor="file"
|
||||
className="custom-btn btn-gradient text-base text-white"
|
||||
>
|
||||
Select Files to Upload
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
id="file"
|
||||
accept="image/*,video/*"
|
||||
style={{ display: "none" }}
|
||||
onChange={handleFileChange}
|
||||
/>
|
||||
</div>
|
||||
<div className="selected_file my-2 overflow-y-auto">
|
||||
{filesToSend.length > 0 &&
|
||||
filesToSend.map((item, index) => (
|
||||
<p key={index} className="flex items-center space-x-2">
|
||||
<span>{item.name}</span>
|
||||
<button
|
||||
name="remove"
|
||||
onClick={() => handleRemoveImage(item)}
|
||||
className="px-2 flex justify-center items-center rounded-full border border-red-500 text-red-500"
|
||||
>
|
||||
x
|
||||
</button>
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{/* Buttons Sections */}
|
||||
<div className="p-2 grid grid-cols-1 xxs:grid-cols-3">
|
||||
<div className="w-full col-span-3 col-start-1 xxs:col-span-2 xxs:col-start-2 flex justify-between items-center gap-4">
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleClearAll}
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className="text-gradient">Clear</span>
|
||||
</button>
|
||||
{selectedTab == "Send Files" ? (
|
||||
<button
|
||||
onClick={sendFile}
|
||||
type="button"
|
||||
className="custom-btn btn-gradient text-white"
|
||||
>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
width="20"
|
||||
height="20"
|
||||
fill="white"
|
||||
>
|
||||
<path d="M12 2L2 12h3v8h14v-8h3L12 2zm0 16v-6h-2v6H7l5-5 5 5h-3z" />
|
||||
</svg>
|
||||
|
||||
<span className="text-white">Upload Files</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
onClick={sendTaskMessage}
|
||||
type="button"
|
||||
className="custom-btn btn-gradient text-white"
|
||||
>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<span className="text-white">Send</span>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{/* end of Buttons Sections */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
|
||||
<div className="w-full">
|
||||
{/* error or success display */}
|
||||
{requestStatus.message != "" &&
|
||||
(!requestStatus.status ? (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
) : (
|
||||
requestStatus.status && (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{requestStatus.message}
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
</div>
|
||||
{/* End of error or success display */}
|
||||
</div>
|
||||
{/* END OF TEXTAREA */}
|
||||
|
||||
{/* MESSAGE SECTION */}
|
||||
<div className="w-full p-4 bg-white dark:bg-black rounded-2xl shadow-md">
|
||||
<div className="flex justify-between items-center gap-5">
|
||||
<p className="w-full text-lg font-bold text-dark-gray dark:text-white tracking-wide flex items-center gap-2 justify-between">
|
||||
<span>Message</span>
|
||||
<button
|
||||
type="button"
|
||||
onClick={popUpHandler}
|
||||
className="text-[12px] tracking-wider text-gray-400 dark:text-slate-400"
|
||||
>
|
||||
View all
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
{props.activeJobMesList.loading ? (
|
||||
<LoadingSpinner size="16" color="sky-blue" />
|
||||
) : (
|
||||
<ActiveJobMessageMedia activeJobMesList={props.activeJobMesList} />
|
||||
)}
|
||||
</div>
|
||||
{/* END OF MESSAGE */}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* POPOUT SECTION */}
|
||||
{popUp && (
|
||||
<PopModal
|
||||
popUpHandler={popUpHandler}
|
||||
popUp={popUp}
|
||||
details={props.details}
|
||||
activeJobMesList={props.activeJobMesList}
|
||||
handlePrint={handlePrint}
|
||||
myRef={printRef}
|
||||
/>
|
||||
)}
|
||||
{/* END OF POPOUT SECTION */}
|
||||
</MediaLayout>
|
||||
);
|
||||
}
|
||||
|
||||
export default ActiveJobsMedia;
|
||||
|
||||
function convertFileToBase64(file) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = () => {
|
||||
const base64String = reader.result.split(",")[1];
|
||||
resolve(base64String);
|
||||
};
|
||||
|
||||
reader.onerror = (error) => {
|
||||
reject(error);
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
});
|
||||
}
|
||||
|
||||
//POPOUT COMPONENT FUNCTION
|
||||
const PopModal = ({
|
||||
popUpHandler,
|
||||
popUp,
|
||||
details,
|
||||
activeJobMesList,
|
||||
handlePrint,
|
||||
myRef,
|
||||
}) => {
|
||||
return (
|
||||
<ModalCom action={popUpHandler} situation={popUp}>
|
||||
<div
|
||||
ref={myRef}
|
||||
className="message-modal-wrapper w-11/12 min-w-[350px] max-w-[700px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto"
|
||||
>
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
{details?.contract}
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="modal-close-btn"
|
||||
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="custom-btn btn-gradient text-white"
|
||||
>
|
||||
<span className="text-white">Print</span>
|
||||
</button>
|
||||
<button
|
||||
onClick={popUpHandler}
|
||||
type="button"
|
||||
className="custom-btn border-gradient text-white"
|
||||
>
|
||||
<span className="text-gradient">Cancel</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
);
|
||||
};
|
||||
@@ -3,22 +3,20 @@ import React from 'react'
|
||||
function CurrentJobAction() {
|
||||
return (
|
||||
<div className='job-action dark:bg-black'>
|
||||
<p className="my-3 py-1 text-base active-owner">
|
||||
<table className="w-full text-sm text-left text-gray-500 ">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div className="flex space-x-2 items-center w-full task_action_panel">
|
||||
<table className="w-full my-3 py-1 text-sm text-left text-gray-500">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div className="flex space-x-2 items-center w-full task_action_panel">
|
||||
|
||||
<div>
|
||||
Waiting for the completion message from the client before you can approve.
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
<div>
|
||||
Waiting for the completion message from the client before you can approve.
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -60,44 +60,42 @@ function CurrentTaskAction({jobDetails}) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='job-action dark:bg-black'>
|
||||
<div className='h-full dark:bg-black'>
|
||||
|
||||
<table className="w-full text-sm text-left text-gray-500 active-worker ">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div className="flex space-x-2 items-center w-full task_action_panel">
|
||||
<div>
|
||||
I completed this task and ready for review and acceptance.
|
||||
</div>
|
||||
{/*<div className="flex flex-col flex-[0.9]">*/}
|
||||
<div className="h-full w-full text-sm text-left text-gray-500">
|
||||
{jobDetails.job_type == 'MEDIA' ?
|
||||
<div className="h-full flex justify-center items-center">
|
||||
<button onClick={popUpHandler} type="button" className="btn-gradient h-full text-white p-1 lg:p-2 border-4 border-slate-300 text-lg lg:text-xl font-medium rounded-2xl">
|
||||
I have completed this task
|
||||
</button>
|
||||
</div>
|
||||
:
|
||||
<div className='job-action active-worker'>
|
||||
<div className="flex space-x-2 items-center w-full task_action_panel">
|
||||
<div>
|
||||
I completed this task and ready for review and acceptance.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/*</div>*/}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div className="flex justify-center items-center">
|
||||
<button onClick={popUpHandler} type="button" className="w-[150px] h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
||||
Send of Review
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div className="flex justify-center items-center">
|
||||
<button onClick={popUpHandler} type="button" className="custom-btn btn-gradient text-white">
|
||||
Send for Review
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
{popUp && (
|
||||
<ModalCom action={popUpHandler} situation={popUp}>
|
||||
<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">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Confirm Completion
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-clode-btn"
|
||||
onClick={popUpHandler}
|
||||
>
|
||||
<svg
|
||||
@@ -145,33 +143,21 @@ function CurrentTaskAction({jobDetails}) {
|
||||
|
||||
{/* FOR SUCCESS/ERROR DISPLAY SECTION*/}
|
||||
<div className="w-full">
|
||||
{reqStatus.message != "" &&
|
||||
(!reqStatus.status ? (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
className={`relative p-4 text-center text-md font-light leading-[19.5px] text-[13px] ${reqStatus.status ? 'text-green-700':'text-[#912741]'}`}
|
||||
>
|
||||
{reqStatus.message}
|
||||
</div>
|
||||
) : (
|
||||
reqStatus.status && (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{reqStatus.message}
|
||||
</div>
|
||||
)
|
||||
))}
|
||||
</div>
|
||||
{/* END OF FOR SUCCESS/ERROR DISPLAY SECTION*/}
|
||||
</div>
|
||||
|
||||
{/* cancel btn */}
|
||||
<div className='flex justify-end items-center'>
|
||||
<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>
|
||||
{/* cancel btn */}
|
||||
<div className='modal-footer-wrapper flex justify-end items-center'>
|
||||
<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>
|
||||
</ModalCom>
|
||||
)}
|
||||
|
||||
@@ -121,7 +121,7 @@ function PastDueJobAction({jobDetails}) {
|
||||
<button
|
||||
type="button"
|
||||
onClick={popUpHandler}
|
||||
className="px-4 h-[48px] flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
className="custom-btn btn-gradient text-base text-white"
|
||||
>
|
||||
Cancel or Extend Timeline
|
||||
</button>
|
||||
@@ -133,14 +133,14 @@ function PastDueJobAction({jobDetails}) {
|
||||
|
||||
{popUp && (
|
||||
<ModalCom action={popUpHandler} situation={popUp}>
|
||||
<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">
|
||||
<div className="logout-modal-wrapper lg:w-[460px] h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Past Due Task
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={popUpHandler}
|
||||
>
|
||||
<svg
|
||||
@@ -164,7 +164,7 @@ function PastDueJobAction({jobDetails}) {
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div className="job-action-modal-body w-full px-10 py-8 gap-4">
|
||||
<div className="relative job-action-modal-body w-full px-10 py-8 gap-4">
|
||||
<div className="w-full flex flex-col items-center">
|
||||
<div className="mb-5 flex justify-center items-center gap-2">
|
||||
<input
|
||||
@@ -173,26 +173,26 @@ function PastDueJobAction({jobDetails}) {
|
||||
onChange={()=>{setChecked(prev => !prev)}}
|
||||
className='w-6 h-6 text-sky-blue bg-gray-100 focus:ring-sky-blue'
|
||||
/>
|
||||
<p className='font-bold text-base tracking-wide text-dark-gray dark:text-white'>I am ready to cancel this task</p>
|
||||
<p className='job-label'>I am ready to cancel this task</p>
|
||||
</div>
|
||||
|
||||
<div className="mb-5 flex justify-center items-center">
|
||||
<div className="mb-5 w-full flex justify-end items-center">
|
||||
{reqStatus.loading && action=='cancel'?
|
||||
<LoadingSpinner color='sky-blue' size='10' />
|
||||
:
|
||||
<button disabled={reqStatus.loading} onClick={cancelTask} type="button" className="px-2 py-1 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white">
|
||||
<button disabled={reqStatus.loading} onClick={cancelTask} type="button" className="custom-btn border-gradient text-base text-white">
|
||||
<span className='text-gradient'>Cancel this task</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
{/* EXTEND TIMELINE SECTION */}
|
||||
<div className='w-full my-3 py-3 border-y flex flex-col items-center'>
|
||||
<div className='w-full my-3 py-3 border-t flex flex-col items-center'>
|
||||
<div className='mb-5 flex items-center gap-2'>
|
||||
<p className='font-bold text-base tracking-wide text-dark-gray dark:text-white'>Extend the timeline by:</p>
|
||||
<p className='job-label'>Extend the timeline by:</p>
|
||||
<select
|
||||
onChange={({target})=>{setExtendedTime(target.value)}}
|
||||
className='text-base p-2 text-dark-gray dark:text-white rounded-md border border-slate-300 outline-0'
|
||||
className='text-base p-2 text-dark-gray dark:text-white border border-slate-300 outline-0 rounded-full'
|
||||
>
|
||||
<option className='text-slate-500 text-lg' value=''>select</option>
|
||||
<option className='text-slate-500 text-lg' value='2'>1 days</option>
|
||||
@@ -204,25 +204,27 @@ function PastDueJobAction({jobDetails}) {
|
||||
{reqStatus.loading && action=='extend' ?
|
||||
<LoadingSpinner color='sky-blue' size='10' />
|
||||
:
|
||||
<button disabled={reqStatus.loading} type="button" onClick={extendTime} className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">
|
||||
Extend Timeline
|
||||
</button>
|
||||
<div className='w-full flex justify-end items-center'>
|
||||
<button disabled={reqStatus.loading} type="button" onClick={extendTime} className="custom-btn btn-gradient text-base text-white">
|
||||
Extend Timeline
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
{/* FOR SUCCESS/ERROR DISPLAY SECTION*/}
|
||||
<div className="w-full">
|
||||
<div className="w-full absolute left-0 bottom-0 text-center">
|
||||
{reqStatus.message != "" &&
|
||||
(!reqStatus.status ? (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
className={`relative p-2 mx-2 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{reqStatus.message}
|
||||
</div>
|
||||
) : (
|
||||
reqStatus.status && (
|
||||
<div
|
||||
className={`relative p-4 my-4 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
className={`relative p-2 mx-2 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
|
||||
>
|
||||
{reqStatus.message}
|
||||
</div>
|
||||
@@ -232,17 +234,17 @@ function PastDueJobAction({jobDetails}) {
|
||||
{/* END OF FOR SUCCESS/ERROR DISPLAY SECTION*/}
|
||||
</div>
|
||||
|
||||
{/* cancel btn */}
|
||||
<div className='flex justify-end items-center'>
|
||||
<button onClick={popUpHandler} type="button"
|
||||
// className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white"
|
||||
className='w-[150px] mt-2 h-[48px] rounded-full text-base bg-transparent border border-red-500 text-red-500'
|
||||
>
|
||||
Cancel
|
||||
{/* <span className='text-gradient'>Cancel</span> */}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/* cancel btn */}
|
||||
<div className='modal-footer-wrapper flex justify-center items-center'>
|
||||
<button onClick={popUpHandler} type="button"
|
||||
// className="w-20 h-11 flex justify-center items-center border-gradient text-base rounded-full text-white"
|
||||
className='custom-btn text-base bg-transparent border border-red-500 text-red-500'
|
||||
>
|
||||
Cancel
|
||||
{/* <span className='text-gradient'>Cancel</span> */}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
)}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import React from 'react'
|
||||
import ModalCom from '../Helpers/ModalCom'
|
||||
|
||||
export default function JobDetailPopout({action, situation, jobDetail}) {
|
||||
return (
|
||||
<ModalCom action={action} situation={situation}>
|
||||
<div className="modal-container">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Delivery Detail
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<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="modal-body-wrapper">
|
||||
<p className='w-full text-left text-sm md:text-lg lg:text-xl text-slate-900 dark:text-white'>{jobDetail}</p>
|
||||
</div>
|
||||
<div className="modal-footer-wrapper justify-end">
|
||||
<button
|
||||
onClick={action}
|
||||
className="custom-btn border-gradient"
|
||||
>
|
||||
<span className="text-gradient">Close</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
);
|
||||
}
|
||||
@@ -7,13 +7,15 @@ import { handlePagingFunc } from "../Pagination/HandlePagination";
|
||||
import PaginatedList from "../Pagination/PaginatedList";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
import DeleteJobPopout from "../jobPopout/DeleteJobPopout";
|
||||
import EditJobPopOut from "../jobPopout/EditJobPopout";
|
||||
// import EditJobPopOut from "../jobPopout/EditJobPopout";
|
||||
|
||||
import DeleteIcon from "../../assets/images/icon-delete.svg";
|
||||
import EditIcon from "../../assets/images/icon-edit.svg";
|
||||
import { tableReload } from "../AddJob/settings";
|
||||
import CreditPopup from "../MyWallet/Popup/CreditPopup";
|
||||
import JobListPopout from "../jobPopout/JobListPopout";
|
||||
// import JobListPopout from "../jobPopout/JobListPopout";
|
||||
import NewJobListPopout from "../jobPopout/NewJobListPopout";
|
||||
import EditJobPopoutNew from "../jobPopout/EditJobPopoutNew";
|
||||
|
||||
export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
||||
const dispatch = useDispatch();
|
||||
@@ -103,7 +105,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
||||
);
|
||||
};
|
||||
|
||||
const currentJobList = filterJobList();
|
||||
const currentJobList = filterJobList()?.filter(item => item?.job_mode == 'GENERAL'); // Show only jobs with job mode of GENERAL
|
||||
|
||||
// Handling Filter Pagination
|
||||
const filteredCurrentJobList = currentJobList?.slice(
|
||||
@@ -156,7 +158,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
||||
|
||||
{/* Job List Popout */}
|
||||
{jobPopout.show && (
|
||||
<JobListPopout
|
||||
<NewJobListPopout
|
||||
details={jobPopout.data}
|
||||
onClose={() => {
|
||||
setJobPopout({ show: false, data: {} });
|
||||
@@ -164,6 +166,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
||||
setWalletItem={setWalletItem}
|
||||
openWallet={openPopUp}
|
||||
situation={jobPopout.show}
|
||||
myJobList={MyJobList}
|
||||
/>
|
||||
)}
|
||||
{/* End of Job List Popout */}
|
||||
@@ -182,7 +185,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) {
|
||||
{/* END of Delete Job Popout */}
|
||||
|
||||
{editJob.show && (
|
||||
<EditJobPopOut
|
||||
<EditJobPopoutNew
|
||||
details={editJob.data}
|
||||
onClose={() => {
|
||||
setEditJob({
|
||||
@@ -357,13 +360,14 @@ function myJobTableFeatures(
|
||||
{MyJobList?.data?.result_list?.length > 0 ? (
|
||||
filteredCurrentJobList.length > 0 ? (
|
||||
filteredCurrentJobList.map((value, index) => (
|
||||
<JobListItem
|
||||
key={index}
|
||||
index={index}
|
||||
value={value}
|
||||
image_server={MyJobList.data.session_image_server}
|
||||
/>
|
||||
))
|
||||
<JobListItem
|
||||
key={index}
|
||||
index={index}
|
||||
value={value}
|
||||
image_server={MyJobList.data.session_image_server}
|
||||
/>
|
||||
)
|
||||
)
|
||||
) : (
|
||||
<NoJobsRow text="No Jobs Available In This Category!" />
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@ import Layout from "../Partials/Layout";
|
||||
import MyJobTable from "./MyJobTable";
|
||||
import CommonHead from "../UserHeader/CommonHead";
|
||||
import AddJobPage from "../../views/AddJobPage";
|
||||
import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb";
|
||||
|
||||
export default function MyJobs(props) {
|
||||
let { state } = useLocation();
|
||||
@@ -32,8 +33,8 @@ export default function MyJobs(props) {
|
||||
<div className="notification-page w-full mb-10">
|
||||
<div className="notification-wrapper w-full">
|
||||
{/* heading */}
|
||||
<div className="sm:flex items-center mb-6">
|
||||
<div className="mb-5 sm:mb-0">
|
||||
<div className="sm:flex items-center mb-2">
|
||||
<div className="w-full">
|
||||
<h1 className="text-26 font-bold flex items-center space-x-1 text-dark-gray dark:text-white gap-2">
|
||||
<span>My Jobs</span>
|
||||
|
||||
@@ -46,6 +47,17 @@ export default function MyJobs(props) {
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-5">
|
||||
<CustomBreadcrumb
|
||||
// title = 'My Jobs'
|
||||
breadcrumb={
|
||||
[
|
||||
{ link: "/", title: "Home" },
|
||||
{ link: "/myjobs", title: "My Jobs", active: true},
|
||||
]
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<MyJobTable MyJobList={props.MyJobList} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -107,11 +107,22 @@ export default function MyPendingJobTable({ MyJobList, className }) {
|
||||
onClick={() => {
|
||||
setJobPopout({ show: true, data: value });
|
||||
}}
|
||||
className="px-4 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
className="w-12 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
{value.owner_status == "OWNER"
|
||||
? "Manage"
|
||||
: "View"}
|
||||
{/* {value.owner_status == "OWNER" ? "Manage": "View"} */}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -122,17 +122,43 @@ export default function MyJobTable({ className, ActiveJobList, Account, imageSer
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center items-center py-4 px-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
navigate("/manage-active-job", {
|
||||
state: { ...task, pathname },
|
||||
});
|
||||
}}
|
||||
className="px-4 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
{task.owner_status == 'OWNER' ? 'Manage' : 'Send Updates'}
|
||||
</button>
|
||||
{accountType ?
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
navigate("/manage-active-job", {
|
||||
state: { ...task, pathname },
|
||||
});
|
||||
}}
|
||||
className="px-4 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
{task.owner_status == 'OWNER' ? 'Manage' : 'Send Updates'}
|
||||
</button>
|
||||
:
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => {
|
||||
navigate("/manage-active-job", {
|
||||
state: { ...task, pathname },
|
||||
});
|
||||
}}
|
||||
className="w-12 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -119,7 +119,7 @@ export default function MyOffersFamilyTable({ className, familyOffers, image_ser
|
||||
</div>
|
||||
</div>
|
||||
{/* trending products */}
|
||||
<div className="trending-products slider-left relative w-full rounded-2xl p-[10px] bg-alice-blue">
|
||||
<div className="trending-products slider-left relative w-full rounded-2xl p-[10px] bg-alice-blue dark:bg-dark-white/50 transition-all duration-300">
|
||||
<SliderCom selector={trendingSlider} settings={settings}>
|
||||
{familyOffers &&
|
||||
familyOffers.length > 0 &&
|
||||
|
||||
@@ -9,6 +9,9 @@ const FamilyWalletBox = lazy(() => import("./FamilyWalletBox"));
|
||||
const FamilyWalletCon = () => {
|
||||
const apiCall = new usersService();
|
||||
// const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||
|
||||
const {userDetails} = useSelector((state) => state?.userDetails); // GETS USER INFO
|
||||
|
||||
const { walletTable } = useSelector((state) => state.tableReload);
|
||||
|
||||
const [paymentHistory, setPaymentHistory] = useState({
|
||||
@@ -23,7 +26,7 @@ const FamilyWalletCon = () => {
|
||||
|
||||
const getFamilyWalletBal = () => {
|
||||
setFamilyWalletBal({loading:true, data: []})
|
||||
apiCall.getFamilyWallet({family_uid: localStorage.getItem("uid")}).then(res => {
|
||||
apiCall.getFamilyWallet({family_uid: userDetails.uid}).then(res => {
|
||||
setFamilyWalletBal({loading:false, data: res?.data?.result_list})
|
||||
}).catch(error => {
|
||||
setFamilyWalletBal({loading:false, data: []})
|
||||
|
||||
@@ -259,14 +259,14 @@ function AddFundDollars(props) {
|
||||
<div className="w-full">
|
||||
{/* switch button */}
|
||||
<div className="flex">
|
||||
<form className="add-fund-info flex items-center gap-3">
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<form className="add-fund-info flex items-center gap-3 md:px-8 md:pt-4 px-4 pt-2">
|
||||
<h1 className="job-label my-1">
|
||||
{countryWallet == "US" && "Payment Method"}
|
||||
</h1>
|
||||
<div className="my-1 flex items-center gap-2">
|
||||
<label
|
||||
htmlFor="previous"
|
||||
className="cursor-pointer flex items-center gap-1"
|
||||
className="flex items-center gap-1"
|
||||
>
|
||||
<input
|
||||
type="radio"
|
||||
@@ -283,7 +283,7 @@ function AddFundDollars(props) {
|
||||
</label>
|
||||
<label
|
||||
htmlFor="new"
|
||||
className={`cursor-pointer flex items-center gap-1 ${
|
||||
className={`flex items-center gap-1 ${
|
||||
payListCards.data.length >= MaxNoOfCards
|
||||
? "pointer-events-none"
|
||||
: ""
|
||||
@@ -313,7 +313,7 @@ function AddFundDollars(props) {
|
||||
|
||||
{/* previous selectedOption */}
|
||||
{selectedOption === "previous" && (
|
||||
<div className="p-4 previous-details w-full min-h-[16.5rem] flex flex-col">
|
||||
<div className="px-8 py-4 previous-details w-full h-[300px] flex flex-col">
|
||||
{payListCards.loading ? (
|
||||
<LoadingSpinner size="10" color="sky-blue" />
|
||||
) : payListCards?.data?.length ? (
|
||||
@@ -367,7 +367,7 @@ function AddFundDollars(props) {
|
||||
)}
|
||||
|
||||
{selectedOption === "new" && (
|
||||
<div className="new-details w-full max-h-[22rem]">
|
||||
<div className="new-details w-full">
|
||||
{payListCards.loading ? (
|
||||
<div className="pt-10 flex w-full h-full justify-center items-center">
|
||||
<LoadingSpinner size="10" color="sky-blue" />
|
||||
@@ -381,14 +381,14 @@ function AddFundDollars(props) {
|
||||
>
|
||||
{(props) => {
|
||||
return (
|
||||
<Form className="md:pl-8">
|
||||
<div className="flex flex-col-reverse sm:flex-row">
|
||||
<Form className="w-full">
|
||||
<div className="flex flex-col-reverse sm:flex-row md:px-8 md:pt-4 px-4 pt-2">
|
||||
<div className="flex-1 sm:mr-10">
|
||||
<div className="fields w-full">
|
||||
{/* Inputs */}
|
||||
{/* Name */}
|
||||
<div className="flex items-center field w-full my-2 flex-[0.4] gap-3">
|
||||
<label className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1">
|
||||
<label className="job-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold flex items-center gap-1">
|
||||
Name:
|
||||
</label>
|
||||
<p className="input-label text-[#181c32] dark:text-white text-[16px] leading-[20.9625px] font-semibold flex items-center gap-1">{`${firstname} ${lastname}`}</p>
|
||||
@@ -423,7 +423,7 @@ function AddFundDollars(props) {
|
||||
className={`flex items-center justify-between mb-2.5`}
|
||||
>
|
||||
<label
|
||||
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold line-clamp-3 flex items-center"
|
||||
className="job-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold line-clamp-3 flex items-center"
|
||||
htmlFor="expiration"
|
||||
>
|
||||
Exp Month{" "}
|
||||
@@ -588,26 +588,28 @@ function AddFundDollars(props) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="add-fund-btn flex justify-end items-center gap-2 mt-4">
|
||||
<button
|
||||
className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center bg-[#f5a430] text-black items-center text-base rounded-full"
|
||||
onClick={handleClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="px-4 py-1 h-11 max-w-[115px] w-full flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
{loadingState ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<>
|
||||
<span className="text-white">Continue</span>{" "}
|
||||
<Icons name="chevron-right" />
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
<div className="modal-footer-wrapper grid grid-cols-1 xxs:grid-cols-3">
|
||||
<div className="w-full col-span-1 xxs:col-span-2 xxs:col-start-2 flex justify-between items-center">
|
||||
<button
|
||||
className="custom-btn bg-[#f5a430] text-black text-base"
|
||||
onClick={handleClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="custom-btn btn-gradient text-base text-white"
|
||||
>
|
||||
{loadingState ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<>
|
||||
<span className="text-white">Continue</span>{" "}
|
||||
<Icons name="chevron-right" />
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Form>
|
||||
);
|
||||
@@ -620,25 +622,27 @@ function AddFundDollars(props) {
|
||||
</div>
|
||||
|
||||
{selectedOption == "previous" && (
|
||||
<div className="md:py-8 add-fund-btn flex justify-end items-center gap-2 py-4">
|
||||
<button
|
||||
className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center bg-[#f5a430] text-black items-center text-base rounded-full"
|
||||
onClick={props.onClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
name="previous"
|
||||
type="button"
|
||||
className="px-4 py-1 h-11 max-w-[115px] w-full flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
{loadingState ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<span className="text-white">Continue</span>
|
||||
)}
|
||||
</button>
|
||||
<div className="modal-footer-wrapper grid grid-cols-1 xxs:grid-cols-3">
|
||||
<div className="w-full col-span-1 xxs:col-span-2 xxs:col-start-2 flex justify-between items-center">
|
||||
<button
|
||||
className="custom-btn bg-[#f5a430] text-black text-base"
|
||||
onClick={props.onClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
name="previous"
|
||||
type="button"
|
||||
className="custom-btn btn-gradient text-base text-white"
|
||||
>
|
||||
{loadingState ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<span className="text-white">Continue</span>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -126,12 +126,12 @@ function AddFundPop({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="h-[33rem] w-full">
|
||||
<div className="w-full">
|
||||
<div className="content-wrapper w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin">
|
||||
<div className="lg:w-2/2 w-full mb-10 lg:mb-0">
|
||||
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl">
|
||||
<form className="md:px-8 md:pt-4 px-4 pt-2 add-fund-info flex items-center gap-[2.1rem]">
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<h1 className="job-label my-1">
|
||||
Amount({currency})
|
||||
</h1>
|
||||
<div className="field w-full max-w-[250px]">
|
||||
@@ -149,51 +149,53 @@ function AddFundPop({
|
||||
</p>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{countryWallet === "US" && (
|
||||
<div className="w-full md:px-8 md:pt-4 px-4 pt-2 bg-white dark:bg-dark-white rounded-2xl">
|
||||
<AddFundDollars
|
||||
setInputError={setInputError}
|
||||
walletItem={walletItem}
|
||||
input={input}
|
||||
setInput={setInput}
|
||||
currency={currency}
|
||||
onClose={onClose}
|
||||
confirmCredit={confirmCredit}
|
||||
setConfirmCredit={setConfirmCredit}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{countryWallet == "NG" && <div className="h-[19rem]"></div>}
|
||||
|
||||
{countryWallet == "NG" && (
|
||||
<div className="md:p-8 p-4 add-fund-btn flex justify-end items-center py-4 gap-4">
|
||||
<button
|
||||
className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center items-center bg-[#f5a430] text-black text-base rounded-full"
|
||||
onClick={onClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
type="button"
|
||||
className="px-4 py-1 h-11 flex justify-center space-x-1 items-center btn-gradient text-base rounded-full text-white max-w-[100px] w-full"
|
||||
>
|
||||
{__awaitComponent.loader ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<>
|
||||
<span className="text-white">Continue</span>{" "}
|
||||
<Icons name="chevron-right" />
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{countryWallet === "US" && (
|
||||
<div className="w-full bg-white dark:bg-dark-white rounded-2xl">
|
||||
<AddFundDollars
|
||||
setInputError={setInputError}
|
||||
walletItem={walletItem}
|
||||
input={input}
|
||||
setInput={setInput}
|
||||
currency={currency}
|
||||
onClose={onClose}
|
||||
confirmCredit={confirmCredit}
|
||||
setConfirmCredit={setConfirmCredit}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{countryWallet == "NG" && <div className="h-[19rem]"></div>}
|
||||
|
||||
{countryWallet == "NG" && (
|
||||
<div className="modal-footer-wrapper grid grid-cols-1 xxs:grid-cols-3">
|
||||
<div className="w-full col-span-1 xxs:col-span-2 xxs:col-start-2 flex justify-between items-center">
|
||||
<button
|
||||
className="custom-btn bg-[#f5a430] text-black text-base"
|
||||
onClick={onClose}
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmit}
|
||||
type="button"
|
||||
className="custom-btn btn-gradient text-base text-white"
|
||||
>
|
||||
{__awaitComponent.loader ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
<>
|
||||
<span className="text-white">Continue</span>{" "}
|
||||
<Icons name="chevron-right" />
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
||||
data?.result === "Charge success" || data?.status === "successful";
|
||||
|
||||
return (
|
||||
<div className="logout-modal-body w-full flex flex-col items-center">
|
||||
<div className="content-wrapper w-full h-[32rem]">
|
||||
<div className="logout-modal-body w-full">
|
||||
<div className="content-wrapper w-full h-[32rem] flex flex-col justify-center">
|
||||
<div className="w-full mb-10">
|
||||
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl">
|
||||
<div className="px-4 md:p-8 py-4 add-fund-info">
|
||||
@@ -49,7 +49,7 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center">
|
||||
<div className="w-full flex justify-center items-center">
|
||||
<h1 className="text-xl font-semibold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
{isSuccess
|
||||
? "Credit was Successful!"
|
||||
@@ -59,55 +59,56 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
|
||||
|
||||
{data?.internal_return >= 0 &&
|
||||
data?.result !== "Charge failed" && (
|
||||
<>
|
||||
<div className="flex items-center gap-8">
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<div className="w-full max-w-[300px] mx-auto">
|
||||
<div className="flex gap-8 my-2">
|
||||
<h1 className="w-full job-label">
|
||||
Amount({data?.currency || ""})
|
||||
</h1>
|
||||
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<span className="text-base text-dark-gray dark:text-white tracking-tighter flex justify-end items-end">
|
||||
{`${data?.symbol || ""} ${
|
||||
Number(data?.amount * 0.01).toLocaleString() || ""
|
||||
Number(data?.amount * 0.01).toFixed(2) || ""
|
||||
}`}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{data?.curr_balance &&
|
||||
<div className="flex items-center gap-8">
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<div className="flex gap-8 my-2">
|
||||
<h1 className="w-full job-label">
|
||||
Wallet Balance
|
||||
</h1>
|
||||
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
{data?.curr_balance * 0.01}
|
||||
<span className="text-base text-dark-gray dark:text-white tracking-tighter flex justify-end items-end">
|
||||
{(data?.curr_balance * 0.01).toFixed(2)}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
{isSuccess && (
|
||||
<div className="flex items-center gap-8">
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<div className="flex gap-8 my-2">
|
||||
<h1 className="w-full job-label">
|
||||
Confirmation Number
|
||||
</h1>
|
||||
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<span className="text-base text-dark-gray dark:text-white tracking-tighter flex justify-end items-end">
|
||||
{data?.confirmation}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="md:p-8 p-4 add-fund-btn flex justify-end items-center py-4 gap-4">
|
||||
<button
|
||||
className="px-4 h-11 flex justify-center items-center btn-gradient text-white text-base rounded-full w-[100px]"
|
||||
onClick={onClose}
|
||||
>
|
||||
Ok
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer-wrapper w-full flex justify-end items-center gap-4">
|
||||
<button
|
||||
className="custom-btn btn-gradient text-white text-base"
|
||||
onClick={onClose}
|
||||
>
|
||||
Ok
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ function ThePaymentText({ value, type }) {
|
||||
return (
|
||||
<div className="my-2 flex items-center gap-5">
|
||||
<div className="card-details flex items-center gap-3">
|
||||
<h1 className="text-xl font-normal text-dark-gray dark:text-white tracking-tighter my-1 space-x-1">
|
||||
<h1 className="text-base">
|
||||
{description} Card
|
||||
</h1>
|
||||
<p className="text-xl font-normal text-dark-gray dark:text-white tracking-wide">
|
||||
<p className="text-base font-normal text-dark-gray dark:text-white tracking-wide">
|
||||
Bank **************{digits}
|
||||
</p>
|
||||
</div>
|
||||
@@ -46,14 +46,14 @@ function ThePaymentText({ value, type }) {
|
||||
*/
|
||||
function AmountSection({ currency, amount, country }) {
|
||||
const formattedAmount = (+amount * 0.01)?.toFixed(2);
|
||||
const gapClassName = country === "US" ? "gap-14" : "gap-4";
|
||||
|
||||
return (
|
||||
<div className={`flex items-center ${gapClassName}`}>
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
Amount({currency})
|
||||
<div className={`flex items-center gap-8`}>
|
||||
{/* text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1 */}
|
||||
<h1 className="min-w-[150px] job-label">
|
||||
Amount ({currency})
|
||||
</h1>
|
||||
<span className="text-xl font-normal text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<span className="min-w-[100px] text-base text-right font-normal text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
{formattedAmount}
|
||||
</span>
|
||||
</div>
|
||||
@@ -66,14 +66,13 @@ function AmountSection({ currency, amount, country }) {
|
||||
*/
|
||||
function TransactionFeeSection({ currency, fee, country }) {
|
||||
const formattedFee = (+fee).toFixed(2);
|
||||
const gapClass = country === "US" ? "gap-[2.7rem]" : "gap-4";
|
||||
|
||||
return (
|
||||
<div className={`flex items-center border-b border-gray-600 ${gapClass}`}>
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<div className={`flex items-center gap-8 border-b border-gray-600`}>
|
||||
<h1 className="min-w-[150px] job-label">
|
||||
Transaction Fee
|
||||
</h1>
|
||||
<span className="text-xl font-normal text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<span className="min-w-[100px] text-base text-right font-normal text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
{formattedFee}
|
||||
</span>
|
||||
</div>
|
||||
@@ -89,14 +88,12 @@ function TotalSection({ currency, amount, fee, country }) {
|
||||
const total = Number(amount) + Number(fee);
|
||||
const formattedTotal = (total * 0.01)?.toFixed(2);
|
||||
|
||||
const gap = country === "US" ? "gap-[8rem]" : "gap-[6.3rem]";
|
||||
|
||||
return (
|
||||
<div className={`flex items-center ${gap}`}>
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
Total
|
||||
<div className={`flex items-center gap-8`}>
|
||||
<h1 className="min-w-[150px] job-label">
|
||||
Total ({currency})
|
||||
</h1>
|
||||
<span className="text-xl font-normal text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
<span className="min-w-[100px] text-base text-right font-normal text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
{formattedTotal}
|
||||
</span>
|
||||
</div>
|
||||
@@ -356,103 +353,104 @@ function ConfirmAddFund({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="content-wrapper w-full h-[32rem]">
|
||||
<div className="w-full mb-10">
|
||||
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl">
|
||||
<div className="px-4 md:p-8 py-4 add-fund-info">
|
||||
<div className="field w-full mb-3 min-h-[45px]">
|
||||
{confirmCredit?.show?.awaitConfirm?.state && (
|
||||
<div className="flex flex-col gap-2">
|
||||
<AmountSection
|
||||
currency={__confirmData?.currency}
|
||||
amount={__confirmData?.amount}
|
||||
country={__confirmCountry}
|
||||
/>
|
||||
<TransactionFeeSection
|
||||
currency={__confirmData?.currency}
|
||||
fee={__confirmData?.fee}
|
||||
country={__confirmCountry}
|
||||
/>
|
||||
<TotalSection
|
||||
currency={__confirmData?.currency}
|
||||
amount={__confirmData?.amount}
|
||||
fee={__confirmData?.fee}
|
||||
country={__confirmCountry}
|
||||
/>
|
||||
{__confirmCountry === "US" && (
|
||||
<div className="flex items-center gap-8">
|
||||
<label
|
||||
htmlFor="payment"
|
||||
className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1"
|
||||
>
|
||||
Payment Method
|
||||
</label>
|
||||
<span className="text-[#181c32] dark:text-white">
|
||||
<ThePaymentText
|
||||
value={__confirmCardDetails}
|
||||
type={__confirmData?.cardType}
|
||||
/>
|
||||
<>
|
||||
<div className="content-wrapper w-full h-[32rem]">
|
||||
<div className="w-full mb-10">
|
||||
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl">
|
||||
<div className="px-4 md:p-8 py-4 add-fund-info">
|
||||
<div className="field w-full mb-3 min-h-[45px]">
|
||||
{confirmCredit?.show?.awaitConfirm?.state && (
|
||||
<div className="flex flex-col gap-2">
|
||||
<AmountSection
|
||||
currency={__confirmData?.currency}
|
||||
amount={__confirmData?.amount}
|
||||
country={__confirmCountry}
|
||||
/>
|
||||
<TransactionFeeSection
|
||||
currency={__confirmData?.currency}
|
||||
fee={__confirmData?.fee}
|
||||
country={__confirmCountry}
|
||||
/>
|
||||
<TotalSection
|
||||
currency={__confirmData?.currency}
|
||||
amount={__confirmData?.amount}
|
||||
fee={__confirmData?.fee}
|
||||
country={__confirmCountry}
|
||||
/>
|
||||
{__confirmCountry === "US" && (
|
||||
<div className="flex items-center gap-8">
|
||||
<label
|
||||
htmlFor="payment"
|
||||
className="min-w-[150px] job-label"
|
||||
>
|
||||
Payment Method
|
||||
</label>
|
||||
<span className="text-[#181c32] dark:text-white">
|
||||
<ThePaymentText
|
||||
value={__confirmCardDetails}
|
||||
type={__confirmData?.cardType}
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
className={`gap-8 flex items-center`}
|
||||
>
|
||||
<h1 className="min-w-[150px] job-label">
|
||||
Reference No
|
||||
</h1>
|
||||
<span className="text-base font-normal text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
{/* Displays only half of the string */}
|
||||
{__confirmData?.credit_reference.slice(0, (Math.floor(__confirmData?.credit_reference.length/2)))}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<div
|
||||
className={`${
|
||||
__confirmCountry === "US"
|
||||
? "gap-[3.7rem]"
|
||||
: "gap-[1.81rem]"
|
||||
} flex items-center`}
|
||||
>
|
||||
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
Reference No
|
||||
</h1>
|
||||
<span className="text-xl font-normal text-dark-gray dark:text-white tracking-tighter my-1">
|
||||
{__confirmData?.credit_reference}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={
|
||||
__confirmCountry === "US" ? "min-h-[96px]" : "min-h-[157px]"
|
||||
}
|
||||
></div>
|
||||
<hr />
|
||||
<div className="md:p-8 p-4 add-fund-btn flex justify-end items-center py-4 gap-4">
|
||||
<button
|
||||
className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center bg-[#f5a430] text-black items-center text-base rounded-full"
|
||||
onClick={getBack}
|
||||
>
|
||||
Back
|
||||
</button>
|
||||
{__confirmCountry === "US" && (
|
||||
<button
|
||||
className="px-4 h-11 flex justify-center items-center btn-gradient text-white text-base rounded-full"
|
||||
onClick={
|
||||
__confirmData?.cardType === "prev"
|
||||
? handlePrevCard
|
||||
: handleNewCard
|
||||
}
|
||||
>
|
||||
{confirmCredit?.show?.acceptConfirm?.loader ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
"Proceed"
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
{__confirmCountry === "NG" && (
|
||||
<FlutterWaveButton
|
||||
{...fwConfig}
|
||||
className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className={
|
||||
__confirmCountry === "US" ? "min-h-[96px]" : "min-h-[157px]"
|
||||
}
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="modal-footer-wrapper grid grid-cols-1 xxs:grid-cols-3">
|
||||
<div className="w-full col-span-1 xxs:col-span-2 xxs:col-start-2 flex justify-between items-center">
|
||||
<button
|
||||
className="custom-btn bg-[#f5a430] text-black text-base"
|
||||
onClick={getBack}
|
||||
>
|
||||
Back
|
||||
</button>
|
||||
{__confirmCountry === "US" && (
|
||||
<button
|
||||
className="custom-btn btn-gradient text-white text-base"
|
||||
onClick={
|
||||
__confirmData?.cardType === "prev"
|
||||
? handlePrevCard
|
||||
: handleNewCard
|
||||
}
|
||||
>
|
||||
{confirmCredit?.show?.acceptConfirm?.loader ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
) : (
|
||||
"Proceed"
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
{__confirmCountry === "NG" && (
|
||||
<FlutterWaveButton
|
||||
{...fwConfig}
|
||||
className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,13 +58,12 @@ function ConfirmNairaWithdraw({
|
||||
.sendMoney(reqData)
|
||||
.then((res) => {
|
||||
if (res.data.internal_return < 0) {
|
||||
// if (res.data?.status_message?.toLowerCase().includes("limit")) {
|
||||
// setRequestStatus({
|
||||
// message: ,
|
||||
// loading: false,
|
||||
// status: false,
|
||||
// });
|
||||
// }
|
||||
setRequestStatus({
|
||||
message: 'Unable to complete, try again',
|
||||
loading: false,
|
||||
status: false,
|
||||
});
|
||||
|
||||
return setTimeout(() => {
|
||||
setRequestStatus({
|
||||
message: "",
|
||||
@@ -79,19 +78,19 @@ function ConfirmNairaWithdraw({
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
setRequestStatus({
|
||||
message: "Withdrawal sucessful",
|
||||
loading: false,
|
||||
status: true,
|
||||
});
|
||||
setShowCompleteNairaWithdraw({
|
||||
show: true,
|
||||
load: false,
|
||||
state: res.data,
|
||||
});
|
||||
setTimeout(() => {
|
||||
setRequestStatus({
|
||||
message: "",
|
||||
loading: false,
|
||||
status: false,
|
||||
});
|
||||
setShowCompleteNairaWithdraw({
|
||||
show: true,
|
||||
load: false,
|
||||
state: res.data,
|
||||
});
|
||||
dispatch(tableReload({ type: "WALLETTABLE" }));
|
||||
}, 5000);
|
||||
dispatch(tableReload({ type: "WALLETTABLE" }));
|
||||
return;
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -105,10 +104,10 @@ function ConfirmNairaWithdraw({
|
||||
|
||||
return (
|
||||
<ModalCom action={action} situation={situation}>
|
||||
<div className="logout-modal-wrapper w-[90%] md:w-[768px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="logout-modal-wrapper w-[90%] md:w-[768px] h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="w-full">
|
||||
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
|
||||
<h2 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="modal-header-con">
|
||||
<h2 className="modal-title">
|
||||
{completeNairaWithdraw.load ? (
|
||||
"Confirming..."
|
||||
) : (
|
||||
@@ -126,7 +125,7 @@ function ConfirmNairaWithdraw({
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={action}
|
||||
>
|
||||
<svg
|
||||
@@ -151,7 +150,7 @@ function ConfirmNairaWithdraw({
|
||||
</button>
|
||||
</div>
|
||||
<hr />
|
||||
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl shadow">
|
||||
<div className="add-fund w-full bg-white dark:bg-dark-white">
|
||||
{completeNairaWithdraw.load ? (
|
||||
<div className="h-[35rem] flex items-center justify-center">
|
||||
<LoadingSpinner size="12" color="sky-blue" />
|
||||
@@ -376,28 +375,28 @@ function ConfirmNairaWithdraw({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{!completeNairaWithdraw.load && (
|
||||
<>
|
||||
<p
|
||||
className={`text-lg text-center font-bold ${
|
||||
requestStatus.status ? "text-emerald-600" : "text-red-500"
|
||||
} px-4 md:px-8 py-4`}
|
||||
>
|
||||
{requestStatus.message && requestStatus.message}
|
||||
</p>
|
||||
<div className="modal-footer-wrapper grid grid-cols-1 xxs:grid-cols-3">
|
||||
<div className="w-full col-span-1 xxs:col-span-2 xxs:col-start-2 flex justify-between items-center">
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={action}
|
||||
className="custom-btn bg-[#f5a430] text-black text-base"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
|
||||
{!completeNairaWithdraw.load && (
|
||||
<>
|
||||
{" "}
|
||||
<hr />
|
||||
<p
|
||||
className={`text-base ${
|
||||
requestStatus.status ? "text-green-500" : "text-red-500"
|
||||
} px-4 md:px-8 py-4 h-5`}
|
||||
>
|
||||
{requestStatus.message && requestStatus.message}
|
||||
</p>
|
||||
<div className="px-4 md:px-8 py-4 add-fund-btn flex justify-end items-center gap-2">
|
||||
{!completeNairaWithdraw.show && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={action}
|
||||
className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center items-center bg-[#f5a430] text-black text-base rounded-full"
|
||||
>
|
||||
Cancel
|
||||
</button>
|
||||
)}
|
||||
|
||||
<button
|
||||
onClick={
|
||||
@@ -407,7 +406,7 @@ function ConfirmNairaWithdraw({
|
||||
? action
|
||||
: handleSubmit
|
||||
}
|
||||
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer min-w-[100px]"
|
||||
className="custom-btn btn-gradient text-base text-white"
|
||||
>
|
||||
{requestStatus.loading ? (
|
||||
<LoadingSpinner size="6" color="sky-blue" />
|
||||
@@ -420,9 +419,10 @@ function ConfirmNairaWithdraw({
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
|
||||
@@ -4,6 +4,7 @@ import LoadingSpinner from "../../Spinners/LoadingSpinner";
|
||||
import AddFundPop from "./AddFundPop";
|
||||
import CompleteConfirmCredit from "./CompleteConfirmCredit";
|
||||
import ConfirmAddFund from "./ConfirmAddFund";
|
||||
import CustomTimer from "../../countdown/CustomTimer";
|
||||
|
||||
const CreditPopup = ({ details, onClose, situation, walletItem }) => {
|
||||
const [input, setInput] = useState("");
|
||||
@@ -33,18 +34,17 @@ const CreditPopup = ({ details, onClose, situation, walletItem }) => {
|
||||
<ModalCom
|
||||
action={onClose}
|
||||
situation={situation}
|
||||
className="assign-task-popup"
|
||||
>
|
||||
<div className="logout-modal-wrapper w-[90%] md:w-[768px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 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">
|
||||
<div className="logout-modal-wrapper w-[90%] md:w-[768px] h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
{confirmCredit?.show?.acceptConfirm?.loader
|
||||
? "Confirming Credit..."
|
||||
: getTitle()}
|
||||
</h1>
|
||||
<button
|
||||
type="button"
|
||||
className="text-[#374557] dark:text-red-500"
|
||||
className="modal-close-btn"
|
||||
onClick={onClose}
|
||||
>
|
||||
<svg
|
||||
@@ -68,10 +68,16 @@ const CreditPopup = ({ details, onClose, situation, walletItem }) => {
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div className="logout-modal-body w-full flex flex-col items-center">
|
||||
<div className="w-full">
|
||||
{confirmCredit?.show?.acceptConfirm?.loader ? (
|
||||
<div className="h-[32rem] flex items-center justify-center">
|
||||
<LoadingSpinner size="12" color="sky-blue" />
|
||||
<div className="h-[32rem] flex flex-col items-center justify-center gap-4">
|
||||
<p className="text-lg md:text-2xl text-emerald-600 tracking-wide font-bold">Processing payment</p>
|
||||
<p className="text-lg md:text-2xl text-emerald-600 tracking-wide font-bold">Please do not refresh</p>
|
||||
<LoadingSpinner size="6" color="sky-blue" height='h-20' />
|
||||
{/* <p className="text-lg md:text-2xl text-emerald-600 tracking-wide font-bold">Timer countdown</p> */}
|
||||
<CustomTimer className="text-lg text-center md:text-2xl text-emerald-600 tracking-wide font-bold" />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -60,13 +60,6 @@ const WalletRoutes = () => {
|
||||
getPaymentHistory();
|
||||
}, [walletTable]);
|
||||
|
||||
console.log(
|
||||
"Testing all country: ",
|
||||
allCountries,
|
||||
"Testing wallet: ",
|
||||
walletDetails
|
||||
);
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Suspense fallback={<LoadingSpinner size="16" color="sky-blue" />}>
|
||||
|
||||
@@ -16,21 +16,21 @@ function WalletAction({ walletItem, payment, openPopUp }) {
|
||||
|
||||
return (
|
||||
<div className="counters w-full flex justify-between gap-2">
|
||||
<div className="w-1/2 flex justify-center items-center">
|
||||
<div className="w-1/2 flex justify-start items-center">
|
||||
<button
|
||||
onClick={() => {
|
||||
setShowNairaWithdraw((prev) => ({ ...prev, show: true }));
|
||||
}}
|
||||
className={`${
|
||||
walletItem.code != "NAIRA" && "invisible"
|
||||
} px-4 h-10 flex justify-center items-center btn-gradient text-base rounded-full text-white`}
|
||||
} logout-btn btn-gradient text-white`}
|
||||
>
|
||||
Spend
|
||||
</button>
|
||||
</div>
|
||||
<div className="w-1/2 flex justify-center items-center">
|
||||
<div className="w-1/2 flex justify-end items-center">
|
||||
<button
|
||||
className="px-4 h-10 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
className="logout-btn btn-gradient text-white"
|
||||
onClick={() => {
|
||||
openPopUp({
|
||||
payment: payment,
|
||||
@@ -38,7 +38,7 @@ function WalletAction({ walletItem, payment, openPopUp }) {
|
||||
});
|
||||
}}
|
||||
>
|
||||
<span className="">Add Credit</span>
|
||||
Add Credit
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -15,14 +15,14 @@ export default function WalletBox({ wallet, payment, countries }) {
|
||||
return (
|
||||
<div className="my-wallet-wrapper w-full mb-10">
|
||||
<div className="main-wrapper w-full">
|
||||
<div className="balance-inquery w-auto grid sm:grid-cols-2 lg:grid-cols-2 xl:grid-cols-[repeat(auto-fill,_minmax(354px,_1fr))] min-[1440px]:grid-cols-[repeat(auto-fill,_minmax(415px,_1fr))] gap-5 mb-11 h-auto">
|
||||
<div className="balance-inquery w-auto grid md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-[repeat(auto-fill,_minmax(354px,_1fr))] min-[1440px]:grid-cols-[repeat(auto-fill,_minmax(415px,_1fr))] gap-5 mb-11 h-auto">
|
||||
{loading ? (
|
||||
<div className="w-full h-full flex items-center justify-center">
|
||||
<LoadingSpinner size="16" color="sky-blue" />
|
||||
</div>
|
||||
) : (
|
||||
data.length > 0 && data.map((item) => (
|
||||
<div key={item.wallet_uid} className="lg:w-full h-full mb-10 lg:mb-0">
|
||||
<div key={item.wallet_uid} className="w-full md:max-w-[450px] h-full mb-10 lg:mb-0">
|
||||
<WalletItemCard walletItem={item} payment={payment} countries={countries} />
|
||||
</div>
|
||||
))
|
||||
|
||||
@@ -15,24 +15,24 @@ function PurchasesTable({purchase}) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='flex flex-col justify-between min-h-[500px]'>
|
||||
<div className='p-4 flex flex-col justify-between min-h-[500px]'>
|
||||
{purchase.data.length ?
|
||||
<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">Trx.</th>
|
||||
<th className="p-2">Amount</th>
|
||||
<th className="p-2">Fee</th>
|
||||
<thead className='w-full'>
|
||||
<tr className='text-slate-600 dark:text-white'>
|
||||
<th className="p-4">Trx.</th>
|
||||
<th className="p-4 text-right">Amount</th>
|
||||
<th className="p-4 text-right">Fee</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{currentPurchase.map((item, index) => (
|
||||
<tr key={index} className='text-slate-500'>
|
||||
<td className="p-2">{item.added_date}<br />
|
||||
<tr key={index} className='dark:text-white dark:bg-dark-white border-y dark:border-[#5356fb29] hover:bg-gray-50 dark:hover:bg-gray-50 dark:hover:text-black transition-all duration-300'>
|
||||
<td className="p-4">{item.added_date}<br />
|
||||
<b>{item.confirmation} </b>
|
||||
</td>
|
||||
<td className="p-2">{item.amount}</td>
|
||||
<td className="p-2">{item.fee}</td>
|
||||
<td className="p-4 text-right">{item.amount}</td>
|
||||
<td className="p-4 text-right">{item.fee}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
@@ -18,31 +18,31 @@ function RecentActivityTable({ payment }) {
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col justify-between min-h-[500px]">
|
||||
<div className="p-4 flex flex-col justify-between min-h-[500px]">
|
||||
{payment?.data?.length > 0 ?
|
||||
<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">Date</th>
|
||||
<thead className="w-full">
|
||||
<tr className="text-slate-600 dark:text-white">
|
||||
<th className="p-4">Date</th>
|
||||
<th className="p-4">Trx.</th>
|
||||
<th className="p-2">Amnt./Fee</th>
|
||||
<th className="p-2">Status</th>
|
||||
<th className="p-4 text-right">Amnt./Fee</th>
|
||||
<th className="p-4">Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{currentActivity.map((item, index) => (
|
||||
<tr key={index} className="text-slate-500">
|
||||
<td className="p-2">{item.trx_date}</td>
|
||||
<tr key={index} className="dark:text-white dark:bg-dark-white border-y dark:border-[#5356fb29] hover:bg-gray-50 dark:hover:bg-gray-50 dark:hover:text-black transition-all duration-300">
|
||||
<td className="p-4">{item.trx_date}</td>
|
||||
<td
|
||||
className="p-4"
|
||||
dangerouslySetInnerHTML={{ __html: item.recipient }}
|
||||
></td>
|
||||
<td className="p-2">
|
||||
<td className="p-4 text-right">
|
||||
{item.amount}
|
||||
<br />
|
||||
{item.fee}
|
||||
</td>
|
||||
<td className="p-2">{item.status}</td>
|
||||
<td className="p-4">{item.status}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useSelector } from "react-redux";
|
||||
|
||||
export default function WalletHeader(props) {
|
||||
|
||||
const {userDetails: { account_type }} = useSelector((state) => state?.userDetails);
|
||||
const {userDetails: { account_type, wallet_available_status }} = useSelector((state) => state?.userDetails);
|
||||
// debugger;
|
||||
//props.myWalletList.result_list
|
||||
let { pathname } = useLocation();
|
||||
@@ -22,6 +22,7 @@ export default function WalletHeader(props) {
|
||||
props.setBalanceDropdown.toggle();
|
||||
else navigate("/my-wallet", { replace: true });
|
||||
}
|
||||
// console.log('props.myWalletList', wallet_available_status)
|
||||
return (
|
||||
<>
|
||||
{account_type == 'FULL' ?
|
||||
@@ -49,6 +50,8 @@ export default function WalletHeader(props) {
|
||||
</h3>
|
||||
</div>
|
||||
<div className="content px-7 pb-7">
|
||||
{/* wallet_available_status == 'WALLET_AVAILABLE' */}
|
||||
{(wallet_available_status == 'WALLET_AVAILABLE' || localStorage.getItem('wallet_available_status')== 'WALLET_AVAILABLE') ?
|
||||
<ul>
|
||||
{props.myWalletList &&
|
||||
props.myWalletList?.length > 0 &&
|
||||
@@ -176,17 +179,25 @@ export default function WalletHeader(props) {
|
||||
{/* </div>*/}
|
||||
{/*</li>*/}
|
||||
</ul>
|
||||
:
|
||||
<div className='p-2 w-full flex gap-4 items-center'>
|
||||
<img className='w-[100px!important] h-auto' src={localImgLoad('images/icons/wallet.svg')} alt='Wallet Icon' />
|
||||
<p className='text-lg text-red-500'>We do not currently support wallets in your area. We are diligently working on it. </p>
|
||||
</div>
|
||||
}
|
||||
|
||||
{(wallet_available_status == 'WALLET_AVAILABLE' || localStorage.getItem('wallet_available_status')== 'WALLET_AVAILABLE') &&
|
||||
<div className="add-money-btn flex justify-center items-center mt-3">
|
||||
{/* <button
|
||||
onClick={() => {
|
||||
if(pathname == '/my-wallet') props.setBalanceDropdown.toggle()
|
||||
else navigate('/my-wallet', {replace: true})
|
||||
}}
|
||||
type="button"
|
||||
className="w-[122px] h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
Manage
|
||||
</button> */}
|
||||
onClick={() => {
|
||||
if(pathname == '/my-wallet') props.setBalanceDropdown.toggle()
|
||||
else navigate('/my-wallet', {replace: true})
|
||||
}}
|
||||
type="button"
|
||||
className="w-[122px] h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
Manage
|
||||
</button> */}
|
||||
<Link
|
||||
to="/my-wallet"
|
||||
onClick={onWalletClick}
|
||||
@@ -195,6 +206,7 @@ export default function WalletHeader(props) {
|
||||
Manage
|
||||
</Link>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,7 @@ export default function WalletItemCard({ walletItem, payment, countries }) {
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className="current-balance-widget w-full h-full rounded-2xl overflow-hidden flex flex-col items-center gap-2 p-8 justify-between"
|
||||
className="current-balance-widget w-full h-full rounded-2xl overflow-hidden flex flex-col items-center gap-4 p-4 justify-between"
|
||||
style={{
|
||||
background: `url(${background}) 0% 0% / cover no-repeat`,
|
||||
}}
|
||||
@@ -81,12 +81,12 @@ export default function WalletItemCard({ walletItem, payment, countries }) {
|
||||
walletItem.escrow * 0.01,
|
||||
walletItem.code,
|
||||
undefined,
|
||||
"text-[2rem]"
|
||||
"text-[1.5rem]"
|
||||
)}
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<div className="my-2 w-full h-[1px] bg-white"></div>
|
||||
<div className="w-full h-[1px] bg-white"></div>
|
||||
|
||||
<WalletAction
|
||||
walletItem={{ ...walletItem, walletCountry: currentWalletCurrency }}
|
||||
|
||||
@@ -6,10 +6,20 @@ import CommonHead from "../UserHeader/CommonHead";
|
||||
import usersService from "../../services/UsersService";
|
||||
import LoadingSpinner from "../Spinners/LoadingSpinner";
|
||||
import OthersInterestedTable from "./OthersInterestedTable";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { tableReload } from "../../store/TableReloads";
|
||||
import { PriceFormatter } from "../Helpers/PriceFormatter";
|
||||
|
||||
export default function ManageInterestOffer(props) {
|
||||
|
||||
const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE
|
||||
|
||||
let { othersInterestedTable } = useSelector((state) => state.tableReload); // FOR OTHERS INTERESTED TABLE RELOAD
|
||||
|
||||
let walletBal = walletDetails?.data?.filter(wallet => wallet.code == props?.offerDetails?.currency_code) // USER WALLET BALANCE FOR CORRESPONDING TASK CURRENCY
|
||||
|
||||
let clientAdded = new Date(props.offerDetails?.client_added)
|
||||
|
||||
const dispatch = useDispatch()
|
||||
const navigate = useNavigate()
|
||||
const apiCall = new usersService()
|
||||
@@ -26,6 +36,8 @@ export default function ManageInterestOffer(props) {
|
||||
|
||||
const [messageList, setMessageList] = useState({loading: true, data: []}) // TO BE REMOVED AND REPLACE WITH REAL MESSAGE FROM API CALL
|
||||
|
||||
const [interestStats, setInterestStats] = useState({loading: true, data: []}) // STATE TO HOLD INTEREST STATS
|
||||
|
||||
const [selectTab, setValue] = useState("today");
|
||||
const filterHandler = (value) => {
|
||||
setValue(value);
|
||||
@@ -120,6 +132,20 @@ export default function ManageInterestOffer(props) {
|
||||
console.log('Failed', err)
|
||||
})
|
||||
},[messageListReload])
|
||||
|
||||
useEffect(()=>{ //API to get Interest stats
|
||||
let reqData = { // API PAYLOADS
|
||||
interest_uid: props?.offerDetails?.interest_uid,
|
||||
client_uid: props?.offerDetails?.client_uid
|
||||
}
|
||||
setInterestStats(prev => ({...prev, loading: true}))
|
||||
apiCall.interestStatistics(reqData).then(res=>{
|
||||
setInterestStats({loading: false, data:res?.data})
|
||||
}).catch(err => {
|
||||
setInterestStats(prev => ({...prev, loading: false}))
|
||||
console.log('Failed', err)
|
||||
})
|
||||
},[othersInterestedTable])
|
||||
return (
|
||||
<Layout>
|
||||
<CommonHead
|
||||
@@ -139,7 +165,7 @@ export default function ManageInterestOffer(props) {
|
||||
|
||||
{/* manage offer section */}
|
||||
<div className="w-full p-4 bg-white dark:bg-dark-white rounded-2xl section-shadow">
|
||||
<div className="my-2 w-full sm:grid gap-5 grid-cols-4">
|
||||
<div className="my-2 w-full md:grid gap-5 grid-cols-4">
|
||||
{/* Detail section */}
|
||||
<div className="w-full mb-5 lg:mb-0 col-span-3">
|
||||
<div className="w-full flex justify-start space-x-3 items-center">
|
||||
@@ -183,12 +209,21 @@ export default function ManageInterestOffer(props) {
|
||||
<button
|
||||
name="message"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
className={`px-4 py-1 rounded-t-2xl flex gap-2 ${
|
||||
tab == "message" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Messages ({messageList.data.length})
|
||||
</button>
|
||||
<button
|
||||
name="details"
|
||||
onClick={(e) => setTab(e.target.name)}
|
||||
className={`px-4 py-1 rounded-t-2xl ${
|
||||
tab == "details" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
|
||||
}`}
|
||||
>
|
||||
Delivery Details
|
||||
</button>
|
||||
</div>
|
||||
{/* END OF switch button */}
|
||||
|
||||
@@ -197,40 +232,94 @@ export default function ManageInterestOffer(props) {
|
||||
<div className="info-details w-full border-t">
|
||||
<div className="my-0 md:my-3 block md:flex items-center gap-10">
|
||||
<div className="my-3 md:my-0 flex items-center gap-1">
|
||||
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Name</span>
|
||||
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_name}</span>
|
||||
<p className="text-xl font-extrabold text-black dark:text-white tracking-wide">
|
||||
Name : {' '}
|
||||
<span className="text-lg font-normal text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_name}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div className="my-3 md:my-0 flex items-center gap-1">
|
||||
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Member Since</span>
|
||||
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_added}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="my-3 flex items-center gap-1">
|
||||
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Jobs completed</span>
|
||||
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_jobs_completed ? props.offerDetails?.client_jobs_completed :0}</span>
|
||||
</div>
|
||||
<div className="my-0 md:my-3 block md:flex items-center gap-10">
|
||||
<div className="my-3 md:my-0 flex items-center gap-1">
|
||||
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Jobs active</span>
|
||||
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_jobs_active ? props.offerDetails?.client_jobs_active:0}</span>
|
||||
</div>
|
||||
<div className="my-3 md:my-0 flex items-center gap-1">
|
||||
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Jobs uncompleted</span>
|
||||
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_jobs_missed ? props.offerDetails?.client_jobs_missed:0}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="block md:flex items-center gap-10">
|
||||
<div className="my-3 md:my-0 flex items-center gap-1">
|
||||
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">% completion</span>
|
||||
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_percent_completion ? props.offerDetails?.client_percent_completion:0}</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<span className="w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide">Pending Offers</span>
|
||||
<span className="min-w-[100px] text-sm font-bold text-dark-gray dark:text-white tracking-wide">{props.offerDetails?.client_offers_pending ? props.offerDetails?.client_offers_pending:0}</span>
|
||||
<p className="text-xl font-extrabold text-black dark:text-white tracking-wide">
|
||||
Member Since : {' '}
|
||||
<span className="text-lg font-normal text-dark-gray dark:text-white tracking-wide">
|
||||
{clientAdded.getFullYear()}{" - "}
|
||||
{clientAdded.getMonth() < 9 ? '0'+ (clientAdded.getMonth() + 1) : clientAdded.getMonth() + 1}
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<>
|
||||
{interestStats.loading ?
|
||||
<LoadingSpinner color='sky-blue' size='10' height='min-h-[40px]' />
|
||||
:
|
||||
<>
|
||||
<div className='w-full my-3 md:my-0'>
|
||||
<h1 className="text-xl font-extrabold text-black dark:text-white tracking-wide">Previous Job Statistics</h1>
|
||||
</div>
|
||||
<div className='p-2 w-full md:max-w-xl flex flex-col md:flex-row gap-4 justify-center items-center rounded-2xl bg-sky-100'>
|
||||
<div className='contents md:flex flex-col gap-3'>
|
||||
<div className='flex items-center gap-1'>
|
||||
<p className="min-w-[150px] text-lg font-bold text-black dark:text-white tracking-wide text-right">Completed :</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_completed && interestStats.data?.job_completed}</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<p className="min-w-[150px] text-lg font-bold text-black dark:text-white tracking-wide text-right">Active :</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_active && interestStats.data?.job_active}</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<p className="min-w-[150px] text-lg font-bold text-black dark:text-white tracking-wide text-right">% Completion :</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_percent_complete && interestStats.data?.job_percent_complete}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className='contents md:flex flex-col gap-3'>
|
||||
<div className="flex items-center gap-1">
|
||||
<p className="min-w-[150px] text-lg font-bold text-black dark:text-white tracking-wide text-right">Last Completed :</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_last_date && interestStats.data?.job_last_date}</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<p className="min-w-[150px] text-lg font-bold text-black dark:text-white tracking-wide text-right">Uncompleted :</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_uncompleted && interestStats.data?.job_uncompleted}</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<p className="min-w-[150px] text-lg font-bold text-black dark:text-white tracking-wide text-right">Pending Offers :</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_pending && interestStats.data?.job_pending}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="my-0 md:my-3 block md:flex items-center gap-5">
|
||||
<div className='my-3 md:my-0 flex items-center gap-4'>
|
||||
<p className="min-w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide text-right">Completed:</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_completed && interestStats.data?.job_completed}</p>
|
||||
</div>
|
||||
<div className="my-3 md:my-0 flex items-center gap-4">
|
||||
<p className="min-w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide text-right">Completed:</p>
|
||||
<p className="min-w-[150px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_last_date && interestStats.data?.job_last_date}</p>
|
||||
</div>
|
||||
</div> */}
|
||||
{/* <div className="my-0 md:my-3 block md:flex items-center gap-10">
|
||||
<div className="my-3 md:my-0 flex items-center gap-4">
|
||||
<p className="min-w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide text-right">Active:</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_active && interestStats.data?.job_active}</p>
|
||||
</div>
|
||||
<div className="my-3 md:my-0 flex items-center gap-4">
|
||||
<p className="min-w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide text-right">Uncompleted:</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_uncompleted && interestStats.data?.job_uncompleted}</p>
|
||||
</div>
|
||||
</div> */}
|
||||
{/* <div className="block md:flex items-center gap-10">
|
||||
<div className="my-3 md:my-0 flex items-center gap-4">
|
||||
<p className="min-w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide text-right">% Completion:</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_percent_complete && interestStats.data?.job_percent_complete}</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<p className="min-w-[200px] text-lg font-bold text-dark-gray dark:text-white tracking-wide text-right">Pending Offers:</p>
|
||||
<p className="min-w-[100px] text-lg font-normal text-dark-gray dark:text-white tracking-wide">{interestStats.data?.job_pending && interestStats.data?.job_pending}</p>
|
||||
</div>
|
||||
</div> */}
|
||||
</>
|
||||
}
|
||||
</>
|
||||
</div>
|
||||
:
|
||||
: tab == 'message' ?
|
||||
<div className="message-details w-full border-t">
|
||||
<p className="my-1 text-base text-dark-gray dark:text-white tracking-wide">To: <span className="font-bold">{props.offerDetails?.client_name}</span></p>
|
||||
<div className="w-full flex items-center gap-5">
|
||||
@@ -294,15 +383,32 @@ export default function ManageInterestOffer(props) {
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
: tab == 'details' ?
|
||||
<div className="info-details w-full border-t">
|
||||
<h1 className="my-3 text-base font-medium text-dark-gray dark:text-white tracking-wide">{props?.offerDetails?.description}</h1>
|
||||
</div>
|
||||
:
|
||||
null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
{/* END OF Detail section */}
|
||||
|
||||
{/* BUTTON section */}
|
||||
<div className="p-4 w-full min-h-full bg-sky-100 dark:bg-dark-gray col-span-1">
|
||||
<div className="w-full h-full">
|
||||
<div className="h-full flex sm:flex-col justify-center items-center gap-10">
|
||||
<div className="p-4 w-full min-h-full bg-sky-100 rounded-2xl dark:bg-dark-gray col-span-1">
|
||||
{/* Wallet balance and reward */}
|
||||
<div className='mb-4 border-b-2 flex flex-col xxs:flex-row md:flex-col justify-center items-center gap-4'>
|
||||
<div className='w-full flex flex-col lg:flex-row justify-center items-center gap-2'>
|
||||
<p className="text-lg font-bold text-dark-gray dark:text-white tracking-wide">Wallet:</p>
|
||||
<span className="font-medium text-dark-gray dark:text-white">{ walletDetails?.loading ? 'loading...' : PriceFormatter(walletBal[0]?.amount * 0.01,props?.offerDetails?.currency_code,props?.offerDetails?.currency)}</span>
|
||||
</div>
|
||||
<div className='w-full flex flex-col lg:flex-row justify-center items-center gap-2'>
|
||||
<p className="text-lg font-bold text-dark-gray dark:text-white tracking-wide">Reward:</p>
|
||||
<span className="font-medium text-dark-gray dark:text-white">{PriceFormatter(props?.offerDetails?.price * 0.01,props?.offerDetails?.currency_code,props?.offerDetails?.currency)}</span>
|
||||
</div>
|
||||
</div>
|
||||
{/* BUTTON section */}
|
||||
<div className="w-full">
|
||||
<div className="h-full flex flex-col xxs:flex-row md:flex-col justify-center items-center gap-10">
|
||||
{requestStatus.loading && requestStatus.processType == 'accept' ?
|
||||
<LoadingSpinner color='sky-blue' size='10' />
|
||||
:
|
||||
@@ -333,6 +439,7 @@ export default function ManageInterestOffer(props) {
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
{/* END of BUTTON section */}
|
||||
|
||||
{/* ERROR DISPLAY */}
|
||||
<div className="w-full">
|
||||
@@ -357,7 +464,6 @@ export default function ManageInterestOffer(props) {
|
||||
{/* End of error or success display */}
|
||||
</div>
|
||||
</div>
|
||||
{/* END of BUTTON section */}
|
||||
</div>
|
||||
</div>
|
||||
{/* END OF manage offer section */}
|
||||
|
||||
@@ -28,6 +28,7 @@ export default function OffersInterestTable({offerInterestList, className}) {
|
||||
handlePagingFunc(e, setCurrentPage);
|
||||
};
|
||||
|
||||
let imgServer = offerInterestList?.imgServer // FOR RENDERING IMAGE FROM SERVER
|
||||
return (
|
||||
<div
|
||||
className={`update-table w-full my-8 p-8 bg-white dark:bg-dark-white rounded-2xl section-shadow min-h-[520px] ${
|
||||
@@ -54,14 +55,19 @@ export default function OffersInterestTable({offerInterestList, className}) {
|
||||
</thead>
|
||||
<tbody className="h-full">
|
||||
{currentOfferInterestList?.map((item, index) => {
|
||||
let image = item.banner ? item.banner : 'default.jpg'
|
||||
// let image = item.banner ? item.banner : 'default.jpg'
|
||||
const image = localStorage.getItem("session_token")
|
||||
? `${imgServer}${localStorage.getItem("session_token")}/job/${
|
||||
item.job_uid
|
||||
}`
|
||||
: "";
|
||||
return (
|
||||
<tr key={index} className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50">
|
||||
<td className=" py-4">
|
||||
<div className="flex space-x-2 items-center">
|
||||
<div className="w-[60px] h-[60px] p-2 bg-alice-blue rounded-full overflow-hidden flex justify-center items-center">
|
||||
<div className="min-w-[60px] max-w-[60px] min-h-[60px] max-h-[60px] p-2 bg-alice-blue rounded-full overflow-hidden flex justify-center items-center">
|
||||
<img
|
||||
src={localImgLoad(`images/taskbanners/${image}`)}
|
||||
src={`${image}`}
|
||||
alt="data"
|
||||
className="w-full h-full rounded-full"
|
||||
/>
|
||||
@@ -90,13 +96,25 @@ export default function OffersInterestTable({offerInterestList, className}) {
|
||||
<button
|
||||
onClick={() => {
|
||||
navigate("/manage-offer", {
|
||||
state: { ...item, pathname },
|
||||
state: { ...item, pathname, jobImage:image },
|
||||
});
|
||||
}}
|
||||
type="button"
|
||||
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
className='w-12 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white'
|
||||
>
|
||||
View
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -56,15 +56,20 @@ export default function OthersInterestTable({othersInterestedList, className}) {
|
||||
</thead>
|
||||
<tbody className="h-full">
|
||||
{currentOthersInterestedList?.map((item, index) => {
|
||||
const image = localStorage.getItem("session_token")
|
||||
? `${othersInterestedList.imageServer}${localStorage.getItem("session_token")}/job/${
|
||||
item.job_uid
|
||||
}`
|
||||
: "";
|
||||
return (
|
||||
<tr key={index} className="bg-white dark:bg-dark-white border-b dark:border-[#5356fb29] hover:bg-gray-50">
|
||||
<td className=" py-4">
|
||||
<div className="flex space-x-2 items-center">
|
||||
<div className="min-w-[60px] min-h-[60px] rounded-full overflow-hidden flex justify-center items-center">
|
||||
<div className="w-[60px] h-[60px] p-2 bg-alice-blue rounded-full overflow-hidden flex justify-center items-center">
|
||||
<img
|
||||
src={dataImage1}
|
||||
src={image}
|
||||
alt="data"
|
||||
className="w-full h-full"
|
||||
className="w-full h-full rounded-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col">
|
||||
@@ -96,9 +101,22 @@ export default function OthersInterestTable({othersInterestedList, className}) {
|
||||
});
|
||||
}}
|
||||
type="button"
|
||||
className="w-20 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
className="w-12 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
|
||||
>
|
||||
View
|
||||
{/* View */}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 11 20"
|
||||
id="Arrow"
|
||||
className="w-[0.7rem]"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M.366 19.708c.405.39 1.06.39 1.464 0l8.563-8.264a1.95 1.95 0 0 0 0-2.827L1.768.292A1.063 1.063 0 0 0 .314.282a.976.976 0 0 0-.011 1.425l7.894 7.617a.975.975 0 0 1 0 1.414L.366 18.295a.974.974 0 0 0 0 1.413"
|
||||
// fill=""
|
||||
className="color000000 svgShape fill-[#fff]"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -9,6 +9,7 @@ export default function OffersInterest(props) {
|
||||
const filterHandler = (value) => {
|
||||
setValue(value);
|
||||
};
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<CommonHead
|
||||
|
||||
@@ -0,0 +1,124 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
const data1 = [];
|
||||
|
||||
export default function NewPaginatedList({
|
||||
data = data1,
|
||||
itemsPerPage = 5,
|
||||
filterItem,
|
||||
tableTitle,
|
||||
children,
|
||||
}) {
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
const [filteredData, setFilteredData] = useState(data);
|
||||
|
||||
const [currentPage, setCurrentPage] = useState(0);
|
||||
const [newData, setNewData] = useState([]);
|
||||
|
||||
const numberOfSelection = itemsPerPage;
|
||||
|
||||
const handlePrev = () => {
|
||||
if (currentPage != 0) {
|
||||
setCurrentPage((prev) => prev - numberOfSelection);
|
||||
}
|
||||
};
|
||||
const handleNext = () => {
|
||||
if (currentPage < data.length) {
|
||||
setCurrentPage((prev) => prev + numberOfSelection);
|
||||
}
|
||||
};
|
||||
|
||||
const handleSearch = ({ target: { value } }, name) => {
|
||||
setSearchTerm(value);
|
||||
let newFilteredData = data.filter((item) =>
|
||||
item[name].toLowerCase().startsWith(value.toLowerCase())
|
||||
);
|
||||
setFilteredData(newFilteredData);
|
||||
setCurrentPage(0);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setNewData(
|
||||
filteredData?.slice(currentPage, numberOfSelection + currentPage)
|
||||
);
|
||||
}, [currentPage, filteredData]);
|
||||
|
||||
useEffect(()=>{
|
||||
setCurrentPage(0)
|
||||
},[itemsPerPage])
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
<h1 className="text-2xl mb-5 font-semibold">{tableTitle}</h1>
|
||||
|
||||
{data.length > 0 && filterItem && (
|
||||
<div className="mb-10 flex justify-end items-center gap-2">
|
||||
{filterItem.map((item, index) => (
|
||||
<label
|
||||
key={index}
|
||||
className="flex flex-col sm:flex-row items-center gap-2 text-slate-600 dark:text-slate-100 transition-all duration-500"
|
||||
>
|
||||
Search by {item[0].toUpperCase() + item.slice(1)}
|
||||
<input
|
||||
name={item}
|
||||
type="text"
|
||||
className="py-1 px-2 text-sm min-w-[100px] text-black dark:text-white bg-white dark:bg-slate-800 rounded-full border-0 outline-none ring-1 ring-slate-300 dark:ring-white transition-all duration-500"
|
||||
value={searchTerm}
|
||||
onChange={(e) => {
|
||||
handleSearch(e, item);
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{children({ data: newData })}
|
||||
|
||||
{/* show prev and next button if data exist */}
|
||||
{data.length > 0 && (
|
||||
<div className="mt-10 w-full flex gap-4 justify-center items-center">
|
||||
<button
|
||||
onClick={handlePrev}
|
||||
className={`w-12 h-12 rounded-full flex justify-center items-center transition-all duration-300 ${
|
||||
currentPage == 0
|
||||
? "text-slate-400 border-slate-400 dark:text-slate-400 dark:border-slate-400 pointer-events-none"
|
||||
: "text-slate-600 border-slate-600 dark:text-white dark:border-white"
|
||||
}`}
|
||||
>
|
||||
<
|
||||
</button>
|
||||
|
||||
{data.length && data.map((item, index)=>{
|
||||
if(index%itemsPerPage == 0 && index >= currentPage && index <= currentPage+itemsPerPage){
|
||||
return (
|
||||
<button
|
||||
key={index}
|
||||
onClick={handleNext}
|
||||
className={`w-12 h-12 rounded-full flex justify-center items-center border transition-all duration-300 ${
|
||||
currentPage != index
|
||||
? "text-slate-400 border-slate-400 dark:text-slate-400 dark:border-slate-400"
|
||||
: "text-slate-600 border-slate-600 dark:text-white dark:border-white pointer-events-none"
|
||||
}`}
|
||||
>
|
||||
{index/itemsPerPage +1}
|
||||
</button>
|
||||
)
|
||||
}
|
||||
})}
|
||||
|
||||
<button
|
||||
onClick={handleNext}
|
||||
className={`w-12 h-12 rounded-full flex justify-center items-center transition-all duration-300 ${
|
||||
currentPage + numberOfSelection >= data.length
|
||||
? "text-slate-400 border-slate-400 dark:text-slate-400 dark:border-slate-400 pointer-events-none"
|
||||
: "text-slate-600 border-slate-600 dark:text-white dark:border-white"
|
||||
}`}
|
||||
>
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
const PaginatedList = ({ onClick, prev, next, data, start, stop }) => {
|
||||
const PaginatedList = ({ onClick, prev, next, data, start, stop, borderTop=true }) => {
|
||||
if (data?.length > process.env.REACT_APP_ITEM_PER_PAGE) {
|
||||
return (
|
||||
<div className="p-3 flex justify-center items-center min-h-[70px] space-x-2 border-t-2 w-full">
|
||||
<div className={`p-3 flex justify-center items-center min-h-[70px] space-x-2 w-full ${borderTop ? 'border-t-2' : 'border-t-0'}`}>
|
||||
{/* Render pagination buttons */}
|
||||
{!prev && (
|
||||
<button
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import DarkModeContext from "../Contexts/DarkModeContext";
|
||||
import axios from 'axios'
|
||||
|
||||
function Default({ children }) {
|
||||
// dark mode setup
|
||||
@@ -12,6 +13,32 @@ function Default({ children }) {
|
||||
const queryParams = new URLSearchParams(location?.search);
|
||||
const country = queryParams.get("cnt")?.toUpperCase();
|
||||
|
||||
const getLocation = () => {
|
||||
if (navigator.geolocation) {
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(data) => {
|
||||
const pos = data.coords;
|
||||
const position = {
|
||||
lat: pos.latitude,
|
||||
long: pos.longitude,
|
||||
};
|
||||
axios.get(`https://nominatim.openstreetmap.org/reverse?format=json&lat=${position.lat}&lon=${position.long}&zoom=18&addressdetails=1`).then(res =>{
|
||||
localStorage.setItem("myloc", res?.data?.address?.country);
|
||||
// console.log('LOC', res?.data?.address?.country)
|
||||
// localStorage.setItem("myloc", JSON.stringify(position));
|
||||
}).catch(err => {
|
||||
console.log('ERR', err)
|
||||
})
|
||||
},
|
||||
(err) => {
|
||||
localStorage.setItem("myloc", JSON.stringify('not supported'));
|
||||
}
|
||||
);
|
||||
} else {
|
||||
localStorage.setItem("myloc", JSON.stringify('not supported'));
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
|
||||
setTheme("dark");
|
||||
@@ -39,6 +66,10 @@ function Default({ children }) {
|
||||
}
|
||||
},[countryMode])
|
||||
|
||||
useEffect(()=>{
|
||||
getLocation()
|
||||
},[])
|
||||
|
||||
return (
|
||||
<>
|
||||
<DarkModeContext.Provider value={{ theme, handleThemeSwitch, countryMode }}>
|
||||
|
||||
@@ -238,7 +238,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
|
||||
{/* balance */}
|
||||
|
||||
{/* My Page Button */}
|
||||
{userDetails.account_type === "FULL" ? <PageButton /> : null}
|
||||
{/* {userDetails.account_type === "FULL" ? <PageButton /> : null} */}
|
||||
|
||||
{/*<div className="lg:hidden block"></div>*/}
|
||||
<WalletHeader
|
||||
|
||||
@@ -10,6 +10,8 @@ import RightSideBar from "./RightSideBar";
|
||||
import Sidebar from "./Sidebar";
|
||||
|
||||
export default function Layout({ children }) {
|
||||
const { userDetails } = useSelector((state) => state?.userDetails); // CHECKS FOR USER Details
|
||||
|
||||
const { drawer } = useSelector((state) => state.drawer);
|
||||
const { userJobList } = useSelector((state) => state.userJobList);
|
||||
const dispatch = useDispatch();
|
||||
@@ -29,53 +31,34 @@ export default function Layout({ children }) {
|
||||
navigate("/login", { replace: true });
|
||||
};
|
||||
|
||||
//---------------------------------------
|
||||
/* LET U DEAL WITH JOB LIST - we need to centralize this list */
|
||||
// const {jobListTable} = useSelector((state) => state.tableReload)
|
||||
// const [myJobList, setMyJobList] = useState({loading: true, data:[]});
|
||||
// const api = new usersService();
|
||||
|
||||
// const getMyJobList = async () => {
|
||||
// setMyJobList({loading: true, data:[]})
|
||||
// try {
|
||||
// const res = await api.getMyJobList();
|
||||
// setMyJobList({loading: false, data:res.data})
|
||||
// // setMyJobList(res.data);
|
||||
// } catch (error) {
|
||||
// setMyJobList({loading: false, data:[]})
|
||||
// console.log("Error getting mode");
|
||||
// }
|
||||
// };
|
||||
// useEffect(() => {
|
||||
// getMyJobList();
|
||||
// }, [jobListTable]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="nft-main-wrapper-layout">
|
||||
<div className={`nft-wrapper-layout-container 2xl:pr-20 md:pr-10 pr-2 pl-2 md:pl-0 w-full min-h-screen flex`}>
|
||||
<div className="relative w-full max-w-[2000px] nft-main-wrapper-layout mx-auto">
|
||||
<div className={`nft-wrapper-layout-container w-full min-h-screen flex`}>
|
||||
{/* sidebar */}
|
||||
<div className={`nft-sidebar xl:block hidden section-shadow ${drawer ? "2xl:w-[335px] w-[280px] 2xl:pl-20 pl-10 pr-6 " : "w-[70px]"} bg-white dark:bg-dark-white h-full overflow-y-scroll overflow-style-none fixed left-0 top-0 pt-[30px]`}>
|
||||
<div className={`nft-sidebar xl:block hidden section-shadow ${drawer ? "2xl:w-[335px] w-[280px] 2xl:pl-20 pl-10 pr-6 " : "w-[70px]"} bg-white dark:bg-dark-white h-screen overflow-y-scroll overflow-style-none sticky left-0 top-0 pt-[30px]`}>
|
||||
<Sidebar logoutModalHandler={logoutModalHandler} sidebar={drawer} action={() => dispatch(drawerToggle())} myJobList={userJobList} />
|
||||
</div>
|
||||
{MobileSideBar && (
|
||||
<div onClick={() => setMobileSidebar.toggle()} className="bg-black bg-opacity-20 fixed left-0 top-0 w-full h-full z-[50] block xl:hidden"></div>
|
||||
)}
|
||||
<div className={`nft-sidebar block xl:hidden section-shadow w-[280px] pl-3 bg-white dark:bg-dark-white h-full overflow-y-scroll overflow-style-none fixed z-[60] top-0 pt-8 ${MobileSideBar ? "left-0" : "-left-[290px]"}`}>
|
||||
<div className={`nft-sidebar block xl:hidden section-shadow w-[280px] 2xl:pl-20 pl-10 pr-6 bg-white dark:bg-dark-white h-full overflow-y-scroll overflow-style-none fixed z-[60] top-0 pt-8 ${MobileSideBar ? "left-0" : "-left-[290px]"}`}>
|
||||
<MobileSidebar logoutModalHandler={logoutModalHandler} sidebar={MobileSideBar} action={() => setMobileSidebar.toggle()} myJobList={userJobList} />
|
||||
</div>
|
||||
{/* end sidebar */}
|
||||
<div className={`nft-header-container-wrapper flex-1 md:ml-10 ${drawer ? "2xl:ml-[375px] xl:ml-[310px]" : "xl:ml-[110px]"} h-full`}>
|
||||
{/* FORMER CLASS NAME `w-full nft-header-container-wrapper ${drawer ? "2xl:ml-[335px] xl:ml-[280px]" : "xl:ml-[70px]"} h-full` */}
|
||||
<div className={`w-full nft-header-container-wrapper h-full 2xl:px-10 px-8`}>
|
||||
{/* header */}
|
||||
<div className="nft-header w-full lg:h-[100px] h-[70px] default-border-bottom dark:border-[#292967] z-40 xl:sticky fixed top-0 left-0 ">
|
||||
<Header sidebarHandler={() => setMobileSidebar.toggle()} logoutModalHandler={logoutModalHandler} />
|
||||
</div>
|
||||
{/* container */}
|
||||
<div className="nft-container 2xl:flex 2xl:space-x-8 h-full mb-12 lg:mt-[140px] mt-24 xl:mt-10 flex flex-col xl:flex-row items-start justify-center gap-4">
|
||||
<div className="nft-main-container flex-[80%] w-full">
|
||||
<div className="nft-container h-full mb-12 lg:mt-[140px] mt-24 xl:mt-10 flex flex-col items-start justify-center 2xl:flex-row 2xl:justify-between gap-10">
|
||||
<div className="w-full 2xl:w-[calc(100%-250px)]">
|
||||
{children && children}
|
||||
</div>
|
||||
<div className="nft-right-side-content 2xl:w-[270px] w-full h-full 2xl:flex justify-center relative flex-[20%]">
|
||||
|
||||
<div className="nft-right-side-content w-full 2xl:w-[200px] 2xl:flex justify-center 2xl:justify-end relative">
|
||||
<RightSideBar myJobList={userJobList} />
|
||||
</div>
|
||||
</div>
|
||||
@@ -84,12 +67,12 @@ export default function Layout({ children }) {
|
||||
</div>
|
||||
{logoutModal && (
|
||||
<ModalCom action={logoutModalHandler} situation={logoutModal}>
|
||||
<div className="logout-modal-wrapper w-11/12 sm:w-[460px] 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 dark:border-[#5356fb29] ">
|
||||
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
|
||||
<div className="logout-modal-wrapper w-11/12 sm:w-[460px] bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
|
||||
<div className="modal-header-con">
|
||||
<h1 className="modal-title">
|
||||
Confirm
|
||||
</h1>
|
||||
<button type="button" className="text-[#374557] dark:text-red-500" onClick={logoutModalHandler}>
|
||||
<button type="button" className="modal-close-btn" onClick={logoutModalHandler}>
|
||||
<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" />
|
||||
@@ -109,14 +92,14 @@ export default function Layout({ children }) {
|
||||
Are you sure you want to Logout of your WrenchBoard account?
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex space-x-2.5">
|
||||
<button onClick={logOut} type="button" className="text-white primary-gradient text-18 tracking-wide px-4 py-3 rounded-full">
|
||||
{`Yes ${process.env.REACT_APP_LOGOUT_TEXT}`}
|
||||
</button>
|
||||
<button onClick={logoutModalHandler} type="button" className=" border-gradient text-18 tracking-wide px-4 py-3 rounded-full">
|
||||
<span className="text-gradient">Not Now</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-footer-wrapper flex justify-center items-center gap-5">
|
||||
<button onClick={logOut} type="button" className="text-white primary-gradient text-18 tracking-wide px-4 py-3 rounded-full">
|
||||
{`Yes ${process.env.REACT_APP_LOGOUT_TEXT}`}
|
||||
</button>
|
||||
<button onClick={logoutModalHandler} type="button" className=" border-gradient text-18 tracking-wide px-4 py-3 rounded-full">
|
||||
<span className="text-gradient">Not Now</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</ModalCom>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user