Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 13ac1d1f85 | |||
| 5a408311ae | |||
| 9c64d8178e | |||
| be8f54bb42 | |||
| 2c6102dfa5 | |||
| bbd6ecac58 | |||
| 56ce8f0556 | |||
| 9e4de10251 | |||
| 777f3cbec4 | |||
| a6e9d507ae | |||
| c1af89919e | |||
| a8686ac2e7 | |||
| 591b1fa3b9 | |||
| 3d5bdc2afd | |||
| cdb676a047 | |||
| 34febdedfa |
@@ -10,6 +10,8 @@
|
|||||||
"@fullcalendar/timegrid": "^6.1.15",
|
"@fullcalendar/timegrid": "^6.1.15",
|
||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
"@reduxjs/toolkit": "^2.4.0",
|
"@reduxjs/toolkit": "^2.4.0",
|
||||||
|
"@stripe/react-stripe-js": "^3.9.1",
|
||||||
|
"@stripe/stripe-js": "^7.8.0",
|
||||||
"@tanstack/react-query": "^5.62.3",
|
"@tanstack/react-query": "^5.62.3",
|
||||||
"@testing-library/jest-dom": "^5.17.0",
|
"@testing-library/jest-dom": "^5.17.0",
|
||||||
"@testing-library/react": "^13.4.0",
|
"@testing-library/react": "^13.4.0",
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ function AppRouters() {
|
|||||||
<Route path={siteLinks.contacts} element={<ContactsPage />} />
|
<Route path={siteLinks.contacts} element={<ContactsPage />} />
|
||||||
<Route path={siteLinks.user} element={<UserPage />} />
|
<Route path={siteLinks.user} element={<UserPage />} />
|
||||||
<Route path={siteLinks.subscription} element={<SubscriptionPage />} />
|
<Route path={siteLinks.subscription} element={<SubscriptionPage />} />
|
||||||
|
<Route path={siteLinks.subscription_success} element={<SubscriptionPage />} />
|
||||||
<Route path={siteLinks.onboard} element={<OnboardPage />} />
|
<Route path={siteLinks.onboard} element={<OnboardPage />} />
|
||||||
<Route path={siteLinks.calendar} element={<CalendarPage />} />
|
<Route path={siteLinks.calendar} element={<CalendarPage />} />
|
||||||
<Route path={siteLinks.settings} element={<SettingsPage />} />
|
<Route path={siteLinks.settings} element={<SettingsPage />} />
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useQuery } from '@tanstack/react-query'
|
import { useQuery } from '@tanstack/react-query'
|
||||||
import { topBar } from '../../services/services'
|
import { topBar } from '../../services/services'
|
||||||
import queryKeys from '../../services/queryKeys'
|
import queryKeys from '../../services/queryKeys'
|
||||||
|
import { Link } from 'react-router-dom'
|
||||||
|
|
||||||
export default function TopBar() {
|
export default function TopBar() {
|
||||||
|
|
||||||
@@ -68,7 +69,7 @@ export default function TopBar() {
|
|||||||
<small className="d-block">{item?.data_span}</small>
|
<small className="d-block">{item?.data_span}</small>
|
||||||
</div>
|
</div>
|
||||||
<div className="col text-right">
|
<div className="col text-right">
|
||||||
<h5 className="text-muted mb-0"><a href={item?.link}>{item?.description}</a></h5>
|
<h5 className="text-muted mb-0"><Link to={item?.link}>{item?.description}</Link></h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="apexchart-wrapper">
|
<div className="apexchart-wrapper">
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ export default function ProductStart(props){
|
|||||||
<img className="card-img-top" src={getImage(productBanner)} alt="Card image cap" />
|
<img className="card-img-top" src={getImage(productBanner)} alt="Card image cap" />
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h4 className="card-title">{productTitle}</h4>
|
<h4 className="card-title">{productTitle}</h4>
|
||||||
<div className="card-text" dangerouslySetInnerHTML={{__html: productDescription}}/>
|
<div className="card-text" style={{fontSize: '14px'}} dangerouslySetInnerHTML={{__html: productDescription}}/>
|
||||||
{/* <p className="card-text">{productDescription}</p> */}
|
{/* <p className="card-text">{productDescription}</p> */}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -97,7 +97,7 @@ export default function ProductStart(props){
|
|||||||
</>
|
</>
|
||||||
|
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<p className="card-text">Start with your goals in mind and then work possible. </p>
|
<p className="card-text">We are actively working to launch this feature soon and will keep you informed every step of the way. </p>
|
||||||
</div>
|
</div>
|
||||||
<ul className="list-group list-group-flush">
|
<ul className="list-group list-group-flush">
|
||||||
<li className="list-group-item"><h4>Coming soon!!!</h4></li>
|
<li className="list-group-item"><h4>Coming soon!!!</h4></li>
|
||||||
@@ -109,19 +109,15 @@ export default function ProductStart(props){
|
|||||||
{/*<img className="card-img-top" src={getImage('widget/01.jpg')} alt="Card image cap" />*/}
|
{/*<img className="card-img-top" src={getImage('widget/01.jpg')} alt="Card image cap" />*/}
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h4 className="card-title">Subscription</h4>
|
<h4 className="card-title">Subscription</h4>
|
||||||
<p className="card-text">Start with your goals in mind and then work possible.ith yand Goals. If the plan doesn’t support the vision then change it! </p>
|
<p className="card-text">Launch your <span style={{color: '#148399' , fontWeight: 'bolder'}}>{productTitle}</span> with us for free! Benefit from our dedicated support and customize features that align perfectly with your goals. Experience everything at no cost! </p>
|
||||||
</div>
|
</div>
|
||||||
<ul className="list-group list-group-flush">
|
<ul className="list-group list-group-flush">
|
||||||
<li className="list-group-item"><h4>{promotion_text}</h4></li>
|
<li className="list-group-item"><h4>{promotion_text}</h4></li>
|
||||||
<li className="list-group-item">90 days free and 3.95/Month</li>
|
<li className="list-group-item">90 days free and $5.99/Month</li>
|
||||||
<li className="list-group-item"></li>
|
<li className="list-group-item"></li>
|
||||||
</ul>
|
</ul>
|
||||||
{/*<div className="card-body">*/}
|
|
||||||
{/* <a href="javascript:void(0)" className="card-link">Card link</a>*/}
|
|
||||||
{/* <a href="javascript:void(0)" className="card-link">Another link</a>*/}
|
|
||||||
{/*</div>*/}
|
|
||||||
<div className="subscribe-box">
|
<div className="subscribe-box">
|
||||||
<button className="btn btn-primary mt-2" data-bs-toggle="modal" data-bs-target="#verticalCenter">Start Subscription</button>
|
<button className="btn btn-primary mt-2" data-bs-toggle="modal" data-bs-target="#verticalCenter">Activate Now!</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -134,13 +130,13 @@ export default function ProductStart(props){
|
|||||||
<div className="modal-dialog modal-dialog-centered" role="document">
|
<div className="modal-dialog modal-dialog-centered" role="document">
|
||||||
<div className="modal-content">
|
<div className="modal-content">
|
||||||
<div className="modal-header">
|
<div className="modal-header">
|
||||||
<h5 className="modal-title" id="verticalCenterTitle">{productTitle}</h5>
|
<h5 className="modal-title" style={{fontSize: '18px'}} id="verticalCenterTitle">{productTitle}</h5>
|
||||||
<button type="button" className="close" data-bs-dismiss="modal" aria-label="Close">
|
<button type="button" className="close" data-bs-dismiss="modal" aria-label="Close">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="modal-body">
|
<div className="modal-body">
|
||||||
<div className="" dangerouslySetInnerHTML={{__html: saleText}}/>
|
<div style={{fontSize: '18px'}} className="" dangerouslySetInnerHTML={{__html: saleText}}/>
|
||||||
{/* {mutation.error &&
|
{/* {mutation.error &&
|
||||||
<>
|
<>
|
||||||
<div className="col-12">
|
<div className="col-12">
|
||||||
@@ -162,8 +158,8 @@ export default function ProductStart(props){
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="modal-footer">
|
<div className="modal-footer">
|
||||||
<button type="button" className="btn btn-danger" data-bs-dismiss="modal">Close</button>
|
<button type="button" className="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
|
||||||
<button type="button" className="btn btn-success" disabled={mutation.isSuccess} onClick={handleSubscribe}>{mutation.isPending ? 'loading...' : 'Start'}</button>
|
<button type="button" className="btn btn-primary" disabled={mutation.isSuccess} onClick={handleSubscribe}>{mutation.isPending ? 'activating...' : 'Start Activation'}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,26 @@
|
|||||||
import React, {memo} from 'react'
|
import React, {memo} from 'react'
|
||||||
import getImage from "../../../utils/getImage";
|
import getImage from "../../../utils/getImage";
|
||||||
|
import { useQuery } from '@tanstack/react-query';
|
||||||
|
import queryKeys from '../../../services/queryKeys';
|
||||||
|
import { getProductTemplateData } from '../../../services/services';
|
||||||
|
|
||||||
|
const SiteTemplateSelector = memo(({name='Full Name', data, productData}) =>{
|
||||||
|
|
||||||
|
const {data:templateData, isFetching, isError, error} = useQuery({
|
||||||
|
queryKey: queryKeys.productTemplateData,
|
||||||
|
queryFn: () => {
|
||||||
|
let reqData = {
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid'), // USER UID
|
||||||
|
product_id: productData?.product_id
|
||||||
|
}
|
||||||
|
return getProductTemplateData(reqData)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const settingsData = templateData?.data
|
||||||
|
console.log('data Template', settingsData)
|
||||||
|
|
||||||
const SiteTemplateSelector = memo(({name='Full Name', data}) =>{
|
|
||||||
console.log("Page data == ", data)
|
console.log("Page data == ", data)
|
||||||
return (
|
return (
|
||||||
<div className="page-account-form">
|
<div className="page-account-form">
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { loadStripe } from '@stripe/stripe-js';
|
||||||
|
import { Elements, useStripe, useElements, CardElement } from '@stripe/react-stripe-js';
|
||||||
|
import {MyProductData, StripeSubscriptionCreate} from '../../services/services';
|
||||||
|
import {useQuery} from "@tanstack/react-query";
|
||||||
|
import queryKeys from "../../services/queryKeys";
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
//const stripePromise = loadStripe('your_stripe_publishable_key');
|
||||||
|
const stripePromise = loadStripe('pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT');
|
||||||
|
|
||||||
|
const CheckoutForm = ({ priceId, customerId ,option_name }) => {
|
||||||
|
const stripe = useStripe();
|
||||||
|
const elements = useElements();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const handleSubmit = async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (!stripe || !elements) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let reqData = {
|
||||||
|
priceId : priceId,
|
||||||
|
customerId: customerId,
|
||||||
|
option_name: option_name,
|
||||||
|
token: localStorage.getItem('token'), // USER TOKEN
|
||||||
|
uid: localStorage.getItem('uid') // USER UID
|
||||||
|
}
|
||||||
|
|
||||||
|
StripeSubscriptionCreate(reqData).then( (res)=>{
|
||||||
|
console.log(res);
|
||||||
|
console.log(res.data.stripe_session);
|
||||||
|
//navigate(res.data.stripe_session)
|
||||||
|
window.location.replace(res.data.stripe_session);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSubmit}>
|
||||||
|
<CardElement />
|
||||||
|
<button type="submit" disabled={!stripe}>
|
||||||
|
Subscribe
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const StripeSubscriptionButton = ({ priceId, customerId ,option_name}) => {
|
||||||
|
return (
|
||||||
|
<Elements stripe={stripePromise}>
|
||||||
|
<CheckoutForm priceId={priceId} customerId={customerId} option_name={option_name} />
|
||||||
|
</Elements>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default StripeSubscriptionButton;
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
export default function SubcribePaymentOptions(){
|
export default function SubcribePaymentOptions({activePaymentType, setActivePaymentType}){
|
||||||
|
|
||||||
|
const handleSwitch = ({target:{name, value}}) => {
|
||||||
|
console.log('SWITCH', name, value)
|
||||||
|
setActivePaymentType(value)
|
||||||
|
}
|
||||||
|
|
||||||
return <>
|
return <>
|
||||||
|
|
||||||
@@ -13,13 +18,13 @@ export default function SubcribePaymentOptions(){
|
|||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
|
|
||||||
<div className="form-check form-check-inline">
|
<div className="form-check form-check-inline">
|
||||||
<input className="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1"
|
<input onChange={handleSwitch} className="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1"
|
||||||
value="option1" />
|
value="previous" checked={activePaymentType == 'previous'} />
|
||||||
<label className="form-check-label" htmlFor="inlineRadio1">Previous Cards</label>
|
<label className="form-check-label" htmlFor="inlineRadio1">Previous Cards</label>
|
||||||
</div>
|
</div>
|
||||||
<div className="form-check form-check-inline">
|
<div className="form-check form-check-inline">
|
||||||
<input className="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2"
|
<input onChange={handleSwitch} className="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2"
|
||||||
value="option2" />
|
value="new" checked={activePaymentType == 'new'} />
|
||||||
<label className="form-check-label" htmlFor="inlineRadio2">Add New card</label>
|
<label className="form-check-label" htmlFor="inlineRadio2">Add New card</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,24 +1,26 @@
|
|||||||
import React from 'react'
|
import React, {useState} from 'react'
|
||||||
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
|
import BreadcrumbComBS from "../breadcrumb/BreadcrumbComBS";
|
||||||
import getImage from "../../utils/getImage";
|
import {Link, useLocation} from 'react-router-dom'
|
||||||
import { getSubscriptions } from '../../services/services';
|
|
||||||
import { useQuery } from '@tanstack/react-query';
|
|
||||||
import queryKeys from '../../services/queryKeys';
|
|
||||||
import siteLinks from "../../links/siteLinks";
|
|
||||||
import { Link, useLocation } from 'react-router-dom'
|
|
||||||
import SubscribeNewCard from "./SubscribeNewCard";
|
import SubscribeNewCard from "./SubscribeNewCard";
|
||||||
import SubscribePreviousCard from "./SubscribePreviousCard";
|
import SubscribePreviousCard from "./SubscribePreviousCard";
|
||||||
import SubcribePaymentOptions from "./SubcribePaymentOptions";
|
import SubcribePaymentOptions from "./SubcribePaymentOptions";
|
||||||
|
import StripeSubscriptionButton from "./StripeSubscriptionButton";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function Subscribe() {
|
export default function Subscribe() {
|
||||||
|
const {state: {selectedSubscription,customerId}} = useLocation()
|
||||||
|
|
||||||
const {state:{selectedSubscription}} = useLocation()
|
console.log('selectedSubscription', selectedSubscription)
|
||||||
|
console.log('selectedSubscription.option_name',selectedSubscription.option_name)
|
||||||
|
console.log('customerId', customerId)
|
||||||
|
|
||||||
// console.log('selectedSubscription', selectedSubscription)
|
let [activePaymentType, setActivePaymentType] = useState('previous')
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BreadcrumbComBS title='Activate or Update your Subscription' paths={['Dashboard', 'subscribe']} />
|
<BreadcrumbComBS title='Activate or Update your Subscription' paths={['Dashboard', 'subscribe']}/>
|
||||||
|
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-12 col-lg-6 col-xl-6">
|
<div className="col-12 col-lg-6 col-xl-6">
|
||||||
@@ -27,36 +29,42 @@ export default function Subscribe() {
|
|||||||
<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">{currentSubscription?.display_name}</h2>*/}
|
{/*<h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>*/}
|
||||||
<SubcribePaymentOptions />
|
<SubcribePaymentOptions activePaymentType={activePaymentType}
|
||||||
|
setActivePaymentType={setActivePaymentType}/>
|
||||||
<SubscribeNewCard />
|
{activePaymentType == 'new' ?
|
||||||
<SubscribePreviousCard />
|
<SubscribeNewCard/>
|
||||||
|
:
|
||||||
|
<SubscribePreviousCard/>
|
||||||
|
}
|
||||||
|
<>
|
||||||
|
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id} customerId={customerId} option_name={selectedSubscription.option_name} />
|
||||||
|
</>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<div key="basic" className="col-12 col-lg-6 col-xl-6">
|
<div key="basic" className="col-12 col-lg-6 col-xl-6">
|
||||||
<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>{selectedSubscription.display_name}</h5>
|
<h5>{selectedSubscription.display_name}</h5>
|
||||||
<h2 className="text-primary pt-3">${selectedSubscription.monthly}</h2>
|
<h2 className="text-primary pt-3">${selectedSubscription.monthly}</h2>
|
||||||
<p className="text-primary pb-3">/ Monthly</p>
|
<p className="text-primary pb-3">/ Monthly</p>
|
||||||
<ul className="py-2">
|
<ol className="py-2"
|
||||||
{selectedSubscription?.items?.map(item =>(
|
style={{fontSize: '16px', fontWeight: 'bold', textAlign: 'left'}}>
|
||||||
<li key={item}>{item}</li>
|
{selectedSubscription?.items?.map(item => (
|
||||||
))}
|
<li key={item.description}>{item.description}</li>
|
||||||
</ul>
|
))}
|
||||||
{/*<div className="pt-2">*/}
|
</ol>
|
||||||
{/* <button className="btn btn-inverse-secondary btn-round btn-sm">Go {subscriptionSelection.display_name}</button>*/}
|
{/*<div className="pt-2">*/}
|
||||||
{/*</div>*/}
|
{/* <button className="btn btn-inverse-secondary btn-round btn-sm">Go {subscriptionSelection.display_name}</button>*/}
|
||||||
|
{/*</div>*/}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,6 +1,28 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
export default function SubscribeNewCard(){
|
export default function SubscribeNewCard(){
|
||||||
|
|
||||||
return <>Previous Card</>
|
return <>
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-md-12 col-12 selects-contant">
|
||||||
|
<div className="card card-statistics">
|
||||||
|
<div className="card-header">
|
||||||
|
<div className="card-heading" style={{textAlign: 'left'}}>
|
||||||
|
<h4 className="card-title">Pay with New Card</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="card-body">
|
||||||
|
<div className="form-group mb-0">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</>
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,36 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
export default function SubscribePreviousCard(){
|
import { IoMdArrowDropdown } from 'react-icons/io'
|
||||||
|
|
||||||
return <>Previous Card</>
|
export default function SubscribePreviousCard() {
|
||||||
|
|
||||||
|
return <>
|
||||||
|
{/*<div className="row select-wrapper">*/}
|
||||||
|
{/* <div className="col-md-12 col-12 selects-contant">*/}
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-md-12 col-12 selects-contant">
|
||||||
|
<div className="card card-statistics">
|
||||||
|
<div className="card-header">
|
||||||
|
<div className="card-heading" style={{textAlign: 'left'}}>
|
||||||
|
<h4 className="card-title">Pay with Previous Card</h4>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="card-body">
|
||||||
|
<div className="position-relative form-group mb-0">
|
||||||
|
<select className="js-basic-single form-control" name="state">
|
||||||
|
<option value="AK">Visa xxxx xxxx xxxx 1234</option>
|
||||||
|
<option value="HI">Mastercard xxxx xxxx xxxx 1234</option>
|
||||||
|
</select>
|
||||||
|
<IoMdArrowDropdown className='position-absolute w-auto' style={{top: '50%', right: '2px', transform: 'translateY(-50%)'}} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* </div>*/}
|
||||||
|
{/*</div>*/}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</>
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,19 @@
|
|||||||
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 {getSubscriptions} from '../../services/services';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import {useQuery} from '@tanstack/react-query';
|
||||||
import queryKeys from '../../services/queryKeys';
|
import queryKeys from '../../services/queryKeys';
|
||||||
import siteLinks from "../../links/siteLinks";
|
import siteLinks from "../../links/siteLinks";
|
||||||
import { Link, useNavigate } from 'react-router-dom'
|
import {Link, useNavigate} from 'react-router-dom'
|
||||||
|
import getDateFromDateString from '../../helpers/GetDateFromDateString';
|
||||||
|
|
||||||
export default function Subscription() {
|
export default function Subscription() {
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const pricingFields ={
|
const pricingFields = {
|
||||||
starter: { name: 'Starter', price: 5.99, active: true },
|
starter: {name: 'Starter', price: 5.99, active: true},
|
||||||
basic: { name: 'Basic', price: 12.99, active: true },
|
basic: {name: 'Basic', price: 12.99, active: true},
|
||||||
premium: { name: 'Premium', price: 20.00, active: true },
|
premium: {name: 'Premium', price: 20.00, active: true},
|
||||||
}
|
}
|
||||||
|
|
||||||
const {data, isFetching, isError, error} = useQuery({
|
const {data, isFetching, isError, error} = useQuery({
|
||||||
@@ -28,63 +29,75 @@ export default function Subscription() {
|
|||||||
|
|
||||||
const currentSubscription = data?.data?.current_product
|
const currentSubscription = data?.data?.current_product
|
||||||
const otherSubscriptions = data?.data?.options
|
const otherSubscriptions = data?.data?.options
|
||||||
|
const stripe_customer_id = data?.data.stripe_customer_id
|
||||||
|
|
||||||
// console.log('urlData', data?.data)
|
// 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="col-12 col-lg-6 col-xl-3">
|
|
||||||
<div className="card card-statistics text-center py-3">
|
|
||||||
<div className="card-body pricing-content">
|
|
||||||
<div className="pricing-content-card">
|
|
||||||
<h5>Current Subscription(s)</h5>
|
|
||||||
<h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
{isFetching ?
|
||||||
<>
|
<>
|
||||||
{Object.entries(otherSubscriptions)?.map(([key, value]) => (
|
<div className="col-12">
|
||||||
|
<p className='text-mute'>Loading...</p>
|
||||||
<div key={key} className="col-12 col-lg-6 col-xl-3">
|
</div>
|
||||||
<div className="card card-statistics text-center py-3">
|
</>
|
||||||
<div className="card-body pricing-content">
|
: isError ?
|
||||||
<div className="pricing-content-card">
|
<div className="col-12">
|
||||||
<h5>{value.display_name}</h5>
|
<p className='text-danger'>{error.message}</p>
|
||||||
<h2 className="text-primary pt-3">${value.monthly}</h2>
|
</div>
|
||||||
<p className="text-primary pb-3">/ Monthly</p>
|
:
|
||||||
<ul className="py-2">
|
<div className="row">
|
||||||
{value?.items?.map(item =>(
|
<div className="col-12 col-lg-6 col-xl-3">
|
||||||
<li key={item}>{item}</li>
|
<div className="card card-statistics text-center py-3" style={{backgroundColor: '#e6f5f4'}}>
|
||||||
))}
|
<div className="card-body pricing-content">
|
||||||
</ul>
|
<div className="pricing-content-card" style={{minHeight: '350px'}}>
|
||||||
<div className="pt-2">
|
<h5>Your Subscription(s)</h5>
|
||||||
<button onClick={()=>{navigate(siteLinks.subscribe, {state:{selectedSubscription: value}})}} className="btn btn-inverse-secondary btn-round btn-sm">Go {value.display_name}</button>
|
<h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>
|
||||||
|
</div>
|
||||||
|
<div className="pt-2" style={{textAlign: 'left'}}>
|
||||||
|
<div style={{fontSize: '10px'}}>
|
||||||
|
Next Payment: {getDateFromDateString(currentSubscription?.next_payment)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<>
|
||||||
|
{Object.entries(otherSubscriptions)?.map(([key, value]) => (
|
||||||
|
|
||||||
|
<div key={key} className="col-12 col-lg-6 col-xl-3">
|
||||||
|
<div className="card card-statistics text-center py-3">
|
||||||
|
<div className="card-body pricing-content">
|
||||||
|
<div className="pricing-content-card" style={{minHeight: '350px'}}>
|
||||||
|
<h5>{value.display_name}</h5>
|
||||||
|
<h2 className="text-primary pt-3">${value.monthly}</h2>
|
||||||
|
<p className="text-primary pb-3">/ Monthly</p>
|
||||||
|
<ol className="py-2"
|
||||||
|
style={{fontSize: '16px', fontWeight: 'bold', textAlign: 'left'}}>
|
||||||
|
{value?.items?.map(item => (
|
||||||
|
<li key={item.description}>{item.description}</li>
|
||||||
|
))}
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="pt-2">
|
||||||
|
<button onClick={() => {
|
||||||
|
navigate(siteLinks.subscribe, {state: {selectedSubscription: value, customerId: stripe_customer_id }})
|
||||||
|
}}
|
||||||
|
className="btn btn-inverse-secondary btn-round btn-sm">Go {value.display_name}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
))}
|
|
||||||
</>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
function getDateFromDateString(dateString) {
|
||||||
|
const date = new Date(dateString);
|
||||||
|
|
||||||
|
const days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||||
|
const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||||
|
|
||||||
|
const dayName = days[date.getDay()];
|
||||||
|
const monthName = months[date.getMonth()];
|
||||||
|
const day = date.getDate();
|
||||||
|
const year = date.getFullYear();
|
||||||
|
|
||||||
|
// Add ordinal suffix
|
||||||
|
function getOrdinal(n) {
|
||||||
|
if (n > 3 && n < 21) return "th"; // 4-20 are all "th"
|
||||||
|
switch (n % 10) {
|
||||||
|
case 1: return "st";
|
||||||
|
case 2: return "nd";
|
||||||
|
case 3: return "rd";
|
||||||
|
default: return "th";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format time in 12hr with AM/PM
|
||||||
|
let hours = date.getHours();
|
||||||
|
const minutes = date.getMinutes().toString().padStart(2, "0");
|
||||||
|
const ampm = hours >= 12 ? "PM" : "AM";
|
||||||
|
hours = hours % 12 || 12;
|
||||||
|
|
||||||
|
return `${dayName}, ${monthName} ${day}${getOrdinal(day)} ${year} ${hours}:${minutes}${ampm}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getDateFromDateString
|
||||||
@@ -9,6 +9,7 @@ const siteLinks = {
|
|||||||
comments: '/comments',
|
comments: '/comments',
|
||||||
reports: '/reports',
|
reports: '/reports',
|
||||||
subscription: '/subscription',
|
subscription: '/subscription',
|
||||||
|
subscription_success:'/subscription-success',
|
||||||
subscribe: '/subscribe',
|
subscribe: '/subscribe',
|
||||||
onboard: '/subscription',
|
onboard: '/subscription',
|
||||||
user: '/user',
|
user: '/user',
|
||||||
|
|||||||
@@ -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'],
|
||||||
|
productTemplateData: ['product_template_data'],
|
||||||
subscriptions: ['subscriptions'],
|
subscriptions: ['subscriptions'],
|
||||||
|
|
||||||
dashboard: ['dashboard'],
|
dashboard: ['dashboard'],
|
||||||
|
|||||||
@@ -83,6 +83,13 @@ export const MyProductData = (reqData) => {
|
|||||||
return postAuxEnd(`/panel/myproduct/dash`, postData, false)
|
return postAuxEnd(`/panel/myproduct/dash`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const StripeSubscriptionCreate = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/subscription/start`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION TO GET CALENDAR EVENTS
|
// FUNCTION TO GET CALENDAR EVENTS
|
||||||
export const getCalendarEvents = (reqData) => {
|
export const getCalendarEvents = (reqData) => {
|
||||||
let postData = {
|
let postData = {
|
||||||
@@ -166,6 +173,14 @@ export const getSettingsData = (reqData) => {
|
|||||||
return postAuxEnd(`/panel/myproduct/settings/values`, postData, false)
|
return postAuxEnd(`/panel/myproduct/settings/values`, postData, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FUNCTION TO GET SETTINGS DATA
|
||||||
|
export const getProductTemplateData = (reqData) => {
|
||||||
|
let postData = {
|
||||||
|
...reqData,
|
||||||
|
}
|
||||||
|
return postAuxEnd(`/panel/account/products/templates`, postData, false)
|
||||||
|
}
|
||||||
|
|
||||||
// FUNCTION TO GET PRODUCT SUBSCRIPTIONS
|
// FUNCTION TO GET PRODUCT SUBSCRIPTIONS
|
||||||
export const completeProfile = (reqData) => {
|
export const completeProfile = (reqData) => {
|
||||||
let postData = {
|
let postData = {
|
||||||
|
|||||||
Reference in New Issue
Block a user