Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 47d3bded9d | |||
| 22c7182993 | |||
| 29a2c937fe | |||
| 3a81da3713 | |||
| 4ace1acda3 | |||
| 04afae48a2 | |||
| 1a35a8c9b8 | |||
| 4f3fb44fcd |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
version: '3'
|
# version: '3'
|
||||||
services:
|
services:
|
||||||
merms-panel:
|
merms-panel:
|
||||||
# image: registry.chiefsoft.net/merms-panel-reactjs:latest
|
# image: registry.chiefsoft.net/merms-panel-reactjs:latest
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export default function Products() {
|
|||||||
return (
|
return (
|
||||||
<div key={product.uid+index} className={`col-12 col-lg-6 mb-2 mb-xxl-0`}>
|
<div key={product.uid+index} className={`col-12 col-lg-6 mb-2 mb-xxl-0`}>
|
||||||
<Link to={productPath(product?.product_id)} >
|
<Link to={productPath(product?.product_id)} >
|
||||||
<div className={`d-flex align-items-center extraProductCard ${product?.icon_style}`} style={{borderColor:'black', borderWidth: '2px'}} >
|
<div className={`d-flex align-items-center extraProductCard ${product?.icon_style}`} style={{borderColor:'black', borderWidth: '2px', paddingLeft:"1px"}} >
|
||||||
<div className="icon-container img-icon m-r-20 bg-light-gray rounded">
|
<div className="icon-container img-icon m-r-20 bg-light-gray rounded">
|
||||||
<i className={`fa ${product?.product_icon} text-primary`}></i>
|
<i className={`fa ${product?.product_icon} text-primary`}></i>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,57 +1,85 @@
|
|||||||
import React from 'react';
|
import React from "react";
|
||||||
import { loadStripe } from '@stripe/stripe-js';
|
import { loadStripe } from "@stripe/stripe-js";
|
||||||
import { Elements, useStripe, useElements, CardElement } from '@stripe/react-stripe-js';
|
import {
|
||||||
import {MyProductData, StripeSubscriptionCreate} from '../../services/services';
|
Elements,
|
||||||
import {useQuery} from "@tanstack/react-query";
|
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 queryKeys from "../../services/queryKeys";
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from "react-router-dom";
|
||||||
//const stripePromise = loadStripe('your_stripe_publishable_key');
|
//const stripePromise = loadStripe('your_stripe_publishable_key');
|
||||||
const stripePromise = loadStripe('pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT');
|
const stripePromise = loadStripe(
|
||||||
|
"pk_test_51RqL5WLjZLojw6IZmEpwFidNZSl9lLlVUHNvuFZNEz1eTR9XXepnyyVhfvXe9cp4eMnqkDPpoe9wxLLRSV0dxRee00UfhayUOT",
|
||||||
|
);
|
||||||
|
|
||||||
const CheckoutForm = ({ priceId, customerId ,option_name }) => {
|
const CheckoutForm = ({
|
||||||
const stripe = useStripe();
|
priceId,
|
||||||
const elements = useElements();
|
customerId,
|
||||||
const navigate = useNavigate();
|
option_name,
|
||||||
const handleSubmit = async (event) => {
|
selected_display_name,
|
||||||
event.preventDefault();
|
}) => {
|
||||||
|
const stripe = useStripe();
|
||||||
|
const elements = useElements();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const handleSubmit = async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
if (!stripe || !elements) {
|
if (!stripe || !elements) {
|
||||||
return;
|
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);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
let reqData = {
|
||||||
|
priceId: priceId,
|
||||||
|
customerId: customerId,
|
||||||
|
option_name: option_name,
|
||||||
|
token: localStorage.getItem("token"), // USER TOKEN
|
||||||
|
uid: localStorage.getItem("uid"), // USER UID
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
StripeSubscriptionCreate(reqData).then((res) => {
|
||||||
<form onSubmit={handleSubmit}>
|
console.log(res);
|
||||||
<CardElement />
|
console.log(res.data.stripe_session);
|
||||||
<button type="submit" disabled={!stripe}>
|
//navigate(res.data.stripe_session)
|
||||||
Subscribe
|
window.location.replace(res.data.stripe_session);
|
||||||
</button>
|
});
|
||||||
</form>
|
};
|
||||||
);
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSubmit}>
|
||||||
|
{/*<CardElement />*/}
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={!stripe}
|
||||||
|
className="btn btn-primary text-uppercase"
|
||||||
|
>
|
||||||
|
Start {selected_display_name} Subscription
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const StripeSubscriptionButton = ({ priceId, customerId ,option_name}) => {
|
const StripeSubscriptionButton = ({
|
||||||
return (
|
priceId,
|
||||||
<Elements stripe={stripePromise}>
|
customerId,
|
||||||
<CheckoutForm priceId={priceId} customerId={customerId} option_name={option_name} />
|
option_name,
|
||||||
</Elements>
|
selected_display_name,
|
||||||
);
|
}) => {
|
||||||
|
return (
|
||||||
|
<Elements stripe={stripePromise}>
|
||||||
|
<CheckoutForm
|
||||||
|
priceId={priceId}
|
||||||
|
customerId={customerId}
|
||||||
|
option_name={option_name}
|
||||||
|
selected_display_name={selected_display_name}
|
||||||
|
/>
|
||||||
|
</Elements>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default StripeSubscriptionButton;
|
export default StripeSubscriptionButton;
|
||||||
|
|||||||
@@ -5,15 +5,14 @@ import SubscribeNewCard from "./SubscribeNewCard";
|
|||||||
import SubscribePreviousCard from "./SubscribePreviousCard";
|
import SubscribePreviousCard from "./SubscribePreviousCard";
|
||||||
import SubcribePaymentOptions from "./SubcribePaymentOptions";
|
import SubcribePaymentOptions from "./SubcribePaymentOptions";
|
||||||
import StripeSubscriptionButton from "./StripeSubscriptionButton";
|
import StripeSubscriptionButton from "./StripeSubscriptionButton";
|
||||||
|
import SubscribeInfo from "./SubscribeInfo";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default function Subscribe() {
|
export default function Subscribe() {
|
||||||
const {state: {selectedSubscription,customerId}} = useLocation()
|
const {state: {selectedSubscription, customerId, currentSubscription}} = useLocation()
|
||||||
|
|
||||||
console.log('selectedSubscription', selectedSubscription)
|
console.log('selectedSubscription', selectedSubscription)
|
||||||
console.log('selectedSubscription.option_name',selectedSubscription.option_name)
|
console.log('currentSubscription', currentSubscription)
|
||||||
|
console.log('selectedSubscription.option_name', selectedSubscription.option_name)
|
||||||
console.log('customerId', customerId)
|
console.log('customerId', customerId)
|
||||||
|
|
||||||
let [activePaymentType, setActivePaymentType] = useState('previous')
|
let [activePaymentType, setActivePaymentType] = useState('previous')
|
||||||
@@ -27,17 +26,22 @@ export default function Subscribe() {
|
|||||||
<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>
|
<h3>Your Current Subscription</h3>
|
||||||
{/*<h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>*/}
|
<h2 className="text-primary pt-3">{currentSubscription?.display_name}</h2>
|
||||||
<SubcribePaymentOptions activePaymentType={activePaymentType}
|
{/*<SubcribePaymentOptions activePaymentType={activePaymentType}*/}
|
||||||
setActivePaymentType={setActivePaymentType}/>
|
{/* setActivePaymentType={setActivePaymentType}/>*/}
|
||||||
{activePaymentType == 'new' ?
|
{/*{activePaymentType == 'new' ?*/}
|
||||||
<SubscribeNewCard/>
|
{/* <SubscribeNewCard/>*/}
|
||||||
:
|
{/* :*/}
|
||||||
<SubscribePreviousCard/>
|
{/* <SubscribePreviousCard/>*/}
|
||||||
}
|
{/*}*/}
|
||||||
<>
|
<>
|
||||||
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id} customerId={customerId} option_name={selectedSubscription.option_name} />
|
<SubscribeInfo />
|
||||||
|
<StripeSubscriptionButton priceId={selectedSubscription.stripe_price_id}
|
||||||
|
customerId={customerId}
|
||||||
|
option_name={selectedSubscription.option_name}
|
||||||
|
selected_display_name={selectedSubscription.display_name}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
export default function SubscribeInfo() {
|
||||||
|
|
||||||
|
return <>
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-md-12 col-12 selects-contant">
|
||||||
|
<div className="card card-statistics">
|
||||||
|
<div className="card-body">
|
||||||
|
<div className="form-group mb-0">
|
||||||
|
Your subscription terms outline the details of your plan, including billing frequency,
|
||||||
|
renewal dates, payment methods, and cancellation policies. Please review your subscription
|
||||||
|
agreement for information on your current plan, how to manage or update your subscription,
|
||||||
|
and any applicable fees or renewal conditions. Contact support if you have questions about
|
||||||
|
your subscription.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</>
|
||||||
|
|
||||||
|
}
|
||||||
@@ -91,7 +91,8 @@ export default function Subscription() {
|
|||||||
navigate(siteLinks.subscribe, {
|
navigate(siteLinks.subscribe, {
|
||||||
state: {
|
state: {
|
||||||
selectedSubscription: value,
|
selectedSubscription: value,
|
||||||
customerId: stripe_customer_id
|
customerId: stripe_customer_id,
|
||||||
|
currentSubscription: currentSubscription
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -2072,7 +2072,7 @@ ul.activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.img-icon i{
|
.img-icon i{
|
||||||
font-size:20px;
|
font-size:35px;
|
||||||
}
|
}
|
||||||
@media (max-width: 1440px) and (min-width:1200px){
|
@media (max-width: 1440px) and (min-width:1200px){
|
||||||
.border-xxl-t{
|
.border-xxl-t{
|
||||||
|
|||||||
Reference in New Issue
Block a user