Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c776419dcf | |||
| 80d5c8ea12 | |||
| df6d2b570c | |||
| a802c1ca39 | |||
| 1a054a9fbc | |||
| 33eacecacf | |||
| a71017fae6 | |||
| 8969234fe5 |
@@ -2,6 +2,7 @@ import React, {memo, useState} from 'react'
|
|||||||
import { useMutation } from "@tanstack/react-query";
|
import { useMutation } from "@tanstack/react-query";
|
||||||
import { pageSettings } from "../../../services/services";
|
import { pageSettings } from "../../../services/services";
|
||||||
import SiteTemplateSelector from './SiteTemplateSelector';
|
import SiteTemplateSelector from './SiteTemplateSelector';
|
||||||
|
import NoYesBooleanDropdown from './NoYesBooleanDropdown';
|
||||||
|
|
||||||
const GeneralTab = memo(({name='Full Name', data, isCustom, productData, backendValues, setFieldsChanged}) =>{
|
const GeneralTab = memo(({name='Full Name', data, isCustom, productData, backendValues, setFieldsChanged}) =>{
|
||||||
|
|
||||||
@@ -9,13 +10,13 @@ const GeneralTab = memo(({name='Full Name', data, isCustom, productData, backend
|
|||||||
|
|
||||||
const fieldData = {}
|
const fieldData = {}
|
||||||
Object.entries(data)?.forEach(([key, value]) => { // LOOP TO POPULATE FIELDDATA PROPERTIES WITH DATA OF EACH TAB
|
Object.entries(data)?.forEach(([key, value]) => { // LOOP TO POPULATE FIELDDATA PROPERTIES WITH DATA OF EACH TAB
|
||||||
fieldData[value?.name?.toLowerCase().replace(" ", "_")] = ''
|
fieldData[value?.name?.toLowerCase().replaceAll(" ", "_")] = ''
|
||||||
})
|
})
|
||||||
backendValues.forEach(item => { //LOOPING THROUGH USER ALREADY ADDED DATA FROM BACKEND IF ANY AND UPDATING THE FIELDDATA OBJECT
|
backendValues.forEach(item => { //LOOPING THROUGH USER ALREADY ADDED DATA FROM BACKEND IF ANY AND UPDATING THE FIELDDATA OBJECT
|
||||||
fieldData[item?.setting_key?.toLowerCase().replace(" ", "_")] = 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)
|
||||||
|
|
||||||
@@ -70,18 +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().replace(" ", "_")} type="text" className="form-control" id={key} value={fields[value.name.toLowerCase().replace(" ", "_")]} 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().replace(" ", "_")} rows={5} style={{resize: 'none'}} type="text" className="form-control" id={key} value={fields[value.name.toLowerCase().replace(" ", "_")]} onChange={handleChange} />
|
{value.controls == 'TEXT' ?
|
||||||
:
|
<input name={fieldName} type="text" className="form-control" id={key} value={fieldValue} onChange={handleChange} />
|
||||||
null
|
:value.controls == 'TEXTAREA' ?
|
||||||
}
|
<textarea name={fieldName} rows={5} style={{resize: 'none'}} type="text" className="form-control" id={key} value={fieldValue} onChange={handleChange} />
|
||||||
</div>
|
: value.controls == 'SELECT_NO_YES' ?
|
||||||
))}
|
// <NoYesBooleanDropdown name={fieldName} value={fieldValue} onChange={handleChange} />
|
||||||
|
<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 &&
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import React, {memo} from 'react'
|
||||||
|
|
||||||
|
export default function NoYesBooleanDropdown(name, value, onChange) {
|
||||||
|
return (
|
||||||
|
<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>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -30,10 +30,12 @@ const Settings = memo(({productData}) => {
|
|||||||
|
|
||||||
const footerFields ={
|
const footerFields ={
|
||||||
footer_description: { name: 'Footer Description', controls: 'TEXTAREA', active: true },
|
footer_description: { name: 'Footer Description', controls: 'TEXTAREA', active: true },
|
||||||
|
boolean_footer_show_email: { name: 'Show email in footer', controls: 'SELECT_NO_YES', active: true },
|
||||||
}
|
}
|
||||||
|
|
||||||
const aboutFields ={
|
const aboutFields ={
|
||||||
about_description: { name: 'About us', controls: 'TEXTAREA', active: true },
|
about_title: { name: 'About Title', controls: 'TEXT', active: true },
|
||||||
|
about_description: { name: 'About Details', controls: 'TEXTAREA', active: true },
|
||||||
about_extra_1: { name: 'Extra About us', controls: 'TEXTAREA', active: true },
|
about_extra_1: { name: 'Extra About us', controls: 'TEXTAREA', active: true },
|
||||||
about_extra_2: { name: 'More About us', controls: 'TEXTAREA', active: true },
|
about_extra_2: { name: 'More About us', controls: 'TEXTAREA', active: true },
|
||||||
}
|
}
|
||||||
@@ -49,13 +51,18 @@ const Settings = memo(({productData}) => {
|
|||||||
template_9 : { title: 'Template Name-9', template_id: 'fc8f0738-6500-4775-9895-2047cd275302', banner: 'file-icon/svg.png', active: '' },
|
template_9 : { title: 'Template Name-9', template_id: 'fc8f0738-6500-4775-9895-2047cd275302', banner: 'file-icon/svg.png', active: '' },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const contactFields ={
|
||||||
|
contact_title : { name: 'Contact Title', controls: 'TEXT', active: true },
|
||||||
|
contact_introduction: { name: 'Extra Introduction', controls: 'TEXTAREA', active: true },
|
||||||
|
}
|
||||||
|
|
||||||
const settingsObject = useMemo(()=>{
|
const settingsObject = useMemo(()=>{
|
||||||
return {
|
return {
|
||||||
settings: { title: 'Settings', controls: 'settings', active: 'active show' , custom: false, data: dataFields},
|
settings: { title: 'Settings', controls: 'settings', active: 'active show' , custom: false, data: dataFields},
|
||||||
home_tab: { title: 'Home Page', controls: 'home', active: '', custom: false, data: homeFields},
|
home_tab: { title: 'Home Page', controls: 'home', active: '', custom: false, data: homeFields},
|
||||||
footer_tab: { title: 'Footer', controls: 'footer', active: '', custom: false, data: footerFields },
|
footer_tab: { title: 'Footer', controls: 'footer', active: '', custom: false, data: footerFields },
|
||||||
about_tab: { title: 'About Page', controls: 'about', active: '', custom: false, data: aboutFields },
|
about_tab: { title: 'About Page', controls: 'about', active: '', custom: false, data: aboutFields },
|
||||||
contact_tab: { title: 'Contact Page', controls: 'contact', active: '', custom: false, data: {} },
|
contact_tab: { title: 'Contact Page', controls: 'contact', active: '', custom: false, data: contactFields },
|
||||||
social_tab: { title: 'Socials', controls: 'social', active: '', custom: false, data: socialFields },
|
social_tab: { title: 'Socials', controls: 'social', active: '', custom: false, data: socialFields },
|
||||||
template_tab: { title: 'Template', controls: 'template', active: '', custom: true, data: templateData },
|
template_tab: { title: 'Template', controls: 'template', active: '', custom: true, data: templateData },
|
||||||
color_scheme_tab: { title: 'Color Scheme', controls: 'color-scheme', active: '', custom: true, data: {} },
|
color_scheme_tab: { title: 'Color Scheme', controls: 'color-scheme', active: '', custom: true, data: {} },
|
||||||
|
|||||||
@@ -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