<>
- {Object.entries(data)?.map(([key, value]) => (
-
-
- {value.controls == 'TEXT' ?
-
- :value.controls == 'TEXTAREA' ?
-
- : value.controls == 'SELECT_NO_YES' ?
-
- :
- null
- }
-
- ))}
+ {Object.entries(data)?.map(([key, value]) => {
+ let fieldName = value.name.toLowerCase().replaceAll(" ", "_")
+ let fieldValue = fields[value.name.toLowerCase().replaceAll(" ", "_")]
+ return (
+
+
+ {value.controls == 'TEXT' ?
+
+ :value.controls == 'TEXTAREA' ?
+
+ : value.controls == 'SELECT_NO_YES' ?
+ //
+
+ :
+ null
+ }
+
+ )
+ }
+ )}
>
{reqStatus.message &&
<>
diff --git a/src/component/product/settingsTab/NoYesBooleanDropdown.jsx b/src/component/product/settingsTab/NoYesBooleanDropdown.jsx
index 7588440..4d153b0 100644
--- a/src/component/product/settingsTab/NoYesBooleanDropdown.jsx
+++ b/src/component/product/settingsTab/NoYesBooleanDropdown.jsx
@@ -1,7 +1,11 @@
import React, {memo} from 'react'
-export default function NoYesBooleanDropdown() {
+export default function NoYesBooleanDropdown(name, value, onChange) {
return (
-
Drop Down Here ---- ---- ---- ----
+
)
}
diff --git a/src/component/subscription/Subscription.jsx b/src/component/subscription/Subscription.jsx
index b337356..e11c9cc 100644
--- a/src/component/subscription/Subscription.jsx
+++ b/src/component/subscription/Subscription.jsx
@@ -1,6 +1,9 @@
import React from 'react'
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
import getImage from "../../utils/getImage";
+import { getSubscriptions } from '../../services/services';
+import { useQuery } from '@tanstack/react-query';
+import queryKeys from '../../services/queryKeys';
export default function Subscription() {
@@ -10,52 +13,66 @@ export default function Subscription() {
premium: { name: 'Premium', price: 20.00, active: true },
}
+ const {data, isFetching, isError, error} = useQuery({
+ queryKey: queryKeys.subscriptions,
+ queryFn: () => {
+ let reqData = {
+ token: localStorage.getItem('token'), // USER TOKEN
+ uid: localStorage.getItem('uid') // USER UID
+ }
+ return getSubscriptions(reqData)
+ }
+ })
+
+ const currentSubscription = data?.data?.current_product
+ const otherSubscriptions = data?.data?.options
+ console.log('urlData', data?.data)
+
return (
<>
-
-
+ {isFetching ?
+ <>
+
+ >
+ : isError ?
+
+ :
-
+
Current Subscription(s)
-
Basic
- {/*
/ Monthly
*/}
- {/*
*/}
- {/* - post jobs
*/}
- {/* - advanced instructors search
*/}
- {/* - invite candidates
*/}
- {/* - post events
*/}
- {/* - cancel any time
*/}
- {/*
*/}
-
-
+
{currentSubscription?.display_name}
<>
- {Object.entries(pricingFields)?.map(([key, value]) => (
+ {Object.entries(otherSubscriptions)?.map(([key, value]) => (
-
+
-
{value.name}
-
${value.price}
+
{value.display_name}
+
${value.monthly}
/ Monthly
- - post jobs
- - advanced instructors search
- - invite candidates
- - post events
- - cancel any time
+ {value?.items?.map(item =>(
+ - {item}
+ ))}
-
+
+
+
@@ -65,7 +82,7 @@ export default function Subscription() {
>
-
+ }
>
)
}
diff --git a/src/services/queryKeys.js b/src/services/queryKeys.js
index c641312..000f364 100644
--- a/src/services/queryKeys.js
+++ b/src/services/queryKeys.js
@@ -6,6 +6,7 @@ const queryKeys = {
product_page: ['product_page'],
recentAction: ['recent-action'],
settingsData: ['settings_data'],
+ subscriptions: ['subscriptions'],
dashboard: ['dashboard'],
topBar: ['top-bar'],
diff --git a/src/services/services.js b/src/services/services.js
index 644b4b3..ef4f2b9 100644
--- a/src/services/services.js
+++ b/src/services/services.js
@@ -166,6 +166,14 @@ export const getSettingsData = (reqData) => {
return postAuxEnd(`/panel/myproduct/settings/values`, postData, false)
}
+// FUNCTION TO GET PRODUCT SUBSCRIPTIONS
+export const getSubscriptions = (reqData) => {
+ let postData = {
+ ...reqData,
+ }
+ return postAuxEnd(`/panel/subscription/products`, postData, false)
+}
+