Added subscription endpoint #64
@@ -16,7 +16,7 @@ const GeneralTab = memo(({name='Full Name', data, isCustom, productData, backend
|
|||||||
fieldData[item?.setting_key?.toLowerCase().replaceAll(" ", "_")] = item?.setting_value
|
fieldData[item?.setting_key?.toLowerCase().replaceAll(" ", "_")] = item?.setting_value
|
||||||
})
|
})
|
||||||
|
|
||||||
// console.log('fieldData', fieldData)
|
console.log('fieldData', fieldData)
|
||||||
|
|
||||||
const [fields, setFields] = useState(fieldData)
|
const [fields, setFields] = useState(fieldData)
|
||||||
|
|
||||||
@@ -71,20 +71,30 @@ const GeneralTab = memo(({name='Full Name', data, isCustom, productData, backend
|
|||||||
<form id='tab_form'>
|
<form id='tab_form'>
|
||||||
<div className="form-row">
|
<div className="form-row">
|
||||||
<>
|
<>
|
||||||
{Object.entries(data)?.map(([key, value]) => (
|
{Object.entries(data)?.map(([key, value]) => {
|
||||||
<div key={key} className="form-group col-md-12">
|
let fieldName = value.name.toLowerCase().replaceAll(" ", "_")
|
||||||
<label htmlFor="name1">{value.name}</label>
|
let fieldValue = fields[value.name.toLowerCase().replaceAll(" ", "_")]
|
||||||
{value.controls == 'TEXT' ?
|
return (
|
||||||
<input name={value.name.toLowerCase().replaceAll(" ", "_")} type="text" className="form-control" id={key} value={fields[value.name.toLowerCase().replaceAll(" ", "_")]} onChange={handleChange} />
|
<div key={key} className="form-group col-md-12">
|
||||||
:value.controls == 'TEXTAREA' ?
|
<label htmlFor="name1">{value.name}</label>
|
||||||
<textarea name={value.name.toLowerCase().replaceAll(" ", "_")} rows={5} style={{resize: 'none'}} type="text" className="form-control" id={key} value={fields[value.name.toLowerCase().replaceAll(" ", "_")]} onChange={handleChange} />
|
{value.controls == 'TEXT' ?
|
||||||
: value.controls == 'SELECT_NO_YES' ?
|
<input name={fieldName} type="text" className="form-control" id={key} value={fieldValue} onChange={handleChange} />
|
||||||
<NoYesBooleanDropdown />
|
:value.controls == 'TEXTAREA' ?
|
||||||
:
|
<textarea name={fieldName} rows={5} style={{resize: 'none'}} type="text" className="form-control" id={key} value={fieldValue} onChange={handleChange} />
|
||||||
null
|
: value.controls == 'SELECT_NO_YES' ?
|
||||||
}
|
// <NoYesBooleanDropdown name={fieldName} value={fieldValue} onChange={handleChange} />
|
||||||
</div>
|
<select onChange={handleChange} name={fieldName} value={fieldValue} className="form-control">
|
||||||
))}
|
<option value=''>Select</option>
|
||||||
|
<option value='0'>No</option>
|
||||||
|
<option value='1'>Yes</option>
|
||||||
|
</select>
|
||||||
|
:
|
||||||
|
null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
{reqStatus.message &&
|
{reqStatus.message &&
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import React, {memo} from 'react'
|
import React, {memo} from 'react'
|
||||||
|
|
||||||
export default function NoYesBooleanDropdown() {
|
export default function NoYesBooleanDropdown(name, value, onChange) {
|
||||||
return (
|
return (
|
||||||
<div> Drop Down Here ---- ---- ---- ---- </div>
|
<select onChange={onChange} name={name} value={value} className="form-control">
|
||||||
|
<option value=''>Select</option>
|
||||||
|
<option value='0'>No</option>
|
||||||
|
<option value='1'>Yes</option>
|
||||||
|
</select>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
|
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
|
||||||
import getImage from "../../utils/getImage";
|
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() {
|
export default function Subscription() {
|
||||||
|
|
||||||
@@ -10,52 +13,66 @@ export default function Subscription() {
|
|||||||
premium: { name: 'Premium', price: 20.00, active: true },
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<BreadcrumbComBS title='Subscription' paths={['Dashboard', 'Subscription']} />
|
<BreadcrumbComBS title='Subscription' paths={['Dashboard', 'Subscription']} />
|
||||||
|
|
||||||
|
{isFetching ?
|
||||||
|
<>
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-mute'>Loading...</p>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
: isError ?
|
||||||
|
<div className="col-12">
|
||||||
|
<p className='text-danger'>{error.message}</p>
|
||||||
|
</div>
|
||||||
|
:
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-xl-3 col-md-6">
|
<div className="col-12 col-lg-6 col-xl-3">
|
||||||
<div className="card card-statistics text-center py-3">
|
<div className="card card-statistics text-center py-3">
|
||||||
<div className="card-body pricing-content">
|
<div className="card-body pricing-content">
|
||||||
<div className="pricing-content-card">
|
<div className="pricing-content-card">
|
||||||
<h5>Current Subscription(s)</h5>
|
<h5>Current Subscription(s)</h5>
|
||||||
<h2 className="text-primary pt-3">Basic</h2>
|
<h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>
|
||||||
{/*<p className="text-primary pb-3">/ Monthly</p>*/}
|
|
||||||
{/*<ul className="py-2">*/}
|
|
||||||
{/* <li>post jobs</li>*/}
|
|
||||||
{/* <li>advanced instructors search</li>*/}
|
|
||||||
{/* <li>invite candidates</li>*/}
|
|
||||||
{/* <li>post events</li>*/}
|
|
||||||
{/* <li>cancel any time</li>*/}
|
|
||||||
{/*</ul>*/}
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
{Object.entries(pricingFields)?.map(([key, value]) => (
|
{Object.entries(otherSubscriptions)?.map(([key, value]) => (
|
||||||
|
|
||||||
<div key={key} className="col-xl-3 col-md-6">
|
<div key={key} className="col-12 col-lg-6 col-xl-3">
|
||||||
<div className="card card-statistics text-center py-3">
|
<div className="card card-statistics text-center py-3">
|
||||||
<div className="card-body pricing-content">
|
<div className="card-body pricing-content">
|
||||||
<div className="pricing-content-card">
|
<div className="pricing-content-card">
|
||||||
<h5>{value.name}</h5>
|
<h5>{value.display_name}</h5>
|
||||||
<h2 className="text-primary pt-3">${value.price}</h2>
|
<h2 className="text-primary pt-3">${value.monthly}</h2>
|
||||||
<p className="text-primary pb-3">/ Monthly</p>
|
<p className="text-primary pb-3">/ Monthly</p>
|
||||||
<ul className="py-2">
|
<ul className="py-2">
|
||||||
<li>post jobs</li>
|
{value?.items?.map(item =>(
|
||||||
<li>advanced instructors search</li>
|
<li key={item}>{item}</li>
|
||||||
<li>invite candidates</li>
|
))}
|
||||||
<li>post events</li>
|
|
||||||
<li>cancel any time</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div className="pt-2"><a href="javascript:void(0)" className="btn btn-inverse-secondary btn-round btn-sm">go {value.name}</a></div>
|
<div className="pt-2">
|
||||||
|
<button className="btn btn-inverse-secondary btn-round btn-sm">Go {value.display_name}</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -65,7 +82,7 @@ export default function Subscription() {
|
|||||||
</>
|
</>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const queryKeys = {
|
|||||||
product_page: ['product_page'],
|
product_page: ['product_page'],
|
||||||
recentAction: ['recent-action'],
|
recentAction: ['recent-action'],
|
||||||
settingsData: ['settings_data'],
|
settingsData: ['settings_data'],
|
||||||
|
subscriptions: ['subscriptions'],
|
||||||
|
|
||||||
dashboard: ['dashboard'],
|
dashboard: ['dashboard'],
|
||||||
topBar: ['top-bar'],
|
topBar: ['top-bar'],
|
||||||
|
|||||||
@@ -166,6 +166,14 @@ export const getSettingsData = (reqData) => {
|
|||||||
return postAuxEnd(`/panel/myproduct/settings/values`, postData, false)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user